How to unwrap coordinates produced by LAMMPS in python

283 Views Asked by At

Okay so I am using LAMMPS to produce wrapped coordinates since I am using periodic boundary conditions with their simulation, in a box of x=[0,91.24] by y=[0,91.24], and I was looking how I would be able to unwrap the coordinates so that I get correct coordinates to be able to calculate the MSD

I have tried putting the origin of the box and having an offset on it, I have seen online that you have to write your coordinates as (Length of the box/coordinate)+equilibrium position

1

There are 1 best solutions below

0
Loi Do On

I am not sure, if I understand your question but if you just want to get unwrapped coordinates from a simulation using Python interface, this works for me:

  1. Suppose, that you create an acceptable lammps simulation (with lammps object lmp = lammps()). Then, add a following command to allow storing unwrapped coordinates at every step of the simulation
  • lmp.command("fix f_unwr all store/state 1 xu yu zu")
  1. After you execute "run" command, you can access the unwrapped coordinates like this:
  • lmp.extract_fix("f_unwr",1,2).contents[0:idx_end])

where "idx_end" depends on the number of atoms (and possibly other parameters)