[lammps-users] Collecting forces on all atoms of a given molecule into an array


I am trying to simulate a polymer bead-spring chain melt using LAMMPS, with atom_style bond. For some of my calculations, I need to operate on a vector that stores the force acting on each atom of a particular molecule. I need such a vector for each molecule in the system. I also need separate vectors for all the atom coordinates belonging to each molecule. Is there a way to get this from LAMMPS, and are there any existing functions that operate on such vectors of atom properties of each molecule, that I can look at?

Thanks very much,

LAMMPS doesn't store any such per-molecule vectors internally,
especially since no processor knows about the entire molecule. You
could post-process this from a dump file, or write your own fix to
do what you want.


Hi, Steve. Aruna is my groupmate. Postprocessing is not an option for what we want to do, we really do need some per-molecule vectors, and they are needed at every timestep. So the question will be what’s the best way to handle this? My first thought is to create a new atom-style with some new vectors, e. g. xmolec[nlocal][3*nmolecule] or some variation thereof (the above is obviously memory-wasteful), and use LAMMPS built in exhange and communication routines to pass these around efficiently. Any thoughts?


LAMMPS has no internal data structure for molecules. I guess
you could do this with a fix which could collect the needed info
across processors. You'd have to be careful to make this work
reasonably well in parallel.