pyscfad.dft.numint.NumInt.eval_rho#

static NumInt.eval_rho(mol, ao, dm, non0tab=None, xctype='LDA', hermi=0, with_lapl=True, verbose=None)[source]#

Calculate the electron density for LDA functional, and the density derivatives for GGA and MGGA functionals.

Args:

mol : an instance of Mole

ao2D array of shape (N,nao) for LDA, 3D array of shape (4,N,nao) for GGA

or meta-GGA. N is the number of grids, nao is the number of AO functions. If xctype is GGA (MGGA), ao[0] is AO value and ao[1:3] are the AO gradients. ao[4:10] are second derivatives of ao values if applicable.

dm2D array

Density matrix

Kwargs:
non0tab2D bool array

mask array to indicate whether the AO values are zero. The mask array can be obtained by calling make_mask()

xctypestr

LDA/GGA/mGGA. It affects the shape of the return density.

hermibool

dm is hermitian or not

verboseint or object of Logger

No effects.

Returns:

1D array of size N to store electron density if xctype = LDA; 2D array of (4,N) to store density and “density derivatives” for x,y,z components if xctype = GGA; For meta-GGA, returns can be a (6,N) (with_lapl=True) array where last two rows are nabla^2 rho and tau = 1/2(nabla f)^2 or (5,N) (with_lapl=False) where the last row is tau = 1/2(nabla f)^2

Examples:

>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz')
>>> coords = numpy.random.random((100,3))  # 100 random points
>>> ao_value = eval_ao(mol, coords, deriv=0)
>>> dm = numpy.random.random((mol.nao_nr(),mol.nao_nr()))
>>> dm = dm + dm.T
>>> rho, dx_rho, dy_rho, dz_rho = eval_rho(mol, ao, dm, xctype='LDA')