[lammps-users] neigh_modify and delete_bonds for fix rigid when there are more than 32 groups

Dear all,

I have a question regarding the use of neigh_modify exclude and delete_bonds commands to save computational resources when there are more than 32 rigid bodies. According to the messages in the archive, when there are more than 32 groups assigned as rigid bodies, a workaround is to use molecular id instead of groups. But if I also want to use the commands of neigh_modify and delete_bonds, group ID seems to be required. Is there any other workaround for removing the redundant pairwise and bonded interactions within each rigid body, when there are more than 32 groups as allowed by Lammps?

Thanks,
Xingcheng

First of all - and most important - be wary of “premature optimization”. There is no need to worry about certain optimizations unless you have confirmed that the change they introduce is significant. Most default settings are set the way they are by default for a reason, and every time you change something there is going to be a trade-off. So before worrying about something that is not significant, you should first determine which is significant.

If you have more than 32 rigid bodies that would mean that there are not many particles inside each rigid body. unless a rigid body is larger than the non-bonded cutoff the computational effort for intra-body interactions scales O(N**2) with the number of particles. so the gain is only big for large rigid bodies (but the overhead to check for whether to exclude a pair is constant per overall pairs and linear with the number of exclusion definitions). so excluding pairwise non-bonded interactions is only worth doing, if the rigid bodies are sufficiently large, and also for small objects with bonds 1-2, 1-3, and 1-4 pairs may already be excluded due to the special_bonds setting.

the time spent on computing bonded interactions is generally small and (much) smaller for bonds than for angles and even more so for dihedrals. so, again, you may be trying to optimize something with very little potential gain.

with more than 30 rigid bodies, you must use something else than groups to define the bodies so molecule ids are the natural choice. at that point, you should also worry about fix rigid requiring collective communications, which can severely limit parallel scaling, and thus using fix rigid/small instead should be something you should be worrying about first.

with that and having rigid bodies defined through molecule ids, you can consider using neigh_modify molecule/intra to exclude intra rigid body non-bonded interactions from the neighbor list.

I encourage you to make benchmarks and carefully observe the changes to the timings break down at the end of a run.

axel.