c2x and Abinit

Abinit is a GPLed DFT code.

From version 2.12 c2x can read its DEN files, extracting charge densities and collinear spin densities. It can write a basic system description to a .in file, and can read a subset of .in files too. It cannot read .in files which specify multiple datasets, nor does it support any use of spinors.


Reading of DEN and POT files was initially tested with Abinit 8.6.3. Version 2.34b of c2x also supports Abinit 9.0.2, which has a slightly different binary format. It is unclear which other versions it will work with.

Reading of WFK files was added in c2x 2.30.

Note that the binary DEN, POT and WFK files all start with a common header which includes atomic positions. C2x can extract these.

Although for POT files only the suffices POT and VCLMB (from c2x 2.32) are recognised, the use of symbolic links (or renaming the files) will enable c2x to read VHA, VXC, VHXC and PSP files too. From c2x 2.32 these are rescaled from Hartrees to volts by default.

Reading of .in files does not support the full syntax of Abinit's input files. However, it can read the cell description and atomic positions from files containing a single dataset and which specify all atoms, or which specify the minimum distinct set and symmetry operations. (This describes c2x 2.14. Reading of .in files was introduced in 2.12.)


There follows an example of using c2x to construct a .in file.

This site contains an example on the use of c2x with spin in FeO. If c2x is run on the .cell file as

  $ c2x --abinit FeO.cell FeO.in

then an Abinit input file is produced containing

acell 16.3725871682 8.18629358411 8.18629358411
      0.00000000000  0.50000000000  0.50000000000
      0.50000000000  0.00000000000  0.50000000000
      0.50000000000  0.50000000000  0.00000000000

ntypat 2
znucl  8 26

natom 4
typat  1  1  2  2
  0.25  0.5  0.5
  0.75  0.5  0.5
  0  0  0
  0.5  0  0

# antiferromagnetic system assumed
nsppol 1
nspden 2
spinat  0 0 0.000000  0 0 0.000000  0 0 2.000000  0 0 -2.000000
kptopt 1
ngkpt 1 3 3
nshiftk 1
shiftk 0.25000000000 0.00000000000 0.00000000000

#ecut 100 eV
toldfe 4e-05 eV

chksymbreak 0
chkprim 0

This can be joined with a .files file containing


(the two pseudopotentials can be found from Abinit's tutorials), and this is nearly sufficient to run Abinit and reproduce the spin density plot shown. All that needs to be done is the ecut line needs uncommenting and set to about 520 eV. If c2x was run on the .castep file, it would have read the cut-off used and filled it in, so the .in file could have been used unmodified.

The command equivalent to

  $ c2x -s FeO.check FeO.spin.xsf
is simply
  $ c2x -s FeO_o.DEN FeO.spin.xsf