Skip to content

Commit 5301017

Browse files
babbushdamiansteiger
authored andcommitted
Fixed some pep8 violations and updated grid docs (#55)
1 parent 6de3144 commit 5301017

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/fermilib/utils/_grid.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, dimensions, length, scale):
2525
Args:
2626
dimensions (int): The number of dimensions the grid lives in.
2727
length (int): The number of points along each grid axis.
28-
scale (float): The distance between adjacent grid points.
28+
scale (float): The total length of each grid dimension.
2929
"""
3030
if not isinstance(dimensions, int) or dimensions < 0:
3131
raise ValueError(
@@ -49,14 +49,14 @@ def volume_scale(self):
4949
Returns:
5050
float: The volume of a length-scale hypercube within the grid.
5151
"""
52-
return self.scale**float(self.dimensions)
52+
return self.scale ** float(self.dimensions)
5353

5454
def num_points(self):
5555
"""
5656
Returns:
5757
int: The number of points in the grid.
5858
"""
59-
return self.length**self.dimensions
59+
return self.length ** self.dimensions
6060

6161
def all_points_indices(self):
6262
"""

src/fermilib/utils/_jellium_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ def test_kinetic_integration(self):
136136

137137
def test_potential_integration(self):
138138

139-
# Compute potential energy operator in both momentum and position
140-
# space.
141-
grid = Grid(dimensions=2, length=3, scale = 2.)
139+
# Compute potential energy operator in momentum and position space.
140+
grid = Grid(dimensions=2, length=3, scale=2.)
142141
spinless = 1
143142
momentum_potential = momentum_potential_operator(grid, spinless)
144143
position_potential = position_potential_operator(grid, spinless)

src/fermilib/utils/_plane_wave_hamiltonian.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def dual_basis_u_operator(grid, geometry, spinless):
5454
continue
5555
exp_index = 1.0j * momenta.dot(coordinate_j - coordinate_p)
5656
coefficient = (prefactor / momenta_squared *
57-
periodic_hash_table[nuclear_term[0]] * numpy.exp(exp_index))
57+
periodic_hash_table[nuclear_term[0]] *
58+
numpy.exp(exp_index))
5859

5960
for spin_p in spins:
6061
orbital_p = orbital_id(
@@ -103,7 +104,8 @@ def plane_wave_u_operator(grid, geometry, spinless):
103104
coordinate_j = numpy.array(nuclear_term[1])
104105
exp_index = 1.0j * momenta_p_q.dot(coordinate_j)
105106
coefficient = (prefactor / momenta_p_q_squared *
106-
periodic_hash_table[nuclear_term[0]] * numpy.exp(exp_index))
107+
periodic_hash_table[nuclear_term[0]] *
108+
numpy.exp(exp_index))
107109

108110
for spin in spins:
109111
orbital_p = orbital_id(grid.length, indices_p, spin)

0 commit comments

Comments
 (0)