pyscf.pbc.mp package¶
Submodules¶
pyscf.pbc.mp.kmp2 module¶
kpointadapted and spinadapted MP2 t2[i,j,a,b] = <ijab> / D_ij^ab
t2 and eris are never stored in full, only a partial eri of size (nkpts,nocc,nocc,nvir,nvir)

class
pyscf.pbc.mp.kmp2.
KMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]¶ Bases:
pyscf.mp.mp2.MP2

get_frozen_mask
()¶ Boolean mask for orbitals in kpoint postHF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for postHF calculations.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.

get_nmo
(per_kpoint=False)¶ Number of orbitals for kpoint calculations.
Number of orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Note:
If per_kpoint is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all kpoints. Otherwise the number of orbitals is returned as a list of number of orbitals at each kpoint.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of orbitals at each kpoint.For a description of False, see Note.
 Returns:
 nmo (int, list of int): Number of orbitals. For return type, see description of arg
per_kpoint.

get_nocc
(per_kpoint=False)¶ Number of occupied orbitals for kpoint calculations.
Number of occupied orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each kpoint. False gives the max of this list.
 Returns:
 nocc (int, list of int): Number of occupied orbitals. For return type, see description of arg
per_kpoint.

kernel
(mo_energy=None, mo_coeff=None, with_t2=True)[source]¶ Args: with_t2 : bool
Whether to generate and hold t2 amplitudes in memory.

make_rdm1
(t2=None, kind='compact')¶ Spintraced oneparticle density matrix in the MO basis representation. The occupiedvirtual orbital response is not included.
dm1[p,q] = <q_alpha^dagger p_alpha> + <q_beta^dagger p_beta>
The convention of 1pdm is based on McWeeney’s book, Eq (5.4.20). The contraction between 1particle Hamiltonian and rdm1 is E = einsum(‘pq,qp’, h1, rdm1)
 Args:
mp (KMP2): a KMP2 kernel object; t2 (ndarray): a t2 MP2 tensor; kind (str): either ‘compact’ or ‘padded’  defines behavior for kdependent MO basis sizes;
 Returns:
A kdependent singleparticle density matrix.

make_rdm2
(t2=None, kind='compact')¶ Spintraced twoparticle density matrix in MO basis
\[dm2[p,q,r,s] = \sum_{\sigma,\tau} <p_\sigma^\dagger r_\tau^\dagger s_\tau q_\sigma>\]Note the contraction between ERIs (in Chemist’s notation) and rdm2 is E = einsum(‘pqrs,pqrs’, eri, rdm2)


pyscf.pbc.mp.kmp2.
KRMP2
¶ alias of
pyscf.pbc.mp.kmp2.KMP2

pyscf.pbc.mp.kmp2.
get_frozen_mask
(mp)[source]¶ Boolean mask for orbitals in kpoint postHF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for postHF calculations.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.

pyscf.pbc.mp.kmp2.
get_nmo
(mp, per_kpoint=False)[source]¶ Number of orbitals for kpoint calculations.
Number of orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Note:
If per_kpoint is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all kpoints. Otherwise the number of orbitals is returned as a list of number of orbitals at each kpoint.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of orbitals at each kpoint.For a description of False, see Note.
 Returns:
 nmo (int, list of int): Number of orbitals. For return type, see description of arg
per_kpoint.

pyscf.pbc.mp.kmp2.
get_nocc
(mp, per_kpoint=False)[source]¶ Number of occupied orbitals for kpoint calculations.
Number of occupied orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each kpoint. False gives the max of this list.
 Returns:
 nocc (int, list of int): Number of occupied orbitals. For return type, see description of arg
per_kpoint.

pyscf.pbc.mp.kmp2.
make_rdm1
(mp, t2=None, kind='compact')[source]¶ Spintraced oneparticle density matrix in the MO basis representation. The occupiedvirtual orbital response is not included.
dm1[p,q] = <q_alpha^dagger p_alpha> + <q_beta^dagger p_beta>
The convention of 1pdm is based on McWeeney’s book, Eq (5.4.20). The contraction between 1particle Hamiltonian and rdm1 is E = einsum(‘pq,qp’, h1, rdm1)
 Args:
mp (KMP2): a KMP2 kernel object; t2 (ndarray): a t2 MP2 tensor; kind (str): either ‘compact’ or ‘padded’  defines behavior for kdependent MO basis sizes;
 Returns:
A kdependent singleparticle density matrix.

pyscf.pbc.mp.kmp2.
make_rdm2
(mp, t2=None, kind='compact')[source]¶ Spintraced twoparticle density matrix in MO basis
\[dm2[p,q,r,s] = \sum_{\sigma,\tau} <p_\sigma^\dagger r_\tau^\dagger s_\tau q_\sigma>\]Note the contraction between ERIs (in Chemist’s notation) and rdm2 is E = einsum(‘pqrs,pqrs’, eri, rdm2)

pyscf.pbc.mp.kmp2.
padded_mo_coeff
(mp, mo_coeff)[source]¶ Pads coefficients of active MOs.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. mo_coeff (ndarray): original nonpadded molecular coefficients; Returns:
Padded molecular coefficients.

pyscf.pbc.mp.kmp2.
padded_mo_energy
(mp, mo_energy)[source]¶ Pads energies of active MOs.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. mo_energy (ndarray): original nonpadded molecular energies; Returns:
Padded molecular energies.

pyscf.pbc.mp.kmp2.
padding_k_idx
(mp, kind='split')[source]¶ A convention used for padding vectors, matrices and tensors in case when occupation numbers depend on the kpoint index.
This implementation stores kdependent Fock and other matrix in dense arrays with additional dimensions corresponding to kpoint indexes. In case when the occupation numbers depend on the kpoint index (i.e. a metal) or when some kpoints have more Bloch basis functions than others the corresponding data structure has to be padded with entries that are not used (fictitious occupied and virtual degrees of freedom). Current convention stores these states at the Fermi level as shown in the following example.
In the above example, get_nmo(mp, per_kpoint=True) == (6, 6, 5), get_nocc(mp, per_kpoint) == (2, 3, 2). The resulting dense get_nmo(mp) == 7 and get_nocc(mp) == 3 correspond to padded dimensions. This function will return the following indexes corresponding to the filled entries of the above table:
>>> padding_k_idx(mp, kind="split") ([(0, 1), (0, 1, 2), (0, 1)], [(0, 1, 2, 3), (1, 2, 3), (1, 2, 3)])
>>> padding_k_idx(mp, kind="joint") [(0, 1, 3, 4, 5, 6), (0, 1, 2, 4, 5, 6), (0, 1, 4, 5, 6)]
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. kind (str): either “split” (occupied and virtual spaces are split) or “joint” (occupied and virtual spaces are the joint; Returns:
Two lists corresponding to the occupied and virtual spaces for kind=”split”. Each list contains integer arrays with indexes pointing to actual nonzero entries in the padded vector/matrix/tensor. If kind=”joint”, a single list of arrays is returned corresponding to the entire MO space.
pyscf.pbc.mp.kump2 module¶
kpointadapted unrestricted MP2 t2[i,j,a,b] = <ijab> / D_ij^ab
t2 and eris are never stored in full, only a partial eri of size (nkpts,nocc,nocc,nvir,nvir)

class
pyscf.pbc.mp.kump2.
KUMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]¶ Bases:
pyscf.pbc.mp.kmp2.KMP2

get_frozen_mask
()¶ Boolean mask for orbitals in kpoint postHF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for postHF calculations.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.

get_nmo
(per_kpoint=False)¶ Number of orbitals for kpoint calculations.
Number of orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Note:
If per_kpoint is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all kpoints. Otherwise the number of orbitals is returned as a list of number of orbitals at each kpoint.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of orbitals at each kpoint.For a description of False, see Note.
 Returns:
 nmo (int, list of int): Number of orbitals. For return type, see description of arg
per_kpoint.

get_nocc
(per_kpoint=False)¶ Number of occupied orbitals for kpoint calculations.
Number of occupied orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each kpoint. False gives the max of this list.
 Returns:
 nocc (int, list of int): Number of occupied orbitals. For return type, see description of arg
per_kpoint.
 Notes:
For specifying frozen orbitals inside mp, the following options are accepted:
+=========================+========================================+===============================+  Argument (Example)  Argument Meaning  Example Meaning  +=========================+========================================+===============================+  int (1)  Freeze the same number of orbitals  Freeze one (lowest) orbital    regardless of spin and/or kpt  for all kpts and spin cases  +————————+—————————————+——————————+  2tuple of list of int  inner list: List of orbitals indices  Freeze the orbitals [0,4] for   ([0, 4], [0, 5, 6])  to freeze at all kpts  spin0, and orbitals [0,5,6]    outer list: Spin index  for spin1 at all kpts  +————————+—————————————+——————————+  list(2) of list of list  inner list: list of orbital indices to  Freeze orbital 0 for spin0 at   ([[0,],[]],  freeze at each kpt for given spin  kpt0, and freeze orbital 0,1   [[0,1],[4]])  outer list: spin index  for spin1 at kpt0 and orbital     4 at kpt1  +————————+—————————————+——————————+


pyscf.pbc.mp.kump2.
get_frozen_mask
(mp)[source]¶ Boolean mask for orbitals in kpoint postHF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for postHF calculations.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.

pyscf.pbc.mp.kump2.
get_nmo
(mp, per_kpoint=False)[source]¶ Number of orbitals for kpoint calculations.
Number of orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Note:
If per_kpoint is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all kpoints. Otherwise the number of orbitals is returned as a list of number of orbitals at each kpoint.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of orbitals at each kpoint.For a description of False, see Note.
 Returns:
 nmo (int, list of int): Number of orbitals. For return type, see description of arg
per_kpoint.

pyscf.pbc.mp.kump2.
get_nocc
(mp, per_kpoint=False)[source]¶ Number of occupied orbitals for kpoint calculations.
Number of occupied orbitals for use in a calculation with kpoints, taking into account frozen orbitals.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each kpoint. False gives the max of this list.
 Returns:
 nocc (int, list of int): Number of occupied orbitals. For return type, see description of arg
per_kpoint.
 Notes:
For specifying frozen orbitals inside mp, the following options are accepted:
+=========================+========================================+===============================+  Argument (Example)  Argument Meaning  Example Meaning  +=========================+========================================+===============================+  int (1)  Freeze the same number of orbitals  Freeze one (lowest) orbital    regardless of spin and/or kpt  for all kpts and spin cases  +————————+—————————————+——————————+  2tuple of list of int  inner list: List of orbitals indices  Freeze the orbitals [0,4] for   ([0, 4], [0, 5, 6])  to freeze at all kpts  spin0, and orbitals [0,5,6]    outer list: Spin index  for spin1 at all kpts  +————————+—————————————+——————————+  list(2) of list of list  inner list: list of orbital indices to  Freeze orbital 0 for spin0 at   ([[0,],[]],  freeze at each kpt for given spin  kpt0, and freeze orbital 0,1   [[0,1],[4]])  outer list: spin index  for spin1 at kpt0 and orbital     4 at kpt1  +————————+—————————————+——————————+

pyscf.pbc.mp.kump2.
padded_mo_coeff
(mp, mo_coeff)[source]¶ Pads coefficients of active MOs.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. mo_coeff (ndarray): original nonpadded molecular coefficients; Returns:
Padded molecular coefficients.

pyscf.pbc.mp.kump2.
padded_mo_energy
(mp, mo_energy)[source]¶ Pads energies of active MOs.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. mo_energy (ndarray): original nonpadded molecular energies; Returns:
Padded molecular energies.

pyscf.pbc.mp.kump2.
padding_k_idx
(mp, kind='split')[source]¶ For a description, see padding_k_idx in kmp2.py.
 Args:
mp (
MP2
): An instantiation of an SCF or postHartreeFock object. kind (str): either “split” (occupied and virtual spaces are split) or “joint” (occupied and virtual spaces are the joint; Returns:
Two lists corresponding to the occupied and virtual spaces for kind=”split”. Each list contains integer arrays with indexes pointing to actual nonzero entries in the padded vector/matrix/tensor. If kind=”joint”, a single list of arrays is returned corresponding to the entire MO space.
pyscf.pbc.mp.mp2 module¶

class
pyscf.pbc.mp.mp2.
GMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]¶ Bases:
pyscf.mp.gmp2.GMP2

class
pyscf.pbc.mp.mp2.
RMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]¶ Bases:
pyscf.mp.mp2.MP2

class
pyscf.pbc.mp.mp2.
UMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]¶ Bases:
pyscf.mp.ump2.UMP2
Module contents¶

pyscf.pbc.mp.
KMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶

pyscf.pbc.mp.
MP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶