CHGCAR: Difference between revisions

From VASP Wiki
No edit summary
No edit summary
Line 1: Line 1:
This file contains the lattice vectors, atomic coordinates, the total charge density multiplied by the volume <math>\rho(r)* V_{\rm cell}</math> on the fine FFT-grid (NG(X,Y,Z)F), and the PAW one-center occupancies. {{TAG|CHGCAR}} can be used to restart VASP from an existing charge density. For visualisation the {{TAG|CHG}} file should be used, since the PAW one-centre occupancies are difficult to parse. It is possible to avoid that the {{TAG|CHGCAR}} is written by setting {{TAG|LCHARG}}=''.FALSE.'' in the {{TAG|INCAR}} file. In VASP, the density is written using the following commands in Fortran:
This file contains the lattice vectors, atomic coordinates, the total charge density multiplied by the volume <math>\rho(r)* V_{\rm cell}</math> on the fine FFT-grid (NG(X,Y,Z)F), and the PAW one-center occupancies. {{TAG|CHGCAR}} can be used to restart VASP from an existing charge density. For visualisation the {{TAG|CHG}} file should be used, since the PAW one-centre occupancies are difficult to parse. It is possible to avoid that the {{TAG|CHGCAR}} is written by setting {{TAG|LCHARG}}=''.FALSE.'' in the {{TAG|INCAR}} file. In VASP, the density is written using the following commands in Fortran:
  WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,NGXC),NY=1,NGYC),NZ=1,NGZC)
  WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,{{TAGBL|NGXF}}),NY=1,{{TAGBL|NGYF}}),NZ=1,{{TAGBL|NGZF}})


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
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
Line 6: Line 6:


Note that the real-space mesh (NX,NY,NZ) is uniform and is spanned by the primitive lattice vectors <math>(\vec{a}, \vec{b}, \vec{c})</math> defined in the {{TAG|POSCAR}} and can read explicitly
Note that the real-space mesh (NX,NY,NZ) is uniform and is spanned by the primitive lattice vectors <math>(\vec{a}, \vec{b}, \vec{c})</math> defined in the {{TAG|POSCAR}} and can read explicitly
<math>(N_x,N_y,N_z) \hat{=} \frac{1}{N_x}\vec{a}+\frac{1}{N_y}\vec{b}+\frac{1}{N_z}\vec{c}</math>.
<math>(N_x,N_y,N_z) \hat{=} \frac{N_x-1}{N_{GXF}}\vec{a}+\frac{N_y-1}{N_{GYF}}\vec{b}+\frac{N_z-1}{N_{GZF}}\vec{c}</math>.


For spinpolarized calculations, two sets of data can be found in the {{TAG|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 spinpolarized calculations, two sets of data can be found in the {{TAG|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.

Revision as of 14:42, 7 January 2019

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:

WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,NGXF),NY=1,NGYF),NZ=1,NGZF)

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).


Contents