How to get the coordinates of a particle in each timestep

Dear users,
I am trying to make a new fix for which I need the coordinates of the particles in each timestep (beads in my case as I am working on a bead and spring model). I tried looking into the other fixes and dump_xyz command but I can’t find where they implement this.
Any suggestions?

Dear users,
I am trying to make a new fix for which I need the coordinates of the particles in each timestep (beads in my case as I am working on a bead and spring model). I tried looking into the other fixes and dump_xyz command but I can't find where they implement this.

Any suggestions?

you need to improve your code reading skills. you could start here:
https://github.com/lammps/lammps/blob/master/src/fix_nve.cpp#L71

axel.

I get it but see the code attached for instance, is something wrong with the way the coordinates were specified because it prints out only the first term in the loop when I tried printing the result.

Screenshot from 2018-12-12 16-43-48.png

I get it but see the code attached for instance, is something wrong with the way the coordinates were specified because it prints out only the first term in the loop when I tried printing the result.

this code is disregarding how LAMMPS stores and manages per-atom data.

please keep in mind, that LAMMPS uses domain decomposition and that
per-atom data is stored in arbitrary order and distributed across
processors.
the per-processor arrays are of the dimension atom->nlocal +
atom->nghost, which correspond to "owned" atoms and "ghost" atoms,
i,e. copied atoms from neigboring subdomains.
because of the distributed nature of this storage, it is not possible
to do a loop of atom->natoms and access data in that order. you can
map global atom ids to local indices with the atom->map() function.
if the resulting index is >= atom->nlocal, it is a ghost atom, and if
it is -1, it is not present on this processor.

there are other problems, too, e.g. the static array sizes and placing
those on the stack.

axel.

Thanks a lot!
I’ll check them out right away

Ajesh Saviour
Department of Chemistry
National Institute of Technology, Rourkela