# How does lammps convert unscaled coordinates into scaled coordinates while writing dump files

I have trajectory files dumped with style atom, where the coordinates are in scaled format (0 to 1). while post-processing the data, I need the coordinates unscaled. The first few lines in the dump file are given here.
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
9000
ITEM: BOX BOUNDS pp pp pp
-2.7599999999999998e+00 4.3159500000000001e+01
-3.2200000000000002e+00 4.2699500000000000e+01
-2.8900000000000001e+00 4.3029499999999999e+01
ITEM: ATOMS id type xs ys zs
1651 3 0.0298457 0.0106817 0.00567297
1652 4 0.018086 0.0015353 0.0527118
1653 3 0.00393079 0.0204815 0.0555429
1655 1 0.0444365 0.010464 0.0644715
1656 2 0.0531474 0.0237481 0.0514052
4114 4 0.0254903 0.0548895 0.131099

I tried to convert the coordinates in unscaled(x, y, z) by multiplying the scaled (xs, ys, zs) coordinates with the corresponding edge vectors a = (xhi-xlo,0,0); b = (0,yhi-ylo,0); c = (0,0,zhi-zlo) and also tried using the method given below.

x = xsa1 + ysb1 + zc1
y = ys
b2 + zc2
z = z
c3

The new coordinate which I got is not an unscaled coordinate. To check, I tried running the simulation and dumping using a custom style with unscaled coordinates. The coordinates obtained are different from the ones calculated using the above method.
how does lammps convert the unscaled coordinates into scaled coordinates while writing dump files?

You may be confusing scaled (i.e. fractional) coordinates and unwrapped coordinates. The latter also include applying the image flags, i.e. add n times the box diameter in the corresponding dimension.

It should be straightforward make LAMMPS do the converting of the trajectory file by using the rerun command with no force styles defined, but a new custom dump or an atom style dump with the necessary dump_modify settings.

Sorry, Sir, I haven’t read this before. I will follow the proper format here onwards.

But I couldn’t understand. I already completed my simulation over a very large time scale and I used atom dump style, now for post-processing the data, that in I need to convert the scaled coordinates to unscaled coordinates. I am not getting how lammps convert unscaled (given in input file) to scaled in first place so I can convert it into a similar way and use for my calculation. I tried the ways given above but those are not correct which I checked by running the simulation by changing the dump style to print unscaled coordinates without force.

You are not providing any more relevant information beyond what you already provided, so there is nothing additional that can be advised. You need to provide a simple test case explaining (with numbers) what you have, what you want to have, what you are trying to get there, and how this fails and what you get instead. Again, see the guidelines post about that subject too. Phrases like “it doesn’t work” or “I don’t understand” are not something that you can be easily helped with since we cannot read your mind.

I have attached two dump files one with scaled coordinates and the other one with unscaled coordinates. I have simulated hydrogen-bonded binary liquids and I am trying to calculate the Voronoi polyhedra (VP) of that binary mixtures. I am trying to write a code for VP calculation where I want to determine the distance between two atoms. I just want to know how to convert scaled to unscaled. Not using LAMMPS software, changing the dump style could do that. I want to know how lammps software convert unscaled to scaled
dump_ethanol_unscaled.lammpstrj (213.8 KB)
dump_ethanol.lammpstrj (298.0 KB)
.

I tried using two methods

1. Multpying the scaled coordinates with edge vectors a = (xhi-xlo,0,0); b = (0,yhi-ylo,0); c = (0,0,zhi-zlo)
2. Finding the unscaled using the method
x = xsa1 + ysb1 + zc1
y = ysb2 + zc2
z = zc3

In both ways it failed to produce the unscaled coordinates, To check whether I am doing it correctly I run a simulation with dump style custom with no force to print unscaled coordinates so I could confirm that I have converted it properly.

I have attacehd the dump files for reference.

The “unscaled” file is bogus. How was it created?

Its “ITEM: ATOMS” line signals that it contains fractional coordinates but they are clearly not.
Thus it will look as if the system is exploded when visualized, since the coordinates are going to be “unscaled” upon reading a second time.

Your system has an orthogonal box, so the conversion between fractional and regular coordinates is by multiplying or dividing with the box length in the respective directions. No magic there.

If however, the rules for the file format itself are not properly followed and inconsistent data created, then you will get a bogus behavior. This is not a LAMMPS issue but a user issue.