QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: jdgayles16 on October 1, 2010, 14:04

Title: adding LDOS
Post by: jdgayles16 on October 1, 2010, 14:04
Can LDOS be added like effective potential?
Title: Re: adding LDOS
Post by: jdgayles16 on October 1, 2010, 14:15
I think I know how, I figure i have to use the .toArray() command. but after i add the new sample to the vnl will i still be able to view it?
Title: Re: adding LDOS
Post by: jdgayles16 on October 1, 2010, 15:07
I want to write a script that adds several LDOS, but  I am having a lot of trouble

This is the script I wrote but I couldn't get anywhere with it.

Code
t=0
energies=numpy.linspace(-0.40308,-0.34967,10)*electronVolt

for i in range(len(energies)):
    lo = calculateLocalDensityOfStates(self_consistent_calculation = scf, energy = energies[i], quantum_number = (0.0,0.0))
    lo=lo.toArray()
    t=t+lo


export_cube_file(t,'file.cube')
if processIsMaster(): file.addToSample(t, 'ldosh', 'Local Density Of States Peak homo')
if processIsMaster(): file.addToSample(atomic_configuration,'ldosh')
Title: Re: adding LDOS
Post by: Anders Blom on October 1, 2010, 18:36
You don't write the error message, so I have to guess a bit what goes wrong. Try removing the t=0 line; it makes t an integer, which you then try to add to an array.

I'd go with something like

Code
t = None
energies = numpy.linspace(-0.40308,-0.34967,10)*electronVolt

for i in range(len(energies)):
    ldos = calculateLocalDensityOfStates(scf, energy = energies[i], quantum_number = (0.0,0.0))
    if t==None:
        t = ldos.toArray()
    else:
        t = t+ldos.toArray()
Title: Re: adding LDOS
Post by: jdgayles16 on October 2, 2010, 20:56
Sorry for not writing an error message, I was a bit tired that morning.




This  code seemed to be working, i just have to analyze the data now.  :)
Code
from ATK.TwoProbe import *
from ATK.MPI import processIsMaster
import numpy

# Fetch the calculations.
if processIsMaster(): file = VNLFile('ldosh.vnl')

# Read old atomic configuration
vnl_file = VNLFile("gap.vnl")
atomic_configuration = vnl_file.readAtomicConfigurations()["gap"]

scf = restoreSelfConsistentCalculation('CGsupergap.nc')
scf._attributeContainer().getAttributeContainer('SetupAttributes').setDouble(100.,'MeshCutoff')
t=None
energies=numpy.linspace(-0.40308,-0.34967,10)*electronVolt

for i in range(len(energies)):
    ldos = calculateLocalDensityOfStates(scf, energy = energies[i], quantum_number = (0.0,0.0))
    if t==None:
        t = ldos.toArray()
    else:
        t = t+ldos.toArray()

ldos._LocalDensityOfStates__local_density_of_states_data =t

if processIsMaster(): file.addToSample(ldos, 'ldosh', 'Local Density Of States Peak homo')
if processIsMaster(): file.addToSample(atomic_configuration,'ldosh'
Title: Re: adding LDOS
Post by: jdgayles16 on October 2, 2010, 20:59
How does one change the dE for the LDOS calculation?
Title: Re: adding LDOS
Post by: Anders Blom on October 2, 2010, 21:33
dE, you mean in your case the energy spacing/resolution? That's part of the statement

Code
energies=numpy.linspace(-0.40308,-0.34967,10)*electronVol

10 means 10 points in the energy range indicated.
Title: Re: adding LDOS
Post by: jdgayles16 on October 3, 2010, 00:59
I meant for a single LDOS calculation.

Title: Re: adding LDOS
Post by: Anders Blom on October 3, 2010, 01:01
There is no dE for LDOS... Only E (energy).

Or you mean the infinitesimal? See http://quantumwise.com/documents/manuals/ATK-2008.10/ref.calculatelocaldensityofstates.html