c2x and VASP

c2x is able to read CHG, CHGCAR, POSCAR and CONTCAR files in VASP 5.x format. (Earlier formats omitted any indication of atomic species from these files.)

It can write CHG and CHGCAR files, which are almost identical apart from in the precision with which they are written.

If run with the --vasp flag, c2x will produce POSCAR output, i.e. unit cell and atomic positions only. If -c is added, the charge density will be included, producing a CHG file. The single flag --chgcar is a convenient shorthand for --vasp -c and increases the precision as expected for a CHGCAR file. To include spin density as well (if present), the -s flag is also required.

Note: when reading CHG or CHGCAR files, unless a density is requested reading will stop after the header. If the input contains data on initial magnetic moment, and there is a desire to retain that data, then the -s flag must be given in order for this to be read. In other words

  c2x -s CHGCAR out.cell

will preserve initial magnetic moments when writing to a .cell file, whereas without the -s flag the reading of the CHGCAR file will stop before the magnetic moments are found.

As c2x can write CHG and CHGCAR files, it can turn densities in .check, .cube, .xsf, .den_fmt and similar files into something which can be read by VASP-compatible viewers and analysers.