Skip to content

Commit d24ae9b

Browse files
committed
examples: add lightweight H4 GASSCF example and relocate AlFe2O4+ comparison
1 parent 74441a0 commit d24ae9b

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

‎examples/mcscf/93_gasscf_h4.py‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
#
3+
# Author: Yi Deng <yideng@uchicago.edu>
4+
#
5+
6+
"""GASSCF orbital optimization for an H4 chain with a restricted GAS space."""
7+
8+
from pyscf import gto, scf
9+
from pyscf.mcscf import gasscf
10+
11+
12+
mol = gto.M(
13+
atom="; ".join("H 0 0 %.1f" % z for z in (0.0, 0.8, 1.8, 2.6)),
14+
basis="sto-3g",
15+
spin=0,
16+
verbose=0,
17+
)
18+
mf = scf.RHF(mol).run()
19+
20+
# The two active orbitals are split into two one-orbital GAS spaces. The
21+
# cumulative bounds enforce one electron after GAS1 and two electrons after
22+
# GAS2, equivalent to one electron in each GAS space.
23+
mc = gasscf.GASSCF(
24+
mf,
25+
ncas=2,
26+
nelecas=(1, 1),
27+
ncore=1,
28+
gas_orbs=(1, 1),
29+
gas_restr=((1, 1), (2, 2)),
30+
gas_restr_type="cumulative-occ",
31+
)
32+
mc.verbose = 4
33+
e_tot, e_gas, ci, mo, mo_energy = mc.kernel()
34+
35+
print("GASSCF total energy = %.12f" % e_tot)
36+
print("GASSCF active-space energy = %.12f" % e_gas)
37+
print("GASSCF converged = %s" % mc.converged)
38+
print("GAS determinant count = %d" % ci.size)
39+

examples/mcscf/93_gasscf_alfe2o4_plus_fix_spin.py renamed to examples/mcscf/gasscf_openmolcas/04_alfe2o4_plus_fix_spin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
target_s2 = 20.0 # S=4, multiplicity 9.
5757

5858
here = Path(__file__).resolve().parent
59-
data_file = here / "gasscf_openmolcas/data/alfe2o4_plus_mo.npz"
59+
data_file = here / "data/alfe2o4_plus_mo.npz"
6060

6161
with numpy.load(data_file, allow_pickle=False) as data:
6262
mol = gto.loads(data["mol"].item())

0 commit comments

Comments
 (0)