[CP2K-user] [CP2K:22438] r2SCAN forces are not the energy derivative with the default XC_DERIV at moderate cutoffs
Carlos Corral-Casas
cmanuel1996 at gmail.com
Tue Oct 13 15:21:07 UTC 2026
Dear developers,
With r2SCAN and the default XC_DERIV (PW), the analytic forces of CP2K
2025.2 are not the derivative of the energy at a cutoff of 500 Ry. I could
only test 2025.2, the version installed on our HPC system.
*Minimal example (attached)*: one fluoroacetonitrile molecule (6 atoms) in
a 12.77 A cubic cell, GTH-SCAN, DZVP-MOLOPT-SR-GTH. RUN_TYPE DEBUG with DX
= 0.001 bohr, x component of the force on F:
numerical
analytical difference
(meV/A)
(meV/A) (meV/A)
r2SCAN, XC_DERIV PW (default) -256 -1178 -922
r2SCAN, XC_DERIV SPLINE3 -200 -200 -0.2
rSCAN, XC_DERIV PW -427 -427
-0.3
r2SCAN, PW, CUTOFF 1500 Ry 28 28 -0.1
In the first case the x-forces summed over all atoms give -1236 meV/A,
against -323 from finite differences. In the other three cases every
component checked agrees within 0.3 meV/A.
*Suspected cause*. In src/xc/xc_libxc.F, tau is replaced by MAX(tau,
sigma/(8 rho)) before the libxc call, and vrho, vsigma and vtau are then
used as returned. Where the replacement is active the energy is e(rho,
sigma, tau = sigma/(8 rho)), but the potential lacks the terms that come
from the dependence of the replaced tau on rho and sigma. The same lines
are in 2026.1 and 2026.2 versions.
*Test of this reading.* I preloaded a libxc 7.0.0 with one change (patch
attached): at grid points where tau arrives equal to sigma/(8 rho), it
returns vrho - vtau*sigma/(8 rho^2), vsigma + vtau/(8 rho) and vtau = 0,
i.e. the derivatives of the energy that is actually evaluated. With nothing
else changed, the net force on the molecule follows the slope of the energy
again when the molecule is shifted across the grid (ratio 1.01 instead of
4.50; table.txt in the attachment).
*Other settings.* On the same molecule, the ratio of net force to energy
slope under a rigid shift (4.50 with the settings above) is unchanged with
NGRIDS 1, REL_CUTOFF 200, EPS_DEFAULT 1e-14 or EPS_SCF 1e-9. It is 1.00
with XC_DERIV SPLINE2, SPLINE3, NN10_SMOOTH or SPLINE2_SMOOTH, but 3.84
with XC_SMOOTH_RHO NN10 and the default derivative. With the default
derivative it is 1.37, 0.16, 1.83 and 1.15 at 600, 700, 800 and 1000 Ry,
and 1.00 from 1200 Ry. In the liquid, larger basis sets (DZVP-MOLOPT-GTH,
TZV2P-MOLOPT-GTH) do not reduce the error on F.
The same library counts the affected points. With the default derivative at
500 Ry they are 0.6% of the grid points with density between 1e-4 and 1e-2
e/bohr^3; with XC_DERIV SPLINE3 at 500 Ry, or the default at 1500 Ry, there
are none. rSCAN has the same affected points, but its vtau is zero there,
which is why it stays consistent.
*Why it matters*: in a 664-atom liquid containing this molecule, the forces
on F at 500 Ry are off by 0.6-1.0 eV/A per component (against 1500 Ry) with
the default, and by 0.10-0.14 eV/A with SPLINE3.
*Questions*:
1. Does PR #6171 on master cover this case? I have not been able to test
master.
2. Would you recommend a non-PW XC_DERIV for meta-GGAs? Even with a
consistent potential, the PW gradient still exceeds the bound at those
points.
I am happy to run further tests.
Best,
Carlos
--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+unsubscribe at googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cp2k/5d6c25d8-0e80-4a60-ae22-961775f5b616n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20261013/4a6a0d71/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp2k_r2scan_force_check.tar.gz
Type: application/x-gzip
Size: 722172 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20261013/4a6a0d71/attachment-0001.bin>
More information about the CP2K-user
mailing list