[CP2K-user] [CP2K:22439] r2SCAN forces are not the energy derivative with the default XC_DERIV at moderate cutoffs

Thomas Kühne tkuehne at gmail.com
Tue Oct 13 18:53:05 UTC 2026


Dear Carlos,

yes, PR #6171 covers this tau-projection problem!

I have tested your six-atom input with a development build containing the fix and Libxc 7.1.2. 
At 500 Ry with XC_DERIV PW and your original DX = 0.001 bohr, the numerical and analytical 
F-x forces are -259.04 and -259.35 meV/A. The largest discrepancy across the eight checked 
components is only 0.31 meV/A, and the mismatch in the summed x force is 0.35 meV/A. With 
DX = 0.0005 bohr and EPS_SCF = 1e-9, the F-x discrepancy falls to just 0.032 meV/A.

CP2K now includes the density and gradient contributions generated by the tau projection, with 
a narrow smooth transition at its boundary. The same treatment covers spin-polarized calculations 
and higher derivatives. The Libxc patch is therefore unnecessary when using a CP2K build 
containing #6171. A version label such as 2026.2 alone is insufficient to identify whether a 
development build contains that change.

The SPLINE3 control at 500 Ry also remains consistent, with a 0.19 meV/A discrepancy for F-x 
at the original DX. I would choose PW or SPLINE3 from force and grid-convergence tests for the 
system in question. Agreement between analytical and numerical forces checks the consistency 
of the discretized energy, not convergence to the continuum result. The forces still need to be 
checked as the grid is refined. Likewise, a nonzero net force at finite cutoff can remain consistent 
with the energy when the latter changes under translation of the molecule relative to the grid.

Best regards,
Thomas

> Am 13.10.2026 um 17:21 schrieb Carlos Corral-Casas <cmanuel1996 at gmail.com>:
> 
> 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 <mailto:cp2k+unsubscribe at googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/cp2k/5d6c25d8-0e80-4a60-ae22-961775f5b616n%40googlegroups.com <https://groups.google.com/d/msgid/cp2k/5d6c25d8-0e80-4a60-ae22-961775f5b616n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> <cp2k_r2scan_force_check.tar.gz>

-- 
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/DFD96250-E46B-46DD-95FC-9E758C3E94C4%40gmail.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20261013/6c575b90/attachment.htm>


More information about the CP2K-user mailing list