QuantumATK Forum
QuantumATK => General Questions and Answers => Topic started by: Jahanzaib 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()
-
Only screenshot from NanoLab attached. What exactly is your question? Also, maybe better to use ProjectedDensityOfStates.
-
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.
-
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)
-
Many thanks Dr. Blom, I got the exact dos.