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. In VASP, the density is written using the following commands in Fortran:
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!
Note that the real-space mesh (NX,NY,NZ) is uniform and is spanned by the primitive lattice vectors defined in the POSCAR and can read explicitly .
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 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 the CONTCAR file, 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 self-consistent charge density for the last step and might be used e.g. for accurate band-structure calculations.
Mind: Since the charge density written to the file CHGCAR is not the self-consistent charge density for the positions on the CONTCAR file, do not perform a bandstructure calculation (ICHARG=11) directly after a dynamic simulation (IBRION=0).