QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: renren123123 on November 18, 2009, 12:36

Title: difference of two kinds of spin-polarized states for LDOS
Post by: renren123123 on November 18, 2009, 12:36
Today, I want to get the difference of two kinds of spin-polarized states for LDOS for example:LDOS(up)-LDOS(down) at the Fermi level?  But I dont know how to get them?
Thank you very much!!!
Title: Re: difference of two kinds of spin-polarized states for LDOS
Post by: Anders Blom on November 18, 2009, 12:50
By LDOS in this context, do you mean the local density of states as computed by ATK using calculateLocalDensityOfStates() (http://quantumwise.com/documents/manuals/ATK-2008.10/ref.calculatelocaldensityofstates.html), for a given energy (E=0 for the Fermi level) and (kx,ky)?

If so, the object returned by the function has a method toArray() which returns a NumPy array. You can directly take the array for spin up minus the one for spin down.

How to proceed from there depends a bit on what you want to do with it, plot it, integrate it, export it, etc.
Title: Re: difference of two kinds of spin-polarized states for LDOS
Post by: renren123123 on November 19, 2009, 10:05
using the function: calculateLocalDensityOfStates, how to get the plot of the difference between LDOS(Ef_UP)-LDOS(Ef_DOWN)?
Title: Re: difference of two kinds of spin-polarized states for LDOS
Post by: Anders Blom on November 19, 2009, 13:58
Try this

Code
from ATK.TwoProbe import *

#------------------------------------------------------------
# Specify your checkpoint file and other parameters here
checkpointfile = 'checkpointfile.nc'
vnlfile = 'ldos.vnl'
sample_name = 'sample'
energy = 0.*eV
kpoint = (0.,0.)
#------------------------------------------------------------

scf = restoreSelfConsistentCalculation(checkpointfile)

# Compute spin up/down LDOS at specific energy
ldos_up = calculateLocalDensityOfStates(scf,energy,(kpoint,Spin.Up))
ldos_dn = calculateLocalDensityOfStates(scf,energy,(kpoint,Spin.Down))

# Save up/down LDOS
f = VNLFile(vnlfile)
f.addToSample(ldos_up,sample_name,'LDOS up')
f.addToSample(ldos_dn,sample_name,'LDOS down')

# Replace data in up object by difference
ldos_up._LocalDensityOfStates__local_density_of_states_data = ldos_up.toArray()-ldos_dn.toArray()

# Save to VNL file
f.addToSample(ldos_up,sample_name,'LDOS difference')

NOTE that the "up" LDOS object is overwritten, so if you want to save it to the VNL file also, do that in a separate script.

If you are adding this to an existing VNL file, use the same sample name as for the configuration for easier plotting.