Skip to content

Commit

Permalink
improve error (useless before)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxscheurer committed Jan 26, 2022
1 parent 7984a57 commit 751b7d0
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions adcc/backends/pyscf.py
Expand Up @@ -59,34 +59,32 @@ def nabla(self):

@property
def pe_induction_elec(self):
if not hasattr(self.scfres, "with_solvent"):
raise ValueError("Cannot compute PE induction for "
"an SCF state without solvent.")
if not hasattr(self.scfres.with_solvent, "cppe_state"):
raise ValueError("Cannot compute PE induction for "
"an SCF state without PE.")

def pe_induction_elec_ao(dm):
if not hasattr(self.scfres, "with_solvent"):
raise ValueError("Cannot compute PE induction for "
"an SCF state without solvent.")
if not hasattr(self.scfres.with_solvent, "cppe_state"):
raise ValueError("Cannot compute PE induction for "
"an SCF state without PE.")
return self.scfres.with_solvent._exec_cppe(
dm.to_ndarray(), elec_only=True
)[1]
return pe_induction_elec_ao

@property
def pcm_potential_elec(self):
if not hasattr(self.scfres, "with_solvent"):
raise ValueError("Cannot compute PCM potential for "
"an SCF state without solvent.")
if not isinstance(self.scfres.with_solvent, ddcosmo.DDCOSMO):
raise ValueError("Cannot compute PCM potential for "
"an SCF state without PCM.")

def pcm_potential_elec_ao(dm):
# Since eps (dielectric constant) is the only solvent parameter
# in pyscf and there is no solvent data available in the
# program, the user needs to adjust scfres.with_solvent.eps
# manually to the optical dielectric constant (if non
# equilibrium solvation is desired).
if not hasattr(self.scfres, "with_solvent"):
raise ValueError("Cannot compute PCM potential for "
"an SCF state without solvent.")
if not isinstance(self.scfres.with_solvent, ddcosmo.DDCOSMO):
raise ValueError("Cannot compute PCM potential for "
"an SCF state without PCM.")
return self.scfres.with_solvent._B_dot_x(
dm.to_ndarray()
)
Expand Down

0 comments on commit 751b7d0

Please sign in to comment.