[CP2K-user] [CP2K:22385] Re: How to fix NaN error and numerical derivative warning (0.100000E+31) in wtMetaD?

tkuehne tkuehne at gmail.com
Tue Aug 11 16:55:27 UTC 2026


Hi Qi,

I checked the attached input and output. The output was produced with CP2K 
2024.2. In that version, kind-based collective variables nested inside 
COMBINE_COLVAR were not post-processed correctly. Consequently, the 
KINDS_FROM/KINDS_TO atom lists of the first COORDINATION remained empty, 
its value became NaN, and the numerical derivative code subsequently 
reported its 1.0E30 error sentinel.

This was fixed in CP2K by PR #4128:
https://github.com/cp2k/cp2k/pull/4128

The fix is included in CP2K 2025.2 and newer releases, so the preferred 
solution is to upgrade CP2K.

As a workaround for CP2K 2024.2, replace the kind-based selection in the 
first nested COORDINATION by explicit atom indices:

  ATOMS_FROM 1
  ATOMS_TO   2

and remove KINDS_FROM/KINDS_TO there. In your input, atom 1 is Ge and atom 
2 is Cl; the second nested COORDINATION already uses explicit indices.

The attached energy file also shows that the MD itself continues for at 
least 50 steps; it is specifically the combined metadynamics CV that is NaN 
from step 0. I also verified that the existing upstream regression test for 
a nested kind-based COORDINATION inside COMBINE_COLVAR completes without 
NaNs on current CP2K.

Best regards,
Thomas
On Wednesday, May 27, 2026 at 4:11:30 PM UTC+2 Qi Zhang wrote:

> Hi CP2K users,
>
> I am running a Well-Tempered Metadynamics simulation, but it fails at the 
> very first step (0.00000000 ps) with NaN in the metadynLog file.
>
> Meanwhile, the stdout shows the following warning:
>
> *** WARNING in colvar_methods.F:4530 :: ASSERTION (cond) failed at line 
>  ***
> *** 4531           Error (0.100000E+31) in computing numerical          ***
> *** derivatives larger then(0.100000E-11) .                             ***
>
>   Here is how I defined my CV section (nesting two &COORDINATION blocks 
> under &COMBINE_COLVAR):
> &COLVAR
>          &COMBINE_COLVAR
>             &COLVAR
>                &COORDINATION
>                   KINDS_FROM  Ge
>                   KINDS_TO   Cl
>                   R_0 [angstrom]  2.80
>                   NN  12
>                   ND  24
>               &END COORDINATION
>            &END COLVAR
>            &COLVAR
>              &COORDINATION
>                 ATOMS_FROM  1
>                 ATOMS_TO   3 5 7 9
>                 R_0 [angstrom]  2.30
>                 NN  12
>                 ND  24
>               &END COORDINATION
>             &END COLVAR
>             FUNCTION  CV2-CV1
>             VARIABLES  CV1 CV2
>          &END COMBINE_COLVAR
>
>     &END COLVAR  
>
> Does anyone know what is causing this NaN and derivative error? How should 
> I modify my input file to fix this issue and get the simulation running 
> properly?
>
> I have attached my full input (.inp) and output (.out) files for your 
> reference.
>
> Thank you for your help!
>
> Best regards,
>
> Qi Zhang
>

-- 
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/437fa7d2-3d9d-46a0-ab4e-64d53fbd0742n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20260811/29d27629/attachment.htm>


More information about the CP2K-user mailing list