Author Topic: single electron transistor: global name 'numpy' is not defined  (Read 7315 times)

0 Members and 1 Guest are viewing this topic.

Offline Shan

  • QuantumATK Guru
  • ****
  • Posts: 101
  • Country: in
  • Reputation: 0
    • View Profile
+------------------------------------------------------------------------------+
| NanoLanguageScript execution started                                         |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 11.2.2 [Build 3069]                                        |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "c:\users\bhushan\appdata\local\temp\5018310895097881.py", line 13, in <module>
    voltage,energy = readTotalEnergy('benzene_set'+str(q)+'.nc')
  File "C:\Program Files (x86)\QuantumWise\atk-11.2.2\atkpython\lib\site-packages\readTotalEnergy.py", line 16, in readTotalEnergy
    total_energy_list = numpy.array([])
NameError: global name 'numpy' is not defined
NanoLanguageScript execution failure
+------------------------------------------------------------------------------+
| NanoLanguageScript execution finished                                        |
+------------------------------------------------------------------------------+



this is the error we are getting when we executed the total_energy.py file given in benzene SET manual.

please help.

regards,
bhushan

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Add "import numpy" as the first line in the Python file "readTotalEnergy.py", that should solve it.

Offline Shan

  • QuantumATK Guru
  • ****
  • Posts: 101
  • Country: in
  • Reputation: 0
    • View Profile
yes Anders, it worked but
 another error it is showing "global name 'nlread' is not defined".

what to do...


+------------------------------------------------------------------------------+
| NanoLanguageScript execution started                                         |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 11.2.2 [Build 3069]                                        |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "c:\users\bhushan\appdata\local\temp\8952494259925050.py", line 12, in <module>
    voltage,energy = readTotalEnergy('benzene_set'+str(q)+'.nc')
  File "C:\Program Files (x86)\QuantumWise\atk-11.2.2\atkpython\lib\site-packages\readTotalEnergy.py", line 21, in readTotalEnergy
    total_energy=nlread(filename, object_id = id[1])[0]
NameError: global name 'nlread' is not defined
NanoLanguageScript execution failure
+------------------------------------------------------------------------------+
| NanoLanguageScript execution finished                                        |
+------------------------------------------------------------------------------+


Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Sorry, same problem. Insert
Code: python
from NanoLanguage import *
at the top, and all should work.

Offline Shan

  • QuantumATK Guru
  • ****
  • Posts: 101
  • Country: in
  • Reputation: 0
    • View Profile
yes.
it worked thank you Anders.

Offline Gurinderpal Singh

  • Regular QuantumATK user
  • **
  • Posts: 5
  • Country: in
  • Reputation: 0
    • View Profile
Re: single electron transistor: global name 'numpy' is not defined
« Reply #5 on: August 22, 2014, 08:25 »
what to do i got this message after running the script

+------------------------------------------------------------------------------+
| NanoLanguageScript execution started                                         |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 11.2.2 [Build 3069]                                        |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "c:\users\lenovo\appdata\local\temp\5292828328785301.py", line 3, in <module>
    from readTotalEnergy import readTotalEnergy
  File "C:\Program Files (x86)\QuantumWise\atk-11.2.2\atkpython\lib\site-packages\readTotalEnergy.py", line 1
    Import numpy
               ^
SyntaxError: invalid syntax
NanoLanguageScript execution failure
+------------------------------------------------------------------------------+
| NanoLanguageScript execution finished                                        |
+------------------------------------------------------------------------------+

Offline Carsten

  • Regular QuantumATK user
  • **
  • Posts: 11
  • Country: dk
  • Reputation: 1
    • View Profile
Re: single electron transistor: global name 'numpy' is not defined
« Reply #6 on: August 22, 2014, 13:12 »
Quote
  File "C:\Program Files (x86)\QuantumWise\atk-11.2.2\atkpython\lib\site-packages\readTotalEnergy.py", line 1
    Import numpy

Write "import" instead of "Import" (lower case i).

On the other hand, that line should not be necessary if you have the "from NanoLanguage import *" in your script as Ander suggested.