How to reach the information of other atoms in a molecule in lammps

Hi all,

Is there a good way to get information of other atoms in a molecule in lammps, like positions, forces or charges. I am coding to include some forces depend on information of other atoms in the molecule. But, in lammps there isn’t an object called molecule.

I think try to do something similar with fix_rigid_small may be a solution. But, I am not sure.

Thank you for your advice.

Hi all,

Is there a good way to get information of other atoms in a molecule in
lammps, like positions, forces or charges. I am coding to include some
forces depend on information of other atoms in the molecule. But, in lammps
there isn't an object called molecule.

correct. all you have is the molecule id, which is just a number that
is attached each atom (provided the atom style is compatible). this is
a very deliberate choice, since in most of the cases, the molecule id
is just "decoration" and having only a forward mapping is simple and
little overhead, which any postprocessing tools can still use it and
usually have the entire dataset available. maintaining the reverse
mapping is significantly more effort, since there may be quite a few
atoms in a single molecule (or rather a lot of atoms sharing the same
molecule id) and then maintaining this kind of information can either
consume a lot of memory or hinder parallelization or generate overhead
or a combination of all of those.

I think try to do something similar with fix_rigid_small may be a solution.
But, I am not sure.

what is the best approach depends on how large your molecules are, how
many of them there are, whether you need to process all of them, and
what kind of tasks you need to do, once you have all that molecule
information. if your molecules are very small, it might be simpler to
just use the neighbor list and build a "molecule" neighbor list from
it, similar to what several manybody potentials are doing and what
some of the fixes are using. the ring communication that is used in
fix rigid/small and shake is another option, as would be a simple
global structure indexed by atomids, if you have not too large
systems. all that you would need in that case would be a map to local
or ghost atoms that have that molecule id, while making sure that you
always consider the nearest neighbors.

axel.