AIMD XDATCAR wrap and unwrap problems

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Locked
Message
Author
xiliang_lian
Newbie
Newbie
Posts: 37
Joined: Thu May 19, 2022 8:44 am

AIMD XDATCAR wrap and unwrap problems

#1 Post by xiliang_lian » Wed Sep 28, 2022 2:52 pm

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
You do not have the required permissions to view the files attached to this post.

martin.schlipf
Global Moderator
Global Moderator
Posts: 542
Joined: Fri Nov 08, 2019 7:18 am

Re: AIMD XDATCAR wrap and unwrap problems

#2 Post by martin.schlipf » Thu Sep 29, 2022 12:33 pm

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.

Martin Schlipf
VASP developer


xiliang_lian
Newbie
Newbie
Posts: 37
Joined: Thu May 19, 2022 8:44 am

Re: AIMD XDATCAR wrap and unwrap problems

#3 Post by xiliang_lian » Mon Oct 03, 2022 10:57 am

Great, that's clear to me. Thanks a lot for your answer.

Locked