Do I need to divide the numpy array myself in order to obtain the charge density in units 1/Å^3?

according to this post,I managed to download CHGCAR files and convert them into numpy arrays. but in CHGCAR - VASP Wiki, the following warning exists.


So my question is:

  1. Do I need to divide the numpy array myself in order to obtain the charge density data in units 1/Å^3 , or pymatgen has already took care of this conversion?
  2. If the latter is the case, where can I find relevant documentation?

Hi @Leonard_Bruce, doesn’t look like that conversion takes place internally in pymatgen. You can do this scaling using just the data in pymatgen’s Chgcar object (chgcar below):

from pymatgen.io.vasp import Chgcar

chgcar = Chgcar.from_file("file_path_to/CHGCAR") # or other CHGCAR source
for k in chgcar.data:
    chgcar.data[k] /= (chgcar.ngridpts * chgcar.structure.volume)
1 Like

I got it, thanks very much!!! :grinning:@Aaron_Kaplan