pyscf.pbc.dft.multigrid package#

Submodules#

pyscf.pbc.dft.multigrid.multigrid module#

Multigrid to compute DFT integrals

class pyscf.pbc.dft.multigrid.multigrid.MultiGridNumInt(cell)[source]#

Bases: StreamObject, LibXCMixin

build()[source]#
cache_xc_kernel(cell, grids, xc_code, mo_coeff, mo_occ, spin=0, kpts=None, max_memory=2000)[source]#
cache_xc_kernel1(cell, grids, xc_code, dm, spin=0, kpts=None, max_memory=2000)[source]#
get_j(dm, hermi=1, kpts=None, kpts_band=None, omega=None)[source]#
get_jk(dm, hermi=1, kpts=None, kpts_band=None, with_j=True, with_k=True, omega=None, exxdiv='ewald')[source]#
get_nuc(kpts=None)#
get_pp(kpts=None, max_memory=4000)#

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

get_rho(cell, dm, grids, kpts=array([[0., 0., 0.]]), max_memory=2000)[source]#
get_vxc(cell, grids, xc_code, dms, spin=0, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, with_j=False, return_j=False, verbose=None)#

Evaluate RKS/UKS XC functional and potential matrix. See nr_rks() and nr_uks() for more details.

nr_nlc_vxc(cell, grids, xc_code, dms, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, verbose=None)[source]#
nr_rks(cell, grids, xc_code, dm_kpts, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, verbose=None)[source]#
nr_rks_fxc(cell, grids, xc_code, dm0, dms, relativity=0, hermi=0, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None)[source]#
nr_rks_fxc_st(cell, grids, xc_code, dm0, dms_alpha, hermi=1, singlet=True, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None)[source]#
nr_uks(cell, grids, xc_code, dm_kpts, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, verbose=None)[source]#
nr_uks_fxc(cell, grids, xc_code, dm0, dms, relativity=0, hermi=0, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None)[source]#
nr_vxc(cell, grids, xc_code, dms, spin=0, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, with_j=False, return_j=False, verbose=None)[source]#

Evaluate RKS/UKS XC functional and potential matrix. See nr_rks() and nr_uks() for more details.

range_coulomb(omega)#

Creates a temporary density fitting object for RSH-DF integrals. In this context, only LR or SR integrals for mol and auxmol are computed.

reset(cell=None)[source]#
to_gpu(out=None)#

Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.

pyscf.pbc.dft.multigrid.multigrid.NumInt#

alias of MultiGridNumInt

pyscf.pbc.dft.multigrid.multigrid.cache_xc_kernel(mydf, xc_code, mo_coeff, mo_occ, spin=0, kpts=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.cache_xc_kernel1(mydf, xc_code, dm, spin=0, kpts=None)[source]#

Compute the 0th order density, Vxc and fxc. They can be used in TDDFT, DFT hessian module etc.

pyscf.pbc.dft.multigrid.multigrid.eval_mat(cell, weights, shls_slice=None, comp=1, hermi=0, xctype='LDA', kpts=None, mesh=None, offset=None, submesh=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.eval_rho(cell, dm, shls_slice=None, hermi=0, xctype='LDA', kpts=None, mesh=None, offset=None, submesh=None, ignore_imag=False, out=None)[source]#

Collocate the real density (opt. gradients) on the real-space grid.

Kwargs:
ignore_image :

The output density is assumed to be real if ignore_imag=True.

pyscf.pbc.dft.multigrid.multigrid.get_j_kpts(mydf, dm_kpts, hermi=1, kpts=array([[0., 0., 0.]]), 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.

kpts : (nkpts, 3) ndarray

Kwargs:
kpts_band(3,) ndarray or (*,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.dft.multigrid.multigrid.get_nuc(mydf, kpts=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.get_pp(mydf, kpts=None, max_memory=4000)[source]#

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

pyscf.pbc.dft.multigrid.multigrid.get_rho(mydf, dm, kpts=None)[source]#

Density in real space

pyscf.pbc.dft.multigrid.multigrid.multi_grids_tasks(cell, fft_mesh=None, verbose=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.multi_grids_tasks_for_ke_cut(cell, fft_mesh=None, verbose=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.multi_grids_tasks_for_rcut(cell, fft_mesh=None, verbose=None)[source]#
pyscf.pbc.dft.multigrid.multigrid.multigrid(mf)#

Use MultiGridNumInt to replace the default FFTDF integration method in the DFT object.

pyscf.pbc.dft.multigrid.multigrid.multigrid_fftdf(mf)[source]#

Use MultiGridNumInt to replace the default FFTDF integration method in the DFT object.

pyscf.pbc.dft.multigrid.multigrid.nr_rks(mydf, xc_code, dm_kpts, hermi=1, kpts=None, kpts_band=None, with_j=False, return_j=False, verbose=None)[source]#

Compute the XC energy and RKS XC matrix at sampled k-points. multigrid version of function pbc.dft.numint.nr_rks.

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

Density matrix at each k-point.

kpts : (nkpts, 3) ndarray

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

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

Returns:

exc : XC energy nelec : number of electrons obtained from the numerical integration veff : (nkpts, nao, nao) ndarray

or list of veff if the input dm_kpts is a list of DMs

vj(nkpts, nao, nao) ndarray

or list of vj if the input dm_kpts is a list of DMs

pyscf.pbc.dft.multigrid.multigrid.nr_rks_fxc(mydf, xc_code, dm0, dms, hermi=0, with_j=False, rho0=None, vxc=None, fxc=None, kpts=None, verbose=None)[source]#

multigrid version of function pbc.dft.numint.nr_rks_fxc

pyscf.pbc.dft.multigrid.multigrid.nr_rks_fxc_st(mydf, xc_code, dm0, dms_alpha, hermi=1, singlet=True, rho0=None, vxc=None, fxc=None, kpts=None, with_j=False, verbose=None)[source]#

multigrid version of function pbc.dft.numint.nr_rks_fxc_st

pyscf.pbc.dft.multigrid.multigrid.nr_uks(mydf, xc_code, dm_kpts, hermi=1, kpts=None, kpts_band=None, with_j=False, return_j=False, verbose=None)[source]#

Compute the XC energy and UKS XC matrix at sampled k-points. multigrid version of function pbc.dft.numint.nr_uks

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

Density matrix at each k-point.

kpts : (nkpts, 3) ndarray

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

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

Returns:

exc : XC energy nelec : number of electrons obtained from the numerical integration veff : (2, nkpts, nao, nao) ndarray

or list of veff if the input dm_kpts is a list of DMs

vj(nkpts, nao, nao) ndarray

or list of vj if the input dm_kpts is a list of DMs

pyscf.pbc.dft.multigrid.multigrid.nr_uks_fxc(mydf, xc_code, dm0, dms, hermi=0, with_j=False, rho0=None, vxc=None, fxc=None, kpts=None, verbose=None)[source]#

multigrid version of function pbc.dft.numint.nr_uks_fxc

pyscf.pbc.dft.multigrid.multigrid_pair module#

class pyscf.pbc.dft.multigrid.multigrid_pair.MultiGridNumInt(cell)[source]#

Bases: MultiGridNumInt

Base class for multigrid DFT (version 2).

Attributes:
task_listTaskList instance

Task list recording which primitive basis function pairs need to be considered.

vpplocG_part1ndarray

Long-range part of the local pseudopotential represented in the reciprocal space. It is cached to reduce cost.

rhoGndarray

Electronic density represented in the reciprocal space. It is cached in nuclear gradient calculations to reduce cost.

cache_xc_kernel = NotImplemented#
cache_xc_kernel1 = NotImplemented#
get_nuc(kpts=None, deriv=0)#
get_nuc_ip1(kpts=None)#
get_nuc_nuc_grad(dm, kpts=None)#
get_pp(kpts=None, return_full=False)[source]#

Return the GTH pseudopotential (PP) matrix in AO basis, with contribution from G=0 removed.

By default, the returned PP includes the short-range part of the local potential and the non-local potential. The long-range part of the local potential is cached as vpplocG_part1, which is the reciprocal space representation, to be added to the electron density Coulomb potential for computing the Coulomb matrix. In order to get the full PP matrix, set return_full to True.

Kwargs:
return_full: bool

If True, the returned PP also contains the long-range part. Default is False.

get_rho = NotImplemented#
get_veff_ip1(dm, xc_code=None, kpts=None, kpts_band=None, spin=0)[source]#
get_vpploc_part1_ip1(kpts=array([[0., 0., 0.]]))#
ke_ratio = 3.0#
property ngrids#
nr_rks(cell, grids, xc_code, dm_kpts, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, verbose=None)[source]#
nr_rks_fxc = NotImplemented#
nr_rks_fxc_st = NotImplemented#
nr_uks(cell, grids, xc_code, dm_kpts, relativity=0, hermi=1, kpts=None, kpts_band=None, max_memory=2000, verbose=None)[source]#
nr_uks_fxc = NotImplemented#
ntasks = 4#
rel_cutoff = 20.0#
reset(cell=None)[source]#
vpploc_part1_nuc_grad(dm, kpts=array([[0., 0., 0.]]), atm_id=None, precision=None)#
pyscf.pbc.dft.multigrid.multigrid_pair.eval_mat(cell, weights, task_list, shls_slice=None, comp=1, hermi=0, deriv=0, xctype='LDA', kpts=None, grid_level=None, dimension=None, mesh=None, cell1=None, shls_slice1=None, a=None)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.eval_rho(cell, dm, task_list, shls_slice=None, hermi=0, xctype='LDA', kpts=None, dimension=None, cell1=None, shls_slice1=None, a=None, ignore_imag=False)[source]#

Collocate density (and gradients) on the real-space grid.

The two sets of Gaussian basis functions can be different.

Returns:
rho: RS_Grid object

Densities on real space multigrids.

pyscf.pbc.dft.multigrid.multigrid_pair.get_nuc(mydf, kpts=None, deriv=0)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.get_nuc_ip1(mydf, kpts=None)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.get_nuc_nuc_grad(mydf, dm, kpts=None)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.get_veff_ip1(mydf, dm_kpts, xc_code=None, kpts=array([[0., 0., 0.]]), kpts_band=None, spin=0)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.multi_grids_tasks(cell, ke_cutoff=None, hermi=0, ntasks=4, ke_ratio=3.0, rel_cutoff=20.0)[source]#
pyscf.pbc.dft.multigrid.multigrid_pair.nr_rks(mydf, xc_code, dm_kpts, hermi=1, kpts=None, kpts_band=None, with_j=False, return_j=False, verbose=None)[source]#

Compute the XC energy and RKS XC matrix using the multigrid algorithm.

See also multigrid.nr_rks.

pyscf.pbc.dft.multigrid.multigrid_pair.nr_uks(mydf, xc_code, dm_kpts, hermi=1, kpts=None, kpts_band=None, with_j=False, return_j=False, verbose=None)[source]#

pyscf.pbc.dft.multigrid.pp module#

pyscf.pbc.dft.multigrid.pp.fake_cell_vloc_part1(cell, atm_id=None, precision=None)[source]#

Generate fakecell for the long-range term of the local part of the GTH pseudo-potential. Also stores the atomic radii. Differs from pp_int.fake_cell_vloc(cell, cn=0) in the normalization factors.

pyscf.pbc.dft.multigrid.pp.get_pp_loc_part1_gs(cell, Gv)[source]#
pyscf.pbc.dft.multigrid.pp.get_vpploc_part1_ip1(mydf, kpts=array([[0., 0., 0.]]))[source]#
pyscf.pbc.dft.multigrid.pp.make_rho_core(cell, mesh=None, precision=None, atm_id=None)[source]#
pyscf.pbc.dft.multigrid.pp.vpploc_part1_nuc_grad(mydf, dm, kpts=array([[0., 0., 0.]]), atm_id=None, precision=None)[source]#

pyscf.pbc.dft.multigrid.utils module#

Module contents#