def test_natorbs_fclist(self): self.mf.mo_coeff[0, :, [1, 3]] = self.mf.mo_coeff[0, :, [3, 1]] self.mf.mo_energy[0, [1, 3]] = self.mf.mo_energy[0, [3, 1]] self.mf.mo_coeff[1, :, [0, 4]] = self.mf.mo_coeff[1, :, [4, 0]] self.mf.mo_energy[1, [0, 4]] = self.mf.mo_energy[1, [4, 0]] with DFUMP2(self.mf, frozen=[[0, 3], [1, 4]]) as pt: # also check the density matrix rdm1 = pt.make_rdm1() self.assertAlmostEqual(rdm1[0, 0, 0], 1.0, delta=1.0e-12) self.assertAlmostEqual(rdm1[0, 3, 3], 1.0, delta=1.0e-12) self.assertAlmostEqual(rdm1[1, 1, 1], 1.0, delta=1.0e-12) self.assertAlmostEqual(rdm1[1, 4, 4], 1.0, delta=1.0e-12) # now calculate the natural orbitals natocc, natorb = pt.make_natorbs() # number of electrons conserved self.assertAlmostEqual(numpy.sum(natocc), mol.nelectron, delta=1.0e-10) # orbital orthogonal check_orth(self, mol, natorb) # selected values self.assertAlmostEqual(natocc[0], 1.9999987581, delta=1.0e-7) self.assertAlmostEqual(natocc[1], 1.9999987356, delta=1.0e-7) self.assertAlmostEqual(natocc[2], 1.9882629065, delta=1.0e-7) self.assertAlmostEqual(natocc[6], 1.9473585838, delta=1.0e-7) self.assertAlmostEqual(natocc[7], 1.0168965649, delta=1.0e-7) self.assertAlmostEqual(natocc[8], 1.0168965649, delta=1.0e-7) self.assertAlmostEqual(natocc[9], 0.0477790944, delta=1.0e-7) self.assertAlmostEqual(natocc[27], 0.0002307322, delta=1.0e-7)
def test_energy_fclist(self): self.mf.mo_coeff[0, :, [1, 3]] = self.mf.mo_coeff[0, :, [3, 1]] self.mf.mo_energy[0, [1, 3]] = self.mf.mo_energy[0, [3, 1]] self.mf.mo_coeff[1, :, [0, 4]] = self.mf.mo_coeff[1, :, [4, 0]] self.mf.mo_energy[1, [0, 4]] = self.mf.mo_energy[1, [4, 0]] with DFUMP2(self.mf, frozen=[[0, 3], [1, 4]]) as pt: pt.kernel() self.assertAlmostEqual(pt.e_corr, -0.343816318675, delta=1.0e-8) self.assertAlmostEqual(pt.e_tot, -149.834200533235, delta=1.0e-8)
def test_natorbs(self): mol = self.mf.mol with DFUMP2(self.mf) as pt: natocc, natorb = pt.make_natorbs() # number of electrons conserved self.assertAlmostEqual(numpy.sum(natocc), mol.nelectron, delta=1.0e-10) # orbitals orthogonal check_orth(self, mol, natorb) # selected values self.assertAlmostEqual(natocc[0], 1.9999191951, delta=1.0e-7) self.assertAlmostEqual(natocc[6], 1.9473283296, delta=1.0e-7) self.assertAlmostEqual(natocc[7], 1.0168954406, delta=1.0e-7) self.assertAlmostEqual(natocc[8], 1.0168954406, delta=1.0e-7) self.assertAlmostEqual(natocc[9], 0.0478262909, delta=1.0e-7) self.assertAlmostEqual(natocc[27], 0.0002326288, delta=1.0e-7)
def test_natorbs_relaxed(self): mol = self.mf.mol with DFUMP2(self.mf) as pt: pt.cphf_tol = 1e-12 natocc, natorb = pt.make_natorbs(relaxed=True) # number of electrons conserved self.assertAlmostEqual(numpy.sum(natocc), mol.nelectron, delta=1.0e-10) # orbitals orthogonal check_orth(self, mol, natorb) # selected values self.assertAlmostEqual(natocc[0], 1.9999198031, delta=1.0e-7) self.assertAlmostEqual(natocc[6], 1.9478407509, delta=1.0e-7) self.assertAlmostEqual(natocc[7], 1.0169668947, delta=1.0e-7) self.assertAlmostEqual(natocc[8], 1.0169668947, delta=1.0e-7) self.assertAlmostEqual(natocc[9], 0.0453923546, delta=1.0e-7) self.assertAlmostEqual(natocc[27], 0.0002225494, delta=1.0e-7)
def test_natorbs_fc(self): mol = self.mf.mol with DFUMP2(self.mf, frozen=2) as pt: natocc, natorb = pt.make_natorbs() # number of electrons conserved self.assertAlmostEqual(numpy.sum(natocc), mol.nelectron, delta=1.0e-10) # orbital orthogonal check_orth(self, mol, natorb) # selected values self.assertAlmostEqual(natocc[0], 1.9999987581, delta=1.0e-7) self.assertAlmostEqual(natocc[1], 1.9999987356, delta=1.0e-7) self.assertAlmostEqual(natocc[2], 1.9882629065, delta=1.0e-7) self.assertAlmostEqual(natocc[6], 1.9473585838, delta=1.0e-7) self.assertAlmostEqual(natocc[7], 1.0168965649, delta=1.0e-7) self.assertAlmostEqual(natocc[8], 1.0168965649, delta=1.0e-7) self.assertAlmostEqual(natocc[9], 0.0477790944, delta=1.0e-7) self.assertAlmostEqual(natocc[27], 0.0002307322, delta=1.0e-7)
def test_natorbs_relaxed_fc(self): mol = self.mf.mol with DFUMP2(self.mf, frozen=2) as pt: pt.cphf_tol = 1e-12 natocc, natorb = pt.make_natorbs(relaxed=True) # number of electrons conserved self.assertAlmostEqual(numpy.sum(natocc), mol.nelectron, delta=1.0e-10) # orbital orthogonal check_orth(self, mol, natorb) # selected values self.assertAlmostEqual(natocc[0], 2.0000050774, delta=1.0e-7) self.assertAlmostEqual(natocc[1], 2.0000042352, delta=1.0e-7) self.assertAlmostEqual(natocc[2], 1.9889171379, delta=1.0e-7) self.assertAlmostEqual(natocc[6], 1.9478689720, delta=1.0e-7) self.assertAlmostEqual(natocc[7], 1.0169674773, delta=1.0e-7) self.assertAlmostEqual(natocc[8], 1.0169674773, delta=1.0e-7) self.assertAlmostEqual(natocc[9], 0.0453427169, delta=1.0e-7) self.assertAlmostEqual(natocc[27], 0.0002207476, delta=1.0e-7)
def test_energy_fc(self): with DFUMP2(self.mf, frozen=2) as pt: pt.kernel() self.assertAlmostEqual(pt.e_corr, -0.343816318675, delta=1.0e-8) self.assertAlmostEqual(pt.e_tot, -149.834200533235, delta=1.0e-8)
def test_energy(self): with DFUMP2(self.mf) as pt: pt.kernel() self.assertAlmostEqual(pt.e_corr, -0.347887316046, delta=1.0e-8) self.assertAlmostEqual(pt.e_tot, -149.838271530605, delta=1.0e-8)