Author Topic: problem about the command: nlread and nlsave  (Read 4056 times)

0 Members and 1 Guest are viewing this topic.

Offline fangyongxinxi

  • QuantumATK Guru
  • ****
  • Posts: 143
  • Reputation: 0
    • View Profile
problem about the command: nlread and nlsave
« on: December 14, 2010, 16:18 »
Dear Sir,
I have a problem about the command: nlread and nlsave
I hope to set and restore the configurations or physical properties with my own  " object name" , not the object_id.
as the  scipt blow,
I set the "modle" as the 'object_id' in order to represent clearly later.
then, I want to restore this device configuration,
No 1 , as the manual said, is ok, but I don't know why I can't use the 'restore_conf[modle]'.
No 2 is convenient, but do not work, I don't know why.
Thank you.

# part of my script
........
device_configuration = DeviceConfiguration( central_region,[left_electrode, right_electrode])
nlsave('analysis.nc', device_configuration,'modle' )
.........

# now restore the configuration
# No 1 success
restore_conf = nlread ( 'analysis.nc', DeviceConfiguration )
this = restore_conf[0]                      
#  wrong to use 'restore_conf[modle]' why ?              
nlsave('2.nc',this,'lih2li')

# No 2  don't know how to do
restore_conf2 = nlread ( 'analysis.nc', DeviceConfiguration,object_id ='modle' )  
# wrong, how to change the script ?

Offline fangyongxinxi

  • QuantumATK Guru
  • ****
  • Posts: 143
  • Reputation: 0
    • View Profile
Re: problem about the command: nlread and nlsave
« Reply #1 on: December 14, 2010, 16:21 »
by the way, what's the
device_configuration.update()
mean ?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: problem about the command: nlread and nlsave
« Reply #2 on: December 14, 2010, 17:50 »
nlread in 10.8 works differently than "restoreAtomicConfiguration" in 2008.10. It will not return a dictionary, but rather a list, and that's why you cannot refer to it as ['modle'], but rather you must use [ 0 ].

Since the point of using a label is to extract a specific object, you are right to attempt nlread ( 'analysis.nc', DeviceConfiguration,object_id ='modle' ), you just need [ 0 ] again, but this time you can be sure the list only contains one element, that's what the object_id does (if you have no object_id specified, the list may be very long if there are several configuration stored, and you don't know their order.

"update" means "run the self-consistent calculation".