Author Topic: How can I export the data of LDOS(no deviceconfiguration)?  (Read 135 times)

0 Members and 1 Guest are viewing this topic.

Offline shyoun

  • Regular ATK user
  • **
  • Posts: 14
  • Country: kr
  • Reputation: 0
    • View Profile
Hello,

I want to print the DOS graph like Fig 15. in   https://doi.org/10.1103/PhysRevX.4.031005
So I calculated LDOS with the attached code

And calculating was over well, and I can see the result. But I cannot export the data from the result.
How can I get the raw data from the calculation result?

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 4969
  • Country: dk
  • Reputation: 81
    • View Profile
    • QuantumWise
The tricky thing with LDOS for bulk systems is that it is actually a 4-dimensional data object - it's a sequence (over energy) of 3D grids. We haven't implemented any standard export function, although that would be a nice feature enhancement for later! Using a few lines of Python, however, you can easily export the data to any format you prefer.

The simplest approach is if you just want to get LDOS(x,y,z) for a given energy.
(sorry about the formatting, not sure why all the code ends up styled as a comment...)

Code: python [Select]
# Start by reading in the data object
ldos_bulk = nlread("LDOS_Heterostructure_Au&BI2O2Se_Bilayer.hdf5", LocalDensityOfStates)[-1]

# Determine which energy index you want. Either print all the energies and count, or figure it out from the grid you used
print(ldos_bulk.energies())

# Let's assume we want to use the 5th point (counting starts from zero!)
# Verify the energy:
print(ldos_bulk.energies()[4])

# Also need the cell information from the bulk configuration
config = nlread('LDOS_Heterostructure_Au&BI2O2Se_Bilayer.hdf5', BulkConfiguration)[-1]

# Create a GridValues object from the data at this energy and save it:
grid = gridValues(ldos_bulk._data()[4,:,:,:,0], config.bravaisLattice())
nlsave("gridfile.hdf5", grid)


This object can now be visualized separately in NanoLab, and also exported as text data easily using the same function you tried for the LDOS itself.

Note: The last 0 is because the data could in principle be spin-resolved (but is not in your case).
To check you can do
Code: python [Select]
print(ldos_bulk._data().shape)

which would return something like (201, 28, 28, 28, 1) showing that you have 201 energy points, for each of these a 28x28x28 3D grid of data, and 1 spin dimension

For information on the query functions see https://docs.quantumatk.com/manual/Types/LocalDensityOfStates/LocalDensityOfStates.html

Note that the LDOS is internally stored in 1/Bohr**3/Hartree so that will be the unit of the data obtained in this low-level way (we use eV and Angstrom in user-level functions and Hartree and Bohr internally).
« Last Edit: June 2, 2021, 00:58 by Anders Blom »

Offline shyoun

  • Regular ATK user
  • **
  • Posts: 14
  • Country: kr
  • Reputation: 0
    • View Profile
Thank you for the details.

I have a question about the code,
What's the meaning of the [-1] in 'ldos_bulk = nlread("LDOS_Heterostructure_Au&BI2O2Se_Bilayer.hdf5", LocalDensityOfStates)[-1]' at the first paragraph

Regards

Offline Anders Blom

  • QuantumWise Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 4969
  • Country: dk
  • Reputation: 81
    • View Profile
    • QuantumWise
Negative indices in lists in in Python means counting backwards from the end, so [-1] is the last element in the list, [-2] the second to last, and so on.

Now, nlread always returns a list so we must select some element. You could just use the first one, so index 0, but the reason I typically use [-1] instead is that if by chance have run the same script twice or more, you may have saved multiple objects in the file, and most likely you want the latest one.

Also, [ 0 ] typically doesn't show up well in this Forum, it gets interpreted as a bullet point unless you add the extra spaces
« Last Edit: June 8, 2021, 09:53 by Anders Blom »

Offline shyoun

  • Regular ATK user
  • **
  • Posts: 14
  • Country: kr
  • Reputation: 0
    • View Profile
Thank you for your answer
That was a great help!