Exemplo n.º 1
0
 def __init__(self, mol, xc='LDA,WVN', grids_level=None):
     self.mol = mol
     self.verbose = mol.verbose
     self.stdout = mol.stdout
     self.max_memory = mol.max_memory
     self._keys = set(())
     _dft_common_init_(self, xc=xc)
     if grids_level is not None: self.grids.level = grids_level
Exemplo n.º 2
0
 def __init__(self, mol):
     pyscf.scf.uhf_symm.UHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 3
0
Arquivo: uks.py Projeto: pulkin/pyscf
 def __init__(self, mol):
     uhf.UHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 4
0
 def __init__(self, mol):
     rohf.ROHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 5
0
 def __init__(self, mol):
     ghf.GHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 6
0
 def __init__(self, mol):
     ghf.GHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 7
0
 def __init__(self, mol):
     pyscf.scf.hf_symm.ROHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 8
0
    def __init__(self,
                 mol,
                 xc,
                 fod1,
                 fod2,
                 ldax=False,
                 grid_level=3,
                 calc_forces=False,
                 debug=False,
                 nuclei=None,
                 l_ij=None,
                 ods=None,
                 fixed_vsic=None,
                 num_iter=0,
                 ham_sic='HOOOV',
                 vsic_every=1,
                 init_dm=None):
        uhf.UHF.__init__(self, mol)
        rks._dft_common_init_(self)

        # Give the input variables to the SIC object.
        self.mol = mol  # Molecular geometry.
        self.xc = xc  # Exchange-correlation functional
        self.fod1 = fod1  # FOD geometry for first spin channel.
        self.fod2 = fod2  # FOD geometry for second spin channel.
        self.nfod = [fod1.positions.shape[0], fod2.positions.shape[0]]
        self.nuclei = nuclei
        self.ldax = ldax  # If True, LDA exchange is used for FLO-SIC (debugging mainly).
        self.is_first = True  # Used to determine which SCF cycle we are in.
        self.grid_level = grid_level  # Grid level.
        self.grids.level = grid_level
        self.grids.prune = None
        self.calc_forces = calc_forces  # Determines whether or not FOD forces are calculated in every step. Default: False.
        self.debug = debug  # enable debugging output
        self.l_ij = l_ij  # Lagrangian multiplier output
        self.lambda_ij = []  # # Lagrangian multiplier matrix
        self.ods = ods  # orbital density scaling

        # creation of an internal UKS object for handling FLO-SIC calculations.
        lib.logger.TIMER_LEVEL = 4
        mol.verbose = 0
        calc_uks = UKS(mol)
        calc_uks.xc = self.xc
        calc_uks.max_cycle = 0
        calc_uks.grids.level = grid_level
        calc_uks.grids.prune = None

        # if an initial density matrix is given
        # initialize the subclass with it
        if init_dm is not None:
            calc_uks.kernel(init_dm)
        else:
            calc_uks.kernel()
        self.calc_uks = calc_uks

        # initialize var to store the FLO's
        self.calc_uks.flo_coeff = None
        self.calc_uks.flo_last = None
        self.on = None
        self.calc_uks.on = self.on

        # add a explicite reference to the FLOSIC class
        # to the helper class to make instances of FLOSIC
        # always accessible via calc_uks
        # (helps simplifying code)
        self.calc_uks.FLOSIC = self

        ## Tha added variables to ensure O(N)
        # and in-scf fod optimization functionality
        self.preopt = False
        self.preopt_start_cycle = 0
        self.preopt_conv_tol = 2e-5
        self.preopt_fmin = 0.005
        self.preopt_fix1s = True
        self.opt_init_mxstep = 0.0050
        self.opt_mxstep = 0.0100

        #self.esic_per_cycle = [0.0]
        self.pflo = None  # list of FLO objects
        self.cesicc = None  # list of ESICC objects

        ## /THa

        # Parameters to coordinate FLO-SIC output.
        dim = np.shape(self.calc_uks.mo_coeff)  # Dimensions of FLO-SIC.
        dim1 = np.shape(fod1)
        dim2 = np.shape(fod2)
        # set nspin class var (its just handy)
        self.nspin = 2
        if dim2 == 0: self.nspin = 1

        self.flo = np.zeros((2, dim[1], dim[1]),
                            dtype=np.float64)  # Will hold the FLOs.
        self.fforces = np.zeros((dim1[0] + dim2[0], 3),
                                dtype=np.float64)  # Will hold the FOD forces.
        if fixed_vsic is None:
            self.fixed_vsic = None
        if fixed_vsic is not None:
            self.fixed_vsic = fixed_vsic

        ## SS
        # print('fixed_vsic', fixed_vsic)
        #sys.exit()
        self.homo_flosic = 0.0  # Will hold the FLO-SIC H**O value.
        self.esic = 0.0  # Will hold the total energy correction.
        self.exc = 0.0  # Will hold the FLO-SIC exchange-correlation energy.
        self.evalues = 0.0  # Will hold the FLO-SIC evalues.
        self.AF = 0.0
        self.num_iter = num_iter  # Number of iteration
        self.vsic_every = vsic_every  # Calculate the vsic after e.g 50 cycles
        self.ham_sic = ham_sic  # SIC hamiltonian
        # This is needed that the PySCF mother class get familiar with all new variables.
        self._keys = self._keys.union([
            'grid_level', 'fod1', 'homo_flosic', 'exc', 'evalues', 'calc_uks',
            'esic', 'flo', 'fforces', 'fod2', 'ldax', 'calc_forces',
            'is_first', 'debug', 'nuclei', 'AF', 'l_ij', 'ods', 'lambda_ij',
            'num_iter', 'vsic_every', 'fixed_vsic', 'ham_sic', 'preopt_fix1s',
            'cesicc', 'nspin', 'opt_mxstep', 'preopt', 'opt_init_mxstep',
            'pflo', 'preopt_start_cycle', 'preopt_conv_tol', 'on',
            'preopt_fmin', 'nfod', 'use_mpi'
        ])

        # make sure initial mo_coeff's are in synch with the
        # helper - subclass
        self.mo_coeff = np.asarray(calc_uks.mo_coeff)

        # this is for basic mpi support
        self.use_mpi = False
        if mpi is not None:
            wsize = MPI.COMM_WORLD.Get_size()
            #print(">>> WSIZE {}".format(wsize))
            #sys.exit()
            if wsize > 1: self.use_mpi = True
Exemplo n.º 9
0
 def __init__(self, mol):
     uhf_symm.UHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 10
0
Arquivo: x2c.py Projeto: swillow/pyscf
 def __init__(self, mol):
     X2C_UHF.__init__(self, mol)
     rks._dft_common_init_(self)
     self._numint = r_numint.RNumInt()
Exemplo n.º 11
0
 def __init__(self, mol):
     pyscf.scf.rohf.ROHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 12
0
 def __init__(self, mol):
     hf_symm.ROHF.__init__(self, mol)
     rks._dft_common_init_(self)
Exemplo n.º 13
0
 def __init__(self, mol):
     dhf.UHF.__init__(self, mol)
     rks._dft_common_init_(self)
     self._numint = r_numint.RNumInt()
Exemplo n.º 14
0
 def __init__(self, mol):
     pyscf.scf.uhf.UHF.__init__(self, mol)
     rks._dft_common_init_(self)