Skip to content

Commit

Permalink
a fix for 4C-TDDFT using GGA functionals in multi-collinear approach (p…
Browse files Browse the repository at this point in the history
…yscf#1446)

* a fix for 4C-TDDFT using GGA functionals in multi-collinear approach

* a possible bug in 2C-TDDFT for GGA functionals using multi-collinear approach, which is similar to the case in 4C-TDDFT

Co-authored-by: maohaohao <lihao@stu.pku.edu.cn>
  • Loading branch information
Haskiy and maohaohao authored Sep 29, 2022
1 parent 70a783f commit 829e404
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyscf/dft/numint2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def cache_xc_kernel(self, mol, grids, xc_code, mo_coeff, mo_occ, spin=0,
in self.block_loop(mol, grids, nao, ao_deriv, max_memory):
rho.append(self.eval_rho2(mol, ao, mo_coeff, mo_occ, mask, xctype,
with_lapl))
rho = np.hstack(rho)
rho = np.concatenate(rho,axis=-1)
if self.collinear[0] == 'm': # mcol
eval_xc = self.mcfun_eval_xc_adapter(xc_code)
else:
Expand All @@ -615,7 +615,7 @@ def cache_xc_kernel(self, mol, grids, xc_code, mo_coeff, mo_occ, spin=0,
# rhoa and rhob must be real
rhoa.append(ni.eval_rho(mol, ao, dm_a, mask, xctype, hermi, with_lapl))
rhob.append(ni.eval_rho(mol, ao, dm_b, mask, xctype, hermi, with_lapl))
rho = np.stack([np.hstack(rhoa), np.hstack(rhob)])
rho = np.stack([np.concatenate(rhoa,axis=-1), np.concatenate(rhob,axis=-1)])
assert rho.dtype == np.double
vxc, fxc = ni.eval_xc_eff(xc_code, rho, deriv=2, xctype=xctype)[1:3]
return rho, vxc, fxc
Expand Down
2 changes: 1 addition & 1 deletion pyscf/dft/r_numint.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def cache_xc_kernel(ni, mol, grids, xc_code, mo_coeff, mo_occ, spin=1,
in ni.block_loop(mol, grids, nao, ao_deriv, max_memory,
with_s=with_s):
rho.append(make_rho(0, ao, mask, xctype))
rho = numpy.hstack(rho)
rho = numpy.concatenate(rho,axis=-1)

if ni.collinear[0] == 'm': # mcol
eval_xc = ni.mcfun_eval_xc_adapter(xc_code)
Expand Down

0 comments on commit 829e404

Please sign in to comment.