File formats

Electrum.jl supports a variety of different file formats from abinit, VASP, and LAMMPS.


Outputs from abinit 7.10.5 and abinit 8.10.3 are supported and have been tested. The headers from these versions contain the numbers 57 and 80 respectively. Fundamentally, these files are FORTRAN binary files written in sequential access mode with 4-byte record markers.

The file reading functionality from this package has not been tested on outputs from other versions of abinit, but may work for the outputs of other abinit versions. However, these functions will fail if the header does not contain either of those numbers in the header.

If other header formats are known to work, please file an issue to extend support for abinit outputs to that format.

Densities and potentials

Density outputs are suffixed with _DEN when written by abinit. Depending on the calculation type, there can be either 1, 2, or 4 components (depending on the value of nsppol). The first component is always the total density.

There is also the kinetic energy density with suffix _KDEN which should use the same format as electron density files.

Potential outputs can have several different suffixes depending on the component of the potential chosen to be written:

  • _POT: Total potential.
  • _VPSP: Local components of the pseudopotentials used.
  • _VHA: Hartree potential.
  • _VHXC: Sum of the Hartree and exchange-correlation potentials.
  • _VXC: Exchange-correlation potential.

Both density and potential files follow the same format. The read_abinit_DEN() and read_abinit_POT() functions can be used to load in density and potential files.


Wavefunctions can be read in by read_abinit_WFK(). This assumes that the wavefunction is stored by k-points (istwfk should be equal to nkpt*1 in the input file).

Because wavefunctions are large files, and reading them can be slow, read_abinit_WFK() will print @info messages for every k-point that is read in. This can be disabled by setting the keyword argument quiet = true.


abinit 7.10.5 (header version 57) does not output the matrix associated with the k-point mesh used in the calculation (the kptrlatt field). The matrix contained in the associated KPointMesh{3} object will be zero.


File reading and writing has been tested with VASP 4. While the functions listed here are not guaranteed to work for future VASP versions, many can still be expected to work.

By default, all functions that read VASP outputs will are named read<FILENAME>(). If called without arguments, or with a directory argument, they will search the current working directory or the directory argument for a file with the name FILENAME, as VASP calculations will generate those particular filenames in a directory where a calculation was run.

Files generated by VASP calculations


The DOSCAR file contains data need to plot a density of states curve.


The POSCAR file contains the basis vectors and all of the atomic positions used to generate a crystal structure. The CONTCAR file is where the atomic positions from a calculation are written, and its format is identical to that of the POSCAR file. In the case of geometry optimizations, the contents of CONTCAR will differ from those of POSCAR. readPOSCAR() and readCONTCAR() will read these files into a PeriodicAtomList{3}.


POSCAR files supported by VASP 4 do not contain explicit atomic identity information. If those are read in without modification, dummy atoms with numeric labels will be used instead of the true atom names.


The PROCAR file contains data needed to plot fat bands (band structures that contain information about contributions from atomic orbitals).


The WAVECAR file contains the coefficients for the wavefunction's reciprocal space representation at each k-point. The wavefunction is stored in an order with sparse, implied indexing.


VASP does not store the weights of k-points in the WAVECAR, nor does it store the matrix that generated the k-point mesh. Naïve summing of quantities associated with each k-point should be avoided.

Like read_abinit_wavefunction(), readWAVECAR() will print @info messages by default for each k-point read in. This can be disabled by setting the keyword argument quiet = true.


Electrum.jl supports the reading and writing of LAMMPS atomic position data.


Like VASP POSCAR files, LAMMPS data files do not contain explicit atomic information. If none is provided, dummy atoms corresponding to each atom type will be used.


Electrum.jl can export AbstractAtomPosition and Crystal data to TOML files through the writeTOML(file, data) function. The internal Electrum.toml_convert() can be used to convert data to a dictionary that TOML.print() can support.

This functionality works only if the TOML module is loaded (as a weak dependency through Requires). If it is not available, run the following command in the REPL:

julia> using TOML