I am performing an NEB calculation with VASP and VTST. I would like to visualize the atoms along the path and to calculate their displacements. When I have a single relaxation's XDATCAR, I can unwrap the trajectories using ASE and get the displacements:

steps = read(xdatcar, ':', format='vasp-xdatcar')
start = steps[0].get_positions(wrap=False)
disp = [atoms.get_positions(wrap=False)-start for atoms in steps]

However, this is not working for multiple images along the NEB path when I replace steps with an array containing the POSCAR for each image. The atoms near the boundary jump back and forth between images which makes the visualization messy and the displacement calculation does not work. I know that I can do this in other tools such as OVITO, but I would prefer to use ASE or something that interfaces with it because I am using ase.visualize.view for the trajectories.


1 Answer 1


This is easy. You can simply use ase.geometry.find_mic:

from ase.geometry import find_mic

disp = [find_mic(atoms.get_positions()-start.get_positions(), 
        cell=atoms.cell, pbc=True)[0] for atoms in steps]
  • $\begingroup$ Thank you, this is more elegant than what I came up with. $\endgroup$
    – kpoint
    Commented Oct 3, 2023 at 3:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .