QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Shan on July 3, 2013, 13:23

Title: single electron transistor --- Error in Induced potential code
Post by: Shan on July 3, 2013, 13:23
Dear experts while i am trying to extract the induced potential after executing the Gatescan files, i am getting below error.
Hope u can help ...thank u in advance.

The below is the error,

Traceback (most recent call last):
  File "c:\users\user\appdata\local\temp\9465999441891664.py", line 10, in <module>
    induced_potential = potential1-potential0
  File ".\zipdir\NL\Analysis\GridValues.py", line 162, in __sub__
AttributeError: 'TotalEnergy' object has no attribute 'unit'
NanoLanguageScript execution failure



CODE used is:\

#filename of the data file
filename = 'benzene_set0.nc'
# read electro-static potential with gate potential 0 Volt
potential0 = nlread(filename, object_id = 'gID001')[0]
#read electro-static potential with gate potential 2 Volt
potential1 = nlread(filename, object_id = 'pot2.0 V')[0]
#calculate the induced potential and save it to a file
induced_potential = potential1-potential0
nlsave('InducedPotential_2V.nc',induced_potential)
Title: Re: single electron transistor --- Error in Induced potential code
Post by: Anders Blom on July 3, 2013, 22:42
Check the object IDs. You are supposed to subtract to potentials from each other, but object "gID001" in benzene_set0.nc appears to be a TotalEnergy object instead. Check in the Result Browser in VNL what the object ID of the first potential is, probably it's gID002 instead, perhaps you inserted the analysis options in the reverse order simply in the Script Generator.