atom_modify

Dear all,

I am a novice to lammps and need your assistance with a few naive queries. As for “first” keyword, defining a groups means that only interactions of the atoms of that group is calculated, and hence, simulations is speed up? or all other atoms are calculated as well? In principle, how “first” keyword speeds up simulations? By limiting the calculations to only atoms of the group-ID?

All atom-atom interactions that you specify will continue to be calculated.

The origin of the potential speedup is as follows: imagine you have a small subset of atoms in your simulation that you want to do some analysis on (with some LAMMPS compute or fix). Under normal cicrumstances, you would need to do a loop over all atoms likes this:

for all atoms
     if atom in target_group
         do analysis

With "atom_modify first" switched on, all the atoms in your target group are placed at the start of the arrays that LAMMPS uses to store the atoms, so this loop only needs to run over the first g atoms (where g is the number of atoms in your group), as opposed to all N. Obviously, the penalty for this is that LAMMPS needs to spend time sorting those arrays. If the time you save by running over a smaller loop exceeds the time that the sorting costs you, then your simulation will be faster.

Dear all,

I am a novice to lammps and need your assistance with a few naive queries.
As for "first" keyword, defining a groups means that only interactions of

the next time please provide more context to your query. for example,
a "first" keyword exists for several LAMMPS commands. i guess you are
talking about "atom_modify first" here

the atoms of that group is calculated, and hence, simulations is speed up?

no. as a beginner, you should not worry about these things.

or all other atoms are calculated as well? In principle, how "first" keyword
speeds up simulations? By limiting the calculations to only atoms of the
group-ID?

there is no beginner-friendly way to explain this beyond what is
already given in the manual. LAMMPS should produce the same results,
but it can do some internal optimizations for very specific cases,
e.g. if you have a small group of atoms with a cutoff that is much
longer than the cutoff of the rest.

in general, as a beginner you should worry first about getting correct
results and only second about performance. there are many ways how
performance can be optimized.

axel.