QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Jahanzaib on February 14, 2023, 20:03

Title: PDDOS
Post by: Jahanzaib on February 14, 2023, 20:03
kpoint_grid = MonkhorstPackGrid()

device_density_of_states = DeviceDensityOfStates(
    configuration=device_configuration,
    energies=numpy.linspace(-3,3,101)*eV,
    kpoints=kpoint_grid,
    projection_list=ProjectionList(atoms=[95, 111, 118], elements=[Iron], angular_momenta=[2]),
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    self_energy_calculator=RecursionSelfEnergy(storage_strategy=NoStorage()),
    )
I tried to adjust the input file and add line of "Projection list" but it's not working. Basically, i have three iron in cluster which is adsorbed on nanoribbons. I just want to know the PDOS of each Iron with d-orbitals only. Can someone plz suggest what's wrong in it.
Title: Re: PDDOS
Post by: Jahanzaib on February 15, 2023, 17:45
Any one please guide me?
Title: Re: PDDOS
Post by: Anders Blom on February 17, 2023, 21:29
The DeviceDensityOfStates class itself does not take a projection_list argument (see https://docs.quantumatk.com/manual/Types/DeviceDensityOfStates/DeviceDensityOfStates.html). The query method evaluate() does, however. So you would add this as a separate data extraction:

result = device_density_of_states.evaluate(projection_list=...)
nlprint(result)

Note that you don't need the elements keyword if you specify the atom indices anyway.
Title: Re: PDDOS
Post by: Jahanzaib on February 23, 2023, 17:24
In PDDOS, I projected the Fe on the nanoribbons but when I mentioned spinUpDown in projectionlist - it shows error (TypeError: __init__() got an unexpected keyword argument 'spin'
). Can any one guide me how to or where to put spin argument in the input so I can get PDDOS of Fe with SPIN UP AND SPIN DOWN.

Thank you

# Define the k-points grid
kpoint_grid = MonkhorstPackGrid()

# Create the DeviceDensityofStates object
device_density_of_states = DeviceDensityOfStates(
    configuration=configuration,
    energies=numpy.linspace(-3,3,101)*eV,
    kpoints=kpoint_grid,
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    self_energy_calculator=RecursionSelfEnergy(storage_strategy=NoStorage()),
    )

# Define the projection list
projection_list = ProjectionList(atoms=[101], elements=[Iron], angular_momenta=[2], spin=UpDownProjection)

nlprint(result)
nlsave('P-S-UD.hdf5', results)
Title: Re: PDDOS
Post by: Anders Blom on February 28, 2023, 07:07
I think I was wrong, you should probably use the Projection class directly.
https://docs.quantumatk.com/manual/Types/Projection/Projection.html#NL.Analysis.Projection.Projection
Title: Re: PDDOS
Post by: Jahanzaib on March 1, 2023, 02:32
Dear Dr. Blom
I have already attempted to use the method you suggested in our previous correspondence, but I encountered a problem: the resulting PDOS shows contributions from the entire system, rather than just the "Fe" atom with spin-up and spin-down which I am interested in. I have attached the .py file - if you have a look into it and suggested me what's wrong in it.

In addition to previous .py files, I made the changes given below, but still got error

# -------------------------------------------------------------
# Device Density Of States
# -------------------------------------------------------------
# Define the k-points grid
kpoint_grid = MonkhorstPackGrid()

# Define a projection on all orbitals
p1 = Projection()

# Define a projection on spin up of Iron
p2 = Projection(spin=Spin.Up, atoms=[Iron]) + Projection(spin=Spin.Down, atoms=[Iron])

# Create the DeviceDensityofStates object
device_density_of_states = DeviceDensityOfStates(
    configuration=configuration,
    energies=numpy.linspace(-3,3,101)*eV,
    kpoints=kpoint_grid,
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    self_energy_calculator=RecursionSelfEnergy(storage_strategy=NoStorage()),
    )

# Evaluate the device density of states with the projection list
result = device_density_of_states.evaluate(projection=p2)

# Print the results using nlprint()
nlsave('Dos.hdf5', device_density_of_states)
nlprint(result)
Title: Re: PDDOS
Post by: Anders Blom on March 1, 2023, 07:38
It would help if you write what error you get, since i don't have your hdf5 file I can't do any quick tests.
Title: Re: PDDOS
Post by: Anders Blom on March 1, 2023, 07:45
Could you share the HDF5 file? That would make it so much easier
Title: Re: PDDOS
Post by: Jahanzaib on March 1, 2023, 12:39
Please find the attached .hdf5 file. There is no error in .hdf5 files but the main issue is that I got the PDOS for whole system rather than "Fe" atom with spin-up and spin-down which I am interested.

   - While using DOS analyzer, I put 101 for Fe, and got PDOS with spin UP/Down but there is not way to save this ( not interested to save it using snip tool) - I want its value so I can use excel or other program to plot PDOS of Fe.
Title: Re: PDDOS
Post by: Anders Blom on March 2, 2023, 07:36
Sorry there was so much back and forth on this, I got confused myself between Projection and ProjectionList, and also because DeviceDensityOfStates kind of uses an older format compared to ProjectedDensityOfStates for bulk. And I didn't have any spin-polarized DDOS test data.


In the end all is quite simple. If you do want a script version I can provide that, however I don't see why you cannot use the GUI analyzer. After I ran your calculation and obtained the DDOS object, I just open it in the DOS Analyzer, select the Iron atom and "d" and spin up or down separated (flipped), then right-click the plot window and choose Export data. This gives a text file with the numbers. Doesn't that work for you?


If you do want the same done in a script, you would need this:
Code: python
pdos_u = device_density_of_states.evaluate(projection_list=ProjectionList(elements=[Iron], angular_momenta=[2]), spin=Spin.Up)
pdos_d = device_density_of_states.evaluate(projection_list=ProjectionList(elements=[Iron], angular_momenta=[2]), spin=Spin.Down)
e = device_density_of_states.energies()


The tricky bit here is that the spin keyword is to evaluate, not to ProjectionList.
Title: Re: PDDOS
Post by: Jahanzaib on March 2, 2023, 14:59
Thank you so much for your detailed response and guidance. I really appreciate your effort.

     - I successfully generated the PDOS using the script I wrote myself, after removing errors. I just checked the method you mentioned to export data and plot PDOS in excel. So, it works for me
    - Similarly, for transmission spectrum, is it possible to explore peak that which peak is associated with atom?

  - Would it be possible for you to share your complete python script which you wrote, I can compare it with mine and figure it out where I was doing wrong.


Thank you
Title: Re: PDDOS
Post by: Anders Blom on March 3, 2023, 08:14
The scripts are attached, but I actually prefer to do this kind of analysis interactively in Python (i.e. just start atkpython without script argument, or atkpython -i script.py) to try different values and be able to tab out the methods.
Title: Re: PDDOS
Post by: Jahanzaib on March 3, 2023, 15:11
Thank you so much.
I really appreciate your effect and support.