Page 1 of 1

AIMD XDATCAR wrap and unwrap problems

Posted: Wed Sep 28, 2022 2:52 pm
by xiliang_lian
Hello,

When I do AIMD (NVT, nose-hoover thermostat) in VASP, I frequently notice that atoms can go outside my simulation box and are not wrapped back. The particles can diffuse quite far from the box. I have uploaded one final snapshot from one trajectory as you will see below. This is especially common when I use MLFF. As far as I understand, VASP follows PBC and wraps atoms back at each step, can you please give some suggestions on what could have gone wrong here or whether I misunderstood something?
snapshot.png
In addition, I would like to ask for your suggestions for unwrapping the trajectory in case I am interested in analyzing properties like MSD. There is not much information available on the forum regarding this. There are already codes available on Github to unwrap and convert XDATCAR to other formats, but some may seem too old or I can't be sure whether I can trust these codes. Does VASP offer codes to do this?

Thanks a lot for your help in advance.

Best regards,
Xiliang

Re: AIMD XDATCAR wrap and unwrap problems

Posted: Thu Sep 29, 2022 12:33 pm
by martin.schlipf
Projecting back to the first cell only happens in relaxations and MD simulations using MDALGO=0. For any MDALGO>0, the atoms propagate freely. The former behavior is kept for backwards compatibility. The latter is more convenient to evaluate displacements e.g. for diffusion and is therefore used in the modern MD simulations.

Regarding analyzing the properties of the trajectory: If you compile VASP with HDF5 support, you can read the trajectory from python using py4vasp.

Code: Select all

from py4vasp import Calculation
calc = Calculation.from_path("path where the vaspout.h5 file is")
calc.structure[:].read()
If you have an orthorhombic unit cell, you can also export the structure to mdtraj (https://www.mdtraj.org/) which provides a lot of analysis functionality

Code: Select all

calc.structure[:].to_mdtraj()
Of course, you can also implement the calculation of the distance calculations manually.

Re: AIMD XDATCAR wrap and unwrap problems

Posted: Mon Oct 03, 2022 10:57 am
by xiliang_lian
Great, that's clear to me. Thanks a lot for your answer.