QuantumATK Forum

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

Title: saving calcs with device?
Post by: esp on January 24, 2012, 22:23
It seems that when you set the device calculator object, then save the object, it does not save the calculator .. is this correct? 

example: 

Code
	device_configuration = nlread(outFileName,DeviceConfiguration)[0]
device_configuration.setCalculator(calculator)
device_configuration.update()
nlsave(outFileName, device_configuration, object_id="cfg")

when i open the "cfg" object later and try to run a calc it says i did not set a calculator ... why?

Title: Re: saving calcs with device?
Post by: Nordland on January 24, 2012, 22:52
It works for me - so in order to help you - I might see a little more of your script.
Title: Re: saving calcs with device?
Post by: esp on January 24, 2012, 23:02
oh ok .. actually i got an error saying that saving of LCAO calcs is not supported .. ?  i changed my script but if i see it again i will post it. 

ed
Title: Re: saving calcs with device?
Post by: Anders Blom on January 24, 2012, 23:51
I don't know about the error message you mentioned, that sounds a bit weird. However, disregarding that, the calculator is actually saved with the configuration when you do "update" and then "nlsave". You will however not see it, the calculator is not a separate object, it's attached to the calculator itself. This is the fact which allows you to compute quantities (like transmission spectrum, etc) from the configuration as restored from the NC file without rerunning the self-consistent calculation.

I think we should later make it a bit more obvious that a configuration has a calculator attached to it, but you can see it by dropping the configuration on the Scripter, then it will expand the calculator for you, or rather the parameters defined for the calculator.
Title: Re: saving calcs with device?
Post by: esp on January 24, 2012, 23:57
Ok I see what I was doing, I wanted to save the calc seperately inside the nc file then reopen that .. that must be where i got the error . here is that error ...

There is no support for writing this object <class 'NL.Calculators.LCAOCalculator.DeviceLCAOCalculator.DeviceLCAOCalculator'> to a NetCDF file

i think what you are saying though is that the code i posted previously is correct and should work, to save the calc within the device object .. i will check again .. thank you.