CHGCAR: Difference between revisions
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
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 | 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}}\ | ::<math>(N_x,N_y,N_z) \hat{=} \frac{N_x-1}{N_{GXF}}\mathbf{a}+\frac{N_y-1}{N_{GYF}}\mathbf{b}+\frac{N_z-1}{N_{GZF}}\mathbf{c}</math>. | ||
The dimensions can be increased by increasing the cutoff energy ({{TAG|ENCUT}}) or explicitly by setting {{TAG|NGXF}}, {{TAG|NGYF}}, {{TAG|NGZF}}. | The dimensions can be increased by increasing the cutoff energy ({{TAG|ENCUT}}) or explicitly by setting {{TAG|NGXF}}, {{TAG|NGYF}}, {{TAG|NGZF}}. | ||
Line 19: | Line 19: | ||
::<code> WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,{{TAGBL|NGXF}}),NY=1,{{TAGBL|NGYF}}),NZ=1,{{TAGBL|NGZF}}) </code>. | ::<code> WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,{{TAGBL|NGXF}}),NY=1,{{TAGBL|NGYF}}),NZ=1,{{TAGBL|NGZF}}) </code>. | ||
{{NB|important|Remember that the values must be divided by the FFT-grid volume to obtain the charge density.}} | {{NB|important|Remember that the values must be divided by the FFT-grid volume and the cell volume to obtain the charge density <math>n(r)</math>.}} | ||
::<math>n(r)=data(r)/( | Hence, | ||
::<math>n(r)=data(r)/(N_{GXF}*N_{GYF}*N_{GZF})/|\mathbf{a}\cdot(\mathbf{b}\times\mathbf{c})|</math>, | |||
where <math>n(r)</math> is the charge density in units 1/Å<math>^3</math>. Sanity check: The integral of <math>n(r)</math> over the unit cell yields the number of valence electrons ({{TAG|NELECT}}), | |||
::<math>\text{NELECT}=\int_{V_{cell}} n(\mathbf{r}) d^3\mathbf{r}= \sum_{N_X,N_Y,N_Z} data(N_X,N_Y,N_Z)/(N_{GXF}*N_{GYF}*N_{GZF})</math>. | |||
By convention, the charge density <math>n(r)</math> is not assumed to have the unit e/Å<math>^3</math> because the potential (e.g. {{FILE|LOCPOT}}, {{TAG|WRT_POTENTIAL}}) is assumed to be in eV. However, e<math>=1</math>, so while this convention makes the sign of <math>n(r)</math> less ambiguous, it has no effect on the numerical values. | |||
{{NB|warning|The augmentation occupancies are written up to the ''l''-quantum number set by the {{TAG|LMAXMIX}}.}} | {{NB|warning|The augmentation occupancies are written up to the ''l''-quantum number set by the {{TAG|LMAXMIX}}.}} | ||
Restarting calculations without one-center PAW occupancy matrices up to the appropriate ''l''-quantum number leads to loss of information. This is particularly problematic for calculations with fixed charge density, e.g., band-structure calculations. See {{TAG|LMAXMIX}} for more details. | Restarting calculations without one-center PAW occupancy matrices up to the appropriate ''l''-quantum number leads to loss of information. This is particularly problematic for calculations with fixed charge density, e.g., band-structure calculations. See {{TAG|LMAXMIX}} for more details. |
Revision as of 09:39, 7 February 2024
The CHGCAR file stores the charge density and the PAW one-center occupancies. It is written by default, but it can be avoided (LCHARG) or redirected to vaspwave.h5 (LH5). The CHGCAR file can be read to restart a calculation (ICHARG).
Tip: We recommend starting from the CHGCAR file when repeatedly restarting with small changes in the input parameters, e.g., the k-point mesh (KPOINTS). |
The CHG file also stores the charge density without the PAW one-center occupancies and is intended for visualization and post-processing.
Format
The CHGCAR consists of the following blocks:
- Structure in POSCAR format
- FFT-grid dimensions NGXF, NGYF, NGZF
- Charge density times FFT-grid volume is written with max five real numbers per line until all NGXF*NGYF*NGZF values of the block are written.
- Augmentation occupancies
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
- .
The dimensions can be increased by increasing the cutoff energy (ENCUT) or explicitly by setting NGXF, NGYF, NGZF.
To arrange the data on the real-space grid in the unit cell, mind that the data runs fastest over NX and slowest over NZ. To be more explicit, the density is written using the following command in Fortran
Important: Remember that the values must be divided by the FFT-grid volume and the cell volume to obtain the charge density . |
Hence,
- ,
where is the charge density in units 1/Å. Sanity check: The integral of over the unit cell yields the number of valence electrons (NELECT),
- .
By convention, the charge density is not assumed to have the unit e/Å because the potential (e.g. LOCPOT, WRT_POTENTIAL) is assumed to be in eV. However, e, so while this convention makes the sign of less ambiguous, it has no effect on the numerical values.
Warning: The augmentation occupancies are written up to the l-quantum number set by the LMAXMIX. |
Restarting calculations without one-center PAW occupancy matrices up to the appropriate l-quantum number leads to loss of information. This is particularly problematic for calculations with fixed charge density, e.g., band-structure calculations. See LMAXMIX for more details.
Magnetic calculations
For magnetic calculations, the CHGCAR file contains additional data blocks for the magnetization. In particular, for spin-polarized calculations (ISPIN=2), 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
- FFT-grid dimensions
- Charge density times FFT-grid volume (spin up + spin down)
- Augmentation occupancies
- Magnetization density (spin up - spin down)
- Augmentation occupancies
For noncollinear calculation (LNONCOLLINEAR=T), contains the total charge density and the magnetization density in the spinor basis set by SAXIS:
- Structure
- FFT-grid dimensions
- Charge density times FFT-grid volume
- Augmentation occupancies
- Augmentation occupancies (imaginary part)
- Magnetization density times FFT-grid volume **in direction**
- Augmentation occupancies
- Augmentation occupancies (imaginary part)
- Magnetization density times FFT-grid volume in direction
- ...
- Magnetization density times FFT-grid volume in direction
- ....
Molecular dynamics and structure relaxation (IBRION)
In the case of molecular-dynamics (MD) simulations (IBRION=0), CHGCAR contains the extrapolated 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.
Related tags and articles
WAVECAR, CHG, LCHARG, ICHARG, LMAXMIX, FFT-grid dimensions: ENCUT,NGXF,NGYF,NGZF