Hello dear LAMMPS developers,
SHORT:
*compute aggregate/atom* gets stuck when run with mpirun and cutoff is too short and special_bonds is 0.0 0.0 0.0 (default)
supposed reason: Empty neighbor lists for some processors -> get stuck in the while loop of compute_aggregate_atom.cpp
LAMMPS Version: 22 Sep 2017
LONG:
We were interested in using aggregate/atom to study the cluster formation of our polymers.
Therefore, we did the simulation then using a rerun script to calculate the property and dump it into a file.
When we reduced the cutoff under a certain value, so that only the neighboring chains with a 'real' contact would be assigned to a cluster we ran in the following problem:
The rerun script runs in serial or mpirun -n 1, but not with more cores.
We can fix this behavior by a greater cutoff (unwanted) or special_bonds 1.0 1.0 1.0 (as stated in the doc).
So i believe that this is due to the while loop in compute_aggregate_atom.cpp. We don't have any clusters in the beginning of the simulation and when due to *special_bonds 0.0 0.0 0.0* the bonded atoms are removed from the neighbor list we get stucked in this loop since we iterate over 0 atoms and can not fulfill the condition for the break.
A test system is shown below.
Since this error can be fixed by appropriated special_bonds settings (see docs) i think its a minor problem,
but you can also create a case where special_bonds wont fix it, see below.
So we want to report it anyway.
TEST SYSTEM to reproduce the error:
LAMMPS Version: 22 Sep 2017
1.) use ${LAMMPSFOLDER}/examples/micelle/in.micelle and uncomment the dump command.
2.) run the simulation
3.) do a rerun with the following script (cluster.lammps):
<script>
dimension 2
atom_style bond
read_data data.micelle
pair_style zero 2.5
pair_coeff * *
bond_style zero nocoeff
bond_coeff *
# special_bonds lj 1.0 1.0 1.0
group alkane type 2 3 4
compute aggr alkane aggregate/atom 1.0
dump calc_agg alkane custom 1 aggregate.dat id c_aggr
dump_modify calc_agg sort id
rerun dump.micelle every 1 dump x y scaled yes box yes wrapped yes format native
</script>
should work: lmp -in cluster.lammps
should work: mpirun -n 1 lmp -in cluster.lammps
should not work: mpirun -n 4 lmp -in cluster.lammps
4.) uncomment * special_bonds lj 1.0 1.0 1.0*
should work: lmp -in cluster.lammps
should work: mpirun -n 1 lmp -in cluster.lammps
should work: mpirun -n 4 lmp -in cluster.lammps
5.) if i change my *aggregate/atom 1.0* cutoff to some value <= bond_length (0.75), i will get the same error but this time special_bonds wont help.
To track down where it went wrong (i know it changed the results of my cluster analysis) i just added
if \(inum == 0\)
change=1
break;
after the second while(1) command in *compute_aggregate_atom.cpp* to check if the error comes from an empty neighbor list.
Then it will not stuck in the loop, but that quick&dirty test will change the results compared to the original code run in serial.
Greetings,
Michael King