def test_json(): """json/energy""" import numpy as np # Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["driver"] = "gradient" json_data["method"] = 'SCF' json_data["kwargs"] = {} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) assert psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") assert psi4.compare_integers(True, json_data["success"], "Success") bench_energy = -5.433191881443323 cenergy = json_data["variables"]["CURRENT ENERGY"] bench_gradient = np.array([[ 0.0 , 0.0 , 0.4206844], [ 0.0 , 0.0 , -0.4206844]]) cgradient = psi4.core.Matrix.from_serial(json_data["return_value"]) assert psi4.compare_arrays(bench_gradient, cgradient.np, 4, "SCF RETURN_VALUE") return_wfn = "return_wfn" not in json_data["kwargs"] assert psi4.compare_integers(True, return_wfn, "Immutable input") with open("pytest_output.dat", "w") as f: f.write(json_data["raw_output"])
def test_json(): """json/energy""" import numpy as np # Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["driver"] = "gradient" json_data["method"] = 'SCF' json_data["kwargs"] = {} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) assert psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") assert psi4.compare_integers(True, json_data["success"], "Success") bench_energy = -5.433191881443323 cenergy = json_data["variables"]["CURRENT ENERGY"] bench_gradient = np.array([[0.0, 0.0, 0.4206844], [0.0, 0.0, -0.4206844]]) cgradient = psi4.core.Matrix.from_serial(json_data["return_value"]) assert psi4.compare_arrays(bench_gradient, cgradient.np, 4, "SCF RETURN_VALUE") return_wfn = "return_wfn" not in json_data["kwargs"] assert psi4.compare_integers(True, return_wfn, "Immutable input") with open("pytest_output.dat", "w") as f: f.write(json_data["raw_output"])
def test_dft_block_schemes(scheme): """all DFT_BLOCK_SCHEME should give same results and number of grid points. Water dimer with ghost atoms""" mol = psi4.geometry( """ 0 1 O -1.490196515110 -0.043256842172 0.000000000000 H -1.845932568294 0.844902886698 0.000000000000 H -0.533258283804 0.073267064698 0.000000000000 @O 1.416663724802 0.038738966977 0.000000000000 @H 1.773104797767 -0.423233996755 0.760023878024 @H 1.773104797767 -0.423233996755 -0.760023878024 no_com no_reorient symmetry c1 """ ) psi4.set_options( { "BASIS": "def2-SVPD", "DFT_SPHERICAL_POINTS": 590, "DFT_RADIAL_POINTS": 85, "D_convergence": 1e-8, "DFT_WEIGHTS_TOLERANCE": -1.0, } ) ref = {"XC GRID TOTAL POINTS": 300900, "DFT XC ENERGY": -9.218561399189895} psi4.set_options({"DFT_BLOCK_SCHEME": scheme}) e, wfn = psi4.energy("pbe/def2-SVPD", return_wfn=True) P = psi4.variable("XC GRID TOTAL POINTS") XC = wfn.variable("DFT XC ENERGY") assert psi4.compare_integers(ref["XC GRID TOTAL POINTS"], P, f" {scheme} GRID POINTS:") assert psi4.compare_values(ref["DFT XC ENERGY"], XC, f" {scheme} XC ENERGY:")
def test_dft_block_scheme_distantpoints(): """Test removal of distant grid points. all DFT_BLOCK_SCHEME should give same results and number of grid points.""" mol = psi4.geometry( """ 0 1 O -1.551007 -0.114520 0.000000 H -1.934259 0.762503 0.000000 H -0.599677 0.040712 0.000000 no_com no_reorient symmetry c1 """ ) psi4.set_options( { "BASIS": "sto-3g", "maxiter": 1, "FAIL_ON_MAXITER": False, "DFT_PRUNING_SCHEME": "ROBUST", "DFT_WEIGHTS_TOLERANCE": -1.0, } ) ref = {"True": 45929, "False": 46890} YESNO = [True,False] SCHEMES = ["OCTREE", "NAIVE", "ATOMIC"] for YN in YESNO: psi4.set_options({"DFT_REMOVE_DISTANT_POINTS":YN}) for S in SCHEMES: psi4.set_options({"DFT_BLOCK_SCHEME": S}) e, wfn = psi4.energy("pbe", return_wfn=True) P = psi4.variable("XC GRID TOTAL POINTS") XC = wfn.variable("DFT XC ENERGY") assert psi4.compare_integers(ref[f"{YN}"], P, f" scheme={S}; distant points={YN} ")
def test_json(): """json/energy""" import numpy as np # Generate JSON data json_input = { "schema_name": "qc_schema_input", "schema_version": 1, "molecule": { "symbols": ["He", "He"], "geometry": [0, 0, -1, 0, 0, 1] }, "driver": "gradient", "model": { "method": "SCF", "basis": "sto-3g" }, "keywords": {} } json_ret = psi4.json_wrapper.run_json(json_input) assert psi4.compare_integers(True, json_ret["success"], "Success") assert psi4.compare_values(-5.474227786274896, json_ret["properties"]["return_energy"], 4, "SCF ENERGY") bench_gradient = np.array([[ 0.0 , 0.0 , 0.32746933], [ 0.0 , 0.0 , -0.32746933]]) cgradient = np.array(json_ret["return_result"]).reshape(-1, 3) assert psi4.compare_arrays(bench_gradient, cgradient, 4, "SCF RETURN GRADIENT") with open("pytest_output.dat", "w") as f: json.dump(json_ret["raw_output"], f)
# Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["memory"] = "5GB" json_data["driver"] = "energy" json_data["method"] = 'SCF' json_data["kwargs"] = {"bsse_type": "cp"} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") #TEST psi4.compare_integers(True, len(json_data["raw_output"]) > 5000, "Output returned") #TEST psi4.compare_integers(True, json_data["success"], "Success") #TEST bench_cp_energy = 0.183936053861 #TEST cenergy = json_data["variables"]["CURRENT ENERGY"] #TEST psi4.compare_values(bench_cp_energy, cenergy, 5, "SCF CURRENT ENERGY") #TEST cenergy = json_data["return_value"] #TEST psi4.compare_values(bench_cp_energy, cenergy, 5, "SCF RETURN_VALUE") #TEST return_wfn = "return_wfn" not in json_data["kwargs"] #TEST psi4.compare_integers(True, return_wfn, "Immutable input") #TEST with open("output.dat", "w") as f: f.write(json_data["raw_output"])
"scf_type": "df" } } noorient_data = copy.deepcopy(json_data) noorient_data["molecule"]["fix_orientation"] = True noorient_data["molecule"]["fix_com"] = True # Write expected output expected_return_result = -100.0194177509218 linear_dipole = 1.948993625469663 psi4.json_wrapper.run_json(json_data) # Orients to Z axis psi4.compare_integers(True, json_data["success"], "JSON Success") #TEST psi4.compare_values(expected_return_result, json_data["return_result"], 5, "Return Value") #TEST psi4.compare_values(0.0, json_data["properties"]["scf_dipole_moment"][0], 5, "DIPOLE X") #TEST psi4.compare_values(0.0, json_data["properties"]["scf_dipole_moment"][1], 5, "DIPOLE Y") #TEST psi4.compare_values(linear_dipole, json_data["properties"]["scf_dipole_moment"][2], 5, "DIPOLE Z") #TEST dist = np.linalg.norm(np.array(json_data["molecule"]["geometry"])[:3] - np.array(np.array(json_data["molecule"]["geometry"])[3:])) #TEST psi4.compare_values(1.732, dist, 4, "HF Bond Distance") #TEST psi4.json_wrapper.run_json(noorient_data) # Orients to Z axis psi4.compare_integers(True, noorient_data["success"], "JSON Success") #TEST psi4.compare_values(expected_return_result, noorient_data["return_result"], 5, "Return Value") #TEST psi4.compare_values(0.0, noorient_data["properties"]["scf_dipole_moment"][0], 5, "DIPOLE X") #TEST
# Write expected output expected_return_result = [ 0.0, 0.0, -0.05959774096119619, 0.0, -0.043039786289375104, 0.02979887048056895, 0.0, 0.043039786289375104, 0.02979887048056895 ] expected_properties = { "calcinfo_nbasis": 24, "calcinfo_nmo": 24, "calcinfo_nalpha": 5, "calcinfo_nbeta": 5, "calcinfo_natom": 3, "scf_one_electron_energy": -122.4452968291507, "scf_two_electron_energy": 37.62243738251799, "nuclear_repulsion_energy": 8.80146206062943, "scf_total_energy": -76.02139738600329, "return_energy": -76.02139738600329 } json_ret = psi4.json_wrapper.run_json(json_data) with open("output.json", "w") as ofile: json.dump(json_ret, ofile, indent=2) psi4.compare_integers(True, json_ret["success"], "JSON Success") #TEST psi4.compare_arrays(expected_return_result, json_ret["return_result"], 5, "Return Value") #TEST for k in expected_properties.keys(): psi4.compare_values(expected_properties[k], json_ret["properties"][k], 5, k.upper()) #TEST
"scf_total_energy": -76.02139738600329, "mp2_same_spin_correlation_energy": -0.05202760538221721, "mp2_opposite_spin_correlation_energy": -0.1548891108392641, "mp2_singles_energy": 0.0, "mp2_doubles_energy": -0.20691671622148142, "mp2_total_correlation_energy": -0.20691671622148142, "mp2_total_energy": -76.22831410222477, "return_energy": expected_return_result } json_ret = psi4.json_wrapper.run_json(json_data) with open("output.json", "w") as ofile: #TEST json.dump(json_ret, ofile, indent=2) #TEST psi4.compare_integers(True, json_ret["success"], "JSON Success") #TEST psi4.compare_values(expected_return_result, json_ret["return_result"], 5, "Return Value") #TEST psi4.compare_integers(True, "MAYER_INDICES" in json_ret["psi4:qcvars"], "Mayer Indices Found") #TEST for k in expected_properties.keys(): #TEST psi4.compare_values(expected_properties[k], json_ret["properties"][k], 5, k.upper()) #TEST # Expected output with exact MP2 expected_return_result = -76.2283674281634 expected_properties = { "calcinfo_nbasis": 24, "calcinfo_nmo": 24, "calcinfo_nalpha": 5, "calcinfo_nbeta": 5, "calcinfo_natom": 3, "scf_one_electron_energy": -122.44534537436829,
"fragments": [[2, 0, 1]] }, "driver": "energy", "model": { "method": "SCF", "basis": "cc-pVDZ" }, "keywords": { "scf_type": "df" } } # Check non-contiguous fragment throws json_ret = psi4.json_wrapper.run_json(json_data) psi4.compare_integers(False, json_ret["success"], "JSON Failure") #TEST psi4.compare_integers("non-contiguous frag" in json_ret["error"], True, "Contiguous Fragment Error") #TEST # Check symbol length errors del json_data["molecule"]["fragments"] json_data["molecule"]["symbols"] = ["O", "H"] json_ret = psi4.json_wrapper.run_json(json_data) psi4.compare_integers(False, json_data["success"], "JSON Failure") #TEST psi4.compare_integers("atoms" in json_data["error"], True, "Symbol Error") #TEST # Check keyword errors json_data["molecule"]["symbols"] = ["O", "H", "H"] json_data["model"] = {"method": "SCF", "basis": "sto-3g"}
"fragments": [[2, 0, 1]] }, "driver": "energy", "model": { "method": "SCF", "basis": "cc-pVDZ" }, "keywords": { "scf_type": "df" } } # Check non-contiguous fragment throws json_ret = psi4.json_wrapper.run_json(json_data) psi4.compare_integers(False, json_ret["success"], "JSON Failure") #TEST psi4.compare_integers("non-contiguous frag" in json_ret["error"], True, "Contiguous Fragment Error") #TEST # Check symbol length errors del json_data["molecule"]["fragments"] json_data["molecule"]["symbols"] = ["O", "H"] json_ret = psi4.json_wrapper.run_json(json_data) psi4.compare_integers(False, json_data["success"], "JSON Failure") #TEST psi4.compare_integers("atoms" in json_data["error"], True, "Symbol Error") #TEST # Check keyword errors json_data["molecule"]["symbols"] = ["O", "H", "H"] json_data["model"] = {"method": "SCF", "basis": "sto-3g"} json_data["keywords"] = {"scf_type": "super_df"} json_ret = psi4.json_wrapper.run_json(json_data)
# JKFIT H 23/25 C 70/81 H +9/10 C +16/20 mymol = psi4.geometry(""" C 0.0 0.0 0.0 O 1.4 0.0 0.0 H_r -0.5 -0.7 0.0 H_l -0.5 0.7 0.0 """) psi4.set_options({'basis': 'cc-pvdz'}) print('[1] <<< uniform cc-pVDZ >>>') wert,ecp = psi4.core.BasisSet.build(mymol, 'BASIS', psi4.core.get_global_option('BASIS')) psi4.compare_strings('CC-PVDZ', psi4.core.get_global_option('BASIS'), 'name') #TEST psi4.compare_integers(38, wert.nbf(), 'nbf()') #TEST psi4.compare_integers(40, wert.nao(), 'nao()') #TEST psi4.compare_strings('c2v', mymol.schoenflies_symbol(), 'symm') #TEST psi4.compare_strings('CC-PVDZ', wert.name(), 'callby') #TEST psi4.compare_strings('CC-PVDZ', wert.blend(), 'blend') #TEST mymol.print_out() print('[2] <<< RIFIT (default) >>>') wert = psi4.core.BasisSet.build(mymol, 'DF_BASIS_MP2', '', 'RIFIT', psi4.core.get_global_option('BASIS')) psi4.compare_integers(140, wert.nbf(), 'nbf()') #TEST psi4.compare_integers(162, wert.nao(), 'nao()') #TEST psi4.compare_strings('c2v', mymol.schoenflies_symbol(), 'symm') #TEST psi4.compare_strings('(CC-PVDZ AUX)', wert.name(), 'callby') #TEST psi4.compare_strings('CC-PVDZ-RI', wert.blend(), 'blend') #TEST mymol.print_out()
psi4.set_output_file("output.dat", False) # Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["driver"] = "gradient" json_data["method"] = 'SCF' json_data["kwargs"] = {} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") #TEST psi4.compare_integers(True, json_data["success"], "Success") #TEST bench_energy = -5.433191881443323 #TEST cenergy = json_data["variables"]["CURRENT ENERGY"] #TEST psi4.compare_values(bench_energy, cenergy, 5, "SCF CURRENT ENERGY") #TEST bench_gradient = np.array([[ 0.0 , 0.0 , 0.4206844], [ 0.0 , 0.0 , -0.4206844]]) cgradient = psi4.core.Matrix.from_serial(json_data["return_value"]) #TEST psi4.compare_arrays(bench_gradient, cgradient.np, 4, "SCF RETURN_VALUE") #TEST return_wfn = "return_wfn" not in json_data["kwargs"] #TEST psi4.compare_integers(True, return_wfn, "Immutable input") #TEST with open("output.dat", "w") as f:
import numpy as np import psi4 # Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["memory"] = "5GB" json_data["driver"] = "energy" json_data["method"] = 'SCF' json_data["kwargs"] = {"bsse_type": "cp"} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") #TEST psi4.compare_integers(True, len(json_data["raw_output"]) > 5000, "Output returned") #TEST psi4.compare_integers(True, json_data["success"], "Success") #TEST bench_cp_energy = 0.183936053861 #TEST cenergy = json_data["variables"]["CURRENT ENERGY"] #TEST psi4.compare_values(bench_cp_energy, cenergy, 5, "SCF CURRENT ENERGY") #TEST cenergy = json_data["return_value"] #TEST psi4.compare_values(bench_cp_energy, cenergy, 5, "SCF RETURN_VALUE") #TEST return_wfn = "return_wfn" not in json_data["kwargs"] #TEST psi4.compare_integers(True, return_wfn, "Immutable input") #TEST with open("output.dat", "w") as f: f.write(json_data["raw_output"])
mymol = psi4.geometry(""" C 0.0 0.0 0.0 O 1.4 0.0 0.0 H_r -0.5 -0.7 0.0 H_l -0.5 0.7 0.0 """) psi4.set_options({'basis': 'cc-pvdz'}) print('[1] <<< uniform cc-pVDZ >>>') wert, ecp = psi4.core.BasisSet.build(mymol, 'BASIS', psi4.core.get_global_option('BASIS')) psi4.compare_strings('CC-PVDZ', psi4.core.get_global_option('BASIS'), 'name') #TEST psi4.compare_integers(38, wert.nbf(), 'nbf()') #TEST psi4.compare_integers(40, wert.nao(), 'nao()') #TEST psi4.compare_strings('c2v', mymol.schoenflies_symbol(), 'symm') #TEST psi4.compare_strings('CC-PVDZ', wert.name(), 'callby') #TEST psi4.compare_strings('CC-PVDZ', wert.blend(), 'blend') #TEST mymol.print_out() print('[2] <<< RIFIT (default) >>>') wert = psi4.core.BasisSet.build(mymol, 'DF_BASIS_MP2', '', 'RIFIT', psi4.core.get_global_option('BASIS')) psi4.compare_integers(140, wert.nbf(), 'nbf()') #TEST psi4.compare_integers(162, wert.nao(), 'nao()') #TEST psi4.compare_strings('c2v', mymol.schoenflies_symbol(), 'symm') #TEST psi4.compare_strings('(CC-PVDZ AUX)', wert.name(), 'callby') #TEST psi4.compare_strings('CC-PVDZ-RI', wert.blend(), 'blend') #TEST mymol.print_out()
"ccsd_opposite_spin_correlation_energy": -0.11488521989019397, "ccsd_singles_energy": 0.0, "ccsd_doubles_energy": -0.13940944106012007, "ccsd_correlation_energy": -0.13940944106012007, "ccsd_total_energy": -76.11955131338757, "ccsd_iterations": 12, "ccsd_prt_pr_correlation_energy": -0.140553536424603, "ccsd_prt_pr_total_energy": expected_return_result, } json_ret = psi4.json_wrapper.run_json(json_data) with open("output.json", "w") as ofile: #TEST json.dump(json_ret, ofile, indent=2) #TEST psi4.compare_integers(True, json_ret["success"], "JSON Success") #TEST psi4.compare_values(expected_return_result, json_ret["return_result"], 5, "Return Value") #TEST psi4.compare_integers(True, "MAYER_INDICES" in json_ret["extras"]["qcvars"], "Mayer Indices Found") #TEST for k in expected_properties.keys(): #TEST psi4.compare_values(expected_properties[k], json_ret["properties"][k], 5, k.upper()) #TEST assert "Density-fitted CCSD" in json_ret["raw_output"] #TEST # Expected output with exact MP2 expected_return_result = -76.2283674281634 expected_properties = { "calcinfo_nbasis": 24,
"fragments": [[2, 0, 1]] }, "driver": "energy", "model": { "method": "SCF", "basis": "cc-pVDZ" }, "keywords": { "scf_type": "df" } } # Check non-contiguous fragment throws json_ret = psi4.schema_wrapper.run_qcschema(json_data) psi4.compare_integers(False, json_ret.success, "JSON Failure") #TEST psi4.compare_integers("non-contiguous frag" in json_ret.error.error_message, True, "Contiguous Fragment Error") #TEST # Check symbol length errors del json_data["molecule"]["fragments"] json_data["molecule"]["symbols"] = ["O", "H"] json_ret = psi4.schema_wrapper.run_qcschema(json_data) psi4.compare_integers(False, json_ret.success, "JSON Failure") #TEST psi4.compare_integers("dropped atoms!" in json_ret.error.error_message, True, "Symbol Error") #TEST # Check keyword errors json_data["molecule"]["symbols"] = ["O", "H", "H"] json_data["model"] = {"method": "SCF", "basis": "sto-3g"} json_data["keywords"] = {"scf_type": "super_df"} json_ret = psi4.schema_wrapper.run_qcschema(json_data)
0.0, -0.043039786289375104, 0.02979887048056895, 0.0, 0.043039786289375104, 0.02979887048056895 ] expected_properties = { "calcinfo_nbasis": 24, "calcinfo_nmo": 24, "calcinfo_nalpha": 5, "calcinfo_nbeta": 5, "calcinfo_natom": 3, "scf_one_electron_energy": -122.4452968291507, "scf_two_electron_energy": 37.62243738251799, "nuclear_repulsion_energy": 8.80146206062943, "scf_total_energy": -76.02139738600329, "return_energy": -76.02139738600329 } json_ret = psi4.json_wrapper.run_json(json_data) with open("output.json", "w") as ofile: json.dump(json_ret, ofile, indent=2) psi4.compare_integers(True, json_ret["success"], "JSON Success") #TEST psi4.compare_arrays(expected_return_result, json_ret["return_result"], 5, "Return Value") #TEST for k in expected_properties.keys(): #TEST psi4.compare_values(expected_properties[k], json_ret["properties"][k], 5, k.upper()) #TEST
psi4.set_output_file("output.dat", False) # Generate JSON data json_data = {} json_data["molecule"] = """He 0 0 0\n--\nHe 0 0 1""" json_data["driver"] = "gradient" json_data["method"] = 'SCF' json_data["kwargs"] = {} json_data["options"] = {"BASIS": "STO-3G"} json_data["return_output"] = True psi4.json_wrapper.run_json(json_data) psi4.compare_strings("STO-3G", json_data["options"]["BASIS"], "Options test") #TEST psi4.compare_integers(True, json_data["success"], "Success") #TEST bench_energy = -5.433191881443323 #TEST cenergy = json_data["variables"]["CURRENT ENERGY"] #TEST psi4.compare_values(bench_energy, cenergy, 6, "SCF CURRENT ENERGY") #TEST bench_gradient = np.array([[0.0, 0.0, 0.4206844], [0.0, 0.0, -0.4206844]]) cgradient = psi4.core.Matrix.from_serial(json_data["return_value"]) #TEST psi4.compare_arrays(bench_gradient, cgradient.np, 4, "SCF RETURN_VALUE") #TEST return_wfn = "return_wfn" not in json_data["kwargs"] #TEST psi4.compare_integers(True, return_wfn, "Immutable input") #TEST with open("output.dat", "w") as f: f.write(json_data["raw_output"])
# Compute required quantities for SCF V = np.asarray(mints.ao_potential()) T = np.asarray(mints.ao_kinetic()) I = np.asarray(mints.ao_eri()) print('\nTotal time taken for integrals: %.3f seconds.' % (time.time() - t)) t = time.time() # Build H_core H = T + V # <-- efp: add in permanent moment contribution and cache Vefp = modify_Fock_permanent(mol, nbf, efpmol) assert (psi4.compare_integers(1, np.allclose(Vefp, ref_V2), 'EFP permanent Fock contrib')) H = H + Vefp Horig = H.copy() set_qm_atoms(mol, efpmol) # --> efp # Orthogonalizer A = S^(-1/2) using Psi4's matrix power. A = mints.ao_overlap() A.power(-0.5, 1.e-16) A = np.asarray(A) # Calculate initial core guess Hp = A.dot(H).dot(A) e, C2 = np.linalg.eigh(Hp) C = A.dot(C2) Cocc = C[:, :ndocc]
# Compute required quantities for SCF V = np.asarray(mints.ao_potential()) T = np.asarray(mints.ao_kinetic()) I = np.asarray(mints.ao_eri()) print('\nTotal time taken for integrals: %.3f seconds.' % (time.time() - t)) t = time.time() # Build H_core H = T + V # <-- efp: add in permanent moment contribution and cache Vefp = modify_Fock_permanent(mol, nbf, efpmol) assert(psi4.compare_integers(1, np.allclose(Vefp, ref_V2), 'EFP permanent Fock contrib')) H = H + Vefp Horig = H.copy() set_qm_atoms(mol, efpmol) # --> efp # Orthogonalizer A = S^(-1/2) using Psi4's matrix power. A = mints.ao_overlap() A.power(-0.5, 1.e-16) A = np.asarray(A) # Calculate initial core guess Hp = A.dot(H).dot(A) e, C2 = np.linalg.eigh(Hp) C = A.dot(C2) Cocc = C[:, :ndocc]