vayesta.core.ao2mo
Submodules
vayesta.core.ao2mo.helper
- vayesta.core.ao2mo.helper.get_kconserv(cell, kpts, nk=3)[source]
Get the momentum conservation array for a set of k-points.
Given k-point indices (k, l, m) the array kconserv[k,l,m] returns the index n that satifies momentum conservation,
- nk=1:
(k(k) - k(n)) dot a = 2npi
- nk=2:
(k(k) - k(l) - k(n)) dot a = 2npi
- nk=3:
(k(k) - k(l) + k(m) - k(n)) dot a = 2npi
- This is used for symmetry e.g. integrals of the form
[phi*[k](1) phi[l](1) | phi*[m](2) phi[n](2)]
are zero unless n satisfies the above.
- vayesta.core.ao2mo.helper.get_full_array(eris, mo_coeff=None, out=None)[source]
Get dense ERI array from CCSD _ChemistEris object.
- vayesta.core.ao2mo.helper.get_full_array_rhf(eris, mo_coeff=None, out=None)[source]
Get dense ERI array from CCSD _ChemistEris object.
- vayesta.core.ao2mo.helper.get_full_array_uhf(eris, mo_coeff=None, out=None)[source]
Get dense ERI array from CCSD _ChemistEris object.
- vayesta.core.ao2mo.helper.contract_dm2_eris(dm2, eris)[source]
Contracts _ChemistsERIs with the two-body density matrix.
- Parameters:
dm2 (ndarry or (ndarray, ndarray, ndarray)) – Two-body density matrix or tuple of alpha-alpha, alpha-beta, beta-beta spin blocks for UHF.
eris (_ChemistERIs) – PySCF ERIs object.
- Returns:
e2 – Two-body energy.
- Return type:
float
- vayesta.core.ao2mo.helper.contract_dm2_eris_rhf(dm2, eris)[source]
Contracts _ChemistsERIs with the two-body density matrix.
- Parameters:
dm2 (ndarry) – Two-body density matrix.
eris (_ChemistERIs) – PySCF ERIs object.
- Returns:
e2 – Two-body energy.
- Return type:
float
- vayesta.core.ao2mo.helper.contract_dm2_eris_uhf(dm2, eris)[source]
Contracts _ChemistsERIs with the two-body density matrix.
- Parameters:
dm2 (tuple(ndarray, ndarray, ndarray)) – Two-body density matrix as a tuple of alpha-alpha, alpha-beta, beta-beta spin blocks.
eris (_ChemistERIs) – PySCF ERIs object.
- Returns:
e2 – Two-body energy.
- Return type:
float
- vayesta.core.ao2mo.helper.contract_dm2intermeds_eris_rhf(dm2, eris, destroy_dm2=True)[source]
Contracts _ChemistsERIs with the two-body density matrix.
- Parameters:
dm2 (tuple) – Intermediates of spin-restricted two-body density matrix.
eris (_ChemistERIs) – PySCF ERIs object.
- Returns:
e2 – Two-body energy.
- Return type:
float
- vayesta.core.ao2mo.helper.contract_dm2intermeds_eris_uhf(dm2, eris, destroy_dm2=True)[source]
Contracts _ChemistsERIs with the two-body density matrix.
- Parameters:
dm2 (tuple) – Intermediates of spin-unrestricted two-body density matrix.
eris (_ChemistERIs) – PySCF ERIs object.
- Returns:
e2 – Two-body energy.
- Return type:
float
- vayesta.core.ao2mo.helper.project_ccsd_eris(eris, mo_coeff, nocc, ovlp, check_subspace=True)[source]
Project CCSD ERIs to a subset of orbital coefficients.
- Parameters:
eris (_ChemistERIs) – PySCF ERIs object
mo_coeff ((n(AO), n(MO)) array) – New subspace MO coefficients.
nocc (int) – Number of occupied orbitals.
ovlp ((n(AO), n(AO)) array) – AO overlap matrix.
check_subspace (bool, optional) – Check if c_occ and c_vir span a subspace of eris.mo_coeff. Return None if Not. Default: True.
- Returns:
eris – ERIs with transformed integral values, as well as transformed attributes mo_coeff, fock, and mo_energy.
- Return type:
_ChemistERIs or None
vayesta.core.ao2mo.kao2gmo
AO to MO transformation from k-space (AOs) to supercell real space (MOs)
Author: Max Nusspickel Email: max.nusspickel@gmail.com
- vayesta.core.ao2mo.kao2gmo.kao2gmo_cderi(gdf, mo_coeffs, make_real=True, blksize=None, tril_kij=True, driver=None)[source]
Transform density-fitted ERIs from primtive cell k-AO, to Gamma-point MOs.
(L|ka,k’b) * C1_(Ra)i * C2_(R’b)j -> (R’’L|Ri,R’j)
- Parameters:
gdf (pyscf.pbc.df.GDF) – Gaussian density-fitting object of primitive unit cell.
mo_coeffs (array or tuple(2) of arrays) – MO coefficients C1_(Ra)i and C2_(R’b)j for the transformation. If only one coefficient matrix is passed, it will be used for both C1 and C2.
make_real (bool, optional) – Fourier-transform the auxiliary DF dimension, such that the final three-center integrals are real. Default: True.
blksize (int, optional) – Blocksize for the auxiliary dimension.
tril_kij (bool, optional) – Only load k-point pairs k >= k’, and use the symmetry (L|ka,k’b) = (L|k’b,ka)*. Default: True.
driver ({None, 'c', 'python'}) – Use Python or C driver for the transformation. If None, use C if compiled library is present, if so use C, else use python. Default: None.
- Returns:
cderi_mo (array) – Density-fitted supercell three-center integrals in MO basis.
cderi_mo_neg (array or None) – Negative part of density-fitted supercell three-center integrals in MO basis. None for 3D systems.
vayesta.core.ao2mo.postscf_ao2mo
- vayesta.core.ao2mo.postscf_ao2mo.postscf_ao2mo(postscf, mo_coeff=None, fock=None, mo_energy=None, e_hf=None)[source]
AO to MO transformation of ERIs for post-SCF calculations.
Use this as postscf_ao2mo(cc,…) instead of cc.ao2mo(…) to allow control of eris.fock, eris.mo_energy, and eris.e_hf.
- Parameters:
postscf (PySCF Post-SCF method) – Instance of MP2, DFMP2, CCSD, RCCSD, or DFCCSD, with attribute mo_coeff set.
mo_coeff (array, optional) – MO coefficients for the AO to MO transformation. If None, PySCF uses postscf.mo_coeff. Default: None.
fock (array, optional) – Fock matrix in AO representation. If None, PySCF uses postscf._scf.get_fock(). Default: None.
mo_energy (array, optional) – Active MO energies. If None, PySCF uses fock.diagonal(). Default: None.
e_hf (float, optional) – Mean-field energy. If None, PySCF calculates this as postscf._scf.energy_tot(). Default: None.
- Returns:
eris – PySCF ERIs object which can be used for the respective post-SCF calculation.
- Return type:
_ChemistsERIs
- vayesta.core.ao2mo.postscf_ao2mo.postscf_kao2gmo(postscf, gdf, fock, mo_energy, e_hf=None, mo_coeff=None)[source]
k-AO to Gamma-MO transformation of ERIs for post-SCF calculations of supercells.
This can be used to avoid performing the expensive density-fitting in the supercell, if a smaller primitive unit cell exists.
- Parameters:
postscf (PySCF Post-SCF method) – Instance of MP2, DFMP2, CCSD, RCCSD, or DFCCSD, with attribute mo_coeff set.
gdf (PySCF Gaussian density-fitting object) – Density-fitting object of the primitive unit cell.
fock (array) – Fock matrix in AO representation.
mo_energy (array) – Active MO energies.
e_hf (float) – Mean-field energy.
mo_coeff (array, optional) – MO coefficients for the AO to MO transformation. If None, PySCF uses postscf.mo_coeff. Default: None.
- Returns:
eris – PySCF ERIs object which can be used for the respective supercell post-SCF calculation.
- Return type:
_ChemistsERIs
- vayesta.core.ao2mo.postscf_ao2mo.postscf_kao2gmo_uhf(postscf, gdf, fock, mo_energy, e_hf=None, mo_coeff=None)[source]
k-AO to Gamma-MO transformation of ERIs for unrestricted post-SCF calculations of supercells.
This can be used to avoid performing the expensive density-fitting in the supercell, if a smaller primitive unit cell exists.
- Parameters:
postscf (PySCF Post-SCF method) – Instance of UMP2 or UCCSD, with attribute mo_coeff set.
gdf (PySCF Gaussian density-fitting object) – Density-fitting object of the primitive unit cell.
fock (tuple(2) of arrays) – Fock matrix in AO representation (alpha, beta).
mo_energy (tuple(2) or arrays) – Active MO energies (alpha, beta).
e_hf (float) – Mean-field energy.
mo_coeff (tuple(2) of arrays, optional) – MO coefficients for the AO to MO transformation (alpha, beta). If None, PySCF uses postscf.mo_coeff. Default: None.
- Returns:
eris – PySCF ERIs object which can be used for the respective supercell post-SCF calculation.
- Return type:
_ChemistsERIs
vayesta.core.ao2mo.pyscf_eris
- vayesta.core.ao2mo.pyscf_eris.make_ccsd_eris(fock, eris, nocc, mo_energy=None)[source]
Generate _ChemistERIs object for pyscf.cc.ccsd.CCSD.
- Parameters:
fock (array) – Fock matrix in MO basis.
eris (array) – Electron-repulsion integrals in MO basis.
nocc (int) – Number of occupied orbitals.
mo_energy (array, optional) – MO energies. Used for the initial guess and preconditioning. Default: fock.diagonal().
- Returns:
eris – ERI object as used by pyscf.cc.ccsd.CCSD.
- Return type:
pyscf.cc.ccsd._ChemistERIs
- vayesta.core.ao2mo.pyscf_eris.make_uccsd_eris(fock, eris, nocc, mo_energy=None)[source]
Generate _ChemistERIs object for pyscf.cc.uccsd.UCCSD.
- Parameters:
fock (tuple(2) of arrays) – Fock matrix in MO basis.
eris (tuple(3) of arrays) – Electron-repulsion integrals in MO basis.
nocc (tuple(2) of ints) – Number of occupied orbitals.
mo_energy (tuple(2) of arrays, optional) – MO energies. Used for the initial guess and preconditioning. Default: fock.diagonal().
- Returns:
eris – ERI object as used by pyscf.cc.uccsd.UCCSD.
- Return type:
pyscf.cc.uccsd._ChemistERIs