Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A partial fix for ReaxFF failure when the number of atoms increases during a simulation #1352

merged 2 commits into from Mar 7, 2019


None yet
5 participants
Copy link

mkanski commented Mar 1, 2019


This pull request fixes partially a long-standing issue of ReaxFF and increasing number of atoms. Briefly, if the number of atoms increase too much during a simulation, LAMMPS exits with an error similar to the one below:
p0: not enough space for bonds! total=1516016387 allocated=25000
A simple input script which triggers the problem is attached.


Michał Kański, Jagiellonian University


By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility


Implementation Notes

Two arrays (num_bonds and num_hbonds) in fix_reaxc.cpp are used for selecting space for bonds of a given atom. At the beginning the arrays are not fully initialized, which leads to problems when the number of atoms increases. The fix is to initialize the entire arrays.

This is only a partial fix, because "mincap" keyword has to be used as in the attached example. There is also a corner case which remains unaddressed - the simulation will fail if there is at least one MPI thread without any ReaxFF bonds/hbonds. However, I think that this pull request can be merged as-is since it solves most of the problems.

Post Submission Checklist

Please check the fields below as they are completed after the pull request has been submitted

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • A package specific README file has been included or updated
  • One or more example input decks are included

Further Information, Files, and Links - It creates a water molecule file and uses it with fix deposit and ReaxFF.

Copy link

sjplimp left a comment

This looks fine. However, is it also important that when
these 2 arrays grow (in the FixReaxC::grow_arrays() method below),
do the new values from the old nmax to the new nmax also
need to be initialized to -1, as in the constructor?

If so, the local nmax can be stored (and updated in grow_arrays),
and used in a loop between nmax_old to nmax_new to set -1.


athomps approved these changes Mar 5, 2019

Copy link

athomps left a comment

This is worth adding, but Steve's comment should also be addressed

@akohlmey akohlmey requested review from sjplimp and athomps Mar 5, 2019


This comment has been minimized.

Copy link
Collaborator Author

mkanski commented Mar 5, 2019

You are right, I missed this. I've added a proper code in grow_arrays() and removed the initialization from the constructor since it became redundant.


athomps approved these changes Mar 7, 2019

Copy link

athomps left a comment

I approve this change

@stanmoore1 stanmoore1 assigned akohlmey and unassigned stanmoore1 Mar 7, 2019

changes are implemented

@akohlmey akohlmey merged commit 4e2ebf7 into lammps:master Mar 7, 2019

6 checks passed

lammps/pull-requests/cmake/new-cmake-serial-pr head run ended
lammps/pull-requests/new-build-docs-pr head run ended
lammps/pull-requests/new-kokkos-omp-pr head run ended
lammps/pull-requests/new-openmpi-pr head run ended
lammps/pull-requests/new-serial-pr head run ended
lammps/pull-requests/new-shlib-pr head run ended

@mkanski mkanski deleted the mkanski:reax_var_atoms branch Apr 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.