This file contains the lattice vectors, atomic coordinates, the total
charge density multiplied by the volume
on the fine FFT-grid (NG(X,Y,Z)F), and the PAW one-center occupancies.
CHGCAR can be used to restart VASP from an existing charge density,
for visualisation the CHG file should be used, since the PAW-one centre occupancies
are difficult to parse.
It is possible to avoid that the CHGCAR is written by setting
LCHARG = .FALSE.in the INCAR file (see section 6.49). In VASP, the density is written using the following commands in Fortran:
WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,NGXC),NY=1,NGYZ),NZ=1,NGZC)The x index is the fastest index, and the z index the slowest index. The file can be read format-free, because at least in new versions, it is guaranteed that spaces separate each number. Please do not forget to divide by the volume before visualizing the file!
For spinpolarized calculations, two sets of data can be found in the CHGCAR file. The first set contains the total charge density (spin up plus spin down), the second one the magnetization density (spin up minus spin down). For non collinear calculations the CHGCAR file contains the total charge density and the magnetisation density in the x, y and z direction in this order.
For dynamic simulation (IBRION=0), the charge density on the file is the predicted charge density for the next step: i.e. it is compatible with CONTCAR, but incompatible with the last positions in the OUTCAR file. This allows the CHGCAR and the CONTCAR file to be used consistently for a molecular dynamics continuation job. For static calculations and relaxations (IBRION=-1,1,2) the written charge density is the selfconsistent charge density for the last step and might be used e.g. for accurate band-structure calculations (see section 9.3).
Mind: Since the
charge density written to the file CHGCAR is not the selfconsistent chargedensity
for the positions on the CONTCAR file,
do not perform a bandstructure calculation (ICHARG=11) directly after a dynamic simulation (IBRION0)
(see section 9.3).