Probably easiest to tell LAMMPS to dump your box bounds along with your unwrapped coordinates, then do your wrapping as a post-process using your favorite scripting tool or a spreadsheet. Alternatively, there’s probably a clever way to do all of this in the LAMMPS input script. Modifying the LAMMPS source code to do it should probably be your last resort.
Paul
Thanks a lot for all the replies. They helped me a lot. I cannot use post-processing since I need the reset image flags during the simulation. Therefore, I have created a very simple fix (see attachment).
Just in case anyone would ever need it, to activate it during the simulation use command as for regular fix e.g.:
fix 1 all resetflag/atom 1000
where the 1000 is number of timesteps after to make a reset of image flags repeated during a simulation (the same as Nfreq for fix ave/time).
All the best,
Bartosz
fix_resetflag_atom.cpp (3.65 KB)
fix_resetflag_atom.h (1.2 KB)