Exemplo n.º 1
0
    # Load or generate active orbital guess
    # --------------------------------------------------------------------------------------------------------------------
    c2h4n4_dmet = dmet(myInts, fraglist, **my_kwargs)
    c2h4n4_dmet.generate_frag_cas_guess(mf.mo_coeff,
                                        caslst=CASlist,
                                        force_imp=active_first,
                                        confine_guess=(not active_first))

    # Calculation
    # --------------------------------------------------------------------------------------------------------------------
    return c2h4n4_dmet


dr_nn = 3.0
mol = struct(dr_nn, dr_nn, '6-31g', symmetry=False)
mol.verbose = lib.logger.DEBUG
mol.output = '/dev/null'
mol.spin = 8
mol.build()
mf = scf.RHF(mol).run()
dmet = build(mf, 1, -1, active_first=True)
dmet.conv_tol_grad = 1e-6
e_tot = dmet.doselfconsistent()


def tearDownModule():
    global mol, mf, dmet
    mol.stdout.close()
    dmet.lasci_log.close()
    del mol, mf, dmet
Exemplo n.º 2
0
from pyscf import gto, scf, lib, df
from c2h4n4_struct import structure as struct
from mrh.my_pyscf.mcscf.lasscf_o0 import LASSCF

lib.logger.TIMER_LEVEL = lib.logger.INFO
mol = struct(3.0, 3.0, 'cc-pvtz', symmetry=False)
mol.verbose = lib.logger.INFO
mol.output = 'debug_tz_df_o0.log'
mol.build()
my_aux = df.aug_etb(mol)
mf = scf.RHF(mol).density_fit(auxbasis=my_aux).run()

# 1. Diamagnetic singlet
''' The constructor arguments are
    1) SCF object
    2) List or tuple of ncas for each fragment
    3) List or tuple of nelec for each fragment
    A list or tuple of total-spin multiplicity is supplied
    in "spin_sub".'''
las = LASSCF(mf, (4, 4), (4, 4), spin_sub=(1, 1))
''' The class doesn't know anything about "fragments" at all.
    The active space is only "localized" provided one offers an
    initial guess for the active orbitals that is localized.
    That is the purpose of the localize_init_guess function.
    It requires a sequence of sequence of atom numbers, and it
    projects the orbitals in the ncore:nocc columns into the
    space of those atoms' AOs. The orbitals in the range
    ncore:ncore+ncas_sub[0] are the first active subspace,
    those in the range ncore+ncas_sub[0]:ncore+sum(ncas_sub[:2])
    are the second active subspace, and so on.'''
frag_atom_list = (list(range(3)), list(range(7, 10)))
Exemplo n.º 3
0
import numpy as np
from scipy import linalg
from pyscf import gto, scf, lib, mcscf
from pyscf.tools import molden
from mrh.my_pyscf.fci import csf_solver
from mrh.my_pyscf.mcscf.lasscf_o0 import LASSCF
from mrh.my_pyscf.mcscf import lassi
from c2h4n4_struct import structure as struct

mol = struct (3.0, 3.0, '6-31g')
mol.symmetry = 'Cs'
mol.output = 'c2h4n4_631g.log'
mol.verbose = lib.logger.INFO
mol.build ()
mf = scf.RHF (mol).run ()

# SA-LASSCF object
# The first positional argument of "state_average" is the orbital weighting function
# Note that there are four states and two fragments and the weights sum to 1
# "Spins" is neleca - nelecb (= 2m for the sake of being an integer)
# "Smults" is the desired local spin quantum *MULTIPLICITY* (2s+1)
# "Wfnsyms" can also be the names of the irreps but I got lazy
# "Charges" modifies the number of electrons in ncas_sub (third argument of LASSCF constructor)
#   For fragment i in state j:
#       neleca = (sum(las.ncas_sub[i]) - charges[j][i] + spins[j][i]) / 2
#       nelecb = (sum(las.ncas_sub[i]) - charges[j][i] - spins[j][i]) / 2
# If your molecule doesn't have point-group symmetry turned on then don't pass "wfnsyms"
las = LASSCF (mf, (5,5), ((3,2),(2,3)))
las = las.state_average ([0.5,0.5,0.0,0.0],
    spins=[[1,-1],[-1,1],[0,0],[0,0]],
    smults=[[2,2],[2,2],[1,1],[1,1]],    
Exemplo n.º 4
0
    # --------------------------------------------------------------------------------------------------------------------
    c2h4n4_dmet = dmet(myInts, fraglist, **my_kwargs)
    c2h4n4_dmet.generate_frag_cas_guess(mf.mo_coeff,
                                        caslst=CASlist,
                                        force_imp=active_first,
                                        confine_guess=(not active_first))

    # Calculation
    # --------------------------------------------------------------------------------------------------------------------
    e = c2h4n4_dmet.doselfconsistent()
    c2h4n4_dmet.lasci_log.close()
    return e


dr_nn = 3.0
mol = struct(dr_nn, dr_nn, '6-31g', symmetry='Cs')
mol.verbose = lib.logger.DEBUG
mol.output = '/dev/null'
mol.build()
mf = scf.RHF(mol).run()
mf_df = mf.density_fit(auxbasis=df.aug_etb(mol)).run()


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


class KnownValues(unittest.TestCase):
    def test_symm(self):
Exemplo n.º 5
0
from pyscf import gto, scf, lib
from c2h4n4_struct import structure as struct
from mrh.my_pyscf.mcscf.lasscf_testing import LASSCF

mol = struct(3.0, 3.0, '6-31g', symmetry=False)
mol.verbose = lib.logger.INFO
mol.output = 'c2h4n4_spin.log'
mol.build()
mf = scf.RHF(mol).run()

# 1. Diamagnetic singlet
''' The constructor arguments are
    1) SCF object
    2) List or tuple of ncas for each fragment
    3) List or tuple of nelec for each fragment
    A list or tuple of total-spin multiplicity is supplied
    in "spin_sub".'''
las = LASSCF(mf, (4, 4), (4, 4), spin_sub=(1, 1))
''' The class doesn't know anything about "fragments" at all.
    The active space is only "localized" provided one offers an
    initial guess for the active orbitals that is localized.
    That is the purpose of the localize_init_guess function.
    It requires a sequence of sequence of atom numbers, and it
    projects the orbitals in the ncore:nocc columns into the
    space of those atoms' AOs. The orbitals in the range
    ncore:ncore+ncas_sub[0] are the first active subspace,
    those in the range ncore+ncas_sub[0]:ncore+sum(ncas_sub[:2])
    are the second active subspace, and so on.'''
frag_atom_list = (list(range(3)), list(range(7, 10)))
mo_coeff = las.localize_init_guess(frag_atom_list, mf.mo_coeff)
''' Right now, this function can only (roughly) reproduce the