QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: esp on January 16, 2012, 22:22

Title: null calculator
Post by: esp on January 16, 2012, 22:22
I am getting an error after reading in a file ...

File "C:\Users\patakye\Documents\EP_EDU\GradSchool\UMN\KiaResearch\QuantumSimulations\ATK\ATKSIMS\gnr_12_0_AGNR_z10.py", line 672, in doCalcs2
    calculator(electrode_voltages=(-0.1*Volt,0.1*Volt)),
TypeError: 'NoneType' object is not callable

My setup is like this ... I create the device in one function and save it as:

Code
	#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceHuckelCalculator(
basis_set=basis_set,
electrode_voltages=(-0.1*Volt,0.1*Volt),
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
)

device_configuration.setCalculator(calculator)
nlprint(device_configuration)
device_configuration.update()
nlsave(outFileName, device_configuration)

then in another function:

Code
	#read in the old configuration
device_configuration = nlread(outFileName,DeviceConfiguration)[0]
calculator = device_configuration.calculator()

This is where I get an error that the calculator object is null ... am i doing this incorrectly?
Title: Re: null calculator
Post by: esp on January 16, 2012, 22:35
I think I figured this one out .. i saved multiple times and there were multiple device configurations in the file .. i used the object_id when saving and reading, and it works now. 
Title: Re: null calculator
Post by: Nordland on January 16, 2012, 22:41
You bet me to it.

When I had enter my answer it said newer post since last edit.

Good you found out.