c2x

ethene pi bond

C2x, or check2xsf as it was first known, was developed in the TCM Group in Cambridge. It reads and writes a selection of file formats which relate to DFT electronic structure codes. It is not simply a conversion utility, but it can also perform manipulations and some analysis. It can form supercells and find primitive cells. If linked with the excellent spglib symmetry finder, it provides access to functionality from that package. It can interpolate densities via a combination of trilinear and Fourier interpolation, integrate densities and calculate their dipole moments, analyse bands for inversion symmetry, and symmetry-expand eigenvalues for use with Fermi surface plotting.

Originally supporting just Castep, c2x now supports Abinit, Onetep, Quantum Espresso, Siesta and VASP as well. It thus can be considered to be a little like OpenBabel, but with an emphasis on different codes, and support for volumetric data.

One use of c2x is extracting volumetric data (charge density, colinear spin density, or charge density from a given band) for visualisation. It supports output formats compatible with XCrysDen, VESTA, VMD and Jmol amongst others, and can also produce 1D data in a format suitable for gnuplot. The ethene π bond above is from the 2016 version of XCrysDen.

Another use of c2x is to use one package's post-processing tools with another's. It can, for instance, convert a Castep .check file into a .chgcar file readable by VASP post-processors.

It can perform many cell manipulations, forming supercells or primitive cells, adding or removing vacuum, and rolling sheets into nanotubes. It can calculate electrostatic potentials from charge densities, and also calculate post hoc dipole correction energies for some geometries.

Getting c2x

C2x can be downloaded from its downloads page, as source or MacOS or Linux binaries.

News

Ubuntu 21.04 released, 22nd April 2021, and it includes a c2x package in its universe repository. I believe that this is the first major stable Linux distribution to include c2x. (There is also a Debian package in bullseye, which is currently "testing", not "stable".)

Version 2.40 released, 26th March 2021. The most significant change is that c2x can now work with multiple input files, and thus add or subtract densities etc. Other new features include being able to read .npy files, being able to extract individual frames from time series, and several other minor changes and bugfixes.

Version 2.35a released, 23rd December 2020. Two minor bugs fixed: a missing "_" when writing a cell file's SPECIES_POT, and the .npy output now works with Numpy on Ubuntu 18.04 and 20.04.

Version 2.35 released, 7th December 2020. Adds support for Castep's Electron Localisation Function, for writing a single dataset to a NumPy .npy file, for reading Abinit's _EIG files, and for calculating bandgaps. Also many other minor improvements, features and bugfixes.

Version 2.34d released, 17th July 2020. Adds support for Vasp LOCPOT files, and can read charges from Vasp POTCAR files. Also adds elements with atomic numbers 104 to 118, and extends the arithmetic parser.

Version 2.34c released, 18th June 2020. Adds basic support for Elk, recognises .pdbx as a form of CIF file, will read and write Castep .geom files, and various minor improvements.

Version 2.34b released, 9th April 2020. Previous versions failed to read Castep .bands files from parallel runs. Also adds support for Abinit 9.0, and tries to avoid re-ordering species when writing Vasp or Abinit input files.

Version 2.34a released, 27th March 2020. Adds ability to read Siesta's .bands files, and has a bunch of miscellaneous bug fixes. It should work better on MacOS, as it no longer assumes "%ms" is valid in a scanf format string.

Version 2.34 released, 9th March 2020. Adds ability to write .bxsf files for plotting Fermi surfaces. Also supports GCOEFF.txt, an ASCII wavefunction format, and (some) extended XYZ cell formats, particularly that from ASE.

Older News

Citing c2x

If you find it useful in your published research, the traditional academic acknowledgement of a citation would be appreciated. C2x: a tool for visualisation and input preparation for Castep and other electronic structure codes, MJ Rutter, Computer Physics Communications, 225 174-179 (2018). Once such papers are noticed, they are added to this list.