c2x and Castep

Castep was the first electronic structure code supported by c2x, then called check2xsf. Castep-specific support currently includes:

Note that:

  1. a .castep_bin is essentially a .check file without the wavefunctions;
  2. .cst_esp and .chdiff files contain just a grid of data with no information about the axes of that grid. So they need to be read in conjunction with a .cell or .check file;
  3. c2x can regenerate a .den_fmt file, including scalar spin density, from a .check file, just as it can regenerate most of a .cell file.
  4. prior to version 2.32, c2x rescaled .cst_esp files to change the sign of their data. From 2.32 it leaves the sign unchanged.

Many different formats of the .cell file can be written. One has a choice between Angstroms and Bohr, between absolute and relative atomic positions, and between Cartesian axes or a, b, c, α, β, γ. Not all data in .cell files are preserved by c2x: it is assumed that its output is taken as a starting-point for generating a new input file, and not simply blindly accepted.

Version 2.05b can read .check files from Castep 3 to 19.1, and perhaps beyond. Support for the use of arithmetic expressions in .cell files was added in 2.10.


Castep works internally in Bohrs and Hartrees, and these are also the units in .check files. C2x converts these to A and eV, but the conversion factors are not perfectly defined. Indeed, different versions of Castep use different factors, as more accurate standard values are published by CODATA.

C2x uses one Hartree=27.211 383 429eV up to version 2.20a inclusive, and one Hartree=27.211 386 020eV thereafter. Changing its conversion factors requires editing c2xsf.h and recompiling.

Final Energies

For non-insulators, Castep reports three final energies. A deliberately extreme example is:

Final energy, E            = -450.6308950278  eV
Final free energy (E-TS)   = -450.6801025320  eV
(energies not corrected for finite basis set)
NB est. 0K energy (E-0.5TS)     =  -450.6554987799  eV

The .check file stores the value (E-TS) only, so this is what c2x will report. The TS term can be calculated from the band occupancies at all k-points, and will be zero unless bands are partially-occupied. If bands are partially-occupied, its value depends on both the occupancies and the smearing scheme used, which makes the calculation less simple as Castep supports large and growing number of schemes. The TS term can be reduced by reducing the smearing width, though this is likely to make convergence slower. See "castep --help SMEARING_WIDTH".

Other information

I also maintain a personal page on Castep.