Dear VASP users and admin,
In CHGCAR file, the format is: WRITE(IU,FORM) (((C(NX,NY,NZ),NX=1,NGXC),NY=1,NGYZ),NZ=1,NGZC) according to the manual.
However, I made a summation of the total charge is largely different from the electrons in my system. My script is:
c--- read the charge density
open(4,file='CHGCAR',status='old')
read(4,*) (((C(NX,NY,NZ),NX=1,NGXC),NY=1,NGYC),NZ=1,NGZC)
c---- I have opened the CHGCAR file and on each axis, there are 160 grids.
do Nx=1,160
do Ny=1,160
do Nz=1,160
totalcharge = totalcharge + C(Nx,Ny,Nz)/volume
enddo
enddo
enddo
open(15,file='Charge_total.dat')
write(15,*) totalcharge
My result is 40959.9999. But in fact, my system only has two atoms. It is a CO module. I am very confused about my result but I cannot figure it out. I just read the data and make a summation. Could someone give me a hint or suggestion? Thanks!
Best wishes,
Zhibin
Why total charge calculating by hand is quite different from my system?
Moderator: moderators
Re: Why total charge calculating by hand is quite different from my system?
I have solved it. Thanks a lot.
Re: Why total charge calculating by hand is quite different from my system?
You should divide the qgrid in FFT. Then you will get the right value.