@@ -24,14 +24,13 @@ class HamiltonianAPI(ABC):
2424 r"""Hamiltonian abstract base class."""
2525
2626 def generate_connectivity_matrix (self ):
27- r"""
28-
29- Generate connectivity matrix.
27+ r"""Generate connectivity matrix.
3028
3129 Returns
3230 -------
3331 tuple
3432 (dictionary, np.ndarray)
33+
3534 """
3635 # check if self.connectivity is a matrix
3736 # if so, put assign it to self.connectivity_matrix
@@ -76,8 +75,7 @@ def generate_zero_body_integral(self):
7675
7776 @abstractmethod
7877 def generate_one_body_integral (self , dense : bool , basis : str ):
79- r"""
80- Generate one body integral in spatial or spin orbital basis.
78+ r"""Generate one body integral in spatial or spin orbital basis.
8179
8280 Parameters
8381 ----------
@@ -89,13 +87,13 @@ def generate_one_body_integral(self, dense: bool, basis: str):
8987 Returns
9088 -------
9189 scipy.sparse.csr_matrix or np.ndarray
90+
9291 """
9392 pass
9493
9594 @abstractmethod
9695 def generate_two_body_integral (self , sym : int , basis : str , dense : bool ):
97- r"""
98- Generate two body integral in spatial or spinorbital basis.
96+ r"""Generate two body integral in spatial or spinorbital basis.
9997
10098 Parameters
10199 ----------
@@ -109,12 +107,12 @@ def generate_two_body_integral(self, sym: int, basis: str, dense: bool):
109107 Returns
110108 -------
111109 scipy.sparse.csr_matrix or np.ndarray
110+
112111 """
113112 pass
114113
115114 def to_sparse (self , Md ):
116- r"""
117- Convert dense array of integrals to sparse array in scipy csr format.
115+ r"""Convert dense array of integrals to sparse array in scipy csr.
118116
119117 Parameters
120118 ----------
@@ -124,6 +122,7 @@ def to_sparse(self, Md):
124122 Returns
125123 -------
126124 scipy.sparse.csr_matrix
125+
127126 """
128127 # Finding indices for non-zero elements and shape of Md.
129128 indices = np .array (np .where (Md != 0 )).astype (int ).T
@@ -156,8 +155,7 @@ def to_sparse(self, Md):
156155 return
157156
158157 def to_dense (self , Ms , dim = 2 ):
159- r"""
160- Convert to dense matrix.
158+ r"""Convert to dense matrix.
161159
162160 Convert sparse array of integrals
163161 in scipy csr format to dense numpy array.
@@ -171,6 +169,7 @@ def to_dense(self, Ms, dim=2):
171169 Returns
172170 -------
173171 np.ndarray
172+
174173 """
175174 # return dense 2D array (default).
176175 if dim == 2 :
@@ -190,8 +189,7 @@ def to_dense(self, Ms, dim=2):
190189 raise ValueError ("Target output dimension must be either 2 or 4." )
191190
192191 def to_spatial (self , sym : int , dense : bool , nbody : int ):
193- r"""
194- Convert one-/two- integral matrix from spin-orbital to spatial basis.
192+ r"""Convert one/two integral matrix from spin-orbital to spatial basis.
195193
196194 Parameters
197195 ----------
@@ -229,6 +227,7 @@ def to_spatial(self, sym: int, dense: bool, nbody: int):
229227 Assuming that :math:`v_{pqrs}^{abab} = v_{pqrs}^{baba}` and
230228 :math:`v_{pqrs}^{aaaa} = v_{pqrs}^{bbbb}`
231229 :math:`v_{pqrs} = 0.5*(v_{pqrs}^{aaaa} + v_{pqrs}^{abab})`
230+
232231 """
233232 # Assumption: spatial components of alpha and beta
234233 # spin-orbitals are equivalent
@@ -275,8 +274,7 @@ def to_spatial(self, sym: int, dense: bool, nbody: int):
275274 return spatial_int
276275
277276 def to_spinorbital (self , integral : np .ndarray , sym = 1 , dense = False ):
278- r"""
279- Convert one-/two- integral matrix from spatial to spin-orbital basis.
277+ r"""Convert one/two integral matrix from spatial to spin-orbital basis.
280278
281279 Parameters
282280 ----------
@@ -290,12 +288,12 @@ def to_spinorbital(self, integral: np.ndarray, sym=1, dense=False):
290288 Returns
291289 -------
292290 None
291+
293292 """
294293 pass
295294
296295 def save_fcidump (self , f : Union [TextIO , str ], nelec = 0 , spinpol = 0 ):
297- r"""
298- Save all parts of hamiltonian in fcidump format.
296+ r"""Save all parts of hamiltonian in fcidump format.
299297
300298 Parameters
301299 ----------
@@ -313,6 +311,7 @@ def save_fcidump(self, f: Union[TextIO, str], nelec=0, spinpol=0):
313311 Returns
314312 -------
315313 None
314+
316315 """
317316 # Open file if it is a string
318317 if isinstance (f , str ):
@@ -358,8 +357,7 @@ def save_fcidump(self, f: Union[TextIO, str], nelec=0, spinpol=0):
358357 print (f"{ core_energy :23.16e} { 0 :4d} { 0 :4d} { 0 :4d} { 0 :4d} " , file = f )
359358
360359 def save_triqs (self , fname : str , integral ):
361- r"""
362- Save matrix in triqc format.
360+ r"""Save matrix in triqc format.
363361
364362 Parameters
365363 ----------
@@ -371,6 +369,7 @@ def save_triqs(self, fname: str, integral):
371369 Returns
372370 -------
373371 None
372+
374373 """
375374 pass
376375
@@ -392,6 +391,7 @@ def savez(self, f: Union[TextIO, str]):
392391 ```
393392 open("file.npz", "wb") as f:
394393 ```
394+
395395 """
396396 if self .zero_energy is not None :
397397 e0 = self .zero_energy
@@ -412,8 +412,7 @@ def savez(self, f: Union[TextIO, str]):
412412
413413
414414def expand_sym (sym , integral , nbody ):
415- r"""
416- Restore permutational symmetry of one- and two-body terms.
415+ r"""Restore permutational symmetry of one- and two-body terms.
417416
418417 Parameters
419418 ----------
@@ -459,6 +458,7 @@ def expand_sym(sym, integral, nbody):
459458 permutations considered can be
460459 found in [this site]
461460 (http://vergil.chemistry.gatech.edu/notes/permsymm/permsymm.html).
461+
462462 """
463463 if sym not in [1 , 2 , 4 , 8 ]:
464464 raise ValueError ("Wrong input symmetry" )
0 commit comments