def get_nc(mol, grids): scfh = HFHelper(mol, init_scf=True) nch = GGAHelper(mol, "b3lypg", grids, init_scf=False) ncengine = NCGGAEngine(scfh, nch) d = { "E_0": ncengine.get_E_0(), "E_1": ncengine.get_E_1(), "E_2": ncengine.get_E_2(), } with open("H2O2-bak.dat", "wb") as f: pickle.dump(d, f, pickle.HIGHEST_PROTOCOL) return d
H 1.237330 1.160145 -1.833324 H 2.503520 0.001674 -0.014122 H 1.259250 -1.151864 1.823627 H -1.227970 -1.162968 1.831961 """ mol.basis = "aug-cc-pVTZ" mol.verbose = 0 mol.max_memory = 72000 mol.build() grids = dft.gen_grid.Grids(mol) grids.atom_grid = (99, 590) grids.becke_scheme = dft.gen_grid.stratmann grids.build() scfh = HFHelper(mol) nch = GGAHelper(mol, "b3lypg", grids, init_scf=False) ncengine = NCGGAEngine(scfh, nch) print("Initialization time: ", time.time() - time0) time0 = time.time() ncengine.get_E_0() print("E_0 time ", time.time() - time0) time0 = time.time() print(ncengine.E_0) ncengine.get_E_1() print("E_1 time ", time.time() - time0) time0 = time.time() print(ncengine.E_1)
def mol_to_E_1(mol): scfh_ = HFHelper(mol) nch_ = GGAHelper(mol, "b3lypg", grids, init_scf=False) ncengine_ = NCGGAEngine(scfh_, nch_) return ncengine_.get_E_1()
def get_numeric_1(mol, grids): scfh = HFHelper(mol, init_scf=True) nch = GGAHelper(mol, "b3lypg", grids, init_scf=False) ncengine = NCGGAEngine(scfh, nch) return ncengine.get_E_1()
print = partial(print, flush=True) np.set_printoptions(8, linewidth=1000, suppress=True) if __name__ == "__main__": mol = gto.Mole() mol.atom = """ O 0.0 0.0 0.0 O 0.0 0.0 1.5 H 1.5 0.0 0.0 H 0.0 0.7 1.5 """ mol.basis = "6-31G" mol.verbose = 0 mol.build() grids = dft.gen_grid.Grids(mol) grids.atom_grid = (99, 590) grids.becke_scheme = dft.gen_grid.stratmann grids.build() scfh_ = HFHelper(mol) nch_ = GGAHelper(mol, "b3lypg", grids, init_scf=False) ncengine = NCGGAEngine(scfh_, nch_) with open("H2O2-bak.dat", "rb") as f: d = pickle.load(f) print(np.allclose(ncengine.get_E_0(), d["E_0"])) print(np.allclose(ncengine.get_E_1(), d["E_1"])) print(np.allclose(ncengine.get_E_2(), d["E_2"]))