Esempio n. 1
0
import numpy as np
from pyscf import gto, scf, tools
from c2h6n4_struct import structure as struct
from mrh.my_pyscf.mcscf.lasscf_testing import LASSCF

rnn0 = 1.23681571
mol = struct(3.0, 3.0, '6-31g', symmetry=False)
mf = scf.RHF(mol).run()
las = LASSCF(mf, (4, 4), (4, 4), spin_sub=(1, 1))
frag_atom_list = (list(range(3)), list(range(9, 12)))
mo0 = las.localize_init_guess(frag_atom_list)
las.kernel(mo0)
las_scanner = las.as_scanner()

pes = np.loadtxt('c2h6n4_pes_old.dat')[:34, :]
pes = np.hstack((pes, np.zeros((34, 1))))
pes[33, 3] = las.e_tot

# ISN'T THIS SO MUCH BETTER RIDDHISH?????
for ix, dr_nn in enumerate(np.arange(2.9, -0.301, -0.1)):
    mol1 = struct(dr_nn, dr_nn, '6-31g', symmetry=False)
    pes[32 - ix, 3] = las_scanner(mol1)

print("  r_NN  {:>11s}  {:>13s}  {:>13s}".format("CASSCF", "vLASSCF(v1)",
                                                 "vLASSCF(test)"))
for row in pes:
    print(" {:5.3f}  {:11.6f}  {:13.8f}  {:13.8f}".format(*row))
Esempio n. 2
0
print("\nSurely I can type si = si * 1 without any consequences")
si = si * 1
try:
    print("<S**2>:", si.s2)
except AttributeError as e:
    print(
        "Oh no! <S**2> disappeared and all I have now is this error message:")
    print("AttributeError:", str(e))
try:
    roots_casdm1s, roots_casdm2s = lassi.roots_make_rdm12s(las, las.ci, si)
except AttributeError as e:
    print("Oh no! I can't make rdms anymore either because:")
    print("AttributeError:", str(e))
print("(Yes, dear user, I will have to make this less stupid in future)")

# Remember that LASSI is a post-hoc diagonalization step if you want to do a
# potential energy scan
las = las.as_scanner()
new_mol = struct(2.9, 2.9, '6-31g', symmetry='Cs')
new_mol.symmetry = 'Cs'
new_mol.build()
print("\n\nPotential energy scan to dr = 2.9 Angs")
e = las(new_mol)
print(e, "<- this is just the state-average energy!")
print(("(Which happens to be identical to the first two LAS state energies\n"
       "because I chose a bad example, but shhhh)"))
print("You need to interrogate the LAS object to get the interesting parts!")
print("New E_LASSCF:", las.e_states)
e_roots, si = las.lassi()
print("New E_LASSI:", e_roots)