How to fix NaN error and numerical derivative warning (0.100000E+31) in wtMetaD?

22 views
Skip to first unread message

Qi Zhang

unread,
May 27, 2026, 10:11:30 AMMay 27
to cp2k
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

aimd.out
GeClOH3_solution-COLVAR.metadynLog
GeClOH3_solution_wtmtd.inp
GeClOH3_solution-1.ener

tkuehne

unread,
Aug 11, 2026, 12:55:27 PM (2 days ago) Aug 11
to cp2k
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
Reply all
Reply to author
Forward
0 new messages