Page 1 of 1

Neighbor search with ML-FF for certain lattice vector ranges bugged

Posted: Mon Nov 23, 2026 2:18 pm
by akretschmer

Dear VASP team,

I believe there is a bug in the neighbour search of the machine-learned force fields in VASP 6.5.1 (src/ml_ff_neighbor.F). It breaks energy conservation for cells with lattice vectors between 24 and 30 A for the default cutoff radius ML_RCUT1 = 8 A.

Problem:
The Verlet list (cutoff 1.5 * ML_RCUT1 = 12 A) is built with a cell list:
• In create_box_parameters, the boxes are at least cutoff/2 = 6 A long. So number_of_needed_neighbor_boxes returns n = 2, and the search loops over box shifts −n ... +n in each direction.
• These 2n+1 = 5 shifts are only distinct if there are at least 5 boxes along that direction.
• The fallback to the N² search, however, is only triggered for 2n > number_boxes, i.e. for at most 3 boxes.
• With exactly 4 boxes (lattice vectors of 24–30 A), the shifts −2 and +2 land on the same box, so its atoms enter the neighbour list twice. Duplicates within ML_RCUT1 are then counted twice in the descriptors.

Fix:
Fall back to the N² search whenever the 2n+1 box shifts are not all distinct. You'll find a suggested patch file attached.

Test:
The attached test runs the same 10 ps NVE simulation of 512 water molecules (cubic cell, a = 24.36 A) twice: once with VASP 6.5.1 and once with VASP 6.5.1 plus the patch. With 6.5.1 the total energy rises by >1 eV in discrete steps; with the patch it stays constant (+0.02 eV). The inputs (without ML_FF), a short analysis script and outputs are included. We also looked at the relevant code section in version 6.6.1 and the bug seems to persist there.

Credit for finding this bug goes to my colleague Nader Nour (TU Wien).


Re: Neighbor search with ML-FF for certain lattice vector ranges bugged

Posted: Mon Nov 23, 2026 2:44 pm
by jonathan_lahnsteiner2

Dear akretschmer,

Thank you for reaching out to us. We are already aware of this bug in the neighbor list and fixed it already. With the next VASP release the neighbor list will work as expected for cases like this.

With many thanks and all the Best

Jonathan