Пример #1
0
 def test_orth_ao(self):
     c0 = orth.pre_orth_ao(mol, method='scf')
     self.assertAlmostEqual(abs(c0).sum(), 33.48215772351, 8)
     c = orth.orth_ao(mol, 'lowdin', c0)
     self.assertAlmostEqual(abs(c).sum(), 94.21571091299639, 8)
     c = orth.orth_ao(mol, 'meta_lowdin', c0)
     self.assertAlmostEqual(abs(c).sum(), 92.15697348744733, 8)
Пример #2
0
 def test_pre_orth_ao_with_ecp(self):
     mol = gto.M(atom='Cu 0. 0. 0.; H  0.  0. -1.56; H  0.  0.  1.56',
                 basis={'Cu':'lanl2dz', 'H':'ccpvdz'},
                 ecp = {'cu':'lanl2dz'},
                 charge=-1,
                 verbose=0)
     c0 = orth.pre_orth_ao(mol, method='ano')
     self.assertAlmostEqual(numpy.linalg.norm(c0), 5.9621174285790959, 9)
Пример #3
0
 def test_pre_orth_ao_with_ecp(self):
     mol = gto.M(atom='Cu 0. 0. 0.; H  0.  0. -1.56; H  0.  0.  1.56',
                 basis={'Cu':'lanl2dz', 'H':'ccpvdz'},
                 ecp = {'cu':'lanl2dz'},
                 charge=-1,
                 verbose=0)
     c0 = orth.pre_orth_ao(mol, method='ano')
     self.assertAlmostEqual(numpy.linalg.norm(c0), 5.9621174285790959, 9)
Пример #4
0
 def test_orth_ao(self):
     c0 = orth.pre_orth_ao(mol, method='scf')
     self.assertAlmostEqual(numpy.linalg.norm(c0), 7.2617698799320358, 9)
     self.assertAlmostEqual(abs(c0).sum(), 40.116080631662804, 8)
     c = orth.orth_ao(mol, 'lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 10.967144073462256, 9)
     self.assertAlmostEqual(abs(c).sum(), 112.23459140302003, 8)
     c = orth.orth_ao(mol, 'meta_lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 10.967144073462256, 9)
     self.assertAlmostEqual(abs(c).sum(), 111.61017124719302, 8)
Пример #5
0
 def test_orth_ao(self):
     c0 = orth.pre_orth_ao(mol, method='scf')
     self.assertAlmostEqual(numpy.linalg.norm(c0), 5.7742626195362039, 9)
     self.assertAlmostEqual(abs(c0).sum(), 33.461490657433551, 8)
     c = orth.orth_ao(mol, 'lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 8.9823854843222257, 9)
     self.assertAlmostEqual(abs(c).sum(), 94.933979307106767, 8)
     c = orth.orth_ao(mol, 'meta_lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 8.9823854843222257, 9)
     self.assertAlmostEqual(abs(c).sum(), 93.029386338534394, 8)
Пример #6
0
 def test_orth_ao(self):
     c0 = orth.pre_orth_ao(mol, method='scf')
     self.assertAlmostEqual(numpy.linalg.norm(c0), 5.7742626195362039, 9)
     self.assertAlmostEqual(abs(c0).sum(), 33.461490657433551, 8)
     c = orth.orth_ao(mol, 'lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 8.9823854843222257, 9)
     self.assertAlmostEqual(abs(c).sum(), 94.933979307106767, 8)
     c = orth.orth_ao(mol, 'meta_lowdin', c0)
     self.assertAlmostEqual(numpy.linalg.norm(c), 8.9823854843222257, 9)
     self.assertAlmostEqual(abs(c).sum(), 93.029386338534394, 8)
Пример #7
0
    def test_orth_ao(self):
        c0 = orth.pre_orth_ao(mol, method='scf')
        self.assertAlmostEqual(abs(c0).sum(), 33.48215772351, 8)
        c = orth.orth_ao(mol, 'lowdin', c0)
        self.assertAlmostEqual(abs(c).sum(), 94.21571091299639, 8)
        c = orth.orth_ao(mol, 'meta_lowdin', c0)
        self.assertAlmostEqual(abs(c).sum(), 92.15697348744733, 8)

        c = orth.orth_ao(mol, 'meta_lowdin', 'sto-3g')
        self.assertAlmostEqual(abs(c).sum(), 90.12324660084619, 8)

        c = orth.orth_ao(mol, 'meta_lowdin', None)
        self.assertAlmostEqual(abs(c).sum(), 83.71349158130113, 8)
Пример #8
0
def mulliken_pop_meta_lowdin_ao(mol, dm_ao, verbose=logger.DEBUG,
                                pre_orth_method='ANO'):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    '''
    from pyscf.lo import orth
    if isinstance(verbose, logger.Logger):
        log = verbose
    else:
        log = logger.Logger(mol.stdout, verbose)
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c)
    c_inv = numpy.linalg.inv(orth_coeff)
    dm_a = reduce(numpy.dot, (c_inv, dm_ao[0], c_inv.T.conj()))
    dm_b = reduce(numpy.dot, (c_inv, dm_ao[1], c_inv.T.conj()))

    log.info(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
    return mulliken_pop(mol, (dm_a,dm_b), numpy.eye(orth_coeff.shape[0]), log)
Пример #9
0
Файл: hf.py Проект: pulkin/pyscf
def mulliken_meta(mol,
                  dm,
                  verbose=logger.DEBUG,
                  pre_orth_method='ANO',
                  s=None):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    In the meta-lowdin, the AOs are grouped in three sets: core, valence and
    Rydberg, the orthogonalization are carreid out within each subsets.

    Args:
        mol : an instance of :class:`Mole`

        dm : ndarray or 2-item list of ndarray
            Density matrix.  ROHF dm is a 2-item list of 2D array

    Kwargs:
        verbose : int or instance of :class:`lib.logger.Logger`

        pre_orth_method : str
            Pre-orthogonalization, which localized GTOs for each atom.
            To obtain the occupied and unoccupied atomic shells, there are
            three methods

            | 'ano'   : Project GTOs to ANO basis
            | 'minao' : Project GTOs to MINAO basis
            | 'scf'   : Fraction-averaged RHF

    '''
    from pyscf.lo import orth
    if s is None:
        s = get_ovlp(mol)
    if isinstance(verbose, logger.Logger):
        log = verbose
    else:
        log = logger.Logger(mol.stdout, verbose)
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c, s=s)
    c_inv = numpy.dot(orth_coeff.T, s)
    if isinstance(dm, numpy.ndarray) and dm.ndim == 2:
        dm = reduce(numpy.dot, (c_inv, dm, c_inv.T.conj()))
    else:  # ROHF
        dm = reduce(numpy.dot, (c_inv, dm[0] + dm[1], c_inv.T.conj()))

    log.info(' ** Mulliken pop on meta-lowdin orthogonal AOs  **')
    return mulliken_pop(mol, dm, numpy.eye(orth_coeff.shape[0]), log)
Пример #10
0
def mulliken_meta(mol, dm, verbose=logger.DEBUG, pre_orth_method='ANO',
                  s=None):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    In the meta-lowdin, the AOs are grouped in three sets: core, valence and
    Rydberg, the orthogonalization are carreid out within each subsets.

    Args:
        mol : an instance of :class:`Mole`

        dm : ndarray or 2-item list of ndarray
            Density matrix.  ROHF dm is a 2-item list of 2D array

    Kwargs:
        verbose : int or instance of :class:`lib.logger.Logger`

        pre_orth_method : str
            Pre-orthogonalization, which localized GTOs for each atom.
            To obtain the occupied and unoccupied atomic shells, there are
            three methods

            | 'ano'   : Project GTOs to ANO basis
            | 'minao' : Project GTOs to MINAO basis
            | 'scf'   : Fraction-averaged RHF

    '''
    from pyscf.lo import orth
    if s is None:
        s = get_ovlp(mol)
    if isinstance(verbose, logger.Logger):
        log = verbose
    else:
        log = logger.Logger(mol.stdout, verbose)
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c, s=s)
    c_inv = numpy.dot(orth_coeff.T, s)
    if isinstance(dm, numpy.ndarray) and dm.ndim == 2:
        dm = reduce(numpy.dot, (c_inv, dm, c_inv.T.conj()))
    else:  # ROHF
        dm = reduce(numpy.dot, (c_inv, dm[0]+dm[1], c_inv.T.conj()))

    log.info(' ** Mulliken pop on meta-lowdin orthogonal AOs  **')
    return mulliken_pop(mol, dm, numpy.eye(orth_coeff.shape[0]), log)
Пример #11
0
def mulliken_meta(mol, dm_ao, verbose=logger.DEBUG, pre_orth_method='ANO',
                  s=None):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    '''
    from pyscf.lo import orth
    if s is None:
        s = hf.get_ovlp(mol)
    if isinstance(verbose, logger.Logger):
        log = verbose
    else:
        log = logger.Logger(mol.stdout, verbose)
    if isinstance(dm_ao, numpy.ndarray) and dm_ao.ndim == 2:
        dm_ao = numpy.array((dm_ao*.5, dm_ao*.5))
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c, s=s)
    c_inv = numpy.dot(orth_coeff.T, s)
    dm_a = reduce(numpy.dot, (c_inv, dm_ao[0], c_inv.T.conj()))
    dm_b = reduce(numpy.dot, (c_inv, dm_ao[1], c_inv.T.conj()))

    log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
    return mulliken_pop(mol, (dm_a,dm_b), numpy.eye(orth_coeff.shape[0]), log)
Пример #12
0
def mulliken_meta(mol, dm_ao, verbose=logger.DEBUG, pre_orth_method='ANO',
                  s=None):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    '''
    from pyscf.lo import orth
    if s is None:
        s = hf.get_ovlp(mol)
    if isinstance(verbose, logger.Logger):
        log = verbose
    else:
        log = logger.Logger(mol.stdout, verbose)
    if isinstance(dm_ao, numpy.ndarray) and dm_ao.ndim == 2:
        dm_ao = numpy.array((dm_ao*.5, dm_ao*.5))
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c, s=s)
    c_inv = numpy.dot(orth_coeff.T, s)
    dm_a = reduce(numpy.dot, (c_inv, dm_ao[0], c_inv.T.conj()))
    dm_b = reduce(numpy.dot, (c_inv, dm_ao[1], c_inv.T.conj()))

    log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
    return mulliken_pop(mol, (dm_a,dm_b), numpy.eye(orth_coeff.shape[0]), log)
Пример #13
0
def mulliken_meta(mol,
                  dm_ao,
                  verbose=logger.DEBUG,
                  pre_orth_method='ANO',
                  s=None):
    '''Mulliken population analysis, based on meta-Lowdin AOs.
    '''
    from pyscf.lo import orth
    if s is None:
        s = hf.get_ovlp(mol)
    log = logger.new_logger(mf, verbose)
    log.note('Analyze output for the gamma point')
    log.note("KUHF mulliken_meta")
    dm_ao_gamma = dm_ao[:, 0, :, :].real.copy()
    s_gamma = s[0, :, :].real.copy()
    c = orth.pre_orth_ao(mol, pre_orth_method)
    orth_coeff = orth.orth_ao(mol, 'meta_lowdin', pre_orth_ao=c, s=s_gamma)
    c_inv = np.dot(orth_coeff.T, s_gamma)
    dm_a = reduce(np.dot, (c_inv, dm_ao_gamma[0], c_inv.T.conj()))
    dm_b = reduce(np.dot, (c_inv, dm_ao_gamma[1], c_inv.T.conj()))

    log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
    return uhf.mulliken_pop(mol, (dm_a, dm_b), np.eye(orth_coeff.shape[0]),
                            log)