9
$\begingroup$

Rephrasing the above, what is the pattern in which the electron-density data is stored in the CHGCAR file?

I understand that the electron density data in a CHGCAR file is in the form of a 3D Fortran array, but I believe that such electron density data should be stored in 3 columns (NX,NY,NZ). Instead we see the presence of 5 columns. What I am requesting, is a comprehensive description of the 5-column electron density data present in every CHGCAR file, and the significance of every column present to represent the electron-density data.

I have shown the part of the CHGCAR data that I am referring to, is shown below:

  64   64   64
 0.27296628474E+03 0.27129538645E+03 0.26632236747E+03 0.25816527382E+03 0.24701868651E+03
 0.23315320780E+03 0.21691723332E+03 0.19873896341E+03 0.17912393717E+03 0.15864307047E+03
 0.13790873569E+03 0.11754046377E+03 0.98125176377E+02 0.80177959210E+02 0.64108387081E+02
 0.50195641939E+02 0.38574367354E+02 0.29232778335E+02 0.22024079253E+02 0.16690923309E+02
 0.12900228129E+02 0.10283187627E+02 0.84752878195E+01 0.72047216409E+01 0.63226226628E+01
 0.57166613639E+01 0.53025284991E+01 0.50199593897E+01 0.48277275324E+01 0.46988015018E+01
 0.46162530737E+01 0.45701256193E+01 0.45552760083E+01 0.45701256193E+01 0.46162530737E+01
 0.46988015018E+01 0.48277275324E+01 0.50199593897E+01 0.53025284991E+01 0.57166613639E+01
 0.63226226628E+01 0.72047216409E+01 0.84752878195E+01 0.10283187627E+02 0.12900228129E+02
 0.16690923309E+02 0.22024079253E+02 0.29232778335E+02 0.38574367354E+02 0.50195641939E+02
 0.64108387081E+02 0.80177959210E+02 0.98125176377E+02 0.11754046377E+03 0.13790873569E+03
 0.15864307047E+03 0.17912393717E+03 0.19873896341E+03 0.21691723332E+03 0.23315320780E+03
 0.24701868651E+03 0.25816527382E+03 0.26632236747E+03 0.27129538645E+03 0.27129538645E+03
..................... over a hundred thousand lines of data
$\endgroup$
1

2 Answers 2

8
$\begingroup$

From the Vaspwiki, the CHGCAR file writes out the density using this Fortran snippet:

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

Basically, this will iterate through the coordinates in the order X, then Y, then Z. For your case, this would look something like with $(N_x,N_y,N_z)$: $(1,1,1),(2,1,1),...,(64,1,1),(1,2,1),(2,2,1),...$

The five columns don't have any particular meaning, the screen would just become too cluttered if you tried to include more values per line, so they just print five at a time. This is what the FORM option in the code above is doing; they don't include the code for the format on the Vaspwiki, but if the code were just write(iu,*), it would try to print all these values on one line until it ran out of buffer space.

To find the actual coordinate values of a grid point from its index, you can convert using $$(N_x,N_y,N_z)=\frac{N_x-1}{N_{GXF}}\vec{a}+\frac{N_y-1}{N_{GYF}}\vec{b}+\frac{N_z-1}{N_{GZF}}\vec{c}$$ where $\vec{a},\vec{b},\vec{c}$ are the lattice vectors.

$\endgroup$
4
  • $\begingroup$ Okay, then how does VESTA rearrange the data to visualize it? $\endgroup$
    – Pranoy Ray
    Commented Jun 22, 2021 at 19:07
  • 1
    $\begingroup$ @PranoyRay I don't know about VESTA and it potentially could warrant another question. But I suspect it just reads the values from the CHGCAR into a 3D array and performs whatever visualization with this data. Is there something missing from my description that you think would be needed to visualize the density? $\endgroup$
    – Tyberius
    Commented Jun 22, 2021 at 19:16
  • $\begingroup$ Thank you for your comment. Your answer is perfect. $\endgroup$
    – Pranoy Ray
    Commented Jun 22, 2021 at 19:23
  • 1
    $\begingroup$ Since this discussion warrants another question, I have posted it here: mattermodeling.stackexchange.com/questions/6225/… $\endgroup$
    – Pranoy Ray
    Commented Jun 22, 2021 at 19:44
2
$\begingroup$

VESTA can understand the data format of CHGCAR outputted by VASP. You just need to move CHGCAR to CHGCAR.vasp and then open with VESTA.

$\endgroup$
1
  • 2
    $\begingroup$ Unecessary to rename with the .vasp suffix $\endgroup$
    – Memories
    Commented Sep 20, 2022 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .