Converting unwrapped coordinates to wrapped ones in deformed box

Dear all,

I have done a simulation where unwrapped coordinates have been dumped (xu yu zu) for a deformed box. Deformation is done using “fix deform xy erate”. How to get wrapped coordinated from unwrapped ones using the information of tilt and box dimensions?

I do similar calculation for undeformed box using modulo operator in python:
x[i] = xu[i]%Lx


Please see the discussion here: 8.2.2. Triclinic (non-orthogonal) simulation boxes — LAMMPS documentation

With the correct box length information you could more-or-less apply the same mechanism as for the orthogonal box, but you have to keep in mind that only the x-axis remains in place. The others are tilted, so you need to compute by how much for the given position and then subtract this first before applying the modulo operation and add it back later.

I suggest you test this on a box that is only deformed in the xy-plane before having other non-zero tilt factors.

Dear Axel,

Thanks for your quick response!

Following your suggestion, I did following (for only xy deformation):

y[i] = yu[i]%Ly
x[i] = ( xu[i] - (y[i]/Ly)*tilt )%Lx + ( (y[i]/Ly)*tilt )
z[i] = zu[i]%Lz

I noticed most of the wrapping is done correctly except the case where yu[I] >Ly or yu[I] <0.

Could you please give some hint where am I making mistake?


Sorry, but to tell you more than I already did, I would have to sit down and figure out all the details myself, i.e. do your work for you. I neither have the time nor the interest to do this.