QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: marmotte on April 9, 2013, 13:54

Title: band structure decomposition
Post by: marmotte on April 9, 2013, 13:54
Dear ATK team,

I run band-structre calculation for a simple bulk material and I'd like to know if there is a script or tool under ATK 2012.8 able to give me which band is the valence band or conduction band. Is it possible to do a decomposition of the bandstructure such as with DOS ?

Best regards,
Title: Re: band structure decomposition
Post by: Anders Blom on April 9, 2013, 19:35
It's possible to project the band structure, like the DOS, on orbitals and atoms. There is no GUI component for this yet, but here is an example which make a project of the band structure of SiO2 (cristobalite) on the oxygen p-orbitals:

Code: python
# Set up lattice
lattice = FaceCenteredCubic(7.166*Angstrom)

# Define elements
elements = [Silicon, Silicon, Oxygen, Oxygen, Oxygen, Oxygen]

# Define coordinates
fractional_coordinates = [[  0.125,   0.125,   0.125],
                          [  0.875,   0.875,   0.875],
                          [  0,   0,   0],
                          [  0,   0.5,  0],
                          [  0.5,   0,  0],
                          [  0,   0,   0.5]]

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )
   
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=(3, 3, 3),
    )

calculator = LCAOCalculator(
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('sio2_bs_pO.nc', bulk_configuration)

# -------------------------------------------------------------
# Bandstructure
# -------------------------------------------------------------

################## THE IMPORTANT PART ##################
project_oxygen_p = ProjectionList(elements=[Oxygen], angular_momenta=[1])
####################################################

bandstructure = Bandstructure(
    configuration=bulk_configuration,
    route=['G', 'X', 'W', 'L', 'G', 'K', 'X', 'U', 'W', 'K', 'L'],
    points_per_segment=60,
    bands_above_fermi_level=All,
    projection_list=project_oxygen_p,     # IT GOES HERE
    )
nlsave('sio2_bs_pO.nc', bandstructure)

Title: Re: band structure decomposition
Post by: kstokbro on April 10, 2013, 10:11
The projection is more like the MolecularEnergySpectrum, i.e. you project the Hamiltonian onto certain orbitals and diagonalizes this reduced Hamiltonian.


Title: Re: band structure decomposition
Post by: zh on April 10, 2013, 10:29
It may be similar to the fat band plot, in which the line thickness of a band is proportional to the weight of an orbital of an atom.
Title: Re: band structure decomposition
Post by: atk_user on November 12, 2014, 08:11
Dear, Dr. Anders Blom

I have a further question. Is it possible to obtain two or three types of elements. I mean just wanted to obtain the band structure only for the scattering part of device model system.

2. Is it possible to analyze the band of each elements for spin up and down component?


Lee



It's possible to project the band structure, like the DOS, on orbitals and atoms. There is no GUI component for this yet, but here is an example which make a project of the band structure of SiO2 (cristobalite) on the oxygen p-orbitals:

Code: python
# Set up lattice
lattice = FaceCenteredCubic(7.166*Angstrom)

# Define elements
elements = [Silicon, Silicon, Oxygen, Oxygen, Oxygen, Oxygen]

# Define coordinates
fractional_coordinates = [[  0.125,   0.125,   0.125],
                          [  0.875,   0.875,   0.875],
                          [  0,   0,   0],
                          [  0,   0.5,  0],
                          [  0.5,   0,  0],
                          [  0,   0,   0.5]]

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )
    
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=(3, 3, 3),
    )

calculator = LCAOCalculator(
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('sio2_bs_pO.nc', bulk_configuration)

# -------------------------------------------------------------
# Bandstructure
# -------------------------------------------------------------

################## THE IMPORTANT PART ##################
project_oxygen_p = ProjectionList(elements=[Oxygen], angular_momenta=[1])
####################################################

bandstructure = Bandstructure(
    configuration=bulk_configuration,
    route=['G', 'X', 'W', 'L', 'G', 'K', 'X', 'U', 'W', 'K', 'L'],
    points_per_segment=60,
    bands_above_fermi_level=All,
    projection_list=project_oxygen_p,     # IT GOES HERE
    )
nlsave('sio2_bs_pO.nc', bandstructure)


Title: Re: band structure decomposition
Post by: Anders Blom on November 12, 2014, 13:01
Sure, just use elements=[Oxygen,Silicon] instead, or similar.
Title: Re: band structure decomposition
Post by: atk_user on November 12, 2014, 13:05
Oh, thanks so much. I used "space" instead of comma.

Spin decomposition (sum, up, and down) is automatically calculated?
Title: Re: band structure decomposition
Post by: Anders Blom on November 12, 2014, 21:55
Yes the spin is specified later, in "evaluate"
Title: Re: band structure decomposition
Post by: atk_user on November 13, 2014, 02:32
It means that I must using the evaluate to obtain the spin decomposed band structures? After running below script, I can't find any output band data. Could you explain more details?


bs = nlread("D:/ATK/Band.nc", Bandstructure)[0]
bs_up = bs.evaluate(spin=Spin.Up)
bs_dn = bs.evaluate(spin=Spin.Down)
Title: Re: band structure decomposition
Post by: Anders Blom on November 13, 2014, 10:51
So, now you have two objects, bs_up and bs_dn that contain the data. Of course there is no output unless you print it, or plot it, etc. See e.g. http://quantumwise.com/forum/index.php?topic=566.0 (a bit old code, some things might not work - but the point is there).
Title: Re: band structure decomposition
Post by: Anders Blom on November 13, 2014, 10:59
Here is a more complete example

Code: python
from NanoLanguage import *

ncfile = 'gold.nc'
plotfile = 'plot.png'
colors = ['r','b','g','m']
ymin = -10
ymax = 10

conf = nlread(ncfile, object_id='gID000')[-1]
bs_s = Bandstructure(conf, projection_list=ProjectionList(angular_momenta=[0]))
bs_p = Bandstructure(conf, projection_list=ProjectionList(angular_momenta=[1]))

bandstructures = [bs_s,bs_p]

import pylab as P
for j,bs in enumerate(bandstructures):
    P.plot(bs._axisGUI(), bs.evaluate(), colors[j])

kticks = [ tick[0] for tick in bs._ticksGUI() ]
ticklabels = [ tick[1].replace('Γ','$\Gamma$') for tick in bs._ticksGUI() ]
P.xticks(kticks,ticklabels)

P.grid(kticks)
P.ylim(ymin,ymax)

#P.savefig(plotfile)
P.show()
Title: Re: band structure decomposition
Post by: atk_user on November 14, 2014, 13:47
Thank you very much. It looks little complicate. I'll try.

In VNL, I found the "band structure Analyzer..." In the Bandstructure Analyzer, I found the drop down menu for "sum", "up", and "down". It looks spin sum, up, and down component of band structure.

Is it different from the band extracted by using the script you gave above?
Title: Re: band structure decomposition
Post by: Anders Blom on November 14, 2014, 13:51
Yes it's different because you cannot do the projection on elements or angular momenta in the Analyzer.
Title: Re: band structure decomposition
Post by: atk_user on November 14, 2014, 14:06
I'm little confusing... ???

If I first projection on elements or angular momenta from reading the analysis.nc (optimized file) using below input file. Is that the same or different with the band from the script?

# -------------------------------------------------------------
# Bandstructure
# -------------------------------------------------------------
bandstructure = Bandstructure(
    configuration=configuration,
    route=['G', 'X', 'U', 'Z', 'G'],
    points_per_segment=20,
    bands_above_fermi_level=4,
    projection_list=ProjectionList(elements=[Silicon, Oxygen]),
    )
nlsave('Band1.nc', bandstructure)

# -------------------------------------------------------------
# Bandstructure
# -------------------------------------------------------------
bandstructure = Bandstructure(
    configuration=configuration,
    route=['G', 'X', 'U', 'Z', 'G'],
    points_per_segment=20,
    bands_above_fermi_level=4,
    projection_list=ProjectionList(elements=[Silicone]),
    )
nlsave('Band2.nc', bandstructure)
Title: Re: band structure decomposition
Post by: Anders Blom on November 14, 2014, 14:23
I suppose it is I who is confusing ;)

If you combine your script with mine (minus a few lines) you get what you want - two band structures in the same plot, computed in different ways.

First run your code, and then

Code: python
from NanoLanguage import *  
     
plotfile = 'plot.png' 
colors = ['r','b','g','m'] 
ymin = -10 
ymax = 10 

bs1 = nlread('Band1.nc', BandStructure)[-1]
bs2 = nlread('Band2.nc', BandStructure)[-1]
...
# same as before
...
Title: Re: band structure decomposition
Post by: atk_user on November 14, 2014, 14:49
Thank you very much. I'll try it.  :D
Title: Re: band structure decomposition
Post by: Jess Wellendorff on June 5, 2015, 09:02
The attached script is a very simple way of reading, plotting, and saving the up and down spin channels of a band structure.
Title: Re: band structure decomposition
Post by: Jess Wellendorff on June 8, 2015, 09:14
A few things might go wrong in this script.

1)  object_id='gID002' may not be a Bandstructure object (I don't know, because I cannot see how file.nc was written).
2) bs_up and bs_dn are arrays with dimensions (#kpoints , #bands), for example (201, 15). When writing to data files, you need to write all bands. The script I posted previously illustrates this.