Segmentation fault upon inserting atoms during simulation

I’ve been trying to run a simulation involving random introduction of Li atoms in my simulation box to observe how the system reacts

I’m using LAMMPS version 23 Jun 2022, with the ReaxFF force field, on a linux machine. Parallelisation with OpenMPI v 4.1.4.

I have observed that trying to insert Lithium atoms in the simulation box after the type has been allocated and the force field is set up - leads to a segmentation fault.

However this behaviour is not observed if I insert a token lithium atom anywhere in the sim box after type allocation and before force field set up.

The error is only reflected on the run screen, and not in the log file.

Here is my input script:

#init

units real
atom_style charge
boundary p p p
read_data EC_electrolyte.data extra/atom/types 1

pair_style reaxff ../lmp_control
mass 19 6.94
#create_atoms 19 random 1 654785 NULL overlap 2.5
pair_coeff * * ../ffield.reax.COHNSLi C C C C C C H H H H H H O O O O O O Li
region ranLi block EDGE 10 EDGE EDGE EDGE EDGE

#minimisation
fix mynve all nve/limit 0.1
fix chg all qeq/reaxff 1 0 8.0 1.0e-3 reaxff
dump mdmp all custom 100 VC_electrolyte.lammpstrj id type xu yu zu
minimize 1.0e-2 1.0-2 100000 100000
unfix mynve



fix mynvt all nvt temp 1 500 100
fix LiInsert all deposit 15 19 100 654894 region ranLi id next near 1.5 attempt 50
thermo 100
timestep 0.10
run 5000

I have stored the on screen error message in the following text document. Please also find attached, the other relevant files

SegmentationFault.txt (3.8 KB)
EC_electrolyte.data (292.3 KB)
ffield_Islam (36.0 KB)
lmp_control (1009 Bytes)

Try using KOKKOS version of ReaxFF. The default implementation really doesn’t like increasing number of atoms during simulations.

Interesting timing! I’ve been running into the same issue with a different reax. If I add in atoms after reax I get an issue

Yes, use the KOKKOS version. For example, the normal C++ ReaxFF version can’t run with GCMC (which inserts particles) in LAMMPS, but the KOKKOS version has no problems with GCMC.

You can build Kokkos ReaxFF with the MPI-only “Serial” backend (no OpenMP threading or GPU) and it may even be a little faster than the regular C++ ReaxFF version.

1 Like

Unfortunately I’m using a legacy OS (CentOS 6.0) with gcc 4.3. Due to the lack of c++14 compatibility I cannot enable the KOKKOS package. Is there a workaround for this case?

Any attempt at updating the compiler results in the build failing.

You can compile a compiler yourself from scratch.
Or you can to check universal Linux LAMMPS binaries described here (they don’t have OpenMPI support though): Universal LAMMPS binaries for Linux