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

Testing with latest pyscf #156

Merged
merged 12 commits into from
Apr 17, 2024
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
"scipy>=1.1.0,<=1.10.0",
"h5py>=2.7",
"cvxpy>=1.1",
"pyscf @ git+https://github.com/pyscf/pyscf@e90d8342e29446365f8570682af4a65fe16be27c",
"pyscf @ git+https://github.com/pyscf/pyscf@master",
]
dynamic = ["version"]

Expand Down
2 changes: 1 addition & 1 deletion vayesta/core/qemb/qemb.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def init_mf(self, mf):
mf = copy.copy(mf)
self.log.debugv("type(mf)= %r", type(mf))
# If the mean-field has k-points, automatically fold to the supercell:
if getattr(mf, "kpts", None) is not None:
if isinstance(mf, pyscf.pbc.scf.khf.KSCF):
with log_time(self.log.timing, "Time for k->G folding of MOs: %s"):
mf = fold_scf(mf)
if isinstance(mf, FoldedSCF):
Expand Down
4 changes: 2 additions & 2 deletions vayesta/dmet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

def DMET(mf, *args, **kwargs):
"""Determine restricted or unrestricted by inspection of mean-field object"""
if isinstance(mf, pyscf.scf.uhf.UHF):
if isinstance(mf, pyscf.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.kuhf.KUHF):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, isinstance accepts a tuple of possible classes as a second argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know that. Thanks!

return UDMET(mf, *args, **kwargs)
elif isinstance(mf, pyscf.scf.rohf.ROHF):
elif isinstance(mf, pyscf.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.krohf.KROHF):
log.warning("Converting ROHF reference to UHF")
return UDMET(mf.to_uhf(), *args, **kwargs)
return RDMET(mf, *args, **kwargs)
4 changes: 2 additions & 2 deletions vayesta/edmet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

def EDMET(mf, *args, **kwargs):
"""Determine restricted or unrestricted by inspection of mean-field object"""
if isinstance(mf, pyscf.scf.uhf.UHF):
if isinstance(mf, pyscf.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.kuhf.KUHF):
return UEDMET(mf, *args, **kwargs)
elif isinstance(mf, pyscf.scf.rohf.ROHF):
elif isinstance(mf, pyscf.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.krohf.KROHF):
log.warning("Converting ROHF reference to UHF")
return UEMET(mf.to_uhf(), *args, **kwargs)
return REDMET(mf, *args, **kwargs)
4 changes: 2 additions & 2 deletions vayesta/ewf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

def EWF(mf, *args, **kwargs):
"""Determine restricted or unrestricted by inspection of mean-field object"""
if isinstance(mf, pyscf.scf.uhf.UHF):
if isinstance(mf, pyscf.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.uhf.UHF) or isinstance(mf, pyscf.pbc.scf.kuhf.KUHF):
return UEWF(mf, *args, **kwargs)
elif isinstance(mf, pyscf.scf.rohf.ROHF):
elif isinstance(mf, pyscf.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.rohf.ROHF) or isinstance(mf, pyscf.pbc.scf.krohf.KROHF):
log.warning("Converting ROHF reference to UHF")
return UEWF(mf.to_uhf(), *args, **kwargs)
return REWF(mf, *args, **kwargs)
4 changes: 2 additions & 2 deletions vayesta/lattmod/latt.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def density_fit(self):


class LatticeRHF(LatticeSCF, pyscf.scf.hf.RHF):
def get_init_guess(self, mol=None, key=None):
def get_init_guess(self, mol=None, key=None, s1e=None):
e, c = np.linalg.eigh(self.get_hcore())
nocc = self.mol.nelectron // 2
dm = 2 * np.dot(c[:, :nocc], c[:, :nocc].T)
Expand Down Expand Up @@ -401,7 +401,7 @@ def check_lattice_symmetry(self, dm=None):


class LatticeUHF(LatticeSCF, pyscf.scf.uhf.UHF):
def get_init_guess(self, mol=None, key=None):
def get_init_guess(self, mol=None, key=None, s1e=None):
e, c = np.linalg.eigh(self.get_hcore())
nocc = self.mol.nelec
dma = np.dot(c[:, : nocc[0]], c[:, : nocc[0]].T)
Expand Down
2 changes: 1 addition & 1 deletion vayesta/tests/core/qemb/test_integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def tearDownClass(cls):
@classmethod
@cache
def get_embedding(cls):
if isinstance(cls.mf, pyscf.scf.uhf.UHF):
if isinstance(cls.mf, pyscf.scf.uhf.UHF) or isinstance(cls.mf, pyscf.pbc.scf.uhf.UHF) or isinstance(cls.mf, pyscf.pbc.scf.kuhf.KUHF):
emb = UEmbedding(cls.mf)
else:
emb = Embedding(cls.mf)
Expand Down
Loading