# How to take periodic snapshots while running a simulation in VASP?

Same question, rephrased:

What is the procedure to take snapshots at fixed intervals while running an AIMD or DFT Simulation in VASP?

OR

Which parameter in the INCAR file do I modify to achieve periodic snapshots(in JPG/PNG) of atomic positions?

There is no way to do this directly in VASP, but you can achieve this goal using the Atomic Simulation Environment (ASE). With your OUTCAR available, do the following:

from ase.io import read, write
images = read('OUTCAR',index=':') # Read in every iteration
interval = 5 # Save .png every N steps
for i, image in enumerate(images):
if i+1 % interval == 0:
write('image_'+str(i)+'.png',image) # Write out imamge


In can be done easily using python or bash script. You have to keep looking for changes in OSZICAR. Whenever OSZICAR prints 'F' i.e. end of electronic self consistent loop, copy your CONTCAR to other file. There is simple tool in linux system inotify-hookable which will watch over change in CONTCAR file.


inotify-hookable -f CONTCAR -c "cp CONTCAR CONTCAR.new"
echo "== \$(date) : executed, continuing to monitor..."



use sudo apt-get install inotify-hookable to install in ubuntu or use source code.