c2x and PWscf

Quantum Espresso is a GPLed suite of electronic structure codes, and c2x targets PWscf, the DFT component.

From version 2.15, c2x can read and write some data from its input files. Version 2.16 extends support to co-linear spin-polarised systems, and to reading .xml files and charge and spin densities.


A file suffix of .in causes c2x to invoke an Abinit reader, which in turn invokes the Quantum Espresso reader if the first line is &control.

Reading of systems with any of the 17 Bravais lattices which QE understands is supported. Just atomic positions, k-points, energy cut-off and title are read.

There seems to be some confusion about the syntax of options on cards. On a line such as


should there be brackets around "angstrom", and should they be square brackets or parentheses? C2x will accept either or none.

When reading namelists, c2x ignores equals signs and commas, and accepts multiple parameters per line. It does not accept a linebreak between a parameter and its value.

.xml files

From version 2.16 c2x will read pwscf's .xml output files and its non-HDF5 charge-density.dat files. It will also attempt to read its pseudopotential files in order to extract the pseudocharges. Thus c2x can extract charge and spin densities, and calculate dipole moments etc., from pwscf calculations.

From version 2.30 c2x can also read the default non-HDF5 wavefunction files. The .xml file should still be specified as the main input file, as the wavefunction files do not contain sufficient information to be read alone.

The units in pwscf's xml files are meant to be Hartrees and Bohr. However, prior to version 6.6 of pwscf, forces were erroneously recorded in Ha/alat. Versions of c2x prior to 2.40 assume this error. Versions from 2.40 onwards assume Ha/B, and refuse to read forces from xml files written by versions of pwscf prior to 6.6. (The error seems to have been slightly more complicated if cell relaxation is performed, so it seems safer not to attempt to unpick it, but to recommend the use of a more modern version of pwscf. If one needs the source of an earlier version of c2x, the prior versions downloads page may help.

.cube files

The .cube files produced by QE's postprocessor pp.x are in atomic units. They should thus be read with the -U switch. The ionic charges given are the atomic numbers, not the pseudopotential charges, so these need to be modified by hand if calculating dipole moments.


Files are written with no brackets, and with one parameter per line in namelists. The -u flag is recognised for switching the output from Angstrom (default) to Bohr. Atomic positions are written in either Cartesian (--qe) or fractional (--qef) co-ordinates.