@@ -197,7 +197,7 @@ def get_guess(arg):
197197 return guesses_dict [arg ]
198198
199199
200- def check_nelec (nelec , nao ):
200+ def check_nelec (nelec , nao , full_shell_warning = 1 ):
201201 """Validate that the number of electrons can be accommodated by available orbitals.
202202
203203 Args:
@@ -212,7 +212,7 @@ def check_nelec(nelec, nao):
212212 """
213213 if np .any (np .array (nelec ) > nao ):
214214 raise RuntimeError (f'Too many electrons ({ nelec } ) for { nao } orbitals' )
215- elif np .any (np .array (nelec ) == nao ):
215+ elif np .any (np .array (nelec ) == nao ) and full_shell_warning > 0 :
216216 msg = f'{ nelec } electrons for { nao } orbitals. Is the input intended to have a complete shell?'
217217 warnings .warn (msg , RuntimeWarning , stacklevel = 2 )
218218
@@ -225,15 +225,14 @@ def get_occ(e, nelec, spin, verbose=1):
225225 or possibly arrays of larger dimensionality.
226226 nelec (tuple): Number of (alpha, beta) electrons.
227227 spin (int or None): Spin multiplicity. If None, assumes closed-shell.
228- verbose (int): Level of verbosity
228+ verbose (int): Level of verbosity (< 1 supresses full-shell warnings)
229229
230230 Returns:
231231 numpy ndarray: Occupied eigenvalues. Shape depends on spin:
232232 - Closed-shell (spin=None): 1D array of occupied eigenvalues
233233 - Open-shell: 2D array (2, nocc) for alpha and beta separately
234234 """
235- if verbose > 0 :
236- check_nelec (nelec , e .shape [0 ])
235+ check_nelec (nelec , e .shape [0 ], full_shell_warning = verbose )
237236 if spin is None :
238237 nocc = nelec [0 ]
239238 return e [:nocc ,...]
@@ -252,15 +251,14 @@ def get_dm(v, nelec, spin, verbose=1):
252251 v (numpy ndarray): 2D array of MO coefficients (eigenvectors), columns are MOs.
253252 nelec (tuple): Number of (alpha, beta) electrons.
254253 spin (int or None): Spin multiplicity. If None, assumes closed-shell (RHF).
255- verbose (int): Level of verbosity
254+ verbose (int): Level of verbosity (< 1 supresses full-shell warnings)
256255
257256 Returns:
258257 numpy ndarray: Density matrix in AO basis.
259258 - Closed-shell: 2D array (nao, nao)
260259 - Open-shell: 3D array (2, nao, nao) for alpha and beta
261260 """
262- if verbose > 0 :
263- check_nelec (nelec , len (v ))
261+ check_nelec (nelec , len (v ), full_shell_warning = verbose )
264262 if spin is None :
265263 nocc = nelec [0 ]
266264 dm = v [:,:nocc ] @ v [:,:nocc ].T
0 commit comments