Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (63 sloc) 3.99 KB



Electron density plotter is a tiny tool for generating electron density plots from VASP output.

CO orbitals generated using EDP

Figure: Four molecular orbitals of CO as generated by EDP.

Obtaining EDP from the repository

Install the GPG key

wget -O -|sudo apt-key add -

Add repository

echo "deb ivofilot-software main" | sudo tee -a /etc/apt/sources.list.d/ivofilot-software.list

Update apt sources and install edp

sudo apt-get update
sudo apt-get install edp


EDP depends on a couple of libraries, which are normally directly available by your favorite package manager.

  • Boost
  • GLM
  • Cairo

Compilation is done using CMake

mkdir build
cd build
cmake ../src
make -j5


To run EDP to construct a contour plane, use something like the command below

./edp -i <PATH_TO_CHGCAR> -v <v1,v2,v3> -w <w1,w2,w3> -p <p1,p2,p3> -o plot.png

where v and w correspond to two vectors that will span the plane and p corresponds to a position on that plane. Additionally, you can supply -s to indicate a scaling in pixels/angstrom. Instead of supplying vectors, you can also supply two atoms for the vectors v and w and a single atom for the position p. For example:

./edp -i CHGCAR -v 1-2 -w 0,0,1 -p 1 -o plot.png

There are 16 different color schemes built into EDP, which you can choose using the -c directive. If there are negative values in the density file, use the -n directive. Finally, to create a legend, use the -l directive.

To obtain a concise overview of all the command line directives, you can run

./edp --help

Color schemes

The following color schemes are built into EDP

Color schemes supported by EDP


A short tutorial on using the program is provided in this blog post.


To obtain an meaningful plane projection, the vectors v and w should be orthogonal to each other. When you are using atoms instead of vectors as input to -v and -w, this is not always the case. Hence, the option to project vector v on w according to the Gram-Schmidt process is provided. To do so, simply add -g as an input directive.

Line extraction

A recently requested feature was to not only construct contour planes from a scalar field, but also allow to project the scalar values onto a line to make a simple graph. To do so, you can use the -e command line parameter followed by either two atoms or a vector. On the line as indicated by the vector and the point supplied by p, the scalar field will be projected and written to the textfile line_extraction.txt which you can then plot. In the file line_extraction.txt, there are four columns which are the Cartesian x,y,z positions and the value at that point.

Below, an example graph is provided which shows the electron density of the 5 sigma orbital of CO projected on the line that crosses both atoms. The x-axis presents the z-position in the unit cell. The C and O atoms are placed at z = 5.00A and z = 6.15A, respectively.

Electron density graph of 5 sigma orbital of CO


Color schemes have been taken from the following sources. Details can be found in plotter.cpp.