Author Topic: Function for calculating Projected Density of States  (Read 37730 times)

0 Members and 1 Guest are viewing this topic.

Offline alan

  • Regular ATK user
  • **
  • Posts: 23
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #15 on: October 20, 2009, 03:27 »
thanks a lot.

Offline yangzw1985

  • ATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #16 on: October 27, 2009, 10:47 »
Hi, I have download the two .py file and put it in the correct place. I draged the example.py file to job manager panel, the follow error occur:

C:\Program Files\QuantumWise\Virtual NanoLab 2008.10.0\atk\bin\atk.exe c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl
Traceback (most recent call last):
  File "c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl", line 5, in ?
    scf = restoreSelfConsistentCalculation('lih2li.nc')
NLValueError: Invalid NetCDFFile.
Terminated Abnormally

Can anyone tell me the reason, and how to solve it ?

thanks!

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #17 on: October 27, 2009, 12:19 »
The reason for this message is that the script executes in c:/docume~1/eric(2)/locals~1/temp/ but most likely your file lih2li.nc is not in that directory. So, you need to specify it with full path.

It's a bit unfortunate that the error message for "file not found" appears to indicate that the file is found but is invalid. The reason issue here is, however, that the nc file is simply not found.

Offline yangzw1985

  • ATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #18 on: October 27, 2009, 14:54 »
Thank you Anders Blom! first, I have placed the two files in a new directory, the error just like the foregoing post:

Running: C:\Program Files\QuantumWise\Virtual NanoLab 2008.10.0\atk\bin\atk.exe c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl
Traceback (most recent call last):
  File "c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl", line 5, in ?   (just like this, because I can not got the exact error)
    from projected_density_of_states import *
ImportError: No module named projected_density_of_states
Terminated Abnormally

So i follow your suggestion and copy the file projected_density_of_states.py to the "temp" directory, and I got my post error.

C:\Program Files\QuantumWise\Virtual NanoLab 2008.10.0\atk\bin\atk.exe c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl
Traceback (most recent call last):
  File "c:/docume~1/eric(2)/locals~1/temp/tmp2knqvl.nl", line 5, in ?
    scf = restoreSelfConsistentCalculation('lih2li.nc')
NLValueError: Invalid NetCDFFile.
Terminated Abnormally


Now, from what you have said, the nc file is simply not found. I just download the two .py file. And I also don't know where is the lih2li.nc file. Now, if I want to perform the calculation, do I have to amend the example.py file?

As far as I know, when we running the calculation, the NC file should be generated automatically. How can I put the nc file in the temp directory? The only way may change the example.py file. Is it right to change the :scf = restoreSelfConsistentCalculation('lih2li.nc') into scf = restoreSelfConsistentCalculation('c:/docume~1/eric(2)/locals~1/temp/lih2li.nc')?

thank you!
« Last Edit: October 27, 2009, 14:56 by yangzw1985 »

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #19 on: October 27, 2009, 15:02 »
Don't bother with putting files in the temp directory, you will just forget to move them back out from there later ;)

Assuming that you are doing mostly everything from within VNL, the easiest way is:

  • Keep control over where the NC file ends up when you run the initial calculation by specifying, in the NanoLanguage Scripter, the absolute path where you want it to end up, like c:/my_calculations/checkpointfile.nc or something
  • Then, when you perform subsequent analysis steps, just point the script to this file, with the full path

So, if you don't know where the NC file is, the easiest way is to rerun the initial calculation (it's quite fast, in this case, after all), taking the first point about into account. (You may find the NC file in temp, if you're lucky; in that case, just copy it out of there to a more convenient location.)

Then, run the PDOS analysis, with something like

Code: [Select]
scf = restoreSelfConsistentCalculation('c:/my_calculations/lih2li.nc')

Of course the directory name c:/my_calculations is just a suggestion, you can use something more relevant in My Documents instead, as you prefer. Do note however that forward-slashes "/" must be used instead of "\" as is "normal" on Windows.

Offline yangzw1985

  • ATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #20 on: October 28, 2009, 10:32 »
Hi,Anders Blom! thank you for your reply!

I have read your answer lots of times, however, I can not solve the problem. Because I can not understand your reply about the "initial calculation". I don't understand what does the initial calculation stands for?

As you can see, I just download the two .py file given by Nord land. I didn't perform any calculations.

Now, you can assume that I have not do anything, and just have the two download .py files and installed the ATK/VNL 2008.10. If I want to perform the calculation, can you tell me what steps should I do?

Please do not laugh at my weak understanding ability. I just want to learn the method about how to calculate the PDOS.

Thanks you very much!

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #21 on: October 28, 2009, 10:42 »
The general approach to compute something in ATK can be divided into two steps:

1. A self-consistent calculation of the system. This is the "initial calculation" I referred to, and it's always necessary. It produces the checkpoint file (NC file), which contains the converged state of the calculation, or the self-consistent density matrix on a technical level.

2. Analysis. This is where you actually compute things, observables, like a spectrum, the current etc. When you set up the calculation in VNL it might appear that you go directly to this step, but in reality the first step is always involved. And, sometimes it's actually better to separate them, since the second step can be performed independently afterwards, provided you have saved the checkpoint file in step 1.

Therefore, in your case, the work-flow should be

1. Set up and perform the self-consistent calculation of the Li-H2-Li two-probe system, as described in detail in the manual, without bothering to compute any "analysis! quantities. That is, just make sure to save the checkpoint file at a well-known location (say, "C:/my_calculation/lih2li.nc") on the "Self-consistent calculation" tab in the NanoLanguage Scripter, but don't select anything on the "Analysis" tab.

2. Enter the relevant path of the checkpoint file into the PDOS analysis script, and run it.

This is specifically needed for the PDOS calculation since this feature is not offered directly in VNL, but it works very generally too.

Note, however, that the PDOS is not the only thing you will be interested in computing, so you also need to consider how to obtain the transmission spectrum etc. This is easier in a sense, since you can just select them in VNL (and perhaps you have already covered this point). The important thing this discussion adds is to always take care where the NC file ends up, so you can use it later to restore the converged state, rather than recompute it.


Offline yangzw1985

  • ATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #22 on: October 28, 2009, 15:26 »
Thank you, Anders Blom! This error has been solved.

Now, I have calculate the Projected densities of states and densities of states for the lih2li two probe model. Attached is the calculated results. By comparing the calculated results, it seems that they are very similar in shape.
Two peaks are shown in both Figure at the same energy points.

I want to know, from the calculated results, what is the main difference between the two Figures. In other words, what is the main difference between PDOS and DOS? Does the calculated results show the main difference?

Thank you for your patient reply! Good job!

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #23 on: October 28, 2009, 20:15 »
For this relatively simple system, the physics is pretty trivial to understand. You have a broad background which is the DOS of Li (just the bandstructure of the metal), and superimprosed on this we see some molecular states from H2, which in fact correspond to the HOMO and LUMO (one above and one below the Fermi level). This would be even more evident if you only projected onto the two hydrogen atoms, I think you have projected onto all the atoms in the central region, perhaps? If not, the broadening and background just show how strongly the molecule has hybridized with the chain.

Tip: If you post images in PNG format they can be viewed directly in the browser.

Offline jdgayles16

  • ATK Guru
  • ****
  • Posts: 108
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #24 on: January 21, 2010, 20:03 »
Hi,
I used this script to calculate the DOS for a molecule and I get  a few values that are negative, is that possible, or did I do something wrong?


# -----------------------------------------------------------------------------
# Density Of States
# -----------------------------------------------------------------------------
# Energy (eV)   DOS (1/eV)
        -1.00      -0.0034
        -1.00      -0.0034
        -0.99      -0.0034
        -0.99      -0.0028
        -0.98       0.0129
        -0.98      -0.0021
        -0.98      -0.0027
        -0.97      -0.0028
        -0.97      -0.0029
        -0.96      -0.0029
        -0.96      -0.0028
        -0.96      -0.0028
        -0.95      -0.0027
        -0.95      -0.0027
        -0.94      -0.0026
        -0.94      -0.0025
        -0.94      -0.0023
        -0.93      -0.0022
        -0.93      -0.0020
        -0.92      -0.0017
        -0.92      -0.0014
        -0.92      -0.0011
        -0.91      -0.0006
        -0.91      -0.0000
        -0.90       0.0007
        -0.90       0.0018
        -0.90       0.0033
        -0.89       0.0057
        -0.89       0.0097
        -0.88       0.0181
        -0.88       0.0469
        -0.88      35.3636
        -0.87      64.2922
        -0.87      81.2093
        -0.86      93.0420
        -0.86     101.7001

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #25 on: January 21, 2010, 20:22 »
A negative DOS can occur as a result of a finite value of the imaginary part of the Green's function. Lowering it should give smaller (absolute) negative values, but you cannot set it to zero to make the negative values disappear completely. For all practical purposes a negative DOS should be considered as if it were zero.

Offline Sabrina

  • Regular ATK user
  • **
  • Posts: 17
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #26 on: February 5, 2010, 08:01 »
Dear Dr. Anders Blom
 I have used this script, it is a wonderful job. But I don't know the unit of the PDOS. Speak franklly, I didn't know many units of the physical qualities in ATK. Could you guide me?
 Thank you .

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #27 on: February 5, 2010, 09:12 »
First of all, the credit goes to Nordland who made the clever modification :)

The unit of DOS is in general not very important, since one rarely is interested in comparing the DOS of two different structures on an absolute scale. Therefore you will almost always see the DOS presented in "arbitrary units".

However, the DOS and PDOS in ATK sure enough has a unit, it's 1/eV. You should see this from printing the returned data. However, one should also take into account that the DOS is normalized by the total volume. But this normalization factor is more or less arbitrary, and thus it is, again, the relative numbers that matter, and you cannot really compare the values of the DOS of two systems.

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 78
    • View Profile
    • QuantumWise
Re: Function for calculating Projected Density of States
« Reply #28 on: February 5, 2010, 09:13 »
Which other units are difficult? We have tried to special care to precisely avoid unit problems by having all units explicit, that is there are no physical quantities for which the units are implicit; whenever a length appears and you print it, it will say e.g. 4 Angstrom, not just 4, and so on. For more information, see http://quantumwise.com/documents/manuals/ATK-2008.10/ref.units.html.
« Last Edit: February 5, 2010, 09:15 by Anders Blom »

Offline Sabrina

  • Regular ATK user
  • **
  • Posts: 17
  • Reputation: 0
    • View Profile
Re: Function for calculating Projected Density of States
« Reply #29 on: February 6, 2010, 13:30 »
Hello Dr. Anders Blom
 I use this script,but I want to get the more precision value of the x-axis(energy), how I modify this script?
Thanks a lot.