Author Topic: warning devide by zero  (Read 4664 times)

0 Members and 1 Guest are viewing this topic.

Offline Sumit2506

  • Regular QuantumATK user
  • **
  • Posts: 17
  • Country: in
  • Reputation: 0
    • View Profile
warning devide by zero
« on: February 12, 2014, 09:38 »
when i am calculating the absorption coefficient and refractive index from the absorption spectra graph(dielectric constant) from script given in tutorial for (5,5) CNT. it is showing some warning :"divide by zero encountered in divide ". and it is not showing any result for refractive index. in figure window. I am not able to understand what to do, please suggest me. I have used MGGA and GGA RPBE both for calculation. 

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: warning devide by zero
« Reply #1 on: February 14, 2014, 17:32 »
Need more details

Offline Sumit2506

  • Regular QuantumATK user
  • **
  • Posts: 17
  • Country: in
  • Reputation: 0
    • View Profile
Re: warning devide by zero
« Reply #2 on: February 17, 2014, 11:01 »
I am using 1x1x20 k points and double zeta double polarize basis set for calculating the optical properties of (5,5) CNT, it is calculating optical spectra but on running the script for the refractive index and absorption coefficient it is showing the  run time error :"divide by zero encountered in divide".
    I am also attaching the images for them:
please suggest me what to do

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: warning devide by zero
« Reply #3 on: February 17, 2014, 12:39 »
You mention "the script for the refractive index and absorption coefficient" - rather than I guess which script that is, can you just send me the Python files, and I'll run it myself and check?

Offline Sumit2506

  • Regular QuantumATK user
  • **
  • Posts: 17
  • Country: in
  • Reputation: 0
    • View Profile
Re: warning devide by zero
« Reply #4 on: February 18, 2014, 08:37 »
i am attaching the python file which i have used to calculate the optical spectra....
ad script which i have used to calculate absorption cofficient and refractive idex..

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: warning devide by zero
« Reply #5 on: February 18, 2014, 10:41 »
Indeed you get the warning message above. The warning is due to the fact that your first element in the energies array is 0 and you use it in the equation:
Code
l = (speed_of_light*planck_constant/energies).inUnitsOf(nanoMeter)
However, it is just a warning and you do get some results in the plot you posted at the beginning. You are just plotting the data in the "wrong" range which is defined by the two lines in the refrac.py script (which was used to study the properties of Silicon):
Code
ax.axis([180,1000,2.2,6.4])
ax.axis([180,1000,0,0.24])
you can comment the lines or choose to plot in a different range, for example:
Code
ax.axis([0,4000, 0.6,1.6])
ax.axis([0,4000, 0.,0.01])

Offline Sumit2506

  • Regular QuantumATK user
  • **
  • Posts: 17
  • Country: in
  • Reputation: 0
    • View Profile
Re: warning devide by zero
« Reply #6 on: February 21, 2014, 08:00 »
Thanks for this reply
Necessary to take same K points in optical spectra .....










Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: warning devide by zero
« Reply #7 on: February 21, 2014, 10:03 »
You can (and probably should) use a higher k-point sampling for the spectrum compared to the calculation.