here is a way to generate image flags (or unwrapped coordinates) from the HISTORY file which contains the wrapped coordinates:
Assumptions:
1. All the atoms listed in the first configuration listed in the HISTORY file are assumed to be inside the box
2. The time between successive configurations in the HISTORY file is small enough for the atoms to not cross the simulation box boundaries more than once
3. Simulation box is cuboid, should be easily modifiable for other geometries
Procedure:
1. Initialize the image flags ix, iy and iz in the x, y and z directions to 0, i.e.
Code:ix = 0; iy = 0; iz = 0;
where
i = index of atoms going from 1 to nAtoms
2. Read the coordinates of all the atoms in the first configuration (config_old) and label them x_old, y_old and z_old
3. Read the coordinates of all the atoms from the next configuration (config_new) and label them x_new, y_new and z_new
4. The image flags for the configuration denoted as 'config_new' are then given as follows
Code: ix = ix+int(2*(x_old-x_new)/L_x);
iy = iy+int(2*(y_old-y_new)/L_y);
iz = iz+int(2*(z_old-z_new)/L_z);
where,
int(k) = the integer part of the floating point number k
L_x = Simulation box length in the x direction
L_y = Simulation box length in the y direction
L_z = Simulation box length in the z direction
Note
1. If the box were cubic, L_x = L_y = L_z = L
2. Do not reset the image flags to zero, just keep on incrementing them
5. The unwrapped coordinated for the configuration denoted as 'config_new' are then given as