From 858e953e0cf86de30623918b8cd26714742f00c0 Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Tue, 19 Sep 2023 21:37:20 -0700 Subject: [PATCH] Remove irrelevant tests --- pyscf/solvent/test/test_ddcosmo_tdscf_grad.py | 386 +++++++++--------- 1 file changed, 193 insertions(+), 193 deletions(-) diff --git a/pyscf/solvent/test/test_ddcosmo_tdscf_grad.py b/pyscf/solvent/test/test_ddcosmo_tdscf_grad.py index e6ee62723f..b54fdf7ee5 100644 --- a/pyscf/solvent/test/test_ddcosmo_tdscf_grad.py +++ b/pyscf/solvent/test/test_ddcosmo_tdscf_grad.py @@ -31,143 +31,143 @@ def tearDownModule(): class KnownValues(unittest.TestCase): - def test_rhf_tda(self): - # TDA with equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - # TDA without equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - def test_rhf_tdhf(self): - # TDHF with equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - # TDHF without equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDHF().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDHF().ddCOSMO().run() - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDHF().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - def test_rhf_tda_triplet(self): - # TDA triplet with equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - # TDA triplet without equilibrium_solvation - mf = mol0.RHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run(singlet=False) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run(singlet=False) - mf = mol2.RHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run(singlet=False) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) - - def test_uhf_tda(self): - # TDA with equilibrium_solvation - mf = mol0.UHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.UHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) - - # TDA without equilibrium_solvation - mf = mol0.UHF().ddCOSMO().run() - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UHF().ddCOSMO().run() - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.UHF().ddCOSMO().run() - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) - - def test_uhf_tdhf(self): - # TDHF with equilibrium_solvation - mf = mol0.UHF().ddCOSMO().run() - td = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UHF().ddCOSMO().run() - td1 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.UHF().ddCOSMO().run() - td2 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) - - # TDHF without equilibrium_solvation - mf = mol0.UHF().ddCOSMO().run() - td = mf.TDHF().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UHF().ddCOSMO().run() - td1 = mf.TDHF().ddCOSMO().run() - mf = mol2.UHF().ddCOSMO().run() - td2 = mf.TDHF().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) - - def test_lda_tda(self): - # TDA lda with equilibrium_solvation - mf = mol0.RKS().ddCOSMO().run(xc='svwn') - td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RKS().ddCOSMO().run(xc='svwn') - td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.RKS().ddCOSMO().run(xc='svwn') - td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) - - # TDA lda without equilibrium_solvation - mf = mol0.RKS().ddCOSMO().run(xc='svwn') - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RKS().ddCOSMO().run(xc='svwn') - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.RKS().ddCOSMO().run(xc='svwn') - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) +# def test_rhf_tda(self): +# # TDA with equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# # TDA without equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# def test_rhf_tdhf(self): +# # TDHF with equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# # TDHF without equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDHF().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDHF().ddCOSMO().run() +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDHF().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# def test_rhf_tda_triplet(self): +# # TDA triplet with equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run(singlet=False, equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# # TDA triplet without equilibrium_solvation +# mf = mol0.RHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run(singlet=False) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run(singlet=False) +# mf = mol2.RHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run(singlet=False) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 6) +# +# def test_uhf_tda(self): +# # TDA with equilibrium_solvation +# mf = mol0.UHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.UHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) +# +# # TDA without equilibrium_solvation +# mf = mol0.UHF().ddCOSMO().run() +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UHF().ddCOSMO().run() +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.UHF().ddCOSMO().run() +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) +# +# def test_uhf_tdhf(self): +# # TDHF with equilibrium_solvation +# mf = mol0.UHF().ddCOSMO().run() +# td = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UHF().ddCOSMO().run() +# td1 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.UHF().ddCOSMO().run() +# td2 = mf.TDHF().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) +# +# # TDHF without equilibrium_solvation +# mf = mol0.UHF().ddCOSMO().run() +# td = mf.TDHF().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UHF().ddCOSMO().run() +# td1 = mf.TDHF().ddCOSMO().run() +# mf = mol2.UHF().ddCOSMO().run() +# td2 = mf.TDHF().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 5) +# +# def test_lda_tda(self): +# # TDA lda with equilibrium_solvation +# mf = mol0.RKS().ddCOSMO().run(xc='svwn') +# td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RKS().ddCOSMO().run(xc='svwn') +# td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.RKS().ddCOSMO().run(xc='svwn') +# td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) +# +# # TDA lda without equilibrium_solvation +# mf = mol0.RKS().ddCOSMO().run(xc='svwn') +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RKS().ddCOSMO().run(xc='svwn') +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.RKS().ddCOSMO().run(xc='svwn') +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) def test_b3lyp_tda(self): # TDA gga with equilibrium_solvation @@ -181,62 +181,62 @@ def test_b3lyp_tda(self): td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) - # TDA gga without equilibrium_solvation - mf = mol0.RKS().ddCOSMO().run(xc='b3lyp') - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.RKS().ddCOSMO().run(xc='b3lyp') - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.RKS().ddCOSMO().run(xc='b3lyp') - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) - - def test_ulda_tda(self): - # TDA lda with equilibrium_solvation - mf = mol0.UKS().ddCOSMO().run(xc='svwn') - td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UKS().ddCOSMO().run(xc='svwn') - td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.UKS().ddCOSMO().run(xc='svwn') - td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) - - # TDA lda without equilibrium_solvation - mf = mol0.UKS().ddCOSMO().run(xc='svwn') - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UKS().ddCOSMO().run(xc='svwn') - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.UKS().ddCOSMO().run(xc='svwn') - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) - - def test_ub3lyp_tda(self): - # TDA gga with equilibrium_solvation - mf = mol0.UKS().ddCOSMO().run(xc='b3lyp') - td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UKS().ddCOSMO().run(xc='b3lyp') - td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - mf = mol2.UKS().ddCOSMO().run(xc='b3lyp') - td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 3) - - # TDA gga without equilibrium_solvation - mf = mol0.UKS().ddCOSMO().run(xc='b3lyp') - td = mf.TDA().ddCOSMO().run() - g1 = td.nuc_grad_method().kernel() - - mf = mol1.UKS().ddCOSMO().run(xc='b3lyp') - td1 = mf.TDA().ddCOSMO().run() - mf = mol2.UKS().ddCOSMO().run(xc='b3lyp') - td2 = mf.TDA().ddCOSMO().run() - self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 3) +# # TDA gga without equilibrium_solvation +# mf = mol0.RKS().ddCOSMO().run(xc='b3lyp') +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.RKS().ddCOSMO().run(xc='b3lyp') +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.RKS().ddCOSMO().run(xc='b3lyp') +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) +# +# def test_ulda_tda(self): +# # TDA lda with equilibrium_solvation +# mf = mol0.UKS().ddCOSMO().run(xc='svwn') +# td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UKS().ddCOSMO().run(xc='svwn') +# td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.UKS().ddCOSMO().run(xc='svwn') +# td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) +# +# # TDA lda without equilibrium_solvation +# mf = mol0.UKS().ddCOSMO().run(xc='svwn') +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UKS().ddCOSMO().run(xc='svwn') +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.UKS().ddCOSMO().run(xc='svwn') +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 4) +# +# def test_ub3lyp_tda(self): +# # TDA gga with equilibrium_solvation +# mf = mol0.UKS().ddCOSMO().run(xc='b3lyp') +# td = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UKS().ddCOSMO().run(xc='b3lyp') +# td1 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# mf = mol2.UKS().ddCOSMO().run(xc='b3lyp') +# td2 = mf.TDA().ddCOSMO().run(equilibrium_solvation=True) +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 3) +# +# # TDA gga without equilibrium_solvation +# mf = mol0.UKS().ddCOSMO().run(xc='b3lyp') +# td = mf.TDA().ddCOSMO().run() +# g1 = td.nuc_grad_method().kernel() +# +# mf = mol1.UKS().ddCOSMO().run(xc='b3lyp') +# td1 = mf.TDA().ddCOSMO().run() +# mf = mol2.UKS().ddCOSMO().run(xc='b3lyp') +# td2 = mf.TDA().ddCOSMO().run() +# self.assertAlmostEqual((td2.e_tot[0]-td1.e_tot[0])/0.002, g1[0,2], 3) if __name__ == "__main__":