Skip to content

Commit

Permalink
partial forward-comp pyscf #2342; pyscf-forge #57
Browse files Browse the repository at this point in the history
Still need to figure out how to deal with laspdft chkfile, after
pyscf-forge #57 is fixed
  • Loading branch information
MatthewRHermes committed Jul 30, 2024
1 parent 6739154 commit 5d2eb95
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
41 changes: 22 additions & 19 deletions tests/fci/test_sanmix_casscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/mcpdft/test_grad_mcpdft_dupe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tests/mcpdft/test_mcpdft_dupe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 5d2eb95

Please sign in to comment.