Author Topic: the current calculation of the python script  (Read 5062 times)

0 Members and 1 Guest are viewing this topic.

Offline muyunfei

  • New QuantumATK user
  • *
  • Posts: 3
  • Reputation: 0
    • View Profile
the current calculation of the python script
« on: November 22, 2009, 08:39 »
Dear all.
i am a green hand about atk software, when i did some calculations about the "two-probe model". the calculation would be converged but when i use the script in the attachment to calculate the current. the output looked like this:
=======================================================================================
+ -------------------------------------------------------------
| NanoLanguageScript execution started
+ -------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/5204414373203287.py", line 4, in <module>
    transmission_spectrum = nlread("/home/zjl/JOB/Si_0_0.nc",TransmissionSpectrum)[1]
IndexError: list index out of range
NanoLanguageScript finished successfully
+ -------------------------------------------------------------
| NanoLanguageScript execution finished
+ -------------------------------------------------------------
=============================================================================================================
the calculations was performed with the ATK-SE, the current calculation script is from the tutorial
i am not familiar with the python, can anyone give me some suggestions?

Offline nori

  • QuantumATK Guru
  • ****
  • Posts: 122
  • Reputation: 12
    • View Profile
Re: the current calculation of the python script
« Reply #1 on: November 22, 2009, 10:22 »
Perhaps you can make it by modifying 4th line of "current.py" as follows:
(before)
transmission_spectrum = nlread("/home/zjl/JOB/Si_0_0.nc",TransmissionSpectrum)[1]
(after)
transmission_spectrum = nlread("/home/zjl/JOB/Si_0_0.nc",TransmissionSpectrum)[0]

Please note that list index starts from not 1 but 0 in Python.

Offline muyunfei

  • New QuantumATK user
  • *
  • Posts: 3
  • Reputation: 0
    • View Profile
Re: the current calculation of the python script
« Reply #2 on: November 22, 2009, 13:50 »
thank you , it works! :)
but i have another question, how can i get the informations that each column contain in the "nc" file.
for example: if i want to get the current, i should use the "TransmissionSpectrum[0]" other than "TransmissionSpectrum [1]", but why should i do like this?

thanks!

Moderator edit: Preventing _[0]_ from being interpreted as bb code
« Last Edit: November 22, 2009, 21:53 by Anders Blom »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: the current calculation of the python script
« Reply #3 on: November 22, 2009, 21:52 »
It's not as difficult as it might seem. How you read things using nlread() is completely analogous to how you put them in, using nlsave(). If you want a bit more detailed control of this process, it's recommended to add your own labels and ids to identify a particular data set, as discussed in the manual: http://quantumwise.com/documents/manuals/ATK-2009.11/ReferenceManual/ref.nlsave.html. These can later be used to retrieve the same data set uniquely. What happens when you use VNL to set up the script, is that no custom ids are (currently) used, instead they are autogenerated, as you can see if you select the NC file in VNL (in the main window). So instead of extracting the transmission as your script does, you could do
Code
transmission_spectrum = nlread("/home/zjl/JOB/Si_0_0.nc",object_id=XYZ)
where XYZ is the ID you can get by looking into the NC file in VNL. The more explicit version of the code for the example you used is really
Code
transmission_spectrum = nlread("/home/zjl/JOB/Si_0_0.nc",class_type=TransmissionSpectrum)
This simply means "read alla transmission spectra from the NC file". If there is only one, then naturally you will use transmission_spectrum[0], but if there were several (for different bias, typically) you would also be interested in transmission_spectrum[1], transmission_spectrum[2], etc. Then it can get a bit messy if you don't directly know which bias each one corresponds to, so using ID's both on nlsave() and nlread() might help, but you can actually extract the bias from the transmission spectrum object itself, so it's not strictly necessary.
« Last Edit: November 22, 2009, 21:54 by Anders Blom »

Offline muyunfei

  • New QuantumATK user
  • *
  • Posts: 3
  • Reputation: 0
    • View Profile
Re: the current calculation of the python script
« Reply #4 on: November 23, 2009, 03:15 »
thank you for your reply! i got the key to the problem.