From 5d2eb957cc7e401b2810e2aba22816110c7f641e Mon Sep 17 00:00:00 2001 From: Matthew R Hermes Date: Tue, 30 Jul 2024 17:36:14 -0500 Subject: [PATCH] partial forward-comp pyscf #2342; pyscf-forge #57 Still need to figure out how to deal with laspdft chkfile, after pyscf-forge #57 is fixed --- tests/fci/test_sanmix_casscf.py | 41 ++++++++++++++------------- tests/mcpdft/test_grad_mcpdft_dupe.py | 4 +-- tests/mcpdft/test_mcpdft_dupe.py | 4 +-- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/tests/fci/test_sanmix_casscf.py b/tests/fci/test_sanmix_casscf.py index 2b766cc5..6a05dcd9 100644 --- a/tests/fci/test_sanmix_casscf.py +++ b/tests/fci/test_sanmix_casscf.py @@ -4,25 +4,28 @@ from mrh.my_pyscf.fci import csf_solver from mrh.my_pyscf.mcscf.addons import state_average_n_mix -mol = gto.M (atom = 'O 0 0 0; H 1.145 0 0', basis='6-31g', symmetry=True, charge=-1, spin=0, verbose=0, output='/dev/null') -mf = scf.RHF (mol).set (conv_tol=1e-10).run () -mc = mcscf.CASSCF (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' - -mc = state_average_n_mix (mc, [anion, rad1, rad2], [1.0/3.0,]*3) -mc.kernel () +def setUpModule(): + global mol, mf, mc, anion, rad1, rad2 + mol = gto.M (atom = 'O 0 0 0; H 1.145 0 0', basis='6-31g', symmetry=True, charge=-1, spin=0, verbose=0, output='/dev/null') + mf = scf.RHF (mol).set (conv_tol=1e-10).run () + mc = mcscf.CASSCF (mf, 8, 8).set (conv_tol=1e-10).run () + mc.ci = None + + 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' + + mc = state_average_n_mix (mc, [anion, rad1, rad2], [1.0/3.0,]*3) + mc.kernel () def tearDownModule(): global mol, mf, mc, anion, rad1, rad2 diff --git a/tests/mcpdft/test_grad_mcpdft_dupe.py b/tests/mcpdft/test_grad_mcpdft_dupe.py index f5a481f1..95b741b3 100644 --- a/tests/mcpdft/test_grad_mcpdft_dupe.py +++ b/tests/mcpdft/test_grad_mcpdft_dupe.py @@ -40,12 +40,12 @@ def auto_setup (xyz='Li 0 0 0\nH 1.5 0 0'): solver_S = fci.solver (mol_nosym, singlet=True).set (spin=0, nroots=2) solver_T = fci.solver (mol_nosym, singlet=False).set (spin=2, nroots=3) mcp_sa_1 = mcp_ss_nosym.state_average_mix ( - [solver_S,solver_T], [1.0/5,]*5).run () + [solver_S,solver_T], [1.0/5,]*5).set (ci=None).run () solver_A1 = fci.solver (mol_sym).set (wfnsym='A1', nroots=3) solver_E1x = fci.solver (mol_sym).set (wfnsym='E1x', nroots=1, spin=2) solver_E1y = fci.solver (mol_sym).set (wfnsym='E1y', nroots=1, spin=2) mcp_sa_2 = mcp_ss_sym.state_average_mix ( - [solver_A1,solver_E1x,solver_E1y], [1.0/5,]*5).run () + [solver_A1,solver_E1x,solver_E1y], [1.0/5,]*5).set (ci=None).run () mcp = [[mcp_ss_nosym, mcp_ss_sym], [mcp_sa_0, mcp_sa_1, mcp_sa_2]] nosym = [mol_nosym, mf_nosym, mc_nosym] sym = [mol_sym, mf_sym, mc_sym] diff --git a/tests/mcpdft/test_mcpdft_dupe.py b/tests/mcpdft/test_mcpdft_dupe.py index da025528..07857aa5 100644 --- a/tests/mcpdft/test_mcpdft_dupe.py +++ b/tests/mcpdft/test_mcpdft_dupe.py @@ -37,12 +37,12 @@ def auto_setup (xyz='Li 0 0 0\nH 1.5 0 0', fnal='tPBE'): solver_S = fci.solver (mol_nosym, singlet=True).set (spin=0, nroots=2) solver_T = fci.solver (mol_nosym, singlet=False).set (spin=2, nroots=3) mcp_sa_1 = mcp_ss_nosym.state_average_mix ( - [solver_S,solver_T], [1.0/5,]*5).run (conv_tol=1e-8) + [solver_S,solver_T], [1.0/5,]*5).set (ci=None).run (conv_tol=1e-8) solver_A1 = fci.solver (mol_sym).set (wfnsym='A1', nroots=3) solver_E1x = fci.solver (mol_sym).set (wfnsym='E1x', nroots=1, spin=2) solver_E1y = fci.solver (mol_sym).set (wfnsym='E1y', nroots=1, spin=2) mcp_sa_2 = mcp_ss_sym.state_average_mix ( - [solver_A1,solver_E1x,solver_E1y], [1.0/5,]*5).run (conv_tol=1e-8) + [solver_A1,solver_E1x,solver_E1y], [1.0/5,]*5).set (ci=None).run (conv_tol=1e-8) mcp = [[mcp_ss_nosym, mcp_ss_sym], [mcp_sa_0, mcp_sa_1, mcp_sa_2]] nosym = [mol_nosym, mf_nosym, mc_nosym] sym = [mol_sym, mf_sym, mc_sym]