Ejemplo n.º 1
0
    def __init__(self, **kw):
        """ Constructor a self-consistent field """
        self.perform_scf = kw['perform_scf'] if 'perform_scf' in kw else False
        for x in ['xc_code', 'dealloc_hsx', 'dtype']:
            kw.pop(x, None)
        tddft_iter.__init__(self,
                            dtype=np.float64,
                            xc_code='RPA',
                            dealloc_hsx=False,
                            **kw)
        #print(__name__, ' dtype ', self.dtype)

        self.xc_code_kernel = copy(self.xc_code)
        self.xc_code = self.xc_code_mf
        self.dm_mf = self.make_rdm1(
        )  # necessary to get_hcore(...) in case of pp starting point
        self.hkernel_den = pack2den_l(self.kernel)
        if self.nspin == 1:
            self.pyscf_scf = hf.SCF(self)
        else:
            self.pyscf_scf = uhf.UHF(self)

        self.pyscf_scf.direct_scf = False  # overriding the attributes from hf.SCF ...
        self.pyscf_scf.get_hcore = self.get_hcore
        self.pyscf_scf.get_ovlp = self.get_ovlp
        self.pyscf_scf.get_j = self.get_j
        self.pyscf_scf.get_jk = self.get_jk
        self.pyscf_scf.energy_nuc = self.energy_nuc
        if self.perform_scf: self.kernel_scf(**kw)
Ejemplo n.º 2
0
def UHF(mol, *args):
    '''This is a wrap function to decide which UHF class to use.
    '''
    if mol.nelectron == 1:
        return RHF(mol)
    elif not mol.symmetry or mol.groupname is 'C1':
        return uhf.UHF(mol, *args)
    else:
        return uhf_symm.UHF(mol, *args)
Ejemplo n.º 3
0
def UHF(mol, *args):
    if mol.nelectron == 1:
        if not mol.symmetry or mol.groupname == 'C1':
            return uhf.HF1e(mol, *args)
        else:
            return uhf_symm.HF1e(mol, *args)
    elif not mol.symmetry or mol.groupname == 'C1':
        return uhf.UHF(mol, *args)
    else:
        return uhf_symm.UHF(mol, *args)
Ejemplo n.º 4
0
def UHF(mol, *args):
    __doc__ = '''This is a wrap function to decide which UHF class to use.\n
    ''' + uhf.UHF.__doc__
    if mol.nelectron == 1:
        if not mol.symmetry or mol.groupname == 'C1':
            return uhf.HF1e(mol, *args)
        else:
            return uhf_symm.HF1e(mol, *args)
    elif not mol.symmetry or mol.groupname == 'C1':
        return uhf.UHF(mol, *args)
    else:
        return uhf_symm.UHF(mol, *args)