Beispiel #1
0
mol.spin = 0 
mol.build ()
mf = scf.RHF (mol).run ()
las = LASSCF (mf, (4,2,4), (4,2,4))
las.state_average_(weights=weights, **states)
las.mo_coeff = las.localize_init_guess ((list (range (3)),
    list (range (3,7)), list (range (7,10))), mf.mo_coeff)
las.ci = get_init_guess_ci (las, las.mo_coeff, las.get_h2eff (las.mo_coeff))
np.random.seed (1)
for c in las.ci:
    for iroot in range (len (c)):
        c[iroot] = np.random.rand (*c[iroot].shape)
        c[iroot] /= linalg.norm (c[iroot])
orbsym = getattr (las.mo_coeff, 'orbsym', None)
if orbsym is None and callable (getattr (las, 'label_symmetry_', None)):
    orbsym = las.label_symmetry_(las.mo_coeff).orbsym
if orbsym is not None:
    orbsym = orbsym[las.ncore:las.ncore+las.ncas]
wfnsym = 0
idx_all = np.ones (nroots, dtype=np.bool_)
rand_mat = np.random.rand (57,57)
rand_mat += rand_mat.T
e, si = linalg.eigh (rand_mat)

def tearDownModule():
    global mol, mf, las
    mol.stdout.close ()
    del mol, mf, las

class KnownValues(unittest.TestCase):
    def test_stdm12s (self):
Beispiel #2
0
dr_nn = 2.0
mol = struct (dr_nn, dr_nn, '6-31g', symmetry='Cs')
mol.verbose = lib.logger.DEBUG 
mol.output = 'test_lassi_symm.log'
mol.spin = 0 
mol.symmetry = 'Cs'
mol.build ()
mf = scf.RHF (mol).run ()
las = LASSCF (mf, (4,4), (4,4), spin_sub=(1,1))
las.state_average_(weights=[1.0/7.0,]*7,
    spins=[[0,0],[0,0],[2,-2],[-2,2],[0,0],[0,0],[2,2]],
    smults=[[1,1],[3,3],[3,3],[3,3],[1,1],[1,1],[3,3]],
    wfnsyms=[['A\'','A\''],]*4+[['A"','A\''],['A\'','A"'],['A\'','A\'']])
las.frozen = list (range (las.mo_coeff.shape[-1]))
ugg = las.get_ugg ()
las.mo_coeff = las.label_symmetry_(np.loadtxt ('test_lassi_symm_mo.dat'))
las.ci = ugg.unpack (np.loadtxt ('test_lassi_symm_ci.dat'))[1]
#las.set (conv_tol_grad=1e-8).run ()
las.e_states = las.energy_nuc () + las.states_energy_elec ()
e_roots, si = las.lassi ()
rdm1s, rdm2s = roots_make_rdm12s (las, las.ci, si)

def tearDownModule():
    global mol, mf, las
    mol.stdout.close ()
    del mol, mf, las

class KnownValues(unittest.TestCase):
    def test_evals (self):
        self.assertAlmostEqual (lib.fp (e_roots), -213.84185089228347, 6)