def test_with_qmmm_scanner(self): from pyscf import qmmm mol = gto.Mole() mol.atom = ''' O 0.00000000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''' mol.verbose = 0 mol.basis = '6-31g' mol.build() coords = [(0.5,0.6,0.1)] #coords = [(0.0,0.0,0.0)] charges = [-0.1] mf = qmmm.add_mm_charges(scf.RHF(mol), coords, charges) mc = mcscf.CASSCF(mf, 4, 4).as_scanner() e_tot, g = mc.nuc_grad_method().as_scanner()(mol) self.assertAlmostEqual(e_tot, -76.0461574155984, 7) self.assertAlmostEqual(lib.finger(g), 0.042835374915102364, 6) e1 = mc(''' O 0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') e2 = mc(''' O -0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') ref = (e1 - e2)/0.002 * lib.param.BOHR self.assertAlmostEqual(g[0,0], ref, 4) mf = scf.RHF(mol) mc = qmmm.add_mm_charges(mcscf.CASSCF(mf, 4, 4).as_scanner(), coords, charges) e_tot, g = mc.nuc_grad_method().as_scanner()(mol) self.assertAlmostEqual(e_tot, -76.0461574155984, 7) self.assertAlmostEqual(lib.finger(g), 0.042835374915102364, 6)
def test_with_qmmm_scanner(self): from pyscf import qmmm mol = gto.Mole() mol.atom = ''' O 0.00000000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''' mol.verbose = 0 mol.basis = '6-31g' mol.build() coords = [(0.5, 0.6, 0.1)] #coords = [(0.0,0.0,0.0)] charges = [-0.1] mf = qmmm.add_mm_charges(mol.RHF, coords, charges) ps = mf.MP2().as_scanner() g = ps.nuc_grad_method().as_scanner()(mol)[1] e1 = ps(''' O 0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') e2 = ps(''' O -0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') ref = (e1 - e2) / 0.002 * lib.param.BOHR self.assertAlmostEqual(g[0, 0], ref, 4)
def test_with_qmmm_scanner(self): from pyscf import qmmm mol = gto.Mole() mol.atom = ''' O 0.00000000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''' mol.verbose = 0 mol.basis = '6-31g' mol.build() coords = [(0.5, 0.6, 0.1)] #coords = [(0.0,0.0,0.0)] charges = [-0.1] mf = qmmm.add_mm_charges(scf.RHF(mol), coords, charges) ccs = cc.ccsd.CCSD(mf).as_scanner() e1 = ccs(''' O 0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') e2 = ccs(''' O -0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') ref = (e1 - e2) / 0.002 * lib.param.BOHR g = ccs.nuc_grad_method().kernel() self.assertAlmostEqual(g[0, 0], ref, 5)
def test_with_qmmm_scanner(self): from pyscf import qmmm mol = gto.Mole() mol.atom = ''' O 0.00000000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''' mol.verbose = 0 mol.basis = '6-31g' mol.build() coords = [(0.5,0.6,0.1)] #coords = [(0.0,0.0,0.0)] charges = [-0.1] mf = qmmm.add_mm_charges(scf.RHF(mol), coords, charges) ccs = cc.ccsd.CCSD(mf).as_scanner() e1 = ccs(''' O 0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') e2 = ccs(''' O -0.00100000 0.00000000 -0.11081188 H -0.00000000 -0.84695236 0.59109389 H -0.00000000 0.89830571 0.52404783 ''') ref = (e1 - e2)/0.002 * lib.param.BOHR g = ccs.nuc_grad_method().kernel() self.assertAlmostEqual(g[0,0], ref, 5)
mc = mcscf.CASCI (mf, 8, 8).set (conv_tol=1e-10).run () anion = csf_solver (mol, smult=1) anion.wfnsym = 'A1' rad1 = csf_solver (mol, smult=2) rad1.spin = 1 rad1.charge = 1 rad1.wfnsym = 'E1x' rad2 = csf_solver (mol, smult=2) rad2.spin = 1 rad2.charge = 1 rad2.wfnsym = 'E1y' mf_hp = add_mm_charges (mf, [[-3.0, 0.0, 0.0]], [1.0]) mc_hp = mcscf.CASCI (mf_hp, 8, 8).set (fcisolver=anion).run () def zip_kernel(casci, mo_coeff=None, ci0=None, verbose=logger.NOTE): '''CASCI solver ''' if mo_coeff is None: mo_coeff = casci.mo_coeff log = logger.new_logger(casci, verbose) t0 = (time.process_time(), time.time()) log.debug('Start CASCI') ncas = casci.ncas nelecas = casci.nelecas # 2e eri_cas = casci.get_h2eff(mo_coeff) t1 = log.timer('integral transformation to CAS space', *t0)