Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Anders Blom

Pages: 1 ... 341 342 [343] 344 345 ... 362
5131
I don't know where the syntax error comes from, because the script you have post contains 228 lines, so it cannot be the script you actually run, if the error is reported on line 419.

But in the code you posted, there are some mistakes. For some reason, Lithium has been replaced by lithium in a few places, this will not work. And finally, about the indentation, you have not made it like my example above (sorry, posted as admin!), since the last segment is not indented. All lines after "for voltage" should be indented, until the end of the script.

5132
Just to make sure we all understand each other:

If you use the main method in ATK, that is you run a self-consistent calculation for each bias, then the full dependence of the transmission on the bias will be properly accounted for. The I-V curve sweep used in the ivcurve.py module does this.

5133
To show the module in action, I have attached the band structure of graphite, generated with the following script:

Code
from ATK.KohnSham import *
from bandstructure import *

route = RouteInBrillouinZone('Hexagonal')
route.setRoute('KGMKHALH')

scf = restoreSelfConsistentCalculation ('graphite.nc')
bs = calculateBandStructure(scf,route,40)

plot_params = {
    'plot_color' : 'b',
    'plot_symbol' : '-',
    'ylabel' : 'Energy (eV)',
    'grid' : True,
    'title' : 'Band structure of graphite',
    'image_filename' : 'graphite_bandstructure.png',
    'ymin' : -20,
    'ymax' : 10,
}

bs.plot(**plot_params)

The calculation was done with DZP and 5x5x5 k-points (just as a demonstration).

5134
I completely agree that this point is weak in VNL, and it will be improved in the next version.

But, as often - NanoLanguage comes to the rescue already now! :-) I have written my own band structure module, which I intend to publish as a tutorial in the near future. It's not 100% ready, but I'd be glad to share it with anyone who wants to test it. Just contact me directly via mail, and I will send a preview copy.

5135
Just a general note to everyone: when posting question about a script that gives errors, please also post the error message. Often the problem will be obvious from the error output (for those who are used to interpreting Python's sometimes a bit cryptic messages), and it saves a lot of time not having to run the script yourself.

5136
Ah, I thought you were using Windows, based on the posted script (checkpoint file C:/users...; that filename will not work on Linux, by the way).

On Linux, put the file in /ms/vnl-2008.10.0/atk/lib/python2.4/site-packages instead.

5137
General Questions and Answers / Re: Questions of electrode
« on: April 28, 2009, 18:52 »
The electrodes are real.
The first version is correct: it's a single impurity in an infinite nanotube.

5138
You should bring back the statement import ivcurve.

But, before you run the calculation, copy the file ivcurve.py to C:\Program Files\QuantumWise\Virtual NanoLab 2008.10.0\atk\lib\site-packages (you probably have to create the directory first).

Note that running an I-V sweep like this is very time-consuming. The recommended way to do it, if you have possibility, is to use a 64-bit Linux computer (can be as much as twice faster) or - even better - in parallel.

5139
This question highlights an important conceptual point about the way ATK calculated two-probe systems under bias, which I would like to take a second to comment on in more detail.

The simplest, and perhaps most common way to compute the I-V curve for a tunneling device is precisely like was attempted above: to first compute the zero-bias transmission, and then just integrate the transmission spectrum over an increasingly broad "bias window" to get the current. This works fine, in some sense, and is called the linear response current. However, it only gives accurate results under one crucial assumption: that the transmission spectrum is not influenced by the bias. In many cases this assumption is valid, in others it is just assumed, without proof (often because there is no simple way to check it).

There are however many situations where the transmission spectrum T(E) itself depends strongly on the applied bias. The uniqueness of ATK lies in its ability to compute T(E) self-consistently under an applied finite bias.

To do this you must, exactly like serhan shows, include the bias in the actual self-consistent calculation. In this way, the bias will be included in the self-consistent electrostatic potential, and consequently in the electron density and the density matrix, which in turn are used to compute the transmission.

Newer versions (later than 2008.02) of ATK actually also include a method to compute the linear response current, which works almost as you tried to do, artingchen. To use this function, you must however first import a module called ATK.Future, and instead of calling calculateCurrent() you use a different function. A rewritten version of your original attempt that utilizes this function would be as below.

I have made this is as a standalone analysis task, loading an already converged calculation from the checkpoint file.

Code
from ATK.TwoProbe import *
import numpy
from ATK.Future import calculateLinearResponseCurrent
from ATK.MPI import processIsMaster

scf = restoreSelfConsistentCalculation ('my_calculation.nc')

my_voltages = numpy.linspace(-4.0, 4.0, 100)*Volt
lr_currents = calculateLinearResponseCurrent(
    self_consistent_calculation = scf,
    voltages = my_voltages,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)

if processIsMaster():
    file = VNLFile ('linear_response_current.vnl')
    print 'Bias (V)\tCurrent (A)'
    for i in range(len(my_voltages)):
        print my_voltages[i].inUnitsOf(Volt), '\t', lr_currents[i].inUnitsOf(Ampere)
        file.addToSample(lr_currents[i], 'twoprobe_configuration', 'Current at %g V bias' % my_voltages[i].inUnitsOf(Volt))

Note that all voltages are given at once, instead of looping over them. I have also made use of the very nice NumPy function linspace() instead of arange() which is a tricky function.

Oh, and I reduced the number of points between -4 and +4 V from 400 to 100. Note that if you want to (and you do want to!) go by serhan's approach, the best approach is always to start by 0 V bias,.

For more details, see the manual page for the function calculateLinearResponseCurrent().

Do note, however, that calculating the current in this way may not give the correct result, if, as mentioned above, the transmission does depend on the bias. And the only way to find out if it does it to compute it... Still, the linear response current can be useful as a first quick test to get an overview. It is however always crucial to also study the details of the transmission spectrum, also at finite bias.

5140
General Questions and Answers / Re: Smearing the I-V curve
« on: April 27, 2009, 14:12 »
Ok, it looks pretty much like I suspected :)

First, I'm wondering whether the actual current is that relevant in this case. The resonance is very sharp and has a reasonable value (not like 0.01), but probably does not change much at all with bias. Therefore, you may not need to spend a lot time computing the current extremely accurately; it seems to me the effect you are looking for is not in the I-V curve but the position of the resonance itself, its height, the difference between spin up/down, how the peak changes when you modify the structure, etc.

The fluctuations in the current are almost certainly due to poor accuracy in the integration. Taking the above point into account, if you are really concerned with the precise value of the current, you need to integrate the transmission spectrum more accurately. However, since the peak is quite sharp, it will be very inefficient to just increase the number of points to a huge value, since most of the points will be in the areas of zero transmission anyway. What you need an adaptive integration routine, that puts more points in the region of the peak, and fewer outside it.

Fortunately for you, I recently wrote such a routine :-)

I'll be happy to share it with you, perhaps, for now, off the Forum, however, since it's not 100% finalized (anyone else who is interested in it are most welcome to contact me!).

However, again: even if you were able to compute the current extremely accurately, I think it will just show a linear increase, which is the bias window "background". The real physics here lies, as I see it, elsewhere, and not in the I-V curve.

5141
General Questions and Answers / Re: Smearing the I-V curve
« on: April 27, 2009, 12:22 »
If the transmission spectrum is zero then the current will be zero :)

But I guess T(E) is not exactly zero, just very small. In that case, I guess the current integration can have a large effect on the results. Can you post an example of the transmission spectrum, at two different biases? Perhaps in log-scale.

5142
General Questions and Answers / Re: Smearing the I-V curve
« on: April 27, 2009, 11:26 »
What is red vs black curve?

How different are the transmission spectra?

One should also note that the current integration routine in ATK is not extremely accurate numerically. So another point that would affect the current values at the level of accuracy you are looking at would be the number of points in the current integration.

5143
General Questions and Answers / Re: Choice of basis
« on: April 26, 2009, 23:10 »
As a general rule, to add the above considerations, I would never use SZ for real calculations, unless I was really forced to by memory constraints. There is just too little freedom both radially and angularly to properly describe bonds except in very spherically symmetric cases.

For several elements (specifically, those with a full shell as the valence), ATK will in fact refuse to run a SZ calculation since it will converge very poorly, if at all.

My rule of thumb is: SZP as a work-horse when trying things out, and most of the time for C-based systems, and DZP whenever I can afford it otherwise. DZ can sometimes be a good alternative to SZP if the geometry is close to "elemental". The difference between DZDP and DZP is rarely important; other errors like exchange-correlation functional are probably larger.

5144
General Questions and Answers / Re: ATKError: bad allocation
« on: April 26, 2009, 22:12 »
Is the error really exactly like you wrote?
In that case, it might not be an out-of-memory error after all (which is St9bad_alloc), but rather something else (like over-lapping atoms).
On the other hand, if you are running it properly now, let's hope it was a spurious thing, perhaps. Let us know if it appears again, and regularly.

Good luck with your calculations!

5145
Although I haven't seen the geometry, my guess is that the electrode is too short. If it's only 1 period, or even 2, this is too short and will, even if the calculation converges (which is sometimes hard, when the electrodes are too short), lead to the wrong results.

It was observant of you to note the charges, but you would probably have seen it very clearly in the transmission spectrum later. This is an ideal system, but I would not be surprised if the transmission spectrum comes out less than perfect (not integer plateaus).

So, increase the electrodes (use 4 periods) and let's see what happens!

Pages: 1 ... 341 342 [343] 344 345 ... 362