CHG file and fine FFT-grid

Question on input files/tags, interpreting output, etc.

Please check whether the answer to your question is given in the VASP online manual or has been discussed in this forum previously!

Moderators: Global Moderator, Moderator

Post Reply
Message
Author
winterro

CHG file and fine FFT-grid

#1 Post by winterro » Wed Feb 06, 2008 9:16 am

Hello,

I need some information on the details of the fine FFT-grid as it relates to charge densities as written in the CHG file. The CHG file contains the total charge density multiplied by the volume on the fine FFT-grid (NG(X,Y,Z)F. This means that if I have NG(X,Y,Z)F = 48, then when I look at my CHG file I find 48x48x48=110592 entries, organized into 10 columns, with roughly 11059 entries in each column. How do each of these 110592 entries in the CHG file map onto the simulation cell as defined in POSCAR (i.e. does the first entry in the first column correspond to the charge density at coordinate (0,0,0), the second entry in the first column correspond to the charge density at coordinate (0.01,0,0) . . .)? In other words, I need to be able to map the numbers in the CHG file to the real space coordinates it represents in my three-dimensional simulation cell. Can anyone help me out here?

Thanks,
-W
Last edited by winterro on Wed Feb 06, 2008 9:16 am, edited 1 time in total.

forsdan
Sr. Member
Sr. Member
Posts: 339
Joined: Mon Apr 24, 2006 9:07 am
License Nr.: 173
Location: Gothenburg, Sweden

CHG file and fine FFT-grid

#2 Post by forsdan » Wed Feb 06, 2008 10:17 pm

If I remember it correctly (it's been a while since I plotted a charge density) the first 48 entries will correspond to the points along the x-axis for the first y and first z point. The next 48 entries will be for the points along the x-axis for the 2nd y point and the first z-point. So that the first 48x48 points will constitute a plane cut with a normal vector in the z-direction. At least it should be the case for orthogonal lattice vectors. Don't know if that answers the question though. Does it make sense at all?

Best regards,
/Dan Fors


<span class='smallblacktext'>[ Edited Wed Feb 06 2008, 11:21PM ]</span>
Last edited by forsdan on Wed Feb 06, 2008 10:17 pm, edited 1 time in total.

Danny
Full Member
Full Member
Posts: 201
Joined: Thu Nov 02, 2006 4:35 pm
License Nr.: 5-532
Location: Ghent, Belgium
Contact:

CHG file and fine FFT-grid

#3 Post by Danny » Thu Feb 07, 2008 10:51 am

In the VASP manual(http://cms.mpi.univie.ac.at/CMSPage/main/) you can find this for the CHGCAR file:
[quote author=1,NGXC),NY=1,NGYZ),NZ=1,NGZC)

The x index is the fastest index, and the z index the slowest index.[/quote]

so you read trough your data, row per row, so first row first number is:
(1,1,1) (if you write your coordinates (x,y,z)
first row second number is
(2,1,1)
then the 5th row 8th number(ie 48th number) is
(48,1,1)
then the 5th row 9th number(ie 49th number) is
(1,2,1)
then the 5th row 10th number(ie 50th number) is
(2,2,1)
...

If you are using fortran for the program to read this data you can use the code given above also to read the entire CHGCAR file.

Danny
Last edited by Danny on Thu Feb 07, 2008 10:51 am, edited 1 time in total.

winterro

CHG file and fine FFT-grid

#4 Post by winterro » Thu Feb 14, 2008 7:25 pm

Thanks for the help.
Last edited by winterro on Thu Feb 14, 2008 7:25 pm, edited 1 time in total.

wren

CHG file and fine FFT-grid

#5 Post by wren » Tue Feb 17, 2009 11:32 pm

Hi!

I'm new to VASP, and I'm looking at a CHGCAR file for the first time. Unfortunately, the statement in the manual is gibberish to me, but reading through this thread has been helpful.

I was wondering if someone could help me figure out:
- what units does VASP output this charge density in? Is it in elementary charges per unit volume? Coulombs?
- It looks like this 'unit volume' that VASP uses is also something I need help deciphering. How do I know how many pieces VASP splits my unit cell into? VASP handles distances in units of angstroms, right?

Thanks,
Lusann
Last edited by wren on Tue Feb 17, 2009 11:32 pm, edited 1 time in total.

forsdan
Sr. Member
Sr. Member
Posts: 339
Joined: Mon Apr 24, 2006 9:07 am
License Nr.: 173
Location: Gothenburg, Sweden

CHG file and fine FFT-grid

#6 Post by forsdan » Wed Feb 18, 2009 6:02 am

1. The number of grid points in the CHGCAR are given by the parameters NGXF, NGYF and NGZF, which in turn are determined by the combination of ENCUT, ENAUG and the PREC-tag. See the manual for specific information:

http://cms.mpi.univie.ac.at/vasp/vasp/node97.html
and
http://cms.mpi.univie.ac.at/vasp/vasp/node98.html

The number of grid points are also written in the CHGCAR file just before the charge density values.

---

2. The values in the CHGCAR are written in terms of the charge density rho(r) (given in electrons/angstroms^3) multiplied by the volume of your supercell V (given in angstroms^3). In order to confirm this you can look at the integral of rho(r) over the supercell, i.e. "I = int rho(r) dV" which should be equal to the number of electrons N. Discretizing the integral on the gridpoints r_i gives

I = sum rho(r_i) * V/(NGXF*NGYF*NGZF)

The product "rho(r_i) * V" is available in the CHGCAR files. So if you simply sum all values in the CHGCAR-file together and divide with the total number of grid points NGXF*NGYF*NGZF you should obtain the number of valence electrons in your supercell.

Hope this helps.

Cheers,
/Dan







<span class='smallblacktext'>[ Edited Wed Feb 18 2009, 07:05AM ]</span>
Last edited by forsdan on Wed Feb 18, 2009 6:02 am, edited 1 time in total.

askhetan
Jr. Member
Jr. Member
Posts: 81
Joined: Wed Sep 28, 2011 4:15 pm
License Nr.: 5-1441
Location: Germany

CHG file and fine FFT-grid

#7 Post by askhetan » Sun Aug 11, 2013 6:40 pm

thanks for your awesome answer!
Last edited by askhetan on Sun Aug 11, 2013 6:40 pm, edited 1 time in total.
In the end, one must accept realism. Saying otherwise would be a denial of incompleteness.

Post Reply