Author Topic: Two Questions for calculateDenistyOfStates() function  (Read 3814 times)

0 Members and 1 Guest are viewing this topic.

Offline jjhskang

  • Heavy QuantumATK user
  • ***
  • Posts: 54
  • Reputation: 0
    • View Profile
Two Questions for calculateDenistyOfStates() function
« on: November 7, 2009, 02:48 »
Hi!

I have difficulty in understanding the parameters of calculateDenistyOfStates(self_consistent_calculation, energies,.......) function.
Here, does 'energies' argument mean energy interval in which DOS is calculated?

As an example,

density_of_states= calculateDenistyOfStates{
 self_const_cal = scf,
 energies = [0.*electronVolt]
}
energies2 = density_of_states.energies()
dos = density_of_states.densityOfStates()


.....

You wil  find that there are two 'energies' in the above example: One  (i.e., 'energies') for a paramater for calculateDenistyOfStates() function, and the other (i.e., 'energies2') is a method of the output of the function.

For this, I have two questions:


(1) How are thoe two energies different?
(2) How do I specifiy energy range in which DOS is to be calculated? For example, if I want to calculate DOS in (=-10, 2)eV at every 0.01eV, how can I achieve it?

I appreciate if somebody can give me an answer to this question.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Two Questions for calculateDenistyOfStates() function
« Reply #1 on: November 8, 2009, 23:12 »
I guess it can look a bit confusing :) First, to get the names etc formally right (because then things are probably clearer), the method is called energies(), and belongs to the object density_of_states which is returned by the function calculateDensityOfStates. This function takes a keyword (or parameter) called energies. So, why so many energies? Well, first we need to tell the function at which energies the DOS is to be computed. This is the keyword to the function. Then, once we have the DOS object, we may (later, for some reason) want to know the energies again; we may have "forgotten" them; imagine if the object is stored in a file, later restored, etc. That's what the query function (method) is for. A clearer way would be to first define a variable containing the energies, and then use this for the keyword:
Code
my_energies = [0.*eV]
density_of_states = calculateDensityOfStates(
    self_const_cal = scf,
    energies = my_energies
)
dos = density_of_states.densityOfStates()
So, finally, how to compute the DOS in a particular range? The function calculateDensityOfStates actually doesn't take a range, it takes a list of energies at which to evaluate the DOS. However, in Python it's quite easy to make a list from a range, esp. if you use the Numpy package. If, as in your examples, you prefer to specify the point spacing (0.01) between a min and a max (-10 and 2 eV), it's best to use arange():
Code
import numpy
my_energies = numpy.arange(-10,2.001,0.01)*eV
The arange() function has some quirky behavior regarding the end-point (max), so you never know if it will be included or not if you just say (-10,2,0.01), it depends on the bit-representation of floats. So, for safety, always set the max a small amount above the max (smaller than the point spacing). As an alternative, for completeness, there is also a very convenient function called linspace(). It takes a min and a max too, but then a number of points to use in between:
Code
import numpy
my_energies = numpy.linspace(-10,2,100)*eV
In this case it's quite safe to write (-10,2), the endpoints are always included.
« Last Edit: November 8, 2009, 23:15 by Anders Blom »