This notebook demonstrates how to perform diffusivity and ionic conductivity analyses starting from a series of VASP AIMD simulations using Python Materials Genomics (pymatgen) and its add-on package pymatgen-diffusion. These notebooks are described in detail in

Deng, Z.; Zhu, Z.; Chu, I.-H.; Ong, S. P. Data-Driven First-Principles Methods for the Study and Design of 
Alkali Superionic Conductors. Chem. Mater. 2017, 29 (1), 281–288 DOI: 10.1021/acs.chemmater.6b02648.

If you find these notebooks useful and use the functionality demonstrated, please consider citing the above work.

Let's start by importing some modules and classes that we will be using.


The DiffusionAnalyzer class in pymatgen can be instantiated from a supplied list of sequential vasprun.xml output files from the AIMD simulations. An example code (commented out) is shown below.

In this work, all trajectories are stored in an efficient document-based MongoDB database. The format of the documents in the database is a binary JSON format. Here, we will instead instantiate the DiffusionAnalyzer from a pre-serialized DiffusionAnalyzer for each temperature.

MSD vs time plot

For each temperature, we can plot the mean square displacement against time as follows (only 1000 K shown).

Activation energy and ionic conductivity

From diffusivity at each temperature, we can obtain activation energy and room temperature ionic conductivity by constructing an Arrhenius plot.

From the temperatures and diffusivities, one may obtained the extrapolated room-temperature conductivity as follows.

Probability density function analysis

We can compute the probability density function from the AIMD trajectories using the ProbabilityDensityAnalysis class implemented in the pymatgen-diffusion add-on. We will use the calculation at 800K as an example. The probability density function can then be output to a CHGCAR-like file for visualization in VESTA.

The VESTA visualization software can be used to visualize isosurfaces in the probability density. The 800K probability density function at an isosurface of 0.002 is shown below.

van Hove correlation function analysis

We can compute the van Hove correlation function from a DiffusionAnalyzer using the VanHoveAnalysis class implemented in the pymatgen-diffusion add-on. We will use the calculation at 800K as an example.

We can then plot the self ($G_s$) and distinct ($G_d$) parts of the van Hove correlation function as follows.