Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time



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.


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.


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