fit gaussian problem

241 views
Skip to first unread message

ya...@cello.t.u-tokyo.ac.jp

unread,
Dec 21, 2018, 2:14:24 AM12/21/18
to CoFFEE code forum
Hi  i am currently using to code to analysis the point defects in GaN

However, I don't quite sure of the step in Fit Gaussian. in order to get the the width of the 
model Gaussian which can be used to determine the Sigma parameter input to the model calculations using coffee.py. I checked the example,  the  readme said : The script g_fit.py fits a Gaussian to the wavefunction charge density provided in cube/xsf format.

So my question is that what exactly is the wavefunction charge density file, is it the LOCPOT or CHGCAR file (from VASP calculation) ? of the what structure ( charged defect dft calculation n*n*n )?

thank you so much for this.

Mit Naik

unread,
Dec 21, 2018, 6:23:55 AM12/21/18
to CoFFEE code forum
Hi,

We are introducing the model charge to mimic the spatial profile of the extra charge added or removed. Hence, the wavefunction charge density of the band that is filled on adding an electron to the system is the relevant charge density we need to model. This information should be in the WAVECAR file of the charged defect supercell calculation. It can be extracted using: https://cms.mpi.univie.ac.at/vasp/guide/node145.html

Also note that for most bulk system the electrostatic correction is not very sensitive to sigma (as long as the model charge is completely inside the cell). This is certainly true for vacancy in diamond. You can check if this is true for your system. 

ya...@cello.t.u-tokyo.ac.jp

unread,
Dec 28, 2018, 7:54:43 AM12/28/18
to CoFFEE code forum
Much thanks for your reply. 

So if I understand the post correctly,  the partial charge density can be calculated using vasp , By setting the EINT parameter, set it to the energy range of the defect , then I can get the partial charge density file----PARCHG . And use this PARCHG file to do the Gaussian fitting ? And I used the xsfconvert (http://theory.chm.tu-dresden.de/~jk/software.html ) to convert it to xsf file, then use the g_fit.py code for fitting. 

I saw that when the fitting is completed, the sigma value printed out in 'bohr', so I am thinking whether I ll need to modify the g_fit code, because my output dimension from vasp  are all in angstrom..

from the manual, I thought that sigma might influence the model potential (far from the defect) in the later step ( compare the difference potential with the model potential)..so I am thinking that this might be the reason that I got some weird plot in the step

 one more thing , again in the manual , step 1-3, 'calculate the total energy.... save the DFT potential in xsf format' , are they correspond to the LOCPOT (local potential file) from the VASP calculations?

cheers!

Mit Naik

unread,
Jan 3, 2019, 9:56:16 PM1/3/19
to CoFFEE code forum
The problem is with the unit of cell dimensions. The cube file format handles bohr as well as angstrom, while the xsf format handles only A. So this is a bug in the code. The script should be able to determine the kind of units being used. This will be fixed in the next version of CoFFEE. 

Since your file is in xsf format, the value it prints out is actually in angstrom. You can check if the fit is reasonable from the plot that is generated. 

For your problem at hand, I wouldn't be too concerned about the Gaussian fit being accurate (since it is a bulk system). There could be other factors that could lead to the model potential not matching the DFT difference. It could be that the supercell is not large enough. Or there is significant lattice relaxation that is making the whole potential modulated? Did you try to compare without relaxations? That would help narrow down the origin of this issue.

Best,
Mit

Samar Fawzy

unread,
Oct 24, 2022, 10:47:10 AM10/24/22
to CoFFEE code forum
  Hi,

I have a question related to this discussion, so I calculated the PARCHG by setting EINT in the INCAR file, then used chg2cube script https://theory.cm.utexas.edu/vtsttools/scripts.html to convert the PARCHG to a cube format. 

I then tried using the g_fit.py to get the fitting but I got the below error. I could only fix it by using an even FFT grid in x,y,z directions, but then I got a terrible fitting. Any insights why?

samar@samar-VirtualBox:~/tst-cof/zno/fitting$ python3 g_fit.py in
Traceback (most recent call last):
  File "g_fit.py", line 214, in <module>
    ierr, na, aspecies, acharge, aposition, grid, origin, step, vol = cub_read(file_inp)
  File "g_fit.py", line 176, in cub_read
    vol[i][j].append(float(t[l]))
IndexError: list index out of range


Thanks a lot. 
Reply all
Reply to author
Forward
0 new messages