pyscf.pbc.mp package¶
Submodules¶
pyscf.pbc.mp.kmp2 module¶
kpoint-adapted and spin-adapted MP2 t2[i,j,a,b] = <ij|ab> / 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)¶ Bases:
pyscf.mp.mp2.MP2
-
get_frozen_mask
()¶ Boolean mask for orbitals in k-point post-HF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for post-HF calculations.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object.- Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.
-
get_nmo
(per_kpoint=False)¶ Number of orbitals for k-point calculations.
Number of orbitals for use in a calculation with k-points, 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 k-points. Otherwise the number of orbitals is returned as a list of number of orbitals at each k-point.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of orbitals at each k-point.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 k-point calculations.
Number of occupied orbitals for use in a calculation with k-points, taking into account frozen orbitals.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each k-point. 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)¶ Args: with_t2 : bool
Whether to generate and hold t2 amplitudes in memory.
-
make_rdm1
(t2=None, kind='compact')¶ Spin-traced one-particle density matrix in the MO basis representation. The occupied-virtual orbital response is not included.
dm1[p,q] = <q_alpha^dagger p_alpha> + <q_beta^dagger p_beta>
The convention of 1-pdm is based on McWeeney’s book, Eq (5.4.20). The contraction between 1-particle 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 k-dependent MO basis sizes;
- Returns:
A k-dependent single-particle density matrix.
-
make_rdm2
(t2=None, kind='compact')¶ Spin-traced two-particle 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)¶ Boolean mask for orbitals in k-point post-HF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for post-HF calculations.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock 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)¶ Number of orbitals for k-point calculations.
Number of orbitals for use in a calculation with k-points, 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 k-points. Otherwise the number of orbitals is returned as a list of number of orbitals at each k-point.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of orbitals at each k-point.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)¶ Number of occupied orbitals for k-point calculations.
Number of occupied orbitals for use in a calculation with k-points, taking into account frozen orbitals.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each k-point. 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.
kernel
(mp, mo_energy, mo_coeff, verbose=3, with_t2=True)¶
-
pyscf.pbc.mp.kmp2.
make_rdm1
(mp, t2=None, kind='compact')¶ Spin-traced one-particle density matrix in the MO basis representation. The occupied-virtual orbital response is not included.
dm1[p,q] = <q_alpha^dagger p_alpha> + <q_beta^dagger p_beta>
The convention of 1-pdm is based on McWeeney’s book, Eq (5.4.20). The contraction between 1-particle 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 k-dependent MO basis sizes;
- Returns:
A k-dependent single-particle density matrix.
-
pyscf.pbc.mp.kmp2.
make_rdm2
(mp, t2=None, kind='compact')¶ Spin-traced two-particle 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)¶ Pads coefficients of active MOs.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. mo_coeff (ndarray): original non-padded molecular coefficients;- Returns:
Padded molecular coefficients.
-
pyscf.pbc.mp.kmp2.
padded_mo_energy
(mp, mo_energy)¶ Pads energies of active MOs.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. mo_energy (ndarray): original non-padded molecular energies;- Returns:
Padded molecular energies.
-
pyscf.pbc.mp.kmp2.
padding_k_idx
(mp, kind='split')¶ A convention used for padding vectors, matrices and tensors in case when occupation numbers depend on the k-point index.
This implementation stores k-dependent Fock and other matrix in dense arrays with additional dimensions corresponding to k-point indexes. In case when the occupation numbers depend on the k-point index (i.e. a metal) or when some k-points 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 post-Hartree-Fock 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 non-zero 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¶
kpoint-adapted unrestricted MP2 t2[i,j,a,b] = <ij|ab> / 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)¶ Bases:
pyscf.pbc.mp.kmp2.KMP2
-
get_frozen_mask
()¶ Boolean mask for orbitals in k-point post-HF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for post-HF calculations.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object.- Returns:
moidx (list of
ndarray
of np.bool): Boolean mask of orbitals to include.
-
get_nmo
(per_kpoint=False)¶ Number of orbitals for k-point calculations.
Number of orbitals for use in a calculation with k-points, 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 k-points. Otherwise the number of orbitals is returned as a list of number of orbitals at each k-point.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of orbitals at each k-point.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 k-point calculations.
Number of occupied orbitals for use in a calculation with k-points, taking into account frozen orbitals.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each k-point. 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 | +————————-+—————————————-+——————————-+ | 2-tuple 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 | +————————-+—————————————-+——————————-+
-
kernel
(mo_energy=None, mo_coeff=None)¶ Args: with_t2 : bool
Whether to generate and hold t2 amplitudes in memory.
-
-
pyscf.pbc.mp.kump2.
get_frozen_mask
(mp)¶ Boolean mask for orbitals in k-point post-HF method.
Creates a boolean mask to remove frozen orbitals and keep other orbitals for post-HF calculations.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock 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)¶ Number of orbitals for k-point calculations.
Number of orbitals for use in a calculation with k-points, 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 k-points. Otherwise the number of orbitals is returned as a list of number of orbitals at each k-point.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of orbitals at each k-point.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)¶ Number of occupied orbitals for k-point calculations.
Number of occupied orbitals for use in a calculation with k-points, taking into account frozen orbitals.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. per_kpoint (bool, optional): True returns the number of occupiedorbitals at each k-point. 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 | +————————-+—————————————-+——————————-+ | 2-tuple 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)¶ Pads coefficients of active MOs.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. mo_coeff (ndarray): original non-padded molecular coefficients;- Returns:
Padded molecular coefficients.
-
pyscf.pbc.mp.kump2.
padded_mo_energy
(mp, mo_energy)¶ Pads energies of active MOs.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock object. mo_energy (ndarray): original non-padded molecular energies;- Returns:
Padded molecular energies.
-
pyscf.pbc.mp.kump2.
padding_k_idx
(mp, kind='split')¶ For a description, see padding_k_idx in kmp2.py.
- Args:
mp (
MP2
): An instantiation of an SCF or post-Hartree-Fock 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 non-zero 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)¶ Bases:
pyscf.mp.gmp2.GMP2
-
ao2mo
(mo_coeff=None)¶
-
-
class
pyscf.pbc.mp.mp2.
RMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶ Bases:
pyscf.mp.mp2.MP2
-
ao2mo
(mo_coeff=None)¶
-
-
class
pyscf.pbc.mp.mp2.
UMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶ Bases:
pyscf.mp.ump2.UMP2
-
ao2mo
(mo_coeff=None)¶
-
Module contents¶
-
pyscf.pbc.mp.
GMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶
-
pyscf.pbc.mp.
KMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶
-
pyscf.pbc.mp.
KRMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶
-
pyscf.pbc.mp.
MP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶
-
pyscf.pbc.mp.
RMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶
-
pyscf.pbc.mp.
UMP2
(mf, frozen=None, mo_coeff=None, mo_occ=None)¶