Author Topic: save time by saving device cfg after density calc?  (Read 4885 times)

0 Members and 1 Guest are viewing this topic.

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
save time by saving device cfg after density calc?
« on: October 16, 2012, 05:55 »
i wanted to save the device cfg after the initial density calculation, but every time i load it it tells me there is no initial information there, and it has to start over ..

here is where i am saving after this part:

   calculator = my_DeviceHuckelCalculator(oList)
   device_configuration.setCalculator(calculator, initial_state=device_configuration)
   device_configuration.update()
   nlsave(<filename>, device_configuration, object_id="cfg")

then next time when i run i use:

device_configuration = nlread(<filename>, object_id="cfg")[0]

but it always then tells me there is nothing there ... the file is 300MB after i save the cfg above .. how do i accomplish what i am trying to do?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: save time by saving device cfg after density calc?
« Reply #1 on: October 16, 2012, 08:15 »
This looks like part of a loop, but it's too sketchy to really understand what the problem might be. You mean it says there is no initial state so it starts over from electrodes? Pls send entire script(s)

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: save time by saving device cfg after density calc?
« Reply #2 on: October 17, 2012, 21:19 »
Ok, well the question is general ... basically I want to know if I can save the initial calculation somehow to save time later, for example, if i want to run the same cfg with a different bias, or maybe a different gate voltage .... here is what i was trying to do: Somewhere in the start of my doTransmissionCalc function, I do:
Code
#read in the old configuration
device_configuration = nlread(<filename>, object_id="cfg")[0]
metallic_region0 = device_configuration.metallicRegions()[0]
metallic_region1 = None
if oList["doubleGate"]:
  metallic_region1 = device_configuration.metallicRegions()[1]
calculator = my_DeviceHuckelCalculator(oList)
device_configuration.setCalculator(calculator, initial_state=device_configuration)
device_configuration.update()
nlsave(<filename>, device_configuration, object_id="cfg")
So the basic question is, by saving the configuration after the update() line, does that speed things up next time because of the initial_state parameter? I suppose the answer is no, because when i run again, it always says there is no initial state saved ... but i don't understand why ... how do i save the initial state?
« Last Edit: October 17, 2012, 21:21 by esp »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: save time by saving device cfg after density calc?
« Reply #3 on: October 17, 2012, 22:47 »
The scheme should work, but I think you may be mixing up variable names, you have device_configuration both for the new config and the old one. It's very hard to judge from pseudocode however.

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: save time by saving device cfg after density calc?
« Reply #4 on: October 17, 2012, 23:00 »
it is not pseudo code that is actual code ... also i am not sure what you mean by the mixing of variables .. i dont see any issue there ?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: save time by saving device cfg after density calc?
« Reply #5 on: October 17, 2012, 23:10 »
It's pseudocode because the syntax <filename> is not allowed in Python :) But - are you sure the object_id "cfg" has the calculation, and not just the geometry? And even if it does have a calculator, as soon as you set a new calculator on the device_configuration, you erase the old state. You need something like (real pseudocode ;) ):
Code: python
old_calculation = nlread(<filename>, object_id="cfg")[0]
device_configuration = nlread(<filename>, object_id="cfg", read_state = False)[0]
...
device_configuration.setCalculator(calculator, initial_state=old_calculation)
device_configuration.update()
nlsave - with another object_id!

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: save time by saving device cfg after density calc?
« Reply #6 on: October 18, 2012, 00:59 »
yes my filename is made of many variables and did not add to the discussion so i just removed it in favor of a simpler general comment there ..

thank you for the code, i will try ..

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: save time by saving device cfg after density calc?
« Reply #7 on: October 19, 2012, 00:18 »
I tried what you said, I always get this:

################################################################################
# Warning:                                                                     #
#   The provided initial state parameter has no pre-calculated data.           #
#   Proceeding without setting an initial state.                               #
################################################################################