def test_dump_scf(self): ftmp = tempfile.NamedTemporaryFile() fname = ftmp.name molden.dump_scf(mf, fname) res = molden.read(fname) mo_coeff = res[2] self.assertAlmostEqual(abs(mf.mo_coeff - mo_coeff).max(), 0, 12)
def test_dump_cartesian_gto_orbital(self): ftmp = tempfile.NamedTemporaryFile() fname = ftmp.name with lib.temporary_env(mol, cart=True, symmetry=False): mf = scf.UHF(mol).run() molden.dump_scf(mf, fname) res = molden.read(fname) mo_coeff = res[2] self.assertAlmostEqual(abs(mf.mo_coeff[0]-mo_coeff[0]).max(), 0, 12) self.assertAlmostEqual(abs(mf.mo_coeff[1]-mo_coeff[1]).max(), 0, 12)
def test_dump_uhf(self): ftmp = tempfile.NamedTemporaryFile() fname = ftmp.name with lib.temporary_env(mol, spin=2, charge=2): mf = scf.UHF(mol).run() molden.dump_scf(mf, fname) res = molden.read(fname) mo_coeff = res[2] self.assertEqual(res[0].spin, 2) self.assertAlmostEqual(abs(mf.mo_coeff[0]-mo_coeff[0]).max(), 0, 12) self.assertAlmostEqual(abs(mf.mo_coeff[1]-mo_coeff[1]).max(), 0, 12)
C 4.18683600 5.39145100 -1.03660400 O 3.83817100 6.05486800 -0.01699800 O 4.59716200 5.80622800 -2.14092100 O 5.58644000 -4.68429900 0.02280900 O 6.18324500 -4.32265200 2.18203900 N 0.81156200 -1.41080600 -0.20541400 H 0.01240100 -0.78770300 -0.11904600 """ mol.symmetry = True mol.verbose = 5 mol.max_memory = 40000 mol.spin = 0 mol.charge = -2 mol.output = "_logs/_dft.out" mol.basis = "ccpvdz" mol.build() # # Mean Field Calculation # mf = dft.RKS(mol) mf.xc = "b3lyp" mf.chkfile = "_chk/pp_dianion_dz_b3lyp.chk" mf.kernel() mf.analyze() # # Dump orbitals # molden.dump_scf(mf, "_molden/pp_dianion_ccpvdz_b3lyp.molden")
# Mean Field Calculation # # places the charge close to where the hydrogen in COO--H--OOC used to be # (-7.0947 ± 0.1190, -3.0432 ± 0.0676, 0.1083 ± 0.6237) chg_coords = np.array([[-7.0947, -3.0432, 0.1083]]) mf = qmmm.mm_charge(dft.RKS(mol), chg_coords, [-1.0]) mf.xc = "b3lyp" mf.chkfile = "_chk/pp_anion_pt_chg_dz_b3lyp.chk" mf.kernel() # mf.analyze() # # Dump orbitals # molden.dump_scf(mf, "_molden/pp_anion_pt_chg_dz_b3lyp.molden") # # SA-MCSCF # nelecas, ncas = (4, 4) n_states = 3 weights = np.ones(n_states) / n_states mc = mcscf.CASSCF(mf, ncas, nelecas).state_average_(weights) mc.fix_spin(ss=0) mc.natorb = True mc.chkfile = "_chk/pp_anion_pt_chg_dz_cas_4e_4o.chk" cas_list = [118, 119, 120, 121] mo = mcscf.sort_mo(mc, mf.mo_coeff, cas_list) mc.mc1step(mo)
O 5.40988100 -1.73974700 0.14443400 O 7.04436600 0.46550400 0.34065500 O 7.12570500 2.65745000 0.64243700 H 6.38825500 -0.26311000 0.33673600 N 0.64470000 1.29842900 -0.42771400 H -0.20484500 0.74272900 -0.38069400 O 3.98457900 -1.77374000 1.82326400 H 3.23637200 -2.30639300 2.13283500""" mol.symmetry = True mol.verbose = 5 mol.max_memory = 40000 mol.spin = 0 mol.charge = 0 mol.output = "_logs/_dft.out" mol.basis = "ccpvdz" mol.build() # # Mean Field Calculation # mf = dft.RKS(mol) mf.xc = "b3lyp" mf.chkfile = "_chk/pp_neutral_dz_b3lyp.chk" mf.kernel() mf.analyze() # # Dump orbitals # molden.dump_scf(mf, "_molden/pp_neutral_ccpvdz_b3lyp.molden")