# read the dos
dos = nlread('device.nc',DeviceDensityOfStates)[0]
conf = nlread('device.nc', DeviceConfiguration)[0]
energies = dos.energies()

# calculate projection on atoms in the central region
dos_projection = [dos.evaluate(projection_list = ProjectionList([i])) \
                  for i in range(3,11)]

# plot the projections
import pylab
pylab.figure()
for i in range(3,11):
    label = conf.elements()[i].symbol()+'('+str(i)+')'
    pylab.plot(energies.inUnitsOf(eV),dos_projection[i-3].inUnitsOf(eV**-1), \
               label = label)
pylab.legend()
pylab.xlabel("Energy (eV)")
pylab.ylabel("dos (1/eV)")
pylab.show()