Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce incore ERIs when cluster has no excitations in one spin channel. #84

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions vayesta/solver/ccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,21 @@ def _debug_exact_wf(self, wf):
self.wf = CCSD_WaveFunction(mo, t1, t2, l1=l1, l2=l2)
self.converged = True

def get_eris(self):
"""Get ERI object."""

# This is to compensate for possible issues with PySCF's UCCSD._make_df_eris_outcore method when one spin
# channel has no occupied and/or virtual orbitals.
try:
return super().get_eris()
except ValueError as e:
if any(np.array(self.cluster.nocc_active) == 0) or any(np.array(self.cluster.nvir_active) == 0):
self.log.info("Cluster has no occupied and/or virtual orbitals in one spin channel.")
with replace_attr(self.solver, incore_complete=True):
return super().get_eris()
else:
# Need to ensure we raise the error that will otherwise be suppressed.
raise e

def _debug_random_wf(self):
raise NotImplementedError
2 changes: 1 addition & 1 deletion vayesta/solver/cisd.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def make_rdm2(self, *args, **kwargs):
raise NotImplementedError()


class UCISD_Solver(CISD_Solver):
class UCISD_Solver(CISD_Solver, ccsd.UCCSD_Solver):

def get_solver_class(self):
# No DF version for UCISD
Expand Down