QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: qiuweicheng on July 19, 2017, 15:21

Title: plot the fatband of spin up electron for atomic orbital projection
Post by: qiuweicheng on July 19, 2017, 15:21
Hi,
In the set of atomic orbital projection fatband, we can't distinguish the bands between spin up electron and spin down electron.
I try to solve this probelm.
I save the result of   atomic orbital projection fatband in 1.py file.
In the scatter line,  the data like this:
# Scatter
x = numpy.array([ 0.            ,  0.003333333333,  0.006666666667,  0.01          ,
                  0.013333333333,  0.016666666667,  0.02          ,  0.023333333333,
                  0.026666666667,  0.03          , .............,  1.0,
                   0.            ,  0.003333333333,  0.006666666667,  0.01          ,
                  0.013333333333,  0.016666666667,  0.02          ,  0.023333333333,
                  0.026666666667,  0.03          , .............,  1.0,
                    ..................................
 The band of spin up electron is list Followed by  the band of spin up electron .
The question:
How do I  distinguish  the datas between the spin up and spin down? or deal with this scatter line?
Could you give me the  relevant py file? or the relevant python commands?
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: Anders Blom on July 20, 2017, 22:10
This is new feature so even I am a bit unused to it, but I think what you need to do is make several projections at the same time, for spin up and down separately. Then you can just choose different color for the projections in the GUI when you plot them. This cannot be done via the Script Generator, but actually the FatBandstucture object supports a lot more complex projection, via the Python interface. See the manual for details: http://docs.quantumwise.com/manuals/Types/FatBandstructure/FatBandstructure.html#fatbandstructure-c
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: qiuweicheng on July 21, 2017, 06:58
thank you for your reply.
I  set py command according to the the manual:
    p3 = Projection(spin=Spin.Up),
    p1 = Projection(atoms=[Boron], l_quantum_number=[0, 1, 2])+Projection(atoms=[Carbon], l_quantum_number=[0, 1, 2])+Projection       (atoms=[Nitrogen], l_quantum_number=[0, 1, 2]),
    projections=p1*p3,
but, it is error:
TypeError: __init__() got an unexpected keyword argument 'l_quantum_number'

and then, i set the py command like this
projections=Projection(ProjectOnOrbitalsByElement, spin=Spin.Up)
but, it is also  error:
TypeError: __init__() got multiple values for keyword argument 'spin'

and then, i set the py command like this
projections=ProjectOnOrbitalsByElement*Projection(spin=Spin.Up),
but, it is also  error:
AttributeError: 'Projection' object has no attribute 'generate'

So, how can I make spin=Spin.Up and ProjectOnOrbitalsByElement projections at the same time? please help me
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: Anders Blom on July 21, 2017, 08:19
You just misspelled the keyword, it's "l_quantum_numbers", not "l_quantum_number"
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: qiuweicheng on July 21, 2017, 08:32
# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Analysis from File
# -------------------------------------------------------------
path = u'C:/Users/ThinkPad/.vnl/graphene-MD/band-Gr-BN.hdf5'
configuration = nlread(path, object_id='BulkConfiguration_0')[0]
# -------------------------------------------------------------
# Fat Bandstructure
#-------------------------------------------------------------
fat_bandstructure = FatBandstructure(
    configuration= configuration,
    route=['G', 'K', 'M'],
    points_per_segment=200,
    bands_above_fermi_level=All, 
    p3 = Projection(spin=Spin.Up),
    p1 = Projection(atoms=[Boron], l_quantum_numbers=[0, 1, 2])+Projection(atoms=[Carbon], l_quantum_numbers=[0, 1, 2])+Projection(atoms=[Nitrogen], l_quantum_numbers=[0, 1, 2]), 
    projections=p3*p1,
)
nlsave('band-Gr-BN.hdf5', fat_bandstructure)

Tt is also error:
NameError: name 'p3' is not defined
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: Jess Wellendorff on July 21, 2017, 08:48
According to the online manual, you can not give the keyword agruments "p3" or "p1". That's the problem. You need instead to use only the keyword argument "projections", which may be a list of projections:

Code
p1 = Projection(atoms=[Boron], l_quantum_numbers=[0, 1, 2])+Projection(atoms=[Carbon], l_quantum_numbers=[0, 1, 2])+Projection(atoms=[Nitrogen], l_quantum_numbers=[0, 1, 2])
p3 = Projection(spin=Spin.Up)

fat_bandstructure = FatBandstructure(
    configuration= configuration,
    route=['G', 'K', 'M'],
    points_per_segment=200,
    bands_above_fermi_level=All,   
    projections=[p3,p1], # a list of the projections defined above
)
Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: qiuweicheng on July 22, 2017, 01:31
Thank you very much.
But, the  Projection(atoms=[Boron], l_quantum_numbers=[0, 1, 2])) is still used by the projection of spin=spin_sum, not the projection of spin=spin_up. and the results of projections=[p3,p1] is the sum of p3 and p1. see the attachments.
By the way,I want to calculate the ProjectOnOrbitalsByElement projections  used by the projection of spin=spin_up. How to solve it?
I write this py file according to the manual http://docs.quantumwise.com/manuals/Types/Projection/Projection.html#NL.Analysis.Projection.Projection

# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Analysis from File
# -------------------------------------------------------------
path = u'C:/Users/ThinkPad/.vnl/graphene-MD/band-Gr-BN.hdf5'
configuration = nlread(path, object_id='BulkConfiguration_0')[0]
# -------------------------------------------------------------
# Fat Bandstructure
#-------------------------------------------------------------
p1 = ProjectOnOrbitalsByElement
p3 = Projection(spin=Spin.Up)
fat_bandstructure = FatBandstructure(
    configuration= configuration,
    route=['G', 'K', 'M'],
    points_per_segment=200,
    bands_above_fermi_level=All,   
    projections=p1*p3, # a list of the projections defined above
)
nlsave('band-Gr-BN.hdf5', fat_bandstructure)

But, it is error:
Traceback (most recent call last):
  File "band-Gr-BN.py", line 17, in <module>
    projections=p1*p3, # a list of the projections defined above
  File "zipdir\NL\Analysis\FatBandstructure.py", line 122, in __init__
  File "zipdir\NL\Analysis\FatBandstructure.py", line 563, in setAndCheckProjections
  File "zipdir\NL\Analysis\ProjectionGenerator.py", line 271, in generate
AttributeError: 'Projection' object has no attribute 'generate'

Title: Re: plot the fatband of spin up electron for atomic orbital projection
Post by: Anders Blom on July 22, 2017, 02:38
Why make it so complicated?
Why not just

p = [Projection(atoms=[Boron], l_quantum_numbers=[0, 1, 2], spin=Spin.Up), Projection(atoms=[Boron], l_quantum_numbers=[0, 1, 2], spin=Spin.Down)]