AIMD / Trajectory Analysis

This tutorial explains how to analyze VASP AIMD trajectories with VQkit.

VQkit provides nine AIMD / trajectory-analysis workflows under:

Main menu
[2] Post-processing
    [6] AIMD / trajectory analysis

The same menu can also be opened directly by typing:

aimd

at any VQkit Enter your choice prompt.

Required files

Most AIMD analyses use the VASP XDATCAR trajectory file.

Depending on the selected analysis, VQkit can also use:

  • INCAR — preferred source for the MD time step POTIM.

  • OUTCAR — fallback source for POTIM and energy data.

  • OSZICAR — preferred source for MD temperature and energy records.

The basic calculation directory therefore commonly contains:

INCAR
OUTCAR
OSZICAR
XDATCAR

VQkit performs the analysis directly in the active working directory.

Open the AIMD menu

Start VQkit in the completed AIMD calculation directory.

At the main menu enter:

2

to open Post-processing.

Then enter:

6

to open AIMD / trajectory analysis.

The AIMD menu is:

[1] Trajectory summary
[2] Atomic position coordinates vs time (XDATCAR)
[3] Energy vs time
[4] Volume / lattice parameters vs time
[5] Bond distance vs time
[6] Mean-square displacement (MSD)
[7] Diffusion coefficient
[8] Radial distribution function (RDF)
[9] Coordination number vs time

[0] Back
[99] Exit VQkit

Time convention

VQkit uses the XDATCAR configuration number multiplied by the VASP MD time step POTIM:

\[t = N_{\mathrm{conf}} \times \mathrm{POTIM}\]

where POTIM is in femtoseconds.

VQkit attempts to detect POTIM automatically:

  1. INCAR is checked first.

  2. OUTCAR is used as a fallback.

  3. If the time step cannot be detected, VQkit asks you to enter it manually.

When VQkit detects the time step, a prompt similar to the following appears:

MD time step POTIM in fs [1, detected from INCAR]:

Press Enter to accept the detected value, or type a different value to override it.

Variable-cell trajectories

For workflows that read XDATCAR, VQkit asks:

Variable-cell / NPT XDATCAR? [y/N]:

For a normal fixed-cell NVT trajectory, press:

Enter

For a variable-cell or NPT trajectory, enter:

y

VQkit then uses the lattice associated with each trajectory frame.

1. Trajectory summary

Purpose

Trajectory summary provides a quick overview of the AIMD trajectory before performing more detailed analysis.

Select:

[1] Trajectory summary

VQkit asks for the XDATCAR filename:

XDATCAR file in current directory [XDATCAR]:

Press Enter if the file is named XDATCAR.

Then choose whether the trajectory is variable-cell and confirm the MD time step.

Output

VQkit creates:

VQkit_AIMD_summary/

Inside the directory, the summary file is:

VQkit_AIMD_trajectory_summary.txt

The summary reports:

  • XDATCAR path

  • number of trajectory frames

  • number of atoms

  • atomic species

  • detected or user-specified time step

  • first and last configuration numbers

  • last-frame simulation time

  • variable-cell status

  • minimum, maximum, and mean cell volume

Example use

Use the trajectory summary first to confirm that:

  • the correct trajectory is being read;

  • the atom count is correct;

  • POTIM is correct;

  • the number of frames is reasonable.

2. Atomic positions versus time

Purpose

This workflow follows the position of one or more selected atoms throughout the AIMD trajectory.

Select:

[2] Atomic position coordinates vs time (XDATCAR)

VQkit asks for the XDATCAR file and whether the trajectory is variable-cell.

It then reports the detected atoms and species and asks:

Atom index/indices (1-based; e.g. 1 or 1,5,10-12):

Examples

One atom:

5

Several atoms:

1,5,10

Atom range:

10-15

Mixed selection:

1,5,10-12

After confirming POTIM, VQkit asks:

Output directory [VQkit_AIMD_positions]:

Press Enter to use the default.

Output

VQkit creates:

VQkit_AIMD_positions/

Important output files include:

VQkit_XDATCAR_position_vs_time.csv
VQkit_XDATCAR_position_vs_time.dat
VQkit_XDATCAR_position_vs_time_summary.txt

For every selected atom, VQkit also creates PNG and PDF plots.

The exported coordinates include:

  • fractional coordinates

  • wrapped Cartesian coordinates

  • PBC-unwrapped Cartesian coordinates

The unwrapped Cartesian coordinates are particularly useful when following long-range atomic motion through periodic boundaries.

3. Energy versus time

Purpose

This workflow extracts AIMD energy information and plots it against simulation time.

Select:

[3] Energy vs time

VQkit determines the time step and then searches for energy records.

Energy source priority

VQkit first checks:

OSZICAR

If suitable MD records are not found, it falls back to:

OUTCAR

When OSZICAR is available, VQkit can export:

  • temperature

  • E

  • F

  • E0

  • EK

when those quantities are present.

Output

VQkit creates:

VQkit_AIMD_energy/

with files such as:

VQkit_AIMD_energy_vs_time.csv
VQkit_AIMD_energy_vs_time.dat
VQkit_AIMD_energy_vs_time_summary.txt
VQkit_AIMD_energy_vs_time.png
VQkit_AIMD_energy_vs_time.pdf

Use this plot to inspect energy equilibration, drift, and fluctuations during the AIMD simulation.

4. Volume and lattice parameters versus time

Purpose

This workflow tracks simulation-cell geometry during the trajectory.

Select:

[4] Volume / lattice parameters vs time

VQkit reads XDATCAR and calculates for each frame:

  • a

  • b

  • c

  • alpha

  • beta

  • gamma

  • cell volume

This is especially useful for variable-cell or NPT simulations.

Output

VQkit creates:

VQkit_AIMD_cell/

with numerical data and PNG/PDF plots of the lattice lengths and cell volume.

For fixed-cell AIMD, these quantities should remain constant unless the trajectory file itself contains changing lattice information.

5. Bond distance versus time

Purpose

This workflow follows the distance between two selected atoms throughout the trajectory.

Select:

[5] Bond distance vs time

VQkit asks for the XDATCAR file and then requests two atom indices:

First atom index (1-N):

and:

Second atom index (1-N):

where N is the total number of atoms.

Example

To monitor the distance between atoms 5 and 18:

First atom index: 5
Second atom index: 18

VQkit uses the periodic minimum-image convention when calculating the pair distance.

Output

The default output directory is:

VQkit_AIMD_bond/

VQkit generates numerical data together with PNG and PDF plots of bond distance versus time.

This analysis is useful for monitoring:

  • bond formation;

  • bond breaking;

  • structural fluctuations;

  • coordination changes.

6. Mean-squared displacement

Purpose

The mean-squared displacement (MSD) measures the average displacement of a selected group of atoms from the first XDATCAR configuration.

Select:

[6] Mean-square displacement (MSD)

VQkit accepts several selection styles.

All atoms:

all

One element:

Li

Several atom indices:

1,5,10-12

VQkit unwraps trajectories across periodic boundaries before calculating the MSD.

Output

The default output directory is:

VQkit_AIMD_MSD/

Files include:

VQkit_AIMD_MSD.csv
VQkit_AIMD_MSD.dat
VQkit_AIMD_MSD_summary.txt
VQkit_AIMD_MSD.png
VQkit_AIMD_MSD.pdf

The MSD has units of:

Angstrom^2

Scientific note

For variable-cell trajectories, Cartesian MSD contains contributions from cell deformation. Interpret NPT or strongly deforming trajectories carefully.

7. Diffusion coefficient

Purpose

VQkit estimates a diffusion coefficient from the MSD using the Einstein relation.

Select:

[7] Diffusion coefficient

Select the diffusing atoms using:

  • all

  • an element symbol such as Li

  • explicit atom indices

Example:

Diffusing atoms [all]: Li

VQkit then asks:

Diffusion dimensionality [3]:

Use:

  • 1 for one-dimensional diffusion;

  • 2 for two-dimensional diffusion;

  • 3 for three-dimensional diffusion.

For normal bulk diffusion, press Enter to use 3.

Fit region

VQkit asks:

Fraction of trajectory to discard before linear fit [0.5]:

The default 0.5 means that the first 50% of the trajectory is excluded from the linear MSD fit.

The diffusion coefficient is calculated from:

\[D = \frac{1}{2d}\frac{d\,\mathrm{MSD}}{dt}\]

where d is the selected dimensionality.

Output

The default output directory is:

VQkit_AIMD_diffusion/

Files include:

VQkit_AIMD_diffusion_fit.csv
VQkit_AIMD_diffusion_fit.dat
VQkit_AIMD_diffusion_summary.txt
VQkit_AIMD_diffusion_fit.png
VQkit_AIMD_diffusion_fit.pdf

VQkit reports:

  • MSD slope in Angstrom^2/fs

  • diffusion coefficient in Angstrom^2/fs

  • diffusion coefficient in cm^2/s

  • linear-fit R^2

Important

VQkit does not automatically identify the physically valid diffusive regime.

You must choose a fit-start fraction corresponding to a region where MSD is approximately linear with time.

Always inspect the MSD and diffusion-fit plot before reporting the diffusion coefficient.

8. Radial distribution function

Purpose

The radial distribution function describes the probability of finding one group of atoms at distance r from another group.

Select:

[8] Radial distribution function (RDF)

Group selection

The group-selection prompt accepts:

  • all

  • element symbols

  • atom indices

Example for Li-O RDF:

Group A [all]: Li
Group B [all]: O

VQkit then asks:

Maximum r in Angstrom [automatic]:

Press Enter to use the automatically determined value.

Then:

Bin width in Angstrom [0.05]:

Press Enter to use 0.05 Angstrom.

Output

The default output directory is:

VQkit_AIMD_RDF/

Files include:

VQkit_AIMD_RDF.csv
VQkit_AIMD_RDF.dat
VQkit_AIMD_RDF_summary.txt
VQkit_AIMD_RDF.png
VQkit_AIMD_RDF.pdf

VQkit uses periodic minimum-image distances and per-frame cell-volume normalization.

Important

For unambiguous normalization, the two RDF groups must be either:

  • identical; or

  • disjoint.

Partially overlapping but non-identical groups are not accepted.

9. Coordination number versus time

Purpose

This workflow follows the coordination environment of selected atoms over the AIMD trajectory.

Select:

[9] Coordination number vs time

VQkit asks for:

Center atoms [all]:
Neighbor atoms [all]:

Selections can be:

  • all

  • element symbols

  • atom indices

Example for Li coordinated by O:

Center atoms [all]: Li
Neighbor atoms [all]: O

Then choose the distance cutoff:

Coordination cutoff in Angstrom [3.0]:

Example:

2.8

Output

The default output directory is:

VQkit_AIMD_coordination/

Files include:

VQkit_AIMD_coordination_vs_time.csv
VQkit_AIMD_coordination_vs_time.dat
VQkit_AIMD_coordination_summary.txt
VQkit_AIMD_coordination_vs_time.png
VQkit_AIMD_coordination_vs_time.pdf

For every trajectory frame, VQkit reports:

  • mean coordination number;

  • minimum coordination number;

  • maximum coordination number.

Self-pairs are excluded and periodic minimum-image distances are used.

Example: Li-ion AIMD analysis

Assume your AIMD calculation directory contains:

INCAR
OUTCAR
OSZICAR
XDATCAR

and you want to analyze Li-ion mobility.

Step 1 — Open the calculation directory

Start VQkit and set the AIMD calculation directory as the working directory.

Step 2 — Open AIMD analysis

At any VQkit menu prompt type:

aimd

Step 3 — Check the trajectory

Choose:

1

Confirm the number of frames, atoms, species, and MD time step.

Step 4 — Check temperature and energy behavior

Choose:

3

Inspect the resulting energy plot and temperature data exported from OSZICAR when available.

Step 5 — Calculate Li MSD

Choose:

6

For the atom selection enter:

Li

Inspect:

VQkit_AIMD_MSD/VQkit_AIMD_MSD.png

Step 6 — Estimate Li diffusion coefficient

Choose:

7

Enter:

Diffusing atoms [all]: Li
Diffusion dimensionality [3]: 3
Fraction of trajectory to discard before linear fit [0.5]: 0.5

Inspect the diffusion-fit plot and R^2 before using the reported diffusion coefficient.

Step 7 — Calculate Li-O RDF

Choose:

8

Enter:

Group A [all]: Li
Group B [all]: O
Maximum r in Angstrom [automatic]:
Bin width in Angstrom [0.05]:

Inspect the first-shell peak in the resulting RDF plot.

Step 8 — Follow Li-O coordination

Choose:

9

For example:

Center atoms [all]: Li
Neighbor atoms [all]: O
Coordination cutoff in Angstrom [3.0]: 2.8

The resulting plot shows how the Li coordination environment changes through the trajectory.

Scientific cautions

Diffusion fitting

A diffusion coefficient is meaningful only when the fitted MSD interval is in a physically linear diffusive regime.

Do not report the automatically calculated value without inspecting the MSD and fit.

Variable-cell MSD

For variable-cell or NPT simulations, Cartesian MSD can include contributions from cell deformation.

RDF normalization

For RDF analysis, the selected groups must be identical or disjoint.

Trajectory quality

AIMD analysis cannot compensate for insufficient simulation time, poor equilibration, unsuitable thermostat settings, inadequate sampling, or incorrect DFT parameters.

The physical reliability of the analysis depends on the quality of the underlying AIMD simulation.