Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Dec 17, 2024
1 parent a289557 commit 255e567
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pyscf/lib/vhf/nr_sr_vhf.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ void CVHFnr_sr_int2e_q_cond(int (*intor)(), CINTOpt *cintopt, float *q_cond,
float ai, aj, aij, ai_aij, a1, ci, cj;
float xi, yi, zi, xj, yj, zj, xij, yij, zij;
float dx, dy, dz, r2, r, v, log_fac, r_guess, theta, theta_r;
float u, ti, tj, ti_fac, tj_fac;
float fi, fj, u, ti, tj, ti_fac, tj_fac;
double qtmp, tmp;
float log_qmax;
int shls[4];
Expand Down
23 changes: 12 additions & 11 deletions pyscf/pbc/df/ft_ao.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ def get_ovlp_mask(self, cutoff=None):
fac_dri = (li * .5/aij + dri**2) ** (li*.5)
fac_drj = (lj * .5/aij + drj**2) ** (lj*.5)
fl = 2*np.pi/vol * (dr/theta[:,None,None,:]) + 1.
# See also lib/vhf/nr_sr_vhf.c the comments of the upper bound
# estimation for CVHFnr_sr_int2e_q_cond.
ovlp = ((cell_cs[:,None]*((2*li+1)/(4*np.pi))**.5) *
(supmol_cs*((2*lj+1)/(4*np.pi))**.5) * (np.pi/aij)**1.5 *
np.exp(-theta*dr**2) * fac_dri * fac_drj * fl)
Expand Down Expand Up @@ -774,18 +776,17 @@ def estimate_rcut(cell, precision=None):
norm_ang = ((2*li+1)*(2*lj+1))**.5/(4*np.pi)
c1 = ci * cj * norm_ang
theta = ai * aj / aij
aij1 = aij**-.5
fac = np.pi**1.5*c1 * aij1**(lij+3) * (2*aij/np.pi)**.25 * aij**lij
fac = c1 * (np.pi/aij)**1.5 * (2*aij/np.pi)**.25
fac /= precision

r0 = cell.rcut
dri = aj*aij1 * r0 + 1.
drj = ai*aij1 * r0 + 1.
fl = 2*np.pi/cell.vol * r0/theta
r0 = (np.log(fac * dri**li * drj**lj * fl + 1.) / theta)**.5

dri = aj*aij1 * r0 + 1.
drj = ai*aij1 * r0 + 1.
fl = 2*np.pi/cell.vol * r0/theta
r0 = (np.log(fac * dri**li * drj**lj * fl + 1.) / theta)**.5
fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/cell.vol * r0/theta + 1.
r0 = (np.log(fac * fac_dri * fac_drj * fl + 1.) / theta)**.5

fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/cell.vol * r0/theta + 1.
r0 = (np.log(fac * fac_dri * fac_drj * fl + 1.) / theta)**.5
return r0
38 changes: 14 additions & 24 deletions pyscf/pbc/df/rsdf_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,24 +1525,19 @@ def estimate_ft_rcut(rs_cell, precision=None, exclude_dd_block=False):
norm_ang = ((2*li+1)*(2*lj+1))**.5/(4*np.pi)
c1 = ci * cj * norm_ang
theta = ai * aj / aij
aij1 = aij**-.5
fac = np.pi**1.5*c1 * aij1**(lij+3) * (2*aij/np.pi)**.25 * aij**lij
fac = c1 * (np.pi/aij)**1.5 * (2*aij/np.pi)**.25
fac /= precision

r0 = rs_cell.rcut
# See also the estimator implemented in lib/vhf/nr_sr_vhf.c
dri = aj*aij1 * r0
drj = ai*aij1 * r0
fac_dri = (li * .5/aij + dri**2) ** (li/2)
fac_drj = (lj * .5/aij + drj**2) ** (lj/2)
fl = 2*np.pi*r0/theta + 1.
fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta + 1.
r0 = (np.log(fac * fac_dri * fac_drj * fl + 1.) / theta)**.5

dri = aj*aij1 * r0
drj = ai*aij1 * r0
fac_dri = (li * .5/aij + dri**2) ** (li/2)
fac_drj = (lj * .5/aij + drj**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta
fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta + 1.
r0 = (np.log(fac * dri**li * drj**lj * fl + 1.) / theta)**.5
rcut = r0

Expand All @@ -1563,23 +1558,18 @@ def estimate_ft_rcut(rs_cell, precision=None, exclude_dd_block=False):
norm_ang = ((2*li+1)*(2*lj+1))**.5/(4*np.pi)
c1 = ci * cj * norm_ang
theta = ai * aj / aij
aij1 = aij**-.5
fac = np.pi**1.5*c1 * aij1**(lij+3) * (2*aij/np.pi)**.25 * aij**lij
fac = c1 * (np.pi/aij)**1.5 * (2*aij/np.pi)**.25
fac /= precision

r0 = rs_cell.rcut
dri = aj*aij1 * r0
drj = ai*aij1 * r0
fac_dri = (li * .5/aij + dri**2) ** (li/2)
fac_drj = (lj * .5/aij + drj**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta
fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta + 1.
r0 = (np.log(fac * fac_dri * fac_drj * fl + 1.) / theta)**.5

dri = aj*aij1 * r0
drj = ai*aij1 * r0
fac_dri = (li * .5/aij + dri**2) ** (li/2)
fac_drj = (lj * .5/aij + drj**2) ** (lj/2)
fl = 2*np.pi*r0/theta + 1.
fac_dri = (li * .5/aij + (aj/aij * r0)**2) ** (li/2)
fac_drj = (lj * .5/aij + (ai/aij * r0)**2) ** (lj/2)
fl = 2*np.pi/rs_cell.vol*r0/theta + 1.
r0 = (np.log(fac * fac_dri * fac_drj * fl + 1.) / theta)**.5
rcut[smooth_mask] = r0
return rcut
Expand Down

0 comments on commit 255e567

Please sign in to comment.