Author Topic: Pdos code  (Read 1616 times)

0 Members and 1 Guest are viewing this topic.

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 109
  • Country: gb
  • Reputation: 3
    • View Profile
Pdos code
« on: December 9, 2024, 03:04 »
Dear Expert,
I am working with a code that generates the PDOS for Hydrogen and Tin separately. However, I am interested in obtaining a combined PDOS, as shown in the attached picture . I have attached pics - Any suggestion please

The code is:
 #plot the spectra using pylab
 import pylab
 import matplotlib.pyplot as plt

 # read DOS object from file
 dos = nlread('/home/dos.hdf5', DensityOfStates)[0]

 # Get the actual energy values from the DOS object
 energies = dos.energies()

 # Calculate the DOS spectrum with spin up
 dos_Up = dos.evaluate(projection_list=ProjectionList(atoms=[96,97,98,99,100,101,126,127,128,129,130,131], elements=[Tin], angular_momenta=[1]), spin=Spin.Up)
 dos_Up1 = dos.evaluate(projection_list=ProjectionList(atoms=[60,61,62,63,64,65,138,139,140,141,142,143], elements=[Hydrogen], angular_momenta=[0]), spin=Spin.Up)

 # Calculate the DOS spectrum with spin down
 dos_Down = dos.evaluate(projection_list=ProjectionList(atoms=[96,97,98,99,100,101,126,127,128,129,130,131], elements=[Tin], angular_momenta=[1]), spin=Spin.Down)
 dos_Down1 = dos.evaluate(projection_list=ProjectionList(atoms=[60,61,62,63,64,65,138,139,140,141,142,143], elements=[Hydrogen], angular_momenta=[0]), spin=Spin.Down)
 # Plot the spectra using pylab
 import pylab
 pylab.figure(figsize=(5, 10))
 pylab.plot(dos_Up.inUnitsOf(eV**-1), energies.inUnitsOf(eV), color='darkblue', label='Spin Up')
 pylab.plot(dos_Down.inUnitsOf(eV**-1), energies.inUnitsOf(eV), color='darkblue', linestyle='--', label='Spin Down')
 pylab.plot(dos_Up1.inUnitsOf(eV**-1), energies.inUnitsOf(eV), color='darkblue', label='Spin Up')
 pylab.plot(dos_Down1.inUnitsOf(eV**-1), energies.inUnitsOf(eV), color='darkblue', linestyle='--', label='Spin Down')

 # Add a dotted line at E-EF=0
 pylab.axhline(y=0, linestyle='dotted', color='gray')

 pylab.xlim(0,15)
 pylab.ylim(-2,2)

 # Save the figure as a high-resolution PNG image
 #plt.savefig('Fe-PDOS.png', dpi=300, bbox_inches='tight')

 # Add the legend in the upper right corner
 pylab.legend(loc='upper right')

 pylab.xlabel("PDOS (1/eV)")
 pylab.ylabel("E-E$_{f}$/eV")
 pylab.legend()
 pylab.show()

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5594
  • Country: dk
  • Reputation: 103
    • View Profile
    • QuantumATK at Synopsys
Re: Pdos code
« Reply #1 on: December 9, 2024, 20:12 »
Only screenshot from NanoLab attached. What exactly is your question? Also, maybe better to use ProjectedDensityOfStates.

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 109
  • Country: gb
  • Reputation: 3
    • View Profile
Re: Pdos code
« Reply #2 on: December 10, 2024, 00:20 »
Dr. Blom, Thank you for the reply.

I have already mentioned my question in previous request. The code I shared, provides the separate DOS for Tin and Hydrogen, but I am interested in obtaining the combined DOS for both Tin and Hydrogen, as shown in the pictures. If you look at the pictures, I have selected only the edge Tin and Hydrogen atoms.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5594
  • Country: dk
  • Reputation: 103
    • View Profile
    • QuantumATK at Synopsys
Re: Pdos code
« Reply #3 on: December 10, 2024, 00:25 »
Isn't it as simple as projecting on the combined list of atom indices for Tin and H atoms, instead of using two separate projections?

You also project H on s and Tin on p, not sure that is relevant. To match the screenshot, you would do

dos_Up = dos.evaluate(projection_list=ProjectionList(atoms=[96,97,98,99,100,101,126,127,128,129,130,131, 60,61,62,63,64,65,138,139,140,141,142,143], angular_momenta=[0,1]), spin=Spin.Up)
dos_Down = dos.evaluate(projection_list=ProjectionList(atoms=[96,97,98,99,100,101,126,127,128,129,130,131, 60,61,62,63,64,65,138,139,140,141,142,143], angular_momenta=[0,1]), spin=Spin.Down)
« Last Edit: December 10, 2024, 00:30 by Anders Blom »

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 109
  • Country: gb
  • Reputation: 3
    • View Profile
Re: Pdos code
« Reply #4 on: December 10, 2024, 00:38 »
Many thanks Dr. Blom, I got the exact dos.