QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: sergio on December 26, 2011, 22:46

Title: Charge density around the Fermi energy?
Post by: sergio on December 26, 2011, 22:46
Hi,

How can we get the charge density, for each spin direction, at energies close to the Fermi energy (or for a specific energy interval) for a two probe system?
Title: Re: Charge density around the Fermi energy?
Post by: zh on December 27, 2011, 03:22
It can be obtained by calling "LocalDeviceDensityOfStates()" for a given energy.
Title: Re: Charge density around the Fermi energy?
Post by: Anders Blom on December 27, 2011, 10:50
The LDOS is an excellent concept to understand the device characteristics. It's not exactly the "electron density", but note that the electron density is not energy-dependent, so if you want something that is (energy-dependent) then the LDOS is indeed what you want.

Of course you can always compute the real-space electron density for a device, but not for a given energy.
Title: Re: Charge density around the Fermi energy?
Post by: sergio on December 27, 2011, 13:50
Thanks for your answers,

This is what I want. One more thing:  In order to get the the LDOS difference for spin up and down, I have used "toArray()" in ATK 11.2.3 but it gives  an error:

'LocalDeviceDensityOfStates' object has no attribute 'toArray'

In the reference manual there is such an argument,

what is the reason of that?

Thanks,
Title: Re: Charge density around the Fermi energy?
Post by: Anders Blom on December 27, 2011, 23:25
toArray was used in ATK 2008.10, but has been discontinued for quite a while. As far as I know, it shouldn't be mentioned in the manuals either.

To get the separate spin up and down LDOS, use the keyword spin=Spin.Up or Spin.Down when you calculate the LDOS, like

Code: python
LDOS_u = LocalDeviceDensityOfStates(device_configuration, energy=0.*eV, spin=Spin.Up)

After that, the need convert the data to raw numbers (which is what toArray did) depends strongly on your objective; for 3D plotting, the best way is to just saved it in an NC file and use VNL. You can also export the data to a Gaussian Cube file from within VNL.
Title: Re: Charge density around the Fermi energy?
Post by: sergio on December 27, 2011, 23:33
Dr. Blom,

By LDOS difference what I mean is to get LDOS_up - LDOS_down
Title: Re: Charge density around the Fermi energy?
Post by: Anders Blom on December 27, 2011, 23:37
Which is real easy :)

Code: python
LDOS_u = LocalDeviceDensityOfStates(device_configuration, energy=0.*eV, spin=Spin.Up)
LDOS_d = LocalDeviceDensityOfStates(device_configuration, energy=0.*eV, spin=Spin.Down)
LDOS_diff = LDOS_u-LDOS_d
nlsave("file.nc",LDOS_u,object_id="LDOS Up")
nlsave("file.nc",LDOS_d,object_id="LDOS Down")
nlsave("file.nc",LDOS_diff,object_id="Difference")

Now you can plot each quantity in VNL. The object_ids are optional, but help identify the data.
Title: Re: Charge density around the Fermi energy?
Post by: sergio on December 27, 2011, 23:43
Dr. Blom,

Ohh! Actually, I have thought that we must define an argument like "toArray" in 11.2.3. You know in order to get LDOS difference in 2008.10, we should introduce this argument. 

Thanks,
Title: Re: Charge density around the Fermi energy?
Post by: sergio on December 28, 2011, 00:39
Hi Dr. Blom,

Sorry for inconvenience. Upon running the code, I get the following error:

 Traceback (most recent call last):
  File "file.py", line 33, in <module>
    nlsave('file.nc',LDOS_diff,object_id="LDOS-diff")
  File "./zipdir/NL/IO/NLSaveUtilities.py", line 161, in nlsave
  File "./zipdir/NL/Analysis/LocalDeviceDensityOfStates.py", line 255, in _nlsave
AttributeError: 'LocalDeviceDensityOfStates' object has no attribute '_LocalDeviceDensityOfStates__contributions'
Title: Re: Charge density around the Fermi energy?
Post by: Anders Blom on December 29, 2011, 10:39
That looks like a bug. I can design a temporary work-around (Python is nice!), I just need to check a few things first.
Title: Re: Charge density around the Fermi energy?
Post by: Anders Blom on December 29, 2011, 15:23
It's a bug, of sorts. One can argue which "spin" property the LDOS difference object should have (and this will create some difficulties for us in designing a proper solution), but at least the following lines of code will allow the computed difference LDOS to be saved in the NetCDF and then visualized in VNL:

Code: python
LDOS_u = LocalDeviceDensityOfStates(device_configuration, energy=0.*eV, spin=Spin.Up)  
LDOS_d = LocalDeviceDensityOfStates(device_configuration, energy=0.*eV, spin=Spin.Down) 
LDOS_diff = LDOS_u-LDOS_d 

# Assign missing quantities to the difference object which allows it to be nlsaved
LDOS_diff._LocalDeviceDensityOfStates__contributions = LDOS_d._LocalDeviceDensityOfStates__contributions
LDOS_diff._LocalDeviceDensityOfStates__energy = LDOS_d._LocalDeviceDensityOfStates__energy
LDOS_diff._LocalDeviceDensityOfStates__energy_zero = LDOS_d._LocalDeviceDensityOfStates__energy_zero
LDOS_diff._LocalDeviceDensityOfStates__energy_zero_parameter = LDOS_d._LocalDeviceDensityOfStates__energy_
# For lack of better value, set the spin to Spin.Sum (Up and Down are certainly wrong!)
# This has no influence on plotting etc, it's just a matter of book-keeping
LDOS_diff._LocalDeviceDensityOfStates__spin = Spin.Sum

nlsave("file.nc",LDOS_u,object_id="LDOS Up")
nlsave("file.nc",LDOS_d,object_id="LDOS Down")
nlsave("file.nc",LDOS_diff,object_id="Difference")
Title: Re: Charge density around the Fermi energy?
Post by: sergio on January 1, 2012, 00:36
Many thanks for your reply...

Happy new year with best wishes...