From 84ee0e57324690fa20461254965272f6dd4addae Mon Sep 17 00:00:00 2001 From: YAY-C Date: Mon, 22 Apr 2024 20:19:01 +0200 Subject: [PATCH 01/11] Checkout test from yannick/fix_sad --- qstack/spahm/guesses.py | 104 ++---------------------- tests/data/645688c7c139c6414b5c0b00.xyz | 20 +++++ tests/test_SAD.py | 35 ++++++++ 3 files changed, 60 insertions(+), 99 deletions(-) create mode 100644 tests/data/645688c7c139c6414b5c0b00.xyz create mode 100644 tests/test_SAD.py diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index 8fb5671..bf183e3 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -1,5 +1,4 @@ import sys -import warnings import numpy import scipy import pyscf @@ -7,27 +6,11 @@ from qstack.spahm.LB2020guess import LB2020guess as LB20 def hcore(mol, *_): - """Uses the diagonalization of the core to compute the guess Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ h = mol.intor_symmetric('int1e_kin') h += mol.intor_symmetric('int1e_nuc') return h def GWH(mol, *_): - """Uses the generalized Wolfsberg-Helmholtz to compute the guess Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ h = hcore(mol) S = mol.intor_symmetric('int1e_ovlp') K = 1.75 # See J. Chem. Phys. 1952, 20, 837 @@ -41,32 +24,19 @@ def GWH(mol, *_): return h_gwh def SAD(mol, func): - """Uses the superposition of atomic densities to compute the guess Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - func (str): Exchange-correlation functional. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ hc = hcore(mol) + print(f"SAD-Hcore = {hc.shape}") dm = pyscf.scf.hf.init_guess_by_atom(mol) + print(f"SAD-DM = {dm.shape}") mf = pyscf.dft.RKS(mol) mf.xc = func vhf = mf.get_veff(dm=dm) + print(f"XC-dunc = {func} (converged = {mf.converged})") + print(f"SAD-vhf = {vhf.shape}") fock = hc + vhf return fock def SAP(mol, *_): - """Uses the superposition of atomic potentials to compute the guess Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ mf = pyscf.dft.RKS(mol) vsap = mf.get_vsap() t = mol.intor_symmetric('int1e_kin') @@ -74,46 +44,17 @@ def SAP(mol, *_): return fock def LB(mol, *_): - """Uses the Laikov-Briling model with HF-based parameters to compute the guess Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ return LB20(parameters='HF').Heff(mol) def LB_HFS(mol, *_): - """ Laikov-Briling using HFS-based parameters - - Args: - mol (pyscf Mole): pyscf Mole object. - - Returns: - A numpy ndarray containing the computed approximate Hamiltonian. - """ return LB20(parameters='HFS').Heff(mol) def solveF(mol, fock): - """Computes the eigenvalues and eigenvectors corresponding to the given Hamiltonian. - - Args: - mol (pyscf Mole): pyscf Mole object. - fock (numpy ndarray): Approximate Hamiltonian. - """ s1e = mol.intor_symmetric('int1e_ovlp') + print(f"1e-overlap = {s1e.shape}, Fock = {fock.shape}") return scipy.linalg.eigh(fock, s1e) def get_guess(arg): - """Returns the function of the method selected to compute the approximate hamiltoninan - - Args: - arg (str): Approximate Hamiltonian - - Returns: - The function of the selected method. - """ arg = arg.lower() guesses = {'core':hcore, 'sad':SAD, 'sap':SAP, 'gwh':GWH, 'lb':LB, 'huckel':'huckel', 'lb-hfs':LB_HFS} if arg not in guesses.keys(): @@ -121,29 +62,7 @@ def get_guess(arg): exit(1) return guesses[arg] - -def check_nelec(nelec, nao): - """ Checks if there is enough orbitals - for the electrons""" - if numpy.any(numpy.array(nelec) > nao): - raise RuntimeError(f'Too many electrons ({nelec}) for {nao} orbitals') - elif numpy.any(numpy.array(nelec) == nao): - msg = f'{nelec} electrons for {nao} orbitals. Is the input intended to have a complete shell?' - warnings.warn(msg) - - def get_occ(e, nelec, spin): - """Returns the occupied subset of e - - Args: - e (numpy ndarray): Energy eigenvalues. - nelec(tuple): Number of alpha and beta electrons. - spin(int): Spin. - - Returns: - A numpy ndarray containing the occupied eigenvalues. - """ - check_nelec(nelec, e.shape[0]) if spin==None: nocc = nelec[0] return e[:nocc,...] @@ -154,20 +73,7 @@ def get_occ(e, nelec, spin): e1[1,:nocc[1],...] = e[:nocc[1],...] return e1 - def get_dm(v, nelec, spin): - """Computes the density matrix. - - Args: - v (numpy ndarray): Eigenvectors of a previously solve Hamiltoinan. - nelec(tuple): Number of alpha and beta electrons. - spin(int): Spin. - - Return: - A numpy ndarray containing the density matrix computed using the guess Hamiltonian. - """ - - check_nelec(nelec, len(v)) if spin==None: nocc = nelec[0] dm = v[:,:nocc] @ v[:,:nocc].T diff --git a/tests/data/645688c7c139c6414b5c0b00.xyz b/tests/data/645688c7c139c6414b5c0b00.xyz new file mode 100644 index 0000000..0f8d329 --- /dev/null +++ b/tests/data/645688c7c139c6414b5c0b00.xyz @@ -0,0 +1,20 @@ +18 +## STRUCTURE-ID: 645688c7c139c6414b5c0b00 ; CHARGE = -1; SPIN = 3 +I -1.4436121126949015 0.42029126592817107 -1.6632891671244727 +C -3.33580743801813 -0.15353604789979267 -0.7339542845183026 +H -3.1287423587721643 -0.9434022824024976 -0.01933696409311693 +H -3.9964207871651225 -0.4901283664418908 -1.5229488133526843 +H -3.7274422375299143 0.7217041183959343 -0.2282996045106841 +O 2.7223903943392993 0.8261760398398512 1.3050834155297588 +C 0.9888087204630703 -2.379094167649743 -0.5398992858009954 +H 1.6940986505047444 -3.152743685891341 -0.26448601467465105 +H 1.4948333510508294 -1.5155711156764566 -0.9595290502133175 +H 0.23509595271835407 -2.753118014964276 -1.2220792965839438 +H 3.6453537356643806 0.6064576399990429 1.069461740053683 +Rh 0.014459630959218359 0.9679146681456635 0.7456381302221328 +I -1.880589614365632 1.6750428531997783 2.5349367788411588 +I -0.030250731343837742 -1.749134256908 1.27855077077407 +O 2.4116878114136866 0.7236029720756493 -0.9162960476741423 +C 1.9293704614065443 0.9262914436358692 0.19859748723285423 +O 1.6398052199498723 3.5271918982221226 0.580225781514007 +C 0.766961351419702 2.742055038391913 0.35762442437864966 diff --git a/tests/test_SAD.py b/tests/test_SAD.py new file mode 100644 index 0000000..7279dab --- /dev/null +++ b/tests/test_SAD.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import os +import numpy as np +from qstack import compound +from qstack.spahm.rho import atom + + +def test_water(): + print("Running water-test") + path = os.path.dirname(os.path.realpath(__file__)) + mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=0, spin=0) + + Xsad = atom.get_repr(mol, ["H", "O"], 0, 0, dm=None, + xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') + + print(np.array([*Xsad[:,1]]).shape) + return 0 + + +def test_other(): + print("Running weird-test") + path = os.path.dirname(os.path.realpath(__file__)) + mol = compound.xyz_to_mol(path+'/data/645688c7c139c6414b5c0b00.xyz', 'sto3g', charge=-1, spin=2) + + Xsad = atom.get_repr(mol, ["H", "O", "C", "I", "Rh"], -1, 2, dm=None, + xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='def2tzvpjkfit') + + print(np.array([*Xsad[:,1]]).shape) + return 0 + + +if __name__ == '__main__': + test_water() + test_other() From 0f4ba3988a96ea681bdd7134f3a27146c9a94916 Mon Sep 17 00:00:00 2001 From: calvinoY Date: Tue, 23 Apr 2024 17:47:38 +0200 Subject: [PATCH 02/11] refined failed test (water example) --- tests/test_SAD.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/test_SAD.py b/tests/test_SAD.py index 7279dab..edd6622 100644 --- a/tests/test_SAD.py +++ b/tests/test_SAD.py @@ -6,10 +6,10 @@ from qstack.spahm.rho import atom -def test_water(): +def test_water_open_shell(): print("Running water-test") path = os.path.dirname(os.path.realpath(__file__)) - mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=0, spin=0) + mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=1, spin=1) ## test breaks when effective open-shell caluclation is needed Xsad = atom.get_repr(mol, ["H", "O"], 0, 0, dm=None, xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') @@ -18,18 +18,31 @@ def test_water(): return 0 -def test_other(): - print("Running weird-test") +def test_water_close_shell(): + print("Running water-test") path = os.path.dirname(os.path.realpath(__file__)) - mol = compound.xyz_to_mol(path+'/data/645688c7c139c6414b5c0b00.xyz', 'sto3g', charge=-1, spin=2) + mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=0, spin=0) ## test breaks when effective open-shell caluclation is needed - Xsad = atom.get_repr(mol, ["H", "O", "C", "I", "Rh"], -1, 2, dm=None, - xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='def2tzvpjkfit') + Xsad = atom.get_repr(mol, ["H", "O"], 0, 0, dm=None, + xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') print(np.array([*Xsad[:,1]]).shape) return 0 +## This is the original failure (spotted) for a xyz-structutre from Reiher-group Monstanto DB +#def test_other(): +# print("Running weird-test") +# path = os.path.dirname(os.path.realpath(__file__)) +# mol = compound.xyz_to_mol(path+'/data/645688c7c139c6414b5c0b00.xyz', 'sto3g', charge=-1, spin=2) +# +# Xsad = atom.get_repr(mol, ["H", "O", "C", "I", "Rh"], -1, 2, dm=None, +# xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='def2tzvpjkfit') +# +# print(np.array([*Xsad[:,1]]).shape) +# return 0 + if __name__ == '__main__': - test_water() - test_other() + test_water_open_shell() + test_water_close_shell() + #test_other() From 7486329b3958a9ff3324fb3abbd3a7b82d51ff55 Mon Sep 17 00:00:00 2001 From: calvinoY Date: Wed, 24 Apr 2024 18:40:47 +0200 Subject: [PATCH 03/11] Added print-details --- qstack/spahm/compute_spahm.py | 2 ++ qstack/spahm/guesses.py | 2 ++ tests/test_SAD.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qstack/spahm/compute_spahm.py b/qstack/spahm/compute_spahm.py index 62e14f0..372d83a 100644 --- a/qstack/spahm/compute_spahm.py +++ b/qstack/spahm/compute_spahm.py @@ -39,6 +39,8 @@ def get_guess_dm(mol, guess, xc="pbe", openshell=None): A numpy ndarray containing the density matrix computed using the guess Hamiltonian. """ e,v = get_guess_orbitals(mol, guess, xc) + print(f"Orbitals = {v.shape}") + exit() return get_dm(v, mol.nelec, mol.spin if mol.spin>0 or not openshell is None else None) def get_spahm_representation(mol, guess_in, xc="pbe"): diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index bf183e3..100bb74 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -33,7 +33,9 @@ def SAD(mol, func): vhf = mf.get_veff(dm=dm) print(f"XC-dunc = {func} (converged = {mf.converged})") print(f"SAD-vhf = {vhf.shape}") + if vhf.ndim >2 : print(f"alpha and beta components are equal {(vhf[0] == vhf[1]).all()}") fock = hc + vhf + print(f"SAD-Fock = {fock.shape}") return fock def SAP(mol, *_): diff --git a/tests/test_SAD.py b/tests/test_SAD.py index edd6622..0facecb 100644 --- a/tests/test_SAD.py +++ b/tests/test_SAD.py @@ -11,7 +11,7 @@ def test_water_open_shell(): path = os.path.dirname(os.path.realpath(__file__)) mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=1, spin=1) ## test breaks when effective open-shell caluclation is needed - Xsad = atom.get_repr(mol, ["H", "O"], 0, 0, dm=None, + Xsad = atom.get_repr(mol, ["H", "O"], 1, 1, dm=None, xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') print(np.array([*Xsad[:,1]]).shape) From ef83cdae1a302dfef82bdfd9b314d2ebc452c085 Mon Sep 17 00:00:00 2001 From: calvinoY Date: Thu, 25 Apr 2024 13:03:07 +0200 Subject: [PATCH 04/11] Fixed SAS issue and cleaned test_SAD --- qstack/spahm/compute_spahm.py | 1 - qstack/spahm/guesses.py | 2 +- tests/test_SAD.py | 32 +++++++------------------------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/qstack/spahm/compute_spahm.py b/qstack/spahm/compute_spahm.py index 372d83a..c3d1523 100644 --- a/qstack/spahm/compute_spahm.py +++ b/qstack/spahm/compute_spahm.py @@ -40,7 +40,6 @@ def get_guess_dm(mol, guess, xc="pbe", openshell=None): """ e,v = get_guess_orbitals(mol, guess, xc) print(f"Orbitals = {v.shape}") - exit() return get_dm(v, mol.nelec, mol.spin if mol.spin>0 or not openshell is None else None) def get_spahm_representation(mol, guess_in, xc="pbe"): diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index 100bb74..d76be56 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -34,7 +34,7 @@ def SAD(mol, func): print(f"XC-dunc = {func} (converged = {mf.converged})") print(f"SAD-vhf = {vhf.shape}") if vhf.ndim >2 : print(f"alpha and beta components are equal {(vhf[0] == vhf[1]).all()}") - fock = hc + vhf + fock = hc + (vhf if vhf.ndim == 2 else vhf[0]) print(f"SAD-Fock = {fock.shape}") return fock diff --git a/tests/test_SAD.py b/tests/test_SAD.py index 0facecb..847c438 100644 --- a/tests/test_SAD.py +++ b/tests/test_SAD.py @@ -5,44 +5,26 @@ from qstack import compound from qstack.spahm.rho import atom - def test_water_open_shell(): - print("Running water-test") path = os.path.dirname(os.path.realpath(__file__)) mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=1, spin=1) ## test breaks when effective open-shell caluclation is needed Xsad = atom.get_repr(mol, ["H", "O"], 1, 1, dm=None, xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') - - print(np.array([*Xsad[:,1]]).shape) - return 0 - + return Xsad def test_water_close_shell(): - print("Running water-test") path = os.path.dirname(os.path.realpath(__file__)) mol = compound.xyz_to_mol(path+'/data/H2O.xyz', 'sto3g', charge=0, spin=0) ## test breaks when effective open-shell caluclation is needed Xsad = atom.get_repr(mol, ["H", "O"], 0, 0, dm=None, xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='ccpvdzjkfit') + return Xsad - print(np.array([*Xsad[:,1]]).shape) - return 0 - -## This is the original failure (spotted) for a xyz-structutre from Reiher-group Monstanto DB -#def test_other(): -# print("Running weird-test") -# path = os.path.dirname(os.path.realpath(__file__)) -# mol = compound.xyz_to_mol(path+'/data/645688c7c139c6414b5c0b00.xyz', 'sto3g', charge=-1, spin=2) -# -# Xsad = atom.get_repr(mol, ["H", "O", "C", "I", "Rh"], -1, 2, dm=None, -# xc = 'hf', guess='sad', model='lowdin-long-x', auxbasis='def2tzvpjkfit') -# -# print(np.array([*Xsad[:,1]]).shape) -# return 0 - +def test_equivalence(): + Xos = test_water_open_shell() + Xcs = test_water_close_shell() + assert(not np.array_equal(Xos, Xcs)) if __name__ == '__main__': - test_water_open_shell() - test_water_close_shell() - #test_other() + test_equivalence() From cd3f1b12fef5336c5c3742c470c9059efe26124b Mon Sep 17 00:00:00 2001 From: calvinoY Date: Thu, 25 Apr 2024 13:14:55 +0200 Subject: [PATCH 05/11] Recovered doc-strings from my-fork/yannick --- qstack/spahm/guesses.py | 105 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 99 insertions(+), 6 deletions(-) diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index d76be56..0fd16df 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -1,4 +1,5 @@ import sys +import warnings import numpy import scipy import pyscf @@ -6,11 +7,27 @@ from qstack.spahm.LB2020guess import LB2020guess as LB20 def hcore(mol, *_): + """Uses the diagonalization of the core to compute the guess Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ h = mol.intor_symmetric('int1e_kin') h += mol.intor_symmetric('int1e_nuc') return h def GWH(mol, *_): + """Uses the generalized Wolfsberg-Helmholtz to compute the guess Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ h = hcore(mol) S = mol.intor_symmetric('int1e_ovlp') K = 1.75 # See J. Chem. Phys. 1952, 20, 837 @@ -24,21 +41,33 @@ def GWH(mol, *_): return h_gwh def SAD(mol, func): + """Uses the superposition of atomic densities to compute the guess Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + func (str): Exchange-correlation functional. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ hc = hcore(mol) print(f"SAD-Hcore = {hc.shape}") dm = pyscf.scf.hf.init_guess_by_atom(mol) - print(f"SAD-DM = {dm.shape}") mf = pyscf.dft.RKS(mol) mf.xc = func vhf = mf.get_veff(dm=dm) - print(f"XC-dunc = {func} (converged = {mf.converged})") - print(f"SAD-vhf = {vhf.shape}") - if vhf.ndim >2 : print(f"alpha and beta components are equal {(vhf[0] == vhf[1]).all()}") fock = hc + (vhf if vhf.ndim == 2 else vhf[0]) - print(f"SAD-Fock = {fock.shape}") return fock def SAP(mol, *_): + """Uses the superposition of atomic potentials to compute the guess Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ mf = pyscf.dft.RKS(mol) vsap = mf.get_vsap() t = mol.intor_symmetric('int1e_kin') @@ -46,17 +75,46 @@ def SAP(mol, *_): return fock def LB(mol, *_): + """Uses the Laikov-Briling model with HF-based parameters to compute the guess Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ return LB20(parameters='HF').Heff(mol) def LB_HFS(mol, *_): + """ Laikov-Briling using HFS-based parameters + + Args: + mol (pyscf Mole): pyscf Mole object. + + Returns: + A numpy ndarray containing the computed approximate Hamiltonian. + """ return LB20(parameters='HFS').Heff(mol) def solveF(mol, fock): + """Computes the eigenvalues and eigenvectors corresponding to the given Hamiltonian. + + Args: + mol (pyscf Mole): pyscf Mole object. + fock (numpy ndarray): Approximate Hamiltonian. + """ s1e = mol.intor_symmetric('int1e_ovlp') - print(f"1e-overlap = {s1e.shape}, Fock = {fock.shape}") return scipy.linalg.eigh(fock, s1e) def get_guess(arg): + """Returns the function of the method selected to compute the approximate hamiltoninan + + Args: + arg (str): Approximate Hamiltonian + + Returns: + The function of the selected method. + """ arg = arg.lower() guesses = {'core':hcore, 'sad':SAD, 'sap':SAP, 'gwh':GWH, 'lb':LB, 'huckel':'huckel', 'lb-hfs':LB_HFS} if arg not in guesses.keys(): @@ -64,7 +122,29 @@ def get_guess(arg): exit(1) return guesses[arg] + +def check_nelec(nelec, nao): + """ Checks if there is enough orbitals + for the electrons""" + if numpy.any(numpy.array(nelec) > nao): + raise RuntimeError(f'Too many electrons ({nelec}) for {nao} orbitals') + elif numpy.any(numpy.array(nelec) == nao): + msg = f'{nelec} electrons for {nao} orbitals. Is the input intended to have a complete shell?' + warnings.warn(msg) + + def get_occ(e, nelec, spin): + """Returns the occupied subset of e + + Args: + e (numpy ndarray): Energy eigenvalues. + nelec(tuple): Number of alpha and beta electrons. + spin(int): Spin. + + Returns: + A numpy ndarray containing the occupied eigenvalues. + """ + check_nelec(nelec, e.shape[0]) if spin==None: nocc = nelec[0] return e[:nocc,...] @@ -75,7 +155,20 @@ def get_occ(e, nelec, spin): e1[1,:nocc[1],...] = e[:nocc[1],...] return e1 + def get_dm(v, nelec, spin): + """Computes the density matrix. + + Args: + v (numpy ndarray): Eigenvectors of a previously solve Hamiltoinan. + nelec(tuple): Number of alpha and beta electrons. + spin(int): Spin. + + Return: + A numpy ndarray containing the density matrix computed using the guess Hamiltonian. + """ + + check_nelec(nelec, len(v)) if spin==None: nocc = nelec[0] dm = v[:,:nocc] @ v[:,:nocc].T From 2f04c5169386f86908a433ffb4d1e575b1edae9c Mon Sep 17 00:00:00 2001 From: calvinoY Date: Thu, 25 Apr 2024 13:44:00 +0200 Subject: [PATCH 06/11] Cleanup and added warning for SAD guess --- qstack/spahm/compute_spahm.py | 1 - qstack/spahm/guesses.py | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qstack/spahm/compute_spahm.py b/qstack/spahm/compute_spahm.py index c3d1523..62e14f0 100644 --- a/qstack/spahm/compute_spahm.py +++ b/qstack/spahm/compute_spahm.py @@ -39,7 +39,6 @@ def get_guess_dm(mol, guess, xc="pbe", openshell=None): A numpy ndarray containing the density matrix computed using the guess Hamiltonian. """ e,v = get_guess_orbitals(mol, guess, xc) - print(f"Orbitals = {v.shape}") return get_dm(v, mol.nelec, mol.spin if mol.spin>0 or not openshell is None else None) def get_spahm_representation(mol, guess_in, xc="pbe"): diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index 0fd16df..f37d3b8 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -51,12 +51,17 @@ def SAD(mol, func): A numpy ndarray containing the computed approximate Hamiltonian. """ hc = hcore(mol) - print(f"SAD-Hcore = {hc.shape}") dm = pyscf.scf.hf.init_guess_by_atom(mol) mf = pyscf.dft.RKS(mol) mf.xc = func vhf = mf.get_veff(dm=dm) - fock = hc + (vhf if vhf.ndim == 2 else vhf[0]) + if vhf.ndim == 2: + fock = hc + vhf + elif vhf.ndim == 3 and numpy.array_equal(vhf[0], vhf[1]): + fock = hc + vhf[0] + else: + msg = f'The effective potential ({func}) return different alpha and beta matrix components from atomicHF DM' + warnings.warn(msg) return fock def SAP(mol, *_): From aea95445d5c91f71a81048e34d8605d41e924970 Mon Sep 17 00:00:00 2001 From: Yannick Calvino Alonso Date: Fri, 26 Apr 2024 14:00:38 +0200 Subject: [PATCH 07/11] Imporved warning --- qstack/spahm/guesses.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index f37d3b8..a5446ed 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -57,11 +57,11 @@ def SAD(mol, func): vhf = mf.get_veff(dm=dm) if vhf.ndim == 2: fock = hc + vhf - elif vhf.ndim == 3 and numpy.array_equal(vhf[0], vhf[1]): - fock = hc + vhf[0] else: - msg = f'The effective potential ({func}) return different alpha and beta matrix components from atomicHF DM' - warnings.warn(msg) + fock = hc + vhf[0] + if numpy.array_equal(vhf[0], vhf[1]): + msg = f'The effective potential ({func}) return different alpha and beta matrix components from atomicHF DM' + warnings.warn(msg) return fock def SAP(mol, *_): From 494c9dddf252e45325dd04329a4c608490ad5efa Mon Sep 17 00:00:00 2001 From: Yannick Calvino Alonso Date: Mon, 29 Apr 2024 10:27:36 +0200 Subject: [PATCH 08/11] Removed unecessary file --- tests/data/645688c7c139c6414b5c0b00.xyz | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tests/data/645688c7c139c6414b5c0b00.xyz diff --git a/tests/data/645688c7c139c6414b5c0b00.xyz b/tests/data/645688c7c139c6414b5c0b00.xyz deleted file mode 100644 index 0f8d329..0000000 --- a/tests/data/645688c7c139c6414b5c0b00.xyz +++ /dev/null @@ -1,20 +0,0 @@ -18 -## STRUCTURE-ID: 645688c7c139c6414b5c0b00 ; CHARGE = -1; SPIN = 3 -I -1.4436121126949015 0.42029126592817107 -1.6632891671244727 -C -3.33580743801813 -0.15353604789979267 -0.7339542845183026 -H -3.1287423587721643 -0.9434022824024976 -0.01933696409311693 -H -3.9964207871651225 -0.4901283664418908 -1.5229488133526843 -H -3.7274422375299143 0.7217041183959343 -0.2282996045106841 -O 2.7223903943392993 0.8261760398398512 1.3050834155297588 -C 0.9888087204630703 -2.379094167649743 -0.5398992858009954 -H 1.6940986505047444 -3.152743685891341 -0.26448601467465105 -H 1.4948333510508294 -1.5155711156764566 -0.9595290502133175 -H 0.23509595271835407 -2.753118014964276 -1.2220792965839438 -H 3.6453537356643806 0.6064576399990429 1.069461740053683 -Rh 0.014459630959218359 0.9679146681456635 0.7456381302221328 -I -1.880589614365632 1.6750428531997783 2.5349367788411588 -I -0.030250731343837742 -1.749134256908 1.27855077077407 -O 2.4116878114136866 0.7236029720756493 -0.9162960476741423 -C 1.9293704614065443 0.9262914436358692 0.19859748723285423 -O 1.6398052199498723 3.5271918982221226 0.580225781514007 -C 0.766961351419702 2.742055038391913 0.35762442437864966 From 7ffc81322abfc79ec630c155397ec49e0ebbe55d Mon Sep 17 00:00:00 2001 From: Yannick Calvino Alonso Date: Mon, 29 Apr 2024 10:32:34 +0200 Subject: [PATCH 09/11] Fixed warning-msg --- qstack/spahm/guesses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qstack/spahm/guesses.py b/qstack/spahm/guesses.py index a5446ed..156f900 100644 --- a/qstack/spahm/guesses.py +++ b/qstack/spahm/guesses.py @@ -59,7 +59,7 @@ def SAD(mol, func): fock = hc + vhf else: fock = hc + vhf[0] - if numpy.array_equal(vhf[0], vhf[1]): + if not numpy.array_equal(vhf[0], vhf[1]): msg = f'The effective potential ({func}) return different alpha and beta matrix components from atomicHF DM' warnings.warn(msg) return fock From caa08dbfe3f2dfdff8c62473c4fd1fce31f48df3 Mon Sep 17 00:00:00 2001 From: Yannick Calvino Alonso Date: Wed, 1 May 2024 21:15:36 +0200 Subject: [PATCH 10/11] Move SAD-test to test_saphm_a.py (renamed) and add test data --- tests/data/SPAHM_a_H2O/X_H2O-RC_SAD.npy | Bin 0 -> 10405 bytes tests/data/SPAHM_a_H2O/X_H2O_SAD.npy | Bin 0 -> 5434 bytes tests/test_SAD.py | 30 -------------- tests/test_atomic_spahm.py | 24 ----------- tests/test_spahm_a.py | 51 ++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 tests/data/SPAHM_a_H2O/X_H2O-RC_SAD.npy create mode 100644 tests/data/SPAHM_a_H2O/X_H2O_SAD.npy delete mode 100644 tests/test_SAD.py delete mode 100755 tests/test_atomic_spahm.py create mode 100755 tests/test_spahm_a.py diff --git a/tests/data/SPAHM_a_H2O/X_H2O-RC_SAD.npy b/tests/data/SPAHM_a_H2O/X_H2O-RC_SAD.npy new file mode 100644 index 0000000000000000000000000000000000000000..311909ec2534763a7fe77df0636f9f0569ef38e3 GIT binary patch literal 10405 zcmeI0do)#D)c+51SCP9YB=l55(y6rOK}m!{QX&aalA}XJrBDi872VvDR6N}zlyel- z=^-H%5|RqJ-^%THYp4Cj7tT}FpEFN& zzv}=0pIDf{Hs63vR4@*iOekyLk9u%Cw*Q`nK8Mx)u#nIgxcjxt4U znPS?O0*-vY)f0n>vO1K?!W=__o;x^1FUNkT2K~uecJw?)%DfR0q zR*8I(%xPX&*OSha{;exx%aonaHDb#Bzq&LQQ{L^ENw)-z_U_B~^4L~gDBs;?x71-7 z(92pRjA|IrZ(;c4aOPs*l67~vuA6Q0X21=2?q9Ra63kRQ4oy`z1qR7~N!Cr4=!*<< z*Mhlh(!-nQR>4oAV@mSZko7gM4dV(=GoUeK={FmnJTz?RvifRdJ^Os2OWxMhFKpYz z_a{rFQ}5rh$)#DU{O^2Y{X(mrQ9>DvN~V7{rR zjPDCGT*LeMd#wc+?bj~|>)soHfA(C=5HN0stYG>58-zN*_eO0XZ+aW7x|`QNcCa4e zh#y`s)-el_TU|aT#mEY;hWHz@jBJK@bMG}NhW(BUb*WVX45RJ?wJL9hAWZ*+&Ay|< z;FEoQmet1}(A}eGnbG+DPhCO8&n==;-Rh<~Q&x!~miq6CQjlfPvOy}OQJB#YAQ1+?9G?rCIR>7>sS{n00N@vp~z5Yd_9 zc2{fe${n?SHguf{2nHd_otuCU5U)gjPyB)^k~(5b>H!czYMNGbzIkb7rgm743{j9^oMDjP-*jX;}(3JuujpaNTX`@Y2wF#=u4F1 ze2YfVf{+L`D~lO>nj}X zp;EYZcS425vS?s5W=)WfUb*oL>?knqo$Xl;HsUyOWtBU(m zJq6b*@*VqM(}w+=DZu)YRXCq3{7u!XtP!m$^S-{PM-D7fJ35-X7eEZm=)SvQAy`~6 zZCK;20*=R*+8tihjh2)6j?lQd-;B(l{#J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;%ziQ2np%Frem1>tH}7O@;HLt^sq`(uaA`N1@M!QqZ6J_fXdX;^z|4 zQ9QR91Ild200vZ{>}q@tbKb)F+0h4c=d6Qyu{0`hpN|hif9{jI9El(CcF<9O--!XW z&oc-EDoG6hHT(wvM8+2Y6`*H}0acyXfdREbD;EPwpXA?-13+ac0B}wbfVA-eP)b%d z7*J{Fy)d8}ib20n9`cjo08m^%091_#0Fq@Y_2Da^3X^p(pjgCD9?|zE`MYldpdNPu zpt29!VL+YsT8IJlS{M8`5I-x%Kwm)e|Fm6!0i~Y369X!7)5wos0aZrom0ke;IcDJJ zKGAQ_f_%>P91N(u<(Dv^B( Date: Wed, 1 May 2024 21:32:46 +0200 Subject: [PATCH 11/11] Fix test_global (broken by caa08db) --- tests/test_global.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_global.py b/tests/test_global.py index ed84f09..ce4bf86 100644 --- a/tests/test_global.py +++ b/tests/test_global.py @@ -8,7 +8,8 @@ def test_avg_kernel(): path = os.path.dirname(os.path.realpath(__file__)) X_dir = os.path.join(path, 'data/SPAHM_a_H2O/') - mols = [np.load(os.path.join(X_dir, f), allow_pickle=True) for f in os.listdir(X_dir) if os.path.isfile(os.path.join(X_dir,f))] + mollist = [os.path.join(X_dir, s) for s in ['X_H2O.npy', 'X_rotated_H2O.npy', 'X_H2O_dist.npy']] + mols = [np.load(f, allow_pickle=True) for f in mollist] K = kernel.kernel(mols, akernel='L', gkernel='avg', sigma=1.0) true_K = np.array( [[1. , 1. , 0.79179528], \ @@ -22,7 +23,8 @@ def test_avg_kernel(): def test_rem_kernel(): path = os.path.dirname(os.path.realpath(__file__)) X_dir = os.path.join(path, 'data/SPAHM_a_H2O/') - mols = [np.load(os.path.join(X_dir, f), allow_pickle=True) for f in os.listdir(X_dir) if os.path.isfile(os.path.join(X_dir,f))] + mollist = [os.path.join(X_dir, s) for s in ['X_H2O.npy', 'X_rotated_H2O.npy', 'X_H2O_dist.npy']] + mols = [np.load(f, allow_pickle=True) for f in mollist] K = kernel.kernel(mols, akernel='L', gkernel='rem', sigma=1.0, gdict={'alpha':1.0, 'normalize':1}) true_K = np.array( [[1. , 0.6528238, 1. ], \