Example #1
0
def ROHF(mol, *args):
    if mol.nelectron == 1:
        if not mol.symmetry or mol.groupname == 'C1':
            return rohf.HF1e(mol)
        else:
            return hf_symm.HF1e(mol, *args)
    elif not mol.symmetry or mol.groupname == 'C1':
        return rohf.ROHF(mol, *args)
    else:
        return hf_symm.ROHF(mol, *args)
Example #2
0
def RHF(mol, *args):
    __doc__ = '''This is a wrap function to decide which SCF class to use, RHF or ROHF\n
    ''' + hf.RHF.__doc__
    if mol.nelectron == 1:
        if mol.symmetry:
            return rhf_symm.HF1e(mol)
        else:
            return rohf.HF1e(mol)
    elif not mol.symmetry or mol.groupname == 'C1':
        if mol.spin > 0:
            return rohf.ROHF(mol, *args)
        else:
            return rhf.RHF(mol, *args)
    else:
        if mol.spin > 0:
            return rhf_symm.ROHF(mol, *args)
        else:
            return rhf_symm.RHF(mol, *args)
Example #3
0
def get_atm_nrhf(mol, atomic_configuration=elements.NRSRHF_CONFIGURATION):
    atm_scf_result = {}

    atm_template = copy.copy(mol)
    atm_template.charge = 0
    atm_template.symmetry = False  # TODO: enable SO3 symmetry here
    atm_template.atom = atm_template._atom = []
    atm_template.cart = False  # AtomSphericAverageRHF does not support cartensian basis

    for ia, a in enumerate(mol._atom):
        element = a[0]
        if element in atm_scf_result:
            continue

        atm = atm_template
        atm._atom = [a]
        atm._atm = mol._atm[ia:ia + 1]
        atm._bas = mol._bas[mol._bas[:, 0] == ia].copy()
        atm._bas[:, 0] = 0  # Point to the only atom
        atm._ecpbas = mol._ecpbas[mol._ecpbas[:, 0] == ia]
        if element in mol._pseudo:
            atm._pseudo = {element: mol._pseudo.get(element)}
        atm.spin = atm.nelectron % 2

        nao = atm.nao
        # nao == 0 for the case that no basis was assigned to an atom
        if nao == 0 or atm.nelectron == 0:  # GHOST
            mo_occ = mo_energy = numpy.zeros(nao)
            mo_coeff = numpy.zeros((nao, nao))
            atm_scf_result[element] = (0, mo_energy, mo_coeff, mo_occ)
        else:
            if atm.nelectron == 1:
                atm_hf = rohf.HF1e(atm)
            else:
                atm_hf = AtomSphericAverageRHF(atm)
                atm_hf.atomic_configuration = atomic_configuration

            atm_hf.verbose = 4
            atm_hf.run()
            atm_scf_result[element] = (atm_hf.e_tot, atm_hf.mo_energy,
                                       atm_hf.mo_coeff, atm_hf.mo_occ)
    return atm_scf_result