Segmentation fault while using fix bond/react

Hi all,

I’m new to LAMMPS and start playing around with the fix bond/react feature. What I’m trying to do is simply create a new monomer at one of the ends of a certain polymer, as the schematic shown below:

When I run the input script, an error message prompts “Segmentation fault: (11)”. I have checked some previous discussion and realize it may be caused by issues from my MPI library rather than the LAMMPS side. I recompiled my MPI and LAMMPS but got the same issue. Here I attach the link of scripts and molecule templates I used, hoping someone can give me some insight for solving this problem. Any suggestion will be greatly appreciated.

Thank you.

I ran your input script on my side and it also segfaults, so it’s likely not an installation issue.

My guess is that your input script has some unphysical force field or simulation settings. When I ran the script LAMMPS outputs a lot of warnings like this:

WARNING: FENE bond too long: 23 87 88 0.4788730 (src/MOLECULE/bond_fene.cpp:89)

I had no experience using bond_style fene before, but from the documentation (bond_style fene command — LAMMPS documentation) it seems that the bond length is very close to (or even larger than) R0 in your input script, where the bond energy is supposed to be infinity. This does not make much sense, and I won’t surprise if they lead to errors. It could be caused by unreasonable bond parameters, too large temperature/timestep (so atoms move too far in a single step), etc. After playing with some numbers in your script I managed to run the simulation without crashes, though I’m not familiar with your project so I cannot tell what are physically correct parameters. You would likely need to find them out by yourself.

Hi initialize,

Thank you for replying. I appreciate your feedback. I’ve also tried various parameters for bond and pair coeffs. With some sets I can run the script without any error. However, I’ve found in these cases, there is no reaction really process (by checking the total number of particle in the system). I wonder if it is also true for your runs without crashes.

The segmentation fault occurs, because you don’t have per-type mass:

Thread 1 "lmp_mpi_debug" received signal SIGSEGV, Segmentation fault.
0x0000555555e57b0b in LAMMPS_NS::FixBondReact::insert_atoms (this=0x555559f8d860, my_update_mega_glove=0x55555a1d3100, iupdate=0) at /apps/Installers/lammps-develop/src/REACTION/fix_bond_react.cpp:3898
3898	        double vtnorm = sqrt(t / (force->mvv2e / (dimension * force->boltz)) / atom->mass[twomol->type[m]]);

You are using atom_style bpm/sphere, but you don’t use any bond_style or pair_style which are aware of the geometry of your particles (like, for example, pair_style bpm/spring or other from the bpm package), so the easy solution here is to move to an atom_style with per-type mass.

More about atom_style command can be found here: atom_style command — LAMMPS documentation

This is a genuine bug though, as the code should either support finite particles or error out at the beginning of a run.


Hi mkanski,

Thank you for the suggestions. Now it works as I switch to the “bond” atom_style. I appreciate your help!!

@mkanski thanks for tracking that down, I will take a look soon

By the way, this has been addressed in PR #3905. The original example using finite-size particles should now work.

1 Like