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()