Background

VASP CHGCAR files are electronic structure output files generated by the Vienna Ab-initio Simulation Package (VASP) software. These files contain information about the electronic charge density distribution of a simulated material or system. The CHGCAR file is written in human-readable format and consists of three blocks.

  • Structure data

  • Charge density

  • Augmentation occupancies

The charge density is stored on the fine FFT-grid whose mesh points are given by

\((N_{x},N_{y},N_{z}) = \frac{N_{x}-1}{N_{GXF}} \vec{a} + \frac{N_{y}-1}{N_{GYF}} \vec{b} + \frac{N_{z}-1}{N_{GZF}} \vec{c}\)

The CHGCAR file primarily serves to store the electron density scalar field. To visualize such scalar fields, there are two popular methods, which are the generation of isosurfaces or heat maps. EDP utilizes the latter technique by projecting the electron density onto a two-dimensional plane.

There are various ways to define the plane onto which the electron density should be projected. The approach used in EDP is to set two unit vectors \(\vec{v}\) and \(\vec{w}\) and a point \(\vec{p}\). Starting at the point \(\vec{p}\), a plane is then constructed by expanding in the two directions as given by the unit vectors \(\vec{v}\) and \(\vec{w}\). In turn, \(\vec{v}\) and \(\vec{w}\) will serve as the horizontal and vertical coordinates of a corresponding canvas onto which the electron density is plotted. The dimensions of the canvas are determined by the resolution given in pixels / Å.

Figure made with TikZ

A plane is defined using two normal vectors and a point. The dashed lines indicate the edges of the unit cell.

Since the electron density is only known at specific points, i.e. the mesh points of the fine FFT-grid, interpolation strategies are used to determine the electron density at the other points not coinciding with the mesh. EDP uses trilinear interpolation to project the electron density onto the plane.

Following the projection of the electron density onto a two-dimensional plane, the electron density values for every pixel on the canvas are established. Subsequently, visualization is executed in a straightforward manner. A color map is utilized to assign a distinct color to each numeric value, which is then allocated to the corresponding pixel on the plane. In addition, pixels on the canvas that correspond to positions outside the unit cell are rendered transparent.