QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: esp on February 14, 2012, 21:38

Title: no results for ldos
Post by: esp on February 14, 2012, 21:38
This is the second time now i have ran an LDOS calculation, it ran for 10 hours, and it finished without giving results .. i dont understand it .. there are no error messages, and i am not sure what is going on .. it is like it just stops!  attached is the log file

shown below is the calculation portion. ...

Code
def doLDOS():
configuration = nlread(nc_files + outFileName, object_id="cfg")[0]
calculator = my_DeviceLCAOCalculator()

#configuration.setCalculator(calculator)
configuration.setCalculator(
calculator(electrode_voltages=(ldosBiasVoltage,0.0*Volt)),
initial_state=configuration)

metallic_region0 = configuration.metallicRegions()[0]
metallic_region1 = None
if doubleGate:
metallic_region1 = configuration.metallicRegions()[1]
configuration.setMetallicRegions([metallic_region0(value = ldosGateVoltage), metallic_region1(value = ldosGateVoltage)] )
else:
configuration.setMetallicRegions([metallic_region0(value = ldosGateVoltage)] )

configuration.update()


# Energies at which to compute the LDOS;
# arguments to linspace are (min, max, number of points)
energies = ldos_energies

# calculate ldos for each energy in the list
for energy in energies:
LDOS = LocalDeviceDensityOfStates(
configuration=configuration,
energy=energy,
kpoints=MonkhorstPackGrid(3,3),
contributions=All,
energy_zero_parameter=AverageFermiLevel,
infinitesimal=1e-06*eV,
self_energy_calculator=KrylovSelfEnergy(),
spin=Spin.Sum,
)
nlsave(nc_files + outFileName + '_ldos.nc', LDOS, object_id="LDOS at %s" % energy)
now = date.today()
nlprint("energy " + str(energy) + " done " + str(now.strftime("%m-%d-%y %I:%M %p")))



some values from my parameter file:

Code

ldos_energies = numpy.linspace(-2,2,21)*eV
iteration_control_parameters = IterationControlParameters(number_of_history_steps=12, tolerance=1e-4)
numerical_accuracy_parameters = NumericalAccuracyParameters(k_point_sampling=(kPntsX, kPntsY, kPntsZ))
ldosBiasVoltage = 0.1*Volt
ldosGateVoltage = 0.0*Volt

Title: Re: no results for ldos
Post by: esp on February 15, 2012, 00:30
oh by the way, there was simply no output .. no (nc) file at all ... when i ran my script i directed that output to a file .. that file simply has "ldos done" in it, which is what i printed after the call to atk ... as i said, mysterious
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 01:24
also fyi just for reference maybe this helps .. trans calcs took about 15 minutes per calc for this same structure
Title: Re: no results for ldos
Post by: Nordland on February 15, 2012, 09:37
Could you try running the script with stupid parameters to see if the logic works or you have encounter a deeper problem?

Reduced the energies to a single point, make the LDOS using only 1,1,1 kpoint and see if it is able to run?
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 09:51
The simplest things escape me ... i am running now will post in a few minutes (hopefully)
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 10:12
My pc is totally unresponsive .. I have to wait or kill everything ... I think ldos does not work .... I am writin from my phone because it totally crashed my pc
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 10:28
ok back up again ... that kind of sucked .. as i watched control slowly slip away, i was hoping i would not lose my matlab program for VLSI CAD  ... my heart pounded faster and faster ... i tried to click the desktop, maybe start the task manager .. ... oh no .. how about that old "Break" key ... I dont have one!!! oh boy ... ok so killed the whole deal, matlab and all .. ouch


so i think what happened is that it was in an infinite loop, kept printing out "Converged in 17 steps", then restarting calculations ... memory was being sucked up, then my computer crashed .. seems like memory to me .. note that i have seen 100% memory utilization before on lab servers .. 3 different machines i have tried, never got a result ...
Title: Re: no results for ldos
Post by: Nordland on February 15, 2012, 10:48
Can you send the script to me then I can try to run it here?
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 20:25
its all part of a complicated script so i am pulling it apart

parameter file looks like this:  (some not used in ldos)
Code

# -------------------------------------------------------------
# setup parms
# -------------------------------------------------------------

from NanoLanguage import *
import numpy
import ase

logs = "../logs/"
nc_files = "../nc_files/"
plots = "../plots/"

# the number of carbon atoms to replace, every <dopingLvl> atoms
# or dope <dopingLvl>% of atoms when dopingType=2
dopingLvl = 2
dopingOn = True
dopingType = 3 # 1=edge, 2=random, 3=specific doping

outFileName = ""
outFileName2 = ""

# ran on stravinsky
gate_voltage_list = [0.01, 0.02, 0.03, 0.04, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.8, 1.0]*Volt #numpy.linspace(-0.2,0.5,15)*Volt
bias_voltage_list = [0.01, 0.025, 0.05, 0.1]*Volt

transSpecEnergies = numpy.linspace(-2,2,21)*eV
kPntsX = 1
kPntsY = 1 # don't need unless periodic here
kPntsZ = 1 #101 # always use odd so gamma point is included
ldos_energies = [1]*eV #numpy.linspace(-2,2,21)*eV
iteration_control_parameters = IterationControlParameters(number_of_history_steps=12, tolerance=1e-4)
numerical_accuracy_parameters = NumericalAccuracyParameters(k_point_sampling=(kPntsX, kPntsY, kPntsZ))

# bandstructure parms
pps=30 # points_per_segment
bafl=10 # bands_above_fermi_level

SCF = 1 # self consistent or not

ldosBiasVoltage = 0.1*Volt
ldosGateVoltage = 0.0*Volt

# set vacuum amount around device based on geometry, including gate
vac = 12.0*Ang

doubleGate = True

# atomic distances for length calcs
dist_1 = float(0.71043) * float(0.1)
dist_2 = float(3.55215) * float(0.1)
dist_3 = float(5.68344) * float(0.1) # atomic distances in nm



then the ldos calc:

Code

def doLDOS():
configuration = nlread(nc_files + outFileName, object_id="cfg")[0]
calculator = my_DeviceLCAOCalculator()

#configuration.setCalculator(calculator)
configuration.setCalculator(
calculator(electrode_voltages=(ldosBiasVoltage,0.0*Volt)),
initial_state=configuration)

metallic_region0 = configuration.metallicRegions()[0]
metallic_region1 = None
if doubleGate:
metallic_region1 = configuration.metallicRegions()[1]
configuration.setMetallicRegions([metallic_region0(value = ldosGateVoltage), metallic_region1(value = ldosGateVoltage)] )
else:
configuration.setMetallicRegions([metallic_region0(value = ldosGateVoltage)] )

configuration.update()


# Energies at which to compute the LDOS;
# arguments to linspace are (min, max, number of points)
energies = ldos_energies

# calculate ldos for each energy in the list
for energy in energies:
LDOS = LocalDeviceDensityOfStates(
configuration=configuration,
energy=energy,
kpoints=MonkhorstPackGrid(3,3),
contributions=All,
energy_zero_parameter=AverageFermiLevel,
infinitesimal=1e-06*eV,
self_energy_calculator=KrylovSelfEnergy(),
spin=Spin.Sum,
)
nlsave(nc_files + outFileName + '_ldos.nc', LDOS, object_id="LDOS at %s" % energy)
now = date.today()
nlprint("energy " + str(energy) + " done " + str(now.strftime("%m-%d-%y %I:%M %p")))



and a supporting function:

Code

def my_DeviceLCAOCalculator():

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

if SCF == 1:

#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
numerical_accuracy_parameters=numerical_accuracy_parameters,
# set these for SCF
iteration_control_parameters=iteration_control_parameters,
)

right_electrode_calculator = LCAOCalculator(
numerical_accuracy_parameters=numerical_accuracy_parameters,
# set these for SCF
iteration_control_parameters=iteration_control_parameters,
)

#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
# set these for SCF
numerical_accuracy_parameters=numerical_accuracy_parameters,
iteration_control_parameters=iteration_control_parameters,
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
)

else:
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
iteration_control_parameters=NonSelfconsistent,
numerical_accuracy_parameters=numerical_accuracy_parameters,
)

right_electrode_calculator = LCAOCalculator(
iteration_control_parameters=NonSelfconsistent,
numerical_accuracy_parameters=numerical_accuracy_parameters,
)

#----------------------------------------
# Device Calculator
#----------------------------------------
device_algorithm_parameters = DeviceAlgorithmParameters(
initial_density_type=NeutralAtom(electrode_constraint_length=0.0*Ang),
)
calculator = DeviceLCAOCalculator(
numerical_accuracy_parameters=numerical_accuracy_parameters,
iteration_control_parameters=NonSelfconsistent,
device_algorithm_parameters = device_algorithm_parameters,
electrode_calculators= [left_electrode_calculator, right_electrode_calculator],
)

return calculator


Note SCF is 1

attached is the nc file with the device
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 20:26
and note that the gate and bais voltages during the ldos calc i added only recently, not sure if that is ok or valid, seems reasonable to me (i want to see ldos under bias), but i had this problem also before i added those
Title: Re: no results for ldos
Post by: esp on February 15, 2012, 20:28
and Norland I apologize i had to sleep it was 4am when i posted so sorry i posted the code like 8 hours later after you responded
Title: Re: no results for ldos
Post by: Nordland on February 15, 2012, 20:32
Sleep is highly overrated :)

I will try take a look at it.
Title: Re: no results for ldos
Post by: esp on February 16, 2012, 22:35
any ideas yet? :)

i really need to do some ldos calcs if possible ... did you guys have a chance to take a look? is it a bug in software or did i do something wrong?
Title: Re: no results for ldos
Post by: esp on March 1, 2012, 22:08
Hey guys just checking on this one .. last time it killed several computers so i am reluctant to try again ..  since it has been 2 weeks, i am assumming there is a problem and it will be fixed on your side, is that correct? .. or maybe i did something wrong and i should redesign and try again .. please let me know .. i would love to see an LDOS plot before my trial license expires :)
Title: Re: no results for ldos
Post by: Nordland on March 3, 2012, 21:57
I am unable to reproduce in the sense that I am not running out of memory.

As the best I can see that is the problem - can you send me the SCF calculation as netcdf file?
Title: Re: no results for ldos
Post by: esp on March 17, 2012, 10:59
Ok I don't want to be a bummer here, ... I set up a Graphene p-i-n structure with a double gate, but as small as possible, width of (3,0) and length of around 4nm .... i ran the LDOS .. it has taken 24 hours already but looks like it might finish this time ... i am just wondering:  Has anyone out there done any LDOS calculations with graphene, and does it normally take this long?  I wanted to use this output as part of an iterative design process, but if it takes this long I can't see how I can .. i just need to know if i am doing something wrong or not ... i have a very powerful machine with tons of memory, hd space, and equiv 24 cores .... i cant imagine that this is normal ... some parameters below:

kPntsX = 1
kPntsY = 1
kPntsZ = 101
ldos_energies = numpy.linspace(-3,3,31)*eV
iteration_control_parameters = IterationControlParameters(number_of_history_steps=12, tolerance=1e-3)
numerical_accuracy_parameters = NumericalAccuracyParameters(k_point_sampling=(kPntsX, kPntsY, kPntsZ))

oh and by the way it has created two files both 4GB in size ... is this normal?
Both exactly the same size, one has .tmp and one does not .. but it still running ...

Title: Re: no results for ldos
Post by: esp on March 17, 2012, 22:27
I am wondering if this tells you anything that might help: the log file shows as below at the end, dont worry about the times those come from my script and they do not include time, but for at least 12 hours it has been on that last line stuck at 2.4eV .... not sure what is happening ... "top" command shows 2 processes at 100%, not much memory used about 8% total .. but it is just hanging ... any ideas?  Again, i can't send the nc file because it is 4GB

Code

|  79   H   [  12.000 ,  16.368 ,  30.708 ]    1.05825   0.05825               |
+------------------------------------------------------------------------------+
|  13 E = -93.1637 dE =  7.491420e-06 dH =  4.465593e-04                       |
+------------------------------------------------------------------------------+
| Calculation Converged in 13 steps                                            |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
|                                                                              |
| Device DFT Calculation  [Finished Sat Mar 17 02:27:38 2012]                  |
|                                                                              |
+------------------------------------------------------------------------------+

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -3.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -2.8 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -2.6 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -2.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -2.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -2.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -1.8 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -1.6 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -1.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -1.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -1.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -0.8 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -0.6 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -0.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy -0.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 0.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 0.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 0.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 0.6 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 0.8 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 1.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 1.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 1.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 1.6 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 1.8 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 2.0 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 2.2 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================
energy 2.4 eV done 03-17-12 12:00 AM

                            |--------------------------------------------------|
Calculating LDOS           : ==================================================


Title: Re: no results for ldos
Post by: esp on March 17, 2012, 22:40
How about this, forget about what I am doing in code ... is it possible that you (ATK) or anyone out there can take this device in the nc file, and run an LDOS? with bias, without, i dont care, i just want to see an LDOS plot ... the object_id is "cfg" ... it is small device because i wanted to get the calc to finish but it never did .. this is yet again going to be another entire weekend waiting for LDOS on a tiny device on a huge powerful computer .. please anyone, run LDOS for this device with whatever parameters you want (but do it self-consistently) ... if you have success, then please let me know how you did it.  

Title: Re: no results for ldos
Post by: esp on March 18, 2012, 11:24
just fyi, i ran this yet another time ... same result .. it ran all the way through but stopped at the same point where it was doing LDOS for 2.5eV ... the output files were both 4GB, and it just hung there for 6 hours ... seemingly doing nothing .. i am rerunning now with half the k points to see if that helps.  Also note i have checked on the linux machine for any file size restrictions and i do not see any ...
Title: Re: no results for ldos
Post by: Nordland on March 18, 2012, 15:10
Are you storing the result in the same file every time?

Title: Re: no results for ldos
Post by: Nordland on March 18, 2012, 16:34
My laptop is running on crunching some numbers now - and I would surprised if it did not work, so while we wait for it to finish, let me elaborate a  little on the details of the problem with appending extensive to the NC file

NetCDF offers support for only one unlimited variable, and it must be the last variable in the file. Therefore appending to a netcdf file is technical impossible if you dont know the number of entries once you create the netcdf file. On the other hand one is not able to predict what and in what order
a user might desire to put things into a netcdf file.
In ATK 11.8 and the version before this, behind the scenes, when a object is appended to an existing file, a temporary file is created with the original content, and then the new object is added to this file, and then this new file is moved back to the original name. (This is the reason for the *.nc.tmp file you are seeing ).
While this approach is quite strong it has two limitations. First of all you need to be able to have all of the file in memory at one point time. The other thing is somewhat more severe. Due to this lack in netcdf were you have to append to the file by rewriting it from scratch every time you write to it, means it scales problematic with the number of appends. Imagine that you have to add 9 grids to a netcdf file on 9 seperate occasions, and each grid is 100 megabyte of data, it means that you have to do 5 GB disk-work (Gauss summation)

In ATK 12.2 we have developed an extension to netcdf framework, that allow you to append a netcdf file without rewriting the file from scratch every time, and without loading it into memory. It is still an valid netcdf file in all extend but it is "prepared" in a way such we can add data to it with excess IO work.

If you are using 11.8 ATK I would recommend putting the LDOS in seperate files if you are going to have many of them.
Title: Re: no results for ldos
Post by: Nordland on March 18, 2012, 16:56
I just took some random parameters, but they will not influence the calculation of the LDOS time ( which takes a couple of seconds.)

Here is your plot.
Title: Re: no results for ldos
Post by: esp on March 18, 2012, 23:25
Thank you I am not sure what you mean about appending to the nc file .. I clean the directory before each run ... but thank you I will look at what you have done here .. hopefully i can figure out what is wrong ... my latest run i started at 4am this morning .. it is 12 hours now it has been running so far .. this time i tried with only 50 k points in the z direction hoping that will help, but i need to look at what you did before i try again
Title: Re: no results for ldos
Post by: esp on March 18, 2012, 23:27
I noticed the basis set is different ... you used: 
    LDABasis.Carbon_SingleZeta,
    LDABasis.Boron_SingleZeta,
    LDABasis.Hydrogen_SingleZeta,
    LDABasis.Nitrogen_SingleZeta,

I though you were supposed to use Cerda.Carbon for graphene for best results?
Title: Re: no results for ldos
Post by: Nordland on March 19, 2012, 01:51
Thank you I am not sure what you mean about appending to the nc file .. I clean the directory before each run ... but thank you I will look at what you have done here .. hopefully i can figure out what is wrong ... my latest run i started at 4am this morning .. it is 12 hours now it has been running so far .. this time i tried with only 50 k points in the z direction hoping that will help, but i need to look at what you did before i try again

Appending means writing to the same nc file.
Title: Re: no results for ldos
Post by: Nordland on March 19, 2012, 01:52
I noticed the basis set is different ... you used: 
    LDABasis.Carbon_SingleZeta,
    LDABasis.Boron_SingleZeta,
    LDABasis.Hydrogen_SingleZeta,
    LDABasis.Nitrogen_SingleZeta,

I though you were supposed to use Cerda.Carbon for graphene for best results?

No and Yes. Cerda is a good basis set, but it is only Huckel basis set and can't be used for DFT. SingleZeta is of course the smallest basis set possible, but it was just to show it could be done.
Title: Re: no results for ldos
Post by: Nordland on March 19, 2012, 01:54
In your routine doLDOS(), try replacing:
Code
nlsave(nc_files + outFileName + '_ldos.nc', LDOS, object_id="LDOS at %s" % energy)
with
Code
nlsave(nc_files + outFileName + '_ldos_%s.nc'%energy, LDOS, object_id="LDOS at %s" % energy)
Title: Re: no results for ldos
Post by: esp on March 19, 2012, 01:56
thank you not a bad idea, then i would have multiple files of smaller size... good idea
Title: Re: no results for ldos
Post by: esp on March 19, 2012, 06:30
well it did complete now with less k points .. i guess i will just have to watch it and see what the limit is before it wont finish anymore .. at least on the machines i am using now ... thank you again
Title: Re: no results for ldos
Post by: Nordland on March 19, 2012, 09:17
The number of k-points in the z-axis will not have an effect on the calculation time of the local density of states, it might have one the LDOS, but not the calculation time of it.
Title: Re: no results for ldos
Post by: esp on March 19, 2012, 10:10
hmm... ok

I am attaching the LDOS plots from 2 different scripts I found on the forums here ... i am wondering if maybe by looking at them you can tell if I am doing something wrong ... they look weird ... i am trying to get this plot so i can see somewhat of a band diagram ... i have a p-i-n structure, but from the LDOS plot it looks very weird ... what do you think?
Title: Re: no results for ldos
Post by: Anders Blom on March 19, 2012, 11:17
This plot type is very delicate when it comes to the choice of colors and cut-off of the colorscale. The contours are set in the statement similar to

V = numpy.linspace(0,0.01,10)

Data outside the range will be white, but it's basically impossible to predict beforehand what the range of LDOS data will be, so the "default" in the script is just a guess, or rather a number which worked for the system at hand that time. So, some experimentation is needed here.
Title: Re: no results for ldos
Post by: esp on March 19, 2012, 20:32
Well I did add a small bit of code to find the max and min, then i set the contour plot using those values

What I meant about it being strange was that I expected a stepped band diagram from a p-i-n  device ... it doesnt look like anything to me .. i dont know what to make of it ...

thank you
Title: Re: no results for ldos
Post by: Anders Blom on March 19, 2012, 21:12
What one has to remember is that the "standard" picture of a p-n junction or similar is the average of several (very many, in fact) atoms, and what goes on microscopically (nanoscopically, we say perhaps) - not least in the interface between the different regions - is completely ignored. In ATK, conversely, we are concerned with what precisely goes on on the length-scale of individual atoms, in this picture concepts such as "the bottom of the conduction band as a function on z" is not a particularly useful concept.

Now, the LDOS plot does let you come a bit closer to this picture, and what you do see is that the conduction band is largely aligned throughout the structure, with almost all offset taking place in the valence band.

Without having any real data at hand, just the plot, I would assign the top of the valence band to the envelope of the blue peaks sticking up out of the white, and the top of the conduction band as the edge between the broad solid blue region and the next color value. I might be wrong, but tuning the parameters (in particular the max) should allow for some further insight. Also, it's a bit odd that you have zero density of states in such a large negative energy interval, did you really compute the LDOS down to -3 eV, or just -1? Seems you need to go lower.