Lammps hbondchk failed

Hello everyone, I am experiencing the hbondchk failed problem with lammps, hope you can help me My in file and data file are as follows

LAMMPS data file written by OVITO Basic 3.10.6

3549 atoms
5 atom types

0.0 39.4618 xlo xhi
0.0 39.4618 ylo yhi
0.0 39.4618 zlo zhi

Masses

1 12.0107 # C
2 15.9994 # O
3 14.0067 # N
4 32.065 # S
5 1.00794 # H

Atoms # full

1 1 1 0.0 1.080464084 12.980169874 27.500533802
2 1 1 0.0 0.324770614 14.16086693 27.280336958
3 1 1 0.0 2.367708 13.095792948 28.004855606
4 1 1 0.0 1.014957496 15.417330642 27.261000676
5 1 1 0.0 3.138002336 14.221638102 27.636282394
6 1 1 0.0 2.453340106 15.422066058 27.264946856
7 1 1 0.0 19.615276926 8.238834604 19.031242286
8 1 1 0.0 19.06202249 9.48464363 19.408497094
9 1 1 0.0 21.005121522 8.043893312 18.996515902
10 1 1 0.0 19.935312124 10.571421602 19.726164584
11 1 1 0.0 21.897747438 9.102653406 19.344963596
12 1 1 0.0 21.361066958 10.393448884 19.675258862
13 1 1 0.0 21.473533088 6.777169532 18.594794778
14 1 1 0.0 22.381154488 5.372329452 16.813883744
15 1 1 0.0 21.683864482 6.52303554 17.223497228
16 1 1 0.0 22.84048984 4.458788782 17.775962428
17 1 1 0.0 22.5326878 4.646232332 19.13502682

in file
units real

atom_style full
read_data DMJ.data

pair_style reaxff lmp_control
pair_coeff * * ffield.reax C H O N S

neighbor 2 bin
neigh_modify every 10 delay 0 check no

fix 1 all nve temp 900.0 900.0 100.0
fix 2 all qeq/reax 1 0.0 10.0 1e-6 reaxff
fix 3 all temp/berendsen 2200.0 2800.0 5.0

fix 4 all reaxff/species 1 100 100 species.out element C H O N S
fix 5 all reaxff/bonds 100 bonds.reaxff

dump 1 all custom 100 DJM.xyz id type q x y z
run 5000

You may find some inspiration in previous post as this error keeps coming back with ReaxFF for similar reasons.

You should also take a look at the documentation, because you are using the temp keyword with fix nve (it may not trigger any error because temp 900.0 900.0 100.0 seem to be ignored by LAMMPS, but I don’t get the logic of having this command + Berendsen thermostat):

Simon

Hi Simon, we (LAMMPS developers) probably should make fix ... nve temp ... error out.

But it’s correct to combine fix nve with fix temp/berendsen. Like some other thermostats (such as fix langevin), fix temp/berendsen doesn’t do its own integration of motion, and requires fix nve as an integrator to move the atoms.

Yes, I too find weird that nve makes no check for optional arguments apart from counting that there are at least 3. Perhaps a rest from old checking methods, since this fix is short and rather straight forward, I guess it is not revised that often.

Note that this is not the case for nve_noforce and nve_limit which require exactly 4 arguments. nve/sphere on the other hand makes the same check as plain nve and should maybe be corrected.

The reason for the lack of checking is that there are fix classes that are derived from fix nve that do take arguments. This results in a problem, because the base class constructor is run before it is run for the derived classes, so it is not possible to remove arguments from the list. And from the constructor we don’t have access to virtual functions yet, so adding an options() virtual function is not helping either. You also cannot simply check for just fix “nve” alone since there are accelerated suffixed versions of it.

That said, we added a utility function utils::strip_style_suffix, that can handle the case of a suffix added via the -sf command line flag (it does not help when people put fix nve/kk explicitly in their inputs). So that a check for plain “nve” and then erroring out with extra arguments is possible.
I’m going to try this out in Collected small changes and fixes by akohlmey · Pull Request #4357 · lammps/lammps · GitHub now. If I get it to work, it should cover most cases since few people use explicit suffixes in their inputs.

1 Like

@wangchao There are a number of problems with your input.

  • for ReaxFF you need to use a shorter timestep than the default, specifically when your system contains hydrogen atoms and when you are running at a very high temperature
  • please also check your log file or screen output. There should be a warning about the neighbor list settings being changed due to your settings for fix reaxff/species. averaging over 100 steps is not going to work for anything with a large-ish timestep that is not a solid at the selected temperature. So I would first test without fix reaxff/species, use a shorter timestep and tweak timestep and neighbor list settings so you can get stable dynamics that can conserve energy
  • the hbondchk warning has multiple causes, one is that you run in parallel with MPI but your distribution of atoms changes a lot over the course of the simulation. The default implementation of ReaxFF assumes that the system is already somewhat equilibrated and thus makes some guess for how many hydrogen bonds might need to be stored during the entire run. The error can happen when this limit is crossed. There are several ways to address this: a) switch to the KOKKOS version of ReaxFF, which is more robust in those cases, b) run without or with fewer MPI processes and use some OPENMP parallelization (can also be applied to KOKKOS, btw), c) break down the run into multiple small chunks where you store intermediate results in data files and the use “clear” and “read_data” to start over with adjusted heuristics for the amount of hydrogen bond storage required.

From remote it is impossible state which of these points impact your simulation or whether all of them in combination are the cause of the error message.
Tracking this down in stages and carefully is essentially your job. As mentioned before, this error has been reported multiple times and more details advice has been given (beyond the one listed by @simongravelle).

Please also let me add that using fix temp/berendsen is a particularly bad choice to heat up a system. Its algorithm is meant for bulk liquids at ambient temperature, but for high temperatures, it will increase the difference between hot and cold atoms, which is the opposite of what you usually want to achieve in these scenarios. I would thus switch to a dissipative thermostat, like one of the many langevin style thermostats supported by LAMMPS. Those will try to homogenize the temperature distribution instead.

Thanks, this explains the format and the way the fix checks if ir is not ^nve/sphere. Makes sense.

It would still be nice to find away to error out that useless arguments are provided to plain nve. I hope your patch can solve this. Else there must be another way. :grin:

IMO anyone and everyone should be using the KOKKOS version of ReaxFF. Not only is it more memory robust and will never have these hbondchk errors, it is also faster on CPUs, at least in most cases that I’ve benchmarked, or same speed at the very least.

1 Like