10.21.3. pbc.scf — Self-consistent field with periodic boundary conditions

This module is constructed to be analogous to the molecular pyscf.scf module to handle mean-field calculations with periodic boundary conditions.

10.21.3.1. Gamma point and single k-point calculation

The usage of the Gamma point Hartree-Fock program is very close to that of the molecular program. In a PBC Gamma point calculation, one needs to initialize the Cell object and the corresponding pyscf.pbc.scf.hf.RHF class:

from pyscf.pbc import gto, scf
cell = gto.M(
    atom = '''H     0.      0.      0.
              H     0.8917  0.8917  0.8917''',
    basis = 'sto3g',
    h = '''
    0       1.7834  1.7834
    1.7834  0       1.7834
    1.7834  1.7834  0     ''',
    gs = [10]*3,
    verbose = 4,
)
mf = scf.RHF(cell).run()

Compared to the pyscf.scf.hf.RHF object for molecular calculations, the PBC-HF calculation with pyscf.pbc.scf.hf.RHF or pyscf.pbc.scf.uhf.UHF has three differences

  • pyscf.pbc.scf.hf.RHF is the single k-point PBC HF class. By default, it creates a Gamma point instance. You can change to other (single) k-points by setting the kpt attribute:

    mf = scf.RHF(cell)
    mf.kpt = cell.get_abs_kpts([.25,.25,.25])  # convert from scaled kpts
    mf.kernel()
    
  • The exchange integrals of the PBC Hartree-Fock method show a slow convergence with respect to the number of k-points. A proper treatment for the divergent part of the exchange integral can improve the convergence. The attribute exxdiv is used to control the method to handle the divergent exchange term. The default exxdiv='ewald' can be used for most scenarios. However, if molecular post-HF methods are mixed with the Gamma point mean-field methods (see Mixing with molecular program for post-HF methods, you will need to explicitly use exxdiv=None to obtain a consistent total energy (see Exchange divergence treatment). If PBC post-HF methods are used, the exxdiv attribute is always treated as None in the correlated calculation to obtain a consistent total energy.

  • In PBC calculations there are different choices for how to evaluate 2-electron integrals. The default integral scheme (FFTDF) is accurate for pseudo-potentials and fast for DFT calculations but slow in other scenarios. A second integral scheme which is a good balance of speed and accuracy for Hartree-Fock, all-electron, and post-Hartree-Fock calculations, is Gaussian density fitting. This can be used by setting the with_df attribute (see pbc.df — PBC denisty fitting) or, conveniently, by using the density_fit() function (see pbc_density_fit). For

higher accuracy, you may wish to use

mixed density fitting (MDF) (see with_df). Here is an example to update with_df

#!/usr/bin/env python

'''
Gamma point Hartree-Fock/DFT for all-electron calculation

The default FFT-based 2-electron integrals may not be accurate enough for
all-electron calculation.  It's recommended to use MDF (mixed density fitting)
technique to improve the accuracy.

See also
examples/df/00-with_df.py
examples/df/01-auxbasis.py
examples/df/40-precomupte_df_ints.py
'''

import numpy
from pyscf.pbc import gto, scf, dft

cell = gto.M(
    a = numpy.eye(3)*3.5668,
    atom = '''C     0.      0.      0.    
              C     0.8917  0.8917  0.8917
              C     1.7834  1.7834  0.    
              C     2.6751  2.6751  0.8917
              C     1.7834  0.      1.7834
              C     2.6751  0.8917  2.6751
              C     0.      1.7834  1.7834
              C     0.8917  2.6751  2.6751''',
    basis = '6-31g',
    verbose = 4,
)

mf = scf.RHF(cell).density_fit()
mf.kernel()

# Mixed density fitting is another option for all-electron calculations
mf = scf.RHF(cell).mix_density_fit()
mf.with_df.mesh = [10]*3  # Tune #PWs in MDF for performance/accuracy balance
mf.kernel()

# Or use even-tempered Gaussian basis as auxiliary fitting functions.
# The following auxbasis is generated based on the expression
#    alpha = a * 1.7^i   i = 0..N
# where a and N are determined by the smallest and largest exponents of AO basis.
import pyscf.df
auxbasis = pyscf.df.aug_etb(cell, beta=1.7)
mf = scf.RHF(cell).density_fit(auxbasis=auxbasis)
mf.kernel()

#
# Second order SCF solver can be used in the PBC SCF code the same way in the
# molecular calculation
#
mf = dft.RKS(cell).density_fit(auxbasis='weigend')
mf.xc = 'bp86'
# You should first set mf.xc then apply newton method (see also
# examples/scf/22-newton.py)
mf = mf.newton()
mf.kernel()

#
# The computational costs to initialize PBC DF object is high.  The density
# fitting integral tensor created in the initialization can be cached for
# future use.  See also examples/df/40-precomupte_df_ints.py
#
mf = dft.RKS(cell).density_fit(auxbasis='weigend')
mf.with_df._cderi_to_save = 'df_ints.h5'
mf.kernel()
#
# The DF integral tensor can be preloaded in an independent calculation.
#
mf = dft.RKS(cell).density_fit()
mf.with_df._cderi = 'df_ints.h5'
mf.kernel()

10.21.3.1.1. Mixing with molecular program for post-HF methods

The Gamma point HF code adopts the same code structure, function and method names and argument’ conventions as the molecular SCF code. This desgin allows one to mix PBC HF objects with the existing molecular post-HF code for PBC electron correlation treatments. A typical molecular post-HF calculation starts from the finite-size HF method with the Mole object:

from pyscf import gto, scf
mol = gto.M(atom='H 0 0 0; H 0 0 1', basis='ccpvdz')
mf = scf.RHF(mol).run()

from pyscf import cc
cc.CCSD(mf).run()

The PBC Gamma point post-HF calculation requires the Cell object and PBC HF object:

from pyscf.pbc import gto, scf
cell = gto.M(atom='H 0 0 0; H 0 0 1', basis='ccpvdz',
             h=numpy.eye(3)*2, gs=[10,10,10])
mf = scf.RHF(cell).run()

from pyscf import cc
cc.CCSD(mf).run()

The differences are the mol or cell object to create and the scf module to import. With the system-specific mean-field object, one can carry out various post-HF methods (MP2, Coupled cluster, CISD, TDHF, TDDFT, …) using the same code for finite-size and extended systems. See Mixing PBC and molecular modules for more details of the interface between PBC and molecular modules.

10.21.3.2. k-point sampling

An example demonstrating the use of k-points for a KRHF, KRKS calculation, and using the Newton (second-order SCF) solver.

#!/usr/bin/env python

'''
Mean field with k-points sampling

The 2-electron integrals are computed using Poisson solver with FFT by default.
In most scenario, it should be used with pseudo potential.
'''

from pyscf.pbc import gto, scf, dft
import numpy

cell = gto.M(
    a = numpy.eye(3)*3.5668,
    atom = '''C     0.      0.      0.    
              C     0.8917  0.8917  0.8917
              C     1.7834  1.7834  0.    
              C     2.6751  2.6751  0.8917
              C     1.7834  0.      1.7834
              C     2.6751  0.8917  2.6751
              C     0.      1.7834  1.7834
              C     0.8917  2.6751  2.6751''',
    basis = 'gth-szv',
    pseudo = 'gth-pade',
    verbose = 4,
)

nk = [4,4,4]  # 4 k-points for each axis, 4^3=64 kpts in total
kpts = cell.make_kpts(nk)

kmf = scf.KRHF(cell, kpts)
kmf.kernel()

kmf = dft.KRKS(cell, kpts)
# Turn to the atomic grids if you like
kmf.grids = dft.gen_grid.BeckeGrids(cell)
kmf.xc = 'm06,m06'
kmf.kernel()


#
# Second order SCF solver can be used in the PBC SCF code the same way in the
# molecular calculation
#
mf = scf.KRHF(cell, kpts).newton()
mf.kernel()

10.21.3.2.1. Smearing

In many periodic systems, the HOMO-LUMO gap may become very small. In such a case, one needs to use occupation number smearing to converge the SCF calculation, as illustrated here:

import numpy
from pyscf.pbc import gto, scf

cell = gto.Cell()
cell.atom = '''
He 0 0 1
He 1 0 1
'''
cell.basis = 'ccpvdz'
cell.a = numpy.eye(3) * 4
cell.verbose = 4
cell.build()

#
# Use scf.addons.smearing_ function to modify the
# PBC (gamma-point or k-points) SCF object
#
nks = [2,1,1]
mf = scf.KRHF(cell, cell.make_kpts(nks))
mf = scf.addons.smearing_(mf, sigma=.1, method='fermi')
mf.kernel()

10.21.3.3. Exchange divergence treatment

The attribute exxdiv controls the handling of the slow convergence of the HF exchange integrals. Generally, exxdiv leads to a shift in the total energy that can be thought of as a HF finite size-correction. It also modifies the spectrum of the occupied orbitals. When a Gamma-point PBC mean-field calculation is mixed with a molecular post-HF implementation, setting this attribute to anything other than None will lead to an inconsistency in the total energy.

Possible values are None, vcut_sph (spherical cutoff), vcut_ws (Wigner-Seitz cutoff), ewald (probe-charge Ewald correction). vcut_sph and vcut_ws are only available when using FFTDF. When using hybrid functionals, the exchange treatment will use the exxdiv attribute.

Note that when calling get_bands(), the choice of exxdiv affects the band structure. In particular, vcut_sph (spherical cutoff), vcut_ws (Wigner-Seitz cutoff) should be used to obtain smooth bands, otherwise, the band structure should be computed by twisting the SCF calculation (i.e. redoing self-consistency at each k point).

10.21.3.4. Gaussian density fitting

This example uses the density_fit() function to enable Gaussian density fitting:

import numpy as np
from pyscf import gto as mol_gto
from pyscf.pbc import gto, scf, cc, df

cell = gto.Cell()
cell.atom='''
C 0.000000000000   0.000000000000   0.000000000000
C 1.685068664391   1.685068664391   1.685068664391
'''
cell.basis = 'gth-dzv'
cell.pseudo = 'gth-pade'
cell.a = '''
0.000000000, 3.370137329, 3.370137329
3.370137329, 0.000000000, 3.370137329
3.370137329, 3.370137329, 0.000000000'''
cell.unit = 'B'
cell.verbose = 5
cell.build()

#
# Default DF auxiliary basis is a set of even-tempered gaussian basis (with
# exponents alpha * beta**i, i = 1,..,N).  The even-tempered parameter alpha
# is determined automatically based on the orbital basis.  beta is set to 2.0
#
mf = scf.RHF(cell).density_fit()
mf.kernel()

10.21.3.5. Program reference

Hartree-Fock for periodic systems at a single k-point

See Also:

pyscf.pbc.scf.khf.py : Hartree-Fock for periodic systems with k-point sampling

class pyscf.pbc.scf.hf.RHF(cell, kpt=array([0., 0., 0.]), exxdiv='ewald')[source]
convert_from_(mf)[source]

Convert given mean-field object to RHF

stability(internal=True, external=False, verbose=None)[source]

RHF/RKS stability analysis.

See also pyscf.scf.stability.rhf_stability function.

Kwargs:
internalbool

Internal stability, within the RHF optimization space.

externalbool

External stability. Including the RHF -> UHF and real -> complex stability analysis.

Returns:

New orbitals that are more close to the stable condition. The return value includes two set of orbitals. The first corresponds to the internal stability and the second corresponds to the external stability.

class pyscf.pbc.scf.hf.SCF(cell, kpt=array([0., 0., 0.]), exxdiv='ewald')[source]

SCF base class adapted for PBCs.

Attributes:
kpt(3,) ndarray

The AO k-point in Cartesian coordinates, in units of 1/Bohr.

exxdivstr

Exchange divergence treatment, can be one of

None : ignore G=0 contribution in exchange
‘ewald’ : Ewald probe charge correction [JCP 122, 234102 (2005); DOI:10.1063/1.1926272]
with_dfdensity fitting object

Default is the FFT based DF model. For all-electron calculation, MDF model is favored for better accuracy. See also pyscf.pbc.df.

direct_scfbool

When this flag is set to true, the J/K matrices will be computed directly through the underlying with_df methods. Otherwise, depending the available memory, the 4-index integrals may be cached and J/K matrices are computed based on the 4-index integrals.

check_sanity()[source]

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

dip_moment(cell=None, dm=None, unit='Debye', verbose=3, **kwargs)[source]

Dipole moment in the unit cell (is it well defined)?

Args:

cell : an instance of Cell

dm (ndarray) : density matrix

Return:

A list: the dipole moment on x, y and z components

from_chk(chk=None, project=None, kpt=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

get_bands(kpts_band, cell=None, dm=None, kpt=None)

Get energy bands at the given (arbitrary) ‘band’ k-points.

Returns:
mo_energy(nmo,) ndarray or a list of (nmo,) ndarray

Bands energies E_n(k)

mo_coeff(nao, nmo) ndarray or a list of (nao,nmo) ndarray

Band orbitals psi_n(k)

get_j(cell=None, dm=None, hermi=1, kpt=None, kpts_band=None, omega=None)[source]

Compute J matrix for the given density matrix and k-point (kpt). When kpts_band is given, the J matrices on kpts_band are evaluated.

J_{pq} = sum_{rs} (pq|rs) dm[s,r]

where r,s are orbitals on kpt. p and q are orbitals on kpts_band if kpts_band is given otherwise p and q are orbitals on kpt.

get_jk(cell=None, dm=None, hermi=1, kpt=None, kpts_band=None, with_j=True, with_k=True, omega=None, **kwargs)[source]

Get Coulomb (J) and exchange (K) following scf.hf.RHF.get_jk_(). for particular k-point (kpt).

When kpts_band is given, the J, K matrices on kpts_band are evaluated.

J_{pq} = sum_{rs} (pq|rs) dm[s,r] K_{pq} = sum_{rs} (pr|sq) dm[r,s]

where r,s are orbitals on kpt. p and q are orbitals on kpts_band if kpts_band is given otherwise p and q are orbitals on kpt.

get_jk_incore(cell=None, dm=None, hermi=1, kpt=None, omega=None, **kwargs)[source]

Get Coulomb (J) and exchange (K) following scf.hf.RHF.get_jk_().

Incore version of Coulomb and exchange build only. Currently RHF always uses PBC AO integrals (unlike RKS), since exchange is currently computed by building PBC AO integrals.

get_k(cell=None, dm=None, hermi=1, kpt=None, kpts_band=None, omega=None)[source]

Compute K matrix for the given density matrix.

get_rho(dm=None, grids=None, kpt=None)

Compute density in real space

get_veff(cell=None, dm=None, dm_last=0, vhf_last=0, hermi=1, kpt=None, kpts_band=None)[source]

Hartree-Fock potential matrix for the given density matrix. See scf.hf.get_veff() and scf.hf.RHF.get_veff()

init_guess_by_1e(cell=None)[source]

Generate initial guess density matrix from core hamiltonian

Returns:

Density matrix, 2D ndarray

init_guess_by_chkfile(chk=None, project=None, kpt=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

nuc_grad_method(*args, **kwargs)[source]

Hook to create object for analytical nuclear gradients.

reset(cell=None)[source]

Reset cell and relevant attributes associated to the old cell object

to_ghf(mf)[source]

Convert the input mean-field object to a GHF/GKS object

to_rhf(mf)[source]

Convert the input mean-field object to a RHF/ROHF/RKS/ROKS object

to_uhf(mf)[source]

Convert the input mean-field object to a UHF/UKS object

pyscf.pbc.scf.hf.dip_moment(cell, dm, unit='Debye', verbose=3, grids=None, rho=None, kpt=array([0., 0., 0.]), origin=None)[source]

Dipole moment in the unit cell (is it well defined)?

Args:

cell : an instance of Cell

dm (ndarray) : density matrix

Return:

A list: the dipole moment on x, y and z components

pyscf.pbc.scf.hf.get_bands(mf, kpts_band, cell=None, dm=None, kpt=None)[source]

Get energy bands at the given (arbitrary) ‘band’ k-points.

Returns:
mo_energy(nmo,) ndarray or a list of (nmo,) ndarray

Bands energies E_n(k)

mo_coeff(nao, nmo) ndarray or a list of (nao,nmo) ndarray

Band orbitals psi_n(k)

pyscf.pbc.scf.hf.get_hcore(cell, kpt=array([0., 0., 0.]))[source]

Get the core Hamiltonian AO matrix.

pyscf.pbc.scf.hf.get_j(cell, dm, hermi=1, vhfopt=None, kpt=array([0., 0., 0.]), kpts_band=None)[source]

Get the Coulomb (J) AO matrix for the given density matrix.

Args:
dmndarray or list of ndarrays

A density matrix or a list of density matrices

Kwargs:
hermiint

Whether J, K matrix is hermitian | 0 : no hermitian or symmetric | 1 : hermitian | 2 : anti-hermitian

vhfopt :

A class which holds precomputed quantities to optimize the computation of J, K matrices

kpt(3,) ndarray

The “inner” dummy k-point at which the DM was evaluated (or sampled).

kpts_band(3,) ndarray or (*,3) ndarray

An arbitrary “band” k-point at which J is evaluated.

Returns:

The function returns one J matrix, corresponding to the input density matrix (both order and shape).

pyscf.pbc.scf.hf.get_jk(mf, cell, dm, hermi=1, vhfopt=None, kpt=array([0., 0., 0.]), kpts_band=None, with_j=True, with_k=True, omega=None, **kwargs)[source]

Get the Coulomb (J) and exchange (K) AO matrices for the given density matrix.

Args:
dmndarray or list of ndarrays

A density matrix or a list of density matrices

Kwargs:
hermiint

Whether J, K matrix is hermitian | 0 : no hermitian or symmetric | 1 : hermitian | 2 : anti-hermitian

vhfopt :

A class which holds precomputed quantities to optimize the computation of J, K matrices

kpt(3,) ndarray

The “inner” dummy k-point at which the DM was evaluated (or sampled).

kpts_band(3,) ndarray or (*,3) ndarray

An arbitrary “band” k-point at which J and K are evaluated.

Returns:

The function returns one J and one K matrix, corresponding to the input density matrix (both order and shape).

pyscf.pbc.scf.hf.get_nuc(cell, kpt=array([0., 0., 0.]))[source]

Get the bare periodic nuc-el AO matrix, with G=0 removed.

See Martin (12.16)-(12.21).

pyscf.pbc.scf.hf.get_ovlp(cell, kpt=array([0., 0., 0.]))[source]

Get the overlap AO matrix.

pyscf.pbc.scf.hf.get_rho(mf, dm=None, grids=None, kpt=None)[source]

Compute density in real space

pyscf.pbc.scf.hf.get_t(cell, kpt=array([0., 0., 0.]))[source]

Get the kinetic energy AO matrix.

pyscf.pbc.scf.hf.init_guess_by_chkfile(cell, chkfile_name, project=None, kpt=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by cell

Returns:

Density matrix, (nao,nao) ndarray

pyscf.pbc.scf.hf.makov_payne_correction(mf)[source]

Makov-Payne correction (Phys. Rev. B, 51, 4014)

pyscf.pbc.scf.hf.normalize_dm_(mf, dm)[source]

Scale density matrix to make it produce the correct number of electrons.

Unrestricted Hartree-Fock for periodic systems at a single k-point

See Also:

pyscf/pbc/scf/khf.py : Hartree-Fock for periodic systems with k-point sampling

class pyscf.pbc.scf.uhf.UHF(cell, kpt=array([0., 0., 0.]), exxdiv='ewald')[source]

UHF class for PBCs.

analyze(verbose=None, with_meta_lowdin=True, **kwargs)[source]

Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.

canonicalize(mo_coeff, mo_occ, fock=None)

Canonicalization diagonalizes the UHF Fock matrix within occupied, virtual subspaces separatedly (without change occupancy).

convert_from_(mf)[source]

Convert given mean-field object to RHF/ROHF

dip_moment(cell=None, dm=None, unit='Debye', verbose=3, **kwargs)[source]

Dipole moment in the unit cell.

Args:

cell : an instance of Cell

dm_kpts (a list of ndarrays) : density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

eig(fock, s)[source]

Solver for generalized eigenvalue problem

\[HC = SCE\]
energy_elec(dm=None, h1e=None, vhf=None)

Electronic energy of Unrestricted Hartree-Fock

Note this function has side effects which cause mf.scf_summary updated.

Returns:

Hartree-Fock electronic energy and the 2-electron part contribution

get_bands(kpts_band, cell=None, dm=None, kpt=None)[source]

Get energy bands at the given (arbitrary) ‘band’ k-points.

Returns:
mo_energy(nmo,) ndarray or a list of (nmo,) ndarray

Bands energies E_n(k)

mo_coeff(nao, nmo) ndarray or a list of (nao,nmo) ndarray

Band orbitals psi_n(k)

get_grad(mo_coeff, mo_occ, fock=None)[source]

RHF orbital gradients

Args:
mo_coeff2D ndarray

Obital coefficients

mo_occ1D ndarray

Orbital occupancy

fock_ao2D ndarray

Fock matrix in AO representation

Returns:

Gradients in MO representation. It’s a num_occ*num_vir vector.

get_rho(dm=None, grids=None, kpt=None)

Compute density in real space

get_veff(cell=None, dm=None, dm_last=0, vhf_last=0, hermi=1, kpt=None, kpts_band=None)[source]

Hartree-Fock potential matrix for the given density matrix. See scf.hf.get_veff() and scf.hf.RHF.get_veff()

init_guess_by_1e(cell=None)[source]

Generate initial guess density matrix from core hamiltonian

Returns:

Density matrix, 2D ndarray

init_guess_by_atom(mol=None, breaksym=True)[source]

Generate initial guess density matrix from superposition of atomic HF density matrix. The atomic HF is occupancy averaged RHF

Returns:

Density matrix, 2D ndarray

init_guess_by_chkfile(chk=None, project=True, kpt=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

init_guess_by_huckel(mol=None, breaksym=True)[source]

Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089

Returns:

Density matrix, 2D ndarray

init_guess_by_minao(mol=None, breaksym=True)[source]

Initial guess in terms of the overlap to minimal basis.

make_rdm1(mo_coeff=None, mo_occ=None, **kwargs)[source]

One-particle density matrix

Returns:

A list of 2D ndarrays for alpha and beta spins

mulliken_meta(mol=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)[source]

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 Mole

dmndarray or 2-item list of ndarray

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

Kwargs:

verbose : int or instance of lib.logger.Logger

pre_orth_methodstr

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’ : Symmetry-averaged fractional occupation atomic RHF
Returns:

A list : pop, charges

popnparray

Mulliken population on each atomic orbitals

chargesnparray

Mulliken charges

mulliken_pop(mol=None, dm=None, s=None, verbose=5)[source]

Mulliken population analysis

\[M_{ij} = D_{ij} S_{ji}\]

Mulliken charges

\[\delta_i = \sum_j M_{ij}\]
Returns:

A list : pop, charges

popnparray

Mulliken population on each atomic orbitals

chargesnparray

Mulliken charges

spin_square(mo_coeff=None, s=None)[source]

Spin square and multiplicity of UHF determinant

\[S^2 = \frac{1}{2}(S_+ S_- + S_- S_+) + S_z^2\]

where \(S_+ = \sum_i S_{i+}\) is effective for all beta occupied orbitals; \(S_- = \sum_i S_{i-}\) is effective for all alpha occupied orbitals.

  1. There are two possibilities for \(S_+ S_-\)
    1. same electron \(S_+ S_- = \sum_i s_{i+} s_{i-}\),

    \[\sum_i \langle UHF|s_{i+} s_{i-}|UHF\rangle = \sum_{pq}\langle p|s_+s_-|q\rangle \gamma_{qp} = n_\alpha\]

    2) different electrons \(S_+ S_- = \sum s_{i+} s_{j-}, (i\neq j)\). There are in total \(n(n-1)\) terms. As a two-particle operator,

    \[\langle S_+ S_- \rangle = \langle ij|s_+ s_-|ij\rangle - \langle ij|s_+ s_-|ji\rangle = -\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle\]
  2. Similarly, for \(S_- S_+\)
    1. same electron

    \[\sum_i \langle s_{i-} s_{i+}\rangle = n_\beta\]
    1. different electrons

    \[\langle S_- S_+ \rangle = -\langle i^\beta|j^\alpha\rangle \langle j^\alpha|i^\beta\rangle\]
  3. For \(S_z^2\)
    1. same electron

    \[\langle s_z^2\rangle = \frac{1}{4}(n_\alpha + n_\beta)\]
    1. different electrons

    \[\begin{split}&\frac{1}{2}\sum_{ij}(\langle ij|2s_{z1}s_{z2}|ij\rangle -\langle ij|2s_{z1}s_{z2}|ji\rangle) \\ &=\frac{1}{4}(\langle i^\alpha|i^\alpha\rangle \langle j^\alpha|j^\alpha\rangle - \langle i^\alpha|i^\alpha\rangle \langle j^\beta|j^\beta\rangle - \langle i^\beta|i^\beta\rangle \langle j^\alpha|j^\alpha\rangle + \langle i^\beta|i^\beta\rangle \langle j^\beta|j^\beta\rangle) \\ &-\frac{1}{4}(\langle i^\alpha|j^\alpha\rangle \langle j^\alpha|i^\alpha\rangle + \langle i^\beta|j^\beta\rangle\langle j^\beta|i^\beta\rangle) \\ &=\frac{1}{4}(n_\alpha^2 - n_\alpha n_\beta - n_\beta n_\alpha + n_\beta^2) -\frac{1}{4}(n_\alpha + n_\beta) \\ &=\frac{1}{4}((n_\alpha-n_\beta)^2 - (n_\alpha+n_\beta))\end{split}\]

In total

\[\begin{split}\langle S^2\rangle &= \frac{1}{2} (n_\alpha-\sum_{ij}\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle +n_\beta -\sum_{ij}\langle i^\beta|j^\alpha\rangle\langle j^\alpha|i^\beta\rangle) + \frac{1}{4}(n_\alpha-n_\beta)^2 \\\end{split}\]
Args:
moa list of 2 ndarrays

Occupied alpha and occupied beta orbitals

Kwargs:
sndarray

AO overlap

Returns:

A list of two floats. The first is the expectation value of S^2. The second is the corresponding 2S+1

Examples:

>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz', charge=1, spin=1, verbose=0)
>>> mf = scf.UHF(mol)
>>> mf.kernel()
-75.623975516256706
>>> mo = (mf.mo_coeff[0][:,mf.mo_occ[0]>0], mf.mo_coeff[1][:,mf.mo_occ[1]>0])
>>> print('S^2 = %.7f, 2S+1 = %.7f' % spin_square(mo, mol.intor('int1e_ovlp_sph')))
S^2 = 0.7570150, 2S+1 = 2.0070027
stability(internal=True, external=False, verbose=None)[source]

Stability analysis for RHF/RKS method.

See also pyscf.scf.stability.uhf_stability function.

Args:

mf : UHF or UKS object

Kwargs:
internalbool

Internal stability, within the UHF space.

externalbool

External stability. Including the UHF -> GHF and real -> complex stability analysis.

Returns:

New orbitals that are more close to the stable condition. The return value includes two set of orbitals. The first corresponds to the internal stability and the second corresponds to the external stability.

pyscf.pbc.scf.uhf.dip_moment(cell, dm, unit='Debye', verbose=3, grids=None, rho=None, kpt=array([0., 0., 0.]))[source]

Dipole moment in the unit cell.

Args:

cell : an instance of Cell

dm_kpts (a list of ndarrays) : density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

pyscf.pbc.scf.uhf.init_guess_by_chkfile(cell, chkfile_name, project=None, kpt=None)[source]

Read the HF results from checkpoint file and make the density matrix for UHF initial guess.

Returns:

Density matrix, (nao,nao) ndarray

Hartree-Fock for periodic systems with k-point sampling

See Also:

hf.py : Hartree-Fock for periodic systems at a single k-point

class pyscf.pbc.scf.khf.KRHF(cell, kpts=array([[0., 0., 0.]]), exxdiv='ewald')[source]
check_sanity()[source]

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

convert_from_(mf)[source]

Convert given mean-field object to KRHF

nuc_grad_method()[source]

Hook to create object for analytical nuclear gradients.

class pyscf.pbc.scf.khf.KSCF(cell, kpts=array([[0., 0., 0.]]), exxdiv='ewald')[source]

SCF base class with k-point sampling.

Compared to molecular SCF, some members such as mo_coeff, mo_occ now have an additional first dimension for the k-points, e.g. mo_coeff is (nkpts, nao, nao) ndarray

Attributes:
kpts(nks,3) ndarray

The sampling k-points in Cartesian coordinates, in units of 1/Bohr.

analyze(verbose=None, with_meta_lowdin=True, **kwargs)[source]

Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.

check_sanity()[source]

Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.

dip_moment(cell=None, dm=None, unit='Debye', verbose=3, **kwargs)[source]

Dipole moment in the unit cell (is it well defined)?

Args:

cell : an instance of Cell

dm_kpts (a list of ndarrays) : density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

eig(h_kpts, s_kpts)[source]

Solver for generalized eigenvalue problem

\[HC = SCE\]
energy_elec(dm_kpts=None, h1e_kpts=None, vhf_kpts=None)

Following pyscf.scf.hf.energy_elec()

from_chk(chk=None, project=None, kpts=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

get_bands(kpts_band, cell=None, dm_kpts=None, kpts=None)[source]

Get energy bands at the given (arbitrary) ‘band’ k-points.

Returns:
mo_energy(nmo,) ndarray or a list of (nmo,) ndarray

Bands energies E_n(k)

mo_coeff(nao, nmo) ndarray or a list of (nao,nmo) ndarray

Band orbitals psi_n(k)

get_fermi(mo_energy_kpts=None, mo_occ_kpts=None)

Fermi level

get_grad(mo_coeff_kpts, mo_occ_kpts, fock=None)[source]

returns 1D array of gradients, like non K-pt version note that occ and virt indices of different k pts now occur in sequential patches of the 1D array

get_hcore(cell=None, kpts=None)

Get the core Hamiltonian AO matrices at sampled k-points.

Args:

kpts : (nkpts, 3) ndarray

Returns:

hcore : (nkpts, nao, nao) ndarray

get_j(cell=None, dm_kpts=None, hermi=1, kpts=None, kpts_band=None, omega=None)[source]

Compute J matrix for the given density matrix and k-point (kpt). When kpts_band is given, the J matrices on kpts_band are evaluated.

J_{pq} = sum_{rs} (pq|rs) dm[s,r]

where r,s are orbitals on kpt. p and q are orbitals on kpts_band if kpts_band is given otherwise p and q are orbitals on kpt.

get_jk(cell=None, dm_kpts=None, hermi=1, kpts=None, kpts_band=None, with_j=True, with_k=True, omega=None, **kwargs)[source]

Get Coulomb (J) and exchange (K) following scf.hf.RHF.get_jk_(). for particular k-point (kpt).

When kpts_band is given, the J, K matrices on kpts_band are evaluated.

J_{pq} = sum_{rs} (pq|rs) dm[s,r] K_{pq} = sum_{rs} (pr|sq) dm[r,s]

where r,s are orbitals on kpt. p and q are orbitals on kpts_band if kpts_band is given otherwise p and q are orbitals on kpt.

get_k(cell=None, dm_kpts=None, hermi=1, kpts=None, kpts_band=None, omega=None)[source]

Compute K matrix for the given density matrix.

get_occ(mo_energy_kpts=None, mo_coeff_kpts=None)

Label the occupancies for each orbital for sampled k-points.

This is a k-point version of scf.hf.SCF.get_occ

get_ovlp(cell=None, kpts=None)

Get the overlap AO matrices at sampled k-points.

Args:

kpts : (nkpts, 3) ndarray

Returns:

ovlp_kpts : (nkpts, nao, nao) ndarray

get_rho(dm=None, grids=None, kpts=None)

Compute density in real space

get_veff(cell=None, dm_kpts=None, dm_last=0, vhf_last=0, hermi=1, kpts=None, kpts_band=None)[source]

Hartree-Fock potential matrix for the given density matrix. See scf.hf.get_veff() and scf.hf.RHF.get_veff()

init_guess_by_1e(cell=None)[source]

Generate initial guess density matrix from core hamiltonian

Returns:

Density matrix, 2D ndarray

init_guess_by_chkfile(chk=None, project=None, kpts=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

make_rdm1(mo_coeff_kpts=None, mo_occ_kpts=None, **kwargs)[source]

One-particle density matrix in AO representation

Args:
mo_coeff2D ndarray

Orbital coefficients. Each column is one orbital.

mo_occ1D ndarray

Occupancy

mulliken_meta(cell=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)[source]

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 Mole

dmndarray or 2-item list of ndarray

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

Kwargs:

verbose : int or instance of lib.logger.Logger

pre_orth_methodstr

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’ : Symmetry-averaged fractional occupation atomic RHF
Returns:

A list : pop, charges

popnparray

Mulliken population on each atomic orbitals

chargesnparray

Mulliken charges

mulliken_pop()[source]

Mulliken population analysis

\[M_{ij} = D_{ij} S_{ji}\]

Mulliken charges

\[\delta_i = \sum_j M_{ij}\]
Returns:

A list : pop, charges

popnparray

Mulliken population on each atomic orbitals

chargesnparray

Mulliken charges

to_ghf(mf)[source]

Convert the input mean-field object to a KGHF/KGKS object

to_rhf(mf)[source]

Convert the input mean-field object to a KRHF/KROHF/KRKS/KROKS object

to_uhf(mf)[source]

Convert the input mean-field object to a KUHF/KUKS object

pyscf.pbc.scf.khf.analyze(mf, verbose=5, with_meta_lowdin=True, **kwargs)[source]

Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Dipole moment

pyscf.pbc.scf.khf.dip_moment(cell, dm_kpts, unit='Debye', verbose=3, grids=None, rho=None, kpts=array([[0., 0., 0.]]))[source]

Dipole moment in the unit cell (is it well defined)?

Args:

cell : an instance of Cell

dm_kpts (a list of ndarrays) : density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

pyscf.pbc.scf.khf.energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None)[source]

Following pyscf.scf.hf.energy_elec()

pyscf.pbc.scf.khf.get_fermi(mf, mo_energy_kpts=None, mo_occ_kpts=None)[source]

Fermi level

pyscf.pbc.scf.khf.get_grad(mo_coeff_kpts, mo_occ_kpts, fock)[source]

returns 1D array of gradients, like non K-pt version note that occ and virt indices of different k pts now occur in sequential patches of the 1D array

pyscf.pbc.scf.khf.get_hcore(mf, cell=None, kpts=None)[source]

Get the core Hamiltonian AO matrices at sampled k-points.

Args:

kpts : (nkpts, 3) ndarray

Returns:

hcore : (nkpts, nao, nao) ndarray

pyscf.pbc.scf.khf.get_j(mf, cell, dm_kpts, kpts, kpts_band=None)[source]

Get the Coulomb (J) AO matrix at sampled k-points.

Args:
dm_kpts(nkpts, nao, nao) ndarray or a list of (nkpts,nao,nao) ndarray

Density matrix at each k-point. If a list of k-point DMs, eg, UHF alpha and beta DM, the alpha and beta DMs are contracted separately. It needs to be Hermitian.

Kwargs:
kpts_band(k,3) ndarray

A list of arbitrary “band” k-points at which to evalute the matrix.

Returns:

vj : (nkpts, nao, nao) ndarray or list of vj if the input dm_kpts is a list of DMs

pyscf.pbc.scf.khf.get_jk(mf, cell, dm_kpts, kpts, kpts_band=None, with_j=True, with_k=True, omega=None, **kwargs)[source]

Get the Coulomb (J) and exchange (K) AO matrices at sampled k-points.

Args:
dm_kpts(nkpts, nao, nao) ndarray

Density matrix at each k-point. It needs to be Hermitian.

Kwargs:
kpts_band(3,) ndarray

A list of arbitrary “band” k-point at which to evalute the matrix.

Returns:

vj : (nkpts, nao, nao) ndarray vk : (nkpts, nao, nao) ndarray or list of vj and vk if the input dm_kpts is a list of DMs

pyscf.pbc.scf.khf.get_occ(mf, mo_energy_kpts=None, mo_coeff_kpts=None)[source]

Label the occupancies for each orbital for sampled k-points.

This is a k-point version of scf.hf.SCF.get_occ

pyscf.pbc.scf.khf.get_ovlp(mf, cell=None, kpts=None)[source]

Get the overlap AO matrices at sampled k-points.

Args:

kpts : (nkpts, 3) ndarray

Returns:

ovlp_kpts : (nkpts, nao, nao) ndarray

pyscf.pbc.scf.khf.get_rho(mf, dm=None, grids=None, kpts=None)[source]

Compute density in real space

pyscf.pbc.scf.khf.init_guess_by_chkfile(cell, chkfile_name, project=None, kpts=None)[source]

Read the KHF results from checkpoint file, then project it to the basis defined by cell

Returns:

Density matrix, 3D ndarray

pyscf.pbc.scf.khf.make_rdm1(mo_coeff_kpts, mo_occ_kpts, **kwargs)[source]

One particle density matrices for all k-points.

Returns:

dm_kpts : (nkpts, nao, nao) ndarray

pyscf.pbc.scf.khf.mulliken_meta(cell, dm_ao_kpts, verbose=5, pre_orth_method='ANO', s=None)[source]

A modified Mulliken population analysis, based on meta-Lowdin AOs.

Note this function only computes the Mulliken population for the gamma point density matrix.

Hartree-Fock for periodic systems with k-point sampling

See Also:

hf.py : Hartree-Fock for periodic systems at a single k-point

class pyscf.pbc.scf.kuhf.KUHF(cell, kpts=array([[0., 0., 0.]]), exxdiv='ewald')[source]

UHF class with k-point sampling.

analyze(verbose=None, with_meta_lowdin=True, **kwargs)[source]

Analyze the given SCF object: print orbital energies, occupancies; print orbital coefficients; Mulliken population analysis; Diople moment.

canonicalize(mo_coeff_kpts, mo_occ_kpts, fock=None)

Canonicalization diagonalizes the UHF Fock matrix within occupied, virtual subspaces separatedly (without change occupancy).

convert_from_(mf)[source]

Convert given mean-field object to KUHF

dip_moment(cell=None, dm=None, unit='Debye', verbose=3, **kwargs)[source]

Dipole moment in the unit cell.

Args:

cell : an instance of Cell

dm_kpts (two lists of ndarrays) : KUHF density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

eig(h_kpts, s_kpts)[source]

Solver for generalized eigenvalue problem

\[HC = SCE\]
energy_elec(dm_kpts=None, h1e_kpts=None, vhf_kpts=None)

Following pyscf.scf.hf.energy_elec()

get_bands(kpts_band, cell=None, dm_kpts=None, kpts=None)[source]

Get energy bands at the given (arbitrary) ‘band’ k-points.

Returns:
mo_energy(nmo,) ndarray or a list of (nmo,) ndarray

Bands energies E_n(k)

mo_coeff(nao, nmo) ndarray or a list of (nao,nmo) ndarray

Band orbitals psi_n(k)

get_fermi(mo_energy_kpts=None, mo_occ_kpts=None)

A pair of Fermi level for spin-up and spin-down orbitals

get_grad(mo_coeff_kpts, mo_occ_kpts, fock=None)[source]

returns 1D array of gradients, like non K-pt version note that occ and virt indices of different k pts now occur in sequential patches of the 1D array

get_occ(mo_energy_kpts=None, mo_coeff_kpts=None)

Label the occupancies for each orbital for sampled k-points.

This is a k-point version of scf.hf.SCF.get_occ

get_rho(dm=None, grids=None, kpts=None)

Compute density in real space

get_veff(cell=None, dm_kpts=None, dm_last=0, vhf_last=0, hermi=1, kpts=None, kpts_band=None)[source]

Hartree-Fock potential matrix for the given density matrix. See scf.hf.get_veff() and scf.hf.RHF.get_veff()

init_guess_by_1e(cell=None)

Generate initial guess density matrix from core hamiltonian

Returns:

Density matrix, 2D ndarray

init_guess_by_atom(mol=None, breaksym=True)

Generate initial guess density matrix from superposition of atomic HF density matrix. The atomic HF is occupancy averaged RHF

Returns:

Density matrix, 2D ndarray

init_guess_by_chkfile(chk=None, project=True, kpts=None)[source]

Read the HF results from checkpoint file, then project it to the basis defined by mol

Returns:

Density matrix, 2D ndarray

init_guess_by_huckel(mol=None, breaksym=True)

Generate initial guess density matrix from a Huckel calculation based on occupancy averaged atomic RHF calculations, doi:10.1021/acs.jctc.8b01089

Returns:

Density matrix, 2D ndarray

init_guess_by_minao(mol=None, breaksym=True)

Initial guess in terms of the overlap to minimal basis.

make_rdm1(mo_coeff_kpts=None, mo_occ_kpts=None, **kwargs)[source]

One-particle density matrix

Returns:

A list of 2D ndarrays for alpha and beta spins

mulliken_meta(cell=None, dm=None, verbose=5, pre_orth_method='ANO', s=None)[source]

A modified Mulliken population analysis, based on meta-Lowdin AOs.

Note this function only computes the Mulliken population for the gamma point density matrix.

mulliken_pop()[source]

Mulliken population analysis

\[M_{ij} = D_{ij} S_{ji}\]

Mulliken charges

\[\delta_i = \sum_j M_{ij}\]
Returns:

A list : pop, charges

popnparray

Mulliken population on each atomic orbitals

chargesnparray

Mulliken charges

nuc_grad_method()[source]

Hook to create object for analytical nuclear gradients.

spin_square(mo_coeff=None, s=None)[source]

Spin square and multiplicity of UHF determinant

\[S^2 = \frac{1}{2}(S_+ S_- + S_- S_+) + S_z^2\]

where \(S_+ = \sum_i S_{i+}\) is effective for all beta occupied orbitals; \(S_- = \sum_i S_{i-}\) is effective for all alpha occupied orbitals.

  1. There are two possibilities for \(S_+ S_-\)
    1. same electron \(S_+ S_- = \sum_i s_{i+} s_{i-}\),

    \[\sum_i \langle UHF|s_{i+} s_{i-}|UHF\rangle = \sum_{pq}\langle p|s_+s_-|q\rangle \gamma_{qp} = n_\alpha\]

    2) different electrons \(S_+ S_- = \sum s_{i+} s_{j-}, (i\neq j)\). There are in total \(n(n-1)\) terms. As a two-particle operator,

    \[\langle S_+ S_- \rangle = \langle ij|s_+ s_-|ij\rangle - \langle ij|s_+ s_-|ji\rangle = -\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle\]
  2. Similarly, for \(S_- S_+\)
    1. same electron

    \[\sum_i \langle s_{i-} s_{i+}\rangle = n_\beta\]
    1. different electrons

    \[\langle S_- S_+ \rangle = -\langle i^\beta|j^\alpha\rangle \langle j^\alpha|i^\beta\rangle\]
  3. For \(S_z^2\)
    1. same electron

    \[\langle s_z^2\rangle = \frac{1}{4}(n_\alpha + n_\beta)\]
    1. different electrons

    \[\begin{split}&\frac{1}{2}\sum_{ij}(\langle ij|2s_{z1}s_{z2}|ij\rangle -\langle ij|2s_{z1}s_{z2}|ji\rangle) \\ &=\frac{1}{4}(\langle i^\alpha|i^\alpha\rangle \langle j^\alpha|j^\alpha\rangle - \langle i^\alpha|i^\alpha\rangle \langle j^\beta|j^\beta\rangle - \langle i^\beta|i^\beta\rangle \langle j^\alpha|j^\alpha\rangle + \langle i^\beta|i^\beta\rangle \langle j^\beta|j^\beta\rangle) \\ &-\frac{1}{4}(\langle i^\alpha|j^\alpha\rangle \langle j^\alpha|i^\alpha\rangle + \langle i^\beta|j^\beta\rangle\langle j^\beta|i^\beta\rangle) \\ &=\frac{1}{4}(n_\alpha^2 - n_\alpha n_\beta - n_\beta n_\alpha + n_\beta^2) -\frac{1}{4}(n_\alpha + n_\beta) \\ &=\frac{1}{4}((n_\alpha-n_\beta)^2 - (n_\alpha+n_\beta))\end{split}\]

In total

\[\begin{split}\langle S^2\rangle &= \frac{1}{2} (n_\alpha-\sum_{ij}\langle i^\alpha|j^\beta\rangle \langle j^\beta|i^\alpha\rangle +n_\beta -\sum_{ij}\langle i^\beta|j^\alpha\rangle\langle j^\alpha|i^\beta\rangle) + \frac{1}{4}(n_\alpha-n_\beta)^2 \\\end{split}\]
Args:
moa list of 2 ndarrays

Occupied alpha and occupied beta orbitals

Kwargs:
sndarray

AO overlap

Returns:

A list of two floats. The first is the expectation value of S^2. The second is the corresponding 2S+1

Examples:

>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz', charge=1, spin=1, verbose=0)
>>> mf = scf.UHF(mol)
>>> mf.kernel()
-75.623975516256706
>>> mo = (mf.mo_coeff[0][:,mf.mo_occ[0]>0], mf.mo_coeff[1][:,mf.mo_occ[1]>0])
>>> print('S^2 = %.7f, 2S+1 = %.7f' % spin_square(mo, mol.intor('int1e_ovlp_sph')))
S^2 = 0.7570150, 2S+1 = 2.0070027
stability(internal=True, external=False, verbose=None)[source]

Stability analysis for RHF/RKS method.

See also pyscf.scf.stability.uhf_stability function.

Args:

mf : UHF or UKS object

Kwargs:
internalbool

Internal stability, within the UHF space.

externalbool

External stability. Including the UHF -> GHF and real -> complex stability analysis.

Returns:

New orbitals that are more close to the stable condition. The return value includes two set of orbitals. The first corresponds to the internal stability and the second corresponds to the external stability.

pyscf.pbc.scf.kuhf.canonicalize(mf, mo_coeff_kpts, mo_occ_kpts, fock=None)[source]

Canonicalization diagonalizes the UHF Fock matrix within occupied, virtual subspaces separatedly (without change occupancy).

pyscf.pbc.scf.kuhf.dip_moment(cell, dm_kpts, unit='Debye', verbose=3, grids=None, rho=None, kpts=array([[0., 0., 0.]]))[source]

Dipole moment in the unit cell.

Args:

cell : an instance of Cell

dm_kpts (two lists of ndarrays) : KUHF density matrices of k-points

Return:

A list: the dipole moment on x, y and z components

pyscf.pbc.scf.kuhf.energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None)[source]

Following pyscf.scf.hf.energy_elec()

pyscf.pbc.scf.kuhf.get_fermi(mf, mo_energy_kpts=None, mo_occ_kpts=None)[source]

A pair of Fermi level for spin-up and spin-down orbitals

pyscf.pbc.scf.kuhf.get_occ(mf, mo_energy_kpts=None, mo_coeff_kpts=None)[source]

Label the occupancies for each orbital for sampled k-points.

This is a k-point version of scf.hf.SCF.get_occ

pyscf.pbc.scf.kuhf.init_guess_by_chkfile(cell, chkfile_name, project=None, kpts=None)[source]

Read the KHF results from checkpoint file, then project it to the basis defined by cell

Returns:

Density matrix, 3D ndarray

pyscf.pbc.scf.kuhf.make_rdm1(mo_coeff_kpts, mo_occ_kpts, **kwargs)[source]

Alpha and beta spin one particle density matrices for all k-points.

Returns:

dm_kpts : (2, nkpts, nao, nao) ndarray

pyscf.pbc.scf.kuhf.mulliken_meta(cell, dm_ao_kpts, verbose=5, pre_orth_method='ANO', s=None)[source]

A modified Mulliken population analysis, based on meta-Lowdin AOs.

Note this function only computes the Mulliken population for the gamma point density matrix.