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:
The {{FILE|CHGCAR}} file stores the charge density and the PAW one-center occupancies and can be used
WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,{{TAGBL|NGXF}}),NY=1,{{TAGBL|NGYF}}),NZ=1,{{TAGBL|NGZF}})
for restarting VASP calculations. The {{FILE|CHG}} file also stores the charge
density and has a similar structure, however {{FILE|CHG}} does not contain the PAW one-center occupancies and is mainly intended for visualization and post-processing.
VASP creates the {{FILE|CHGCAR}} file by default, but it can be avoided by setting {{TAG|LCHARG}} = .FALSE. in the {{TAG|INCAR}} file.


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 <math>(\vec{a}, \vec{b}, \vec{c})</math> defined in the {{TAG|POSCAR}} and can read explicitly
 
== Format ==
The {{FILE|CHGCAR}} consists of the following blocks:
* structure
* charge density
* augmentation occupancies
The structure block uses the same format as the {{FILE|POSCAR}} file.
The total charge density is represented on the fine FFT-grid (NGXF,NGYF,NGZF) and is multiplied by the cell volume, i.e. <math>\rho(r)* V_{\rm cell}</math>.
Thus, remember that the charge density should be divided by the cell volume for visualization.
As the density is written out using the following command in Fortran
 
<code> WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,{{TAGBL|NGXF}}),NY=1,{{TAGBL|NGYF}}),NZ=1,{{TAGBL|NGZF}}) </code>,
 
the iteration over NX is performed in the inner-most loop (fastest) and the loop over NZ is the outer-most (slowest).
In the new versions of VASP, the values of the charge density in {{TAG|CHGCAR}} are separated by spaces and can be read format-free.
The augmentation occupancies are written to {{TAG|CHGCAR}} up to the ''l''-quantum number, which is set by the {{TAG|LMAXMIX}} flag.
The real-space mesh (NX,NY,NZ) is uniform and is spanned by the lattice vectors <math>\vec{a}, \vec{b}, \vec{c}</math> defined in the structure block. The coordinates of the mesh points can be restored via
 
<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>.
<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.
=== Molecular dynamics ===
In the case of MD simulations ({{TAG|IBRION}}=0), {{FILE|CHGCAR}} contains the predicted charge density for the next step, which corresponds to the atomic structure in the {{FILE|CONTCAR}} file. Although it makes the charge density incompatible with the last atomic coordinates in the {{FILE|OUTCAR}} file, it allows one to use the {{FILE|CHGCAR}} and the {{FILE|CONTCAR}} files consistently for continuing the MD simulation.
{{NB|warning|In MD simulations, the charge density in {{FILE|CHGCAR}} is not the self-consistent charge density for the structure in the {{FILE|CONTCAR}} file, hence one should not perform a band structure calculation directly after the MD simulation.}}
For static and relaxation calculations ({{TAG|IBRION}}=-1,1,2), the charge density in {{FILE|CHGCAR}} is the self-consistent charge density for the last iteration. Hence it can be used for accurate band structure calculations.
 
 
=== Spin-polarized ===
In spin-polarized calculations, two sets of data are stored in the {{FILE|CHGCAR}} file.
The first set contains the total charge density (spin up + spin down) and the second one is the magnetization density (spin up - spin down).
* structure
* total charge density (spin up + spin down)
* augmentation occupancies
* magnetization density (spin up - spin down)
* augmentation occupancies


For dynamic simulation ({{TAG|IBRION}}=0), the charge density on the file is the predicted charge density for the next step: i.e. it is compatible with the {{TAG|CONTCAR}} file, but incompatible with the last positions in the {{TAG|OUTCAR}} file. This allows the {{TAG|CHGCAR}} and the {{TAG|CONTCAR}} file to be used consistently for a molecular dynamics continuation job. For static calculations and relaxations ({{TAG|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.
=== Non-collinear ===
In non-collinear calculations, {{FILE|CHGCAR}} contains the total charge density and the magnetization density in the x, y, and z-direction.
* structure
* total charge density
* augmentation occupancies
* augmentation occupancies (imaginary part)
* magnetization density in x-direction
* augmentation occupancies
* augmentation occupancies (imaginary part)
* magnetization density in y-direction
*  ...
* magnetization density in z-direction
*  ....


'''Mind''':  Since the charge density written to the file {{TAG|CHGCAR}} is not the self-consistent charge density for the positions on the {{TAG|CONTCAR}} file, do not perform a bandstructure calculation ({{TAG|ICHARG}}=11) directly after a dynamic simulation ({{TAG|IBRION}}=0).
----
----


[[Category:Files]][[Category:Input Files]][[Category:Output Files]]
[[Category:Files]][[Category:Input Files]][[Category:Output Files]]

Revision as of 18:29, 25 March 2022

The CHGCAR file stores the charge density and the PAW one-center occupancies and can be used for restarting VASP calculations. The CHG file also stores the charge density and has a similar structure, however CHG does not contain the PAW one-center occupancies and is mainly intended for visualization and post-processing. VASP creates the CHGCAR file by default, but it can be avoided by setting LCHARG = .FALSE. in the INCAR file.


Format

The CHGCAR consists of the following blocks:

  • structure
  • charge density
  • augmentation occupancies

The structure block uses the same format as the POSCAR file. The total charge density is represented on the fine FFT-grid (NGXF,NGYF,NGZF) and is multiplied by the cell volume, i.e. . Thus, remember that the charge density should be divided by the cell volume for visualization. As the density is written out using the following command in Fortran

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

the iteration over NX is performed in the inner-most loop (fastest) and the loop over NZ is the outer-most (slowest). In the new versions of VASP, the values of the charge density in CHGCAR are separated by spaces and can be read format-free. The augmentation occupancies are written to CHGCAR up to the l-quantum number, which is set by the LMAXMIX flag. The real-space mesh (NX,NY,NZ) is uniform and is spanned by the lattice vectors defined in the structure block. The coordinates of the mesh points can be restored via

.

Molecular dynamics

In the case of MD simulations (IBRION=0), CHGCAR contains the predicted charge density for the next step, which corresponds to the atomic structure in the CONTCAR file. Although it makes the charge density incompatible with the last atomic coordinates in the OUTCAR file, it allows one to use the CHGCAR and the CONTCAR files consistently for continuing the MD simulation.

Warning: In MD simulations, the charge density in CHGCAR is not the self-consistent charge density for the structure in the CONTCAR file, hence one should not perform a band structure calculation directly after the MD simulation.

For static and relaxation calculations (IBRION=-1,1,2), the charge density in CHGCAR is the self-consistent charge density for the last iteration. Hence it can be used for accurate band structure calculations.


Spin-polarized

In spin-polarized calculations, two sets of data are stored in the CHGCAR file. The first set contains the total charge density (spin up + spin down) and the second one is the magnetization density (spin up - spin down).

  • structure
  • total charge density (spin up + spin down)
  • augmentation occupancies
  • magnetization density (spin up - spin down)
  • augmentation occupancies

Non-collinear

In non-collinear calculations, CHGCAR contains the total charge density and the magnetization density in the x, y, and z-direction.

  • structure
  • total charge density
  • augmentation occupancies
  • augmentation occupancies (imaginary part)
  • magnetization density in x-direction
  • augmentation occupancies
  • augmentation occupancies (imaginary part)
  • magnetization density in y-direction
  • ...
  • magnetization density in z-direction
  • ....