QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Shan on July 12, 2012, 10:10

Title: single electron transistor: global name 'numpy' is not defined
Post by: Shan on July 12, 2012, 10:10
+------------------------------------------------------------------------------+
| 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
Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Anders Blom on July 12, 2012, 11:58
Add "import numpy" as the first line in the Python file "readTotalEnergy.py", that should solve it.
Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Shan on July 12, 2012, 12:17
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                                        |
+------------------------------------------------------------------------------+

Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Anders Blom on July 12, 2012, 12:55
Sorry, same problem. Insert

Code: python
from NanoLanguage import *

at the top, and all should work.
Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Shan on July 12, 2012, 13:09
yes.
it worked thank you Anders.
Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Gurinderpal Singh 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                                        |
+------------------------------------------------------------------------------+
Title: Re: single electron transistor: global name 'numpy' is not defined
Post by: Carsten 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.