Author Topic: 3 questions about: import initial _state; export data from .nc; debug in python.  (Read 2667 times)

0 Members and 1 Guest are viewing this topic.

Offline fangyongxinxi

  • QuantumATK Guru
  • ****
  • Posts: 143
  • Reputation: 0
    • View Profile
Dear Sir,
Question1:
Import the initial calculation is helpful to calculate efficiently, I am familiar with ATK2008.10, but stange to ATK 2010.8,
I wrote a script, part of it is shown blow, I wonder is it right ?  and what's the use of the " device_configuration.update() " ?
I also have a question on the manual page 109, as the attach shows. First,  v = 0 V, the imported initial_state is just a device_configuration.(just contains the xyz_file, not scf process ). When the 0V calculation is done, but no "nlsave" to store the scf calculation ( I don't know it's right to say like this ), so when v = 0.1, the imported initial_state is the same xyz_file, no scf process. Am I right ? If I am wrong, how to understand the initial_state ?
Question2:
Could you give us some script on how to export the data , especially how to deal with these data. ( for example, how to draw a "v-scan I-V" picture by script. ), just like the previous topics on ATK 2008.10.
Qestion3:
a question about python. How to debug a python script efficiently ? I know how to use " try--except ", but that's not help me too much on how to debug a script. I like the debug in matlab, that's convenient.

Thank you.


#----------------------------------------
# Device Calculator
#----------------------------------------
v=0
calculator = DeviceLCAOCalculator(
        electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
        electrode_voltages=( v*Volt, 0.0*Volt)
       )
device_configuration.setCalculator(calculator) ## time cost , this is the v=0 scf done.
device_configuration.update()
nlsave("analysis-%.1f.nc"  % v, device_configuration)  

opt_configuration = OptimizeGeometry(
        device_configuration,
        maximum_forces=0.05*eV/Ang,
        constraints=[ 0, 1, 2, 3, 4, 5,  8, 9, 10, 11, 12,13],
        trajectory_filename="analysis-%.1f.nc" % v )
nlsave("analysis-%.1f.nc"  % v, opt_configuration)

forces = Forces(device_configuration)
nlsave("analysis-%.1f.nc"  % v, forces)
print  " ### 0 is done ####"


v= 0.2
calculator = DeviceLCAOCalculator(
        electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
        electrode_voltages=( v*Volt, 0.0*Volt)
       )
device_configuration.setCalculator(calculator,
                                   initial_state = device_configuration )   # I set the initial_stat here is right ? and after this scipt ,the v=0.2 scf is stored in device_configration, right?
device_configuration.update()
nlsave("analysis-%.1f.nc"  % v,device_configuration)

opt_configuration = OptimizeGeometry(
        device_configuration,
        maximum_forces=0.05*eV/Ang,
        constraints=[ 0, 1, 2, 3, 4, 5,  8, 9, 10, 11, 12,13],
        trajectory_filename= "analysis-%.1f.nc"  % v )
nlsave("analysis-%.1f.nc"  % v, opt_configuration)

forces = Forces(device_configuration)
nlsave("analysis-%.1f.nc"  % v,forces)
print "########0.2 is done########"

v=0.4....../v=0.6......

« Last Edit: December 1, 2010, 04:10 by fangyongxinxi »

Offline fangyongxinxi

  • QuantumATK Guru
  • ****
  • Posts: 143
  • Reputation: 0
    • View Profile
In my script, I understand it like this:
 first I use
"device_configuration.setCalculator(calculator)"
to get the v=0 scf, and this is stored in device_configuration, which will be used by 0.2V (right ?)
then, I use the stored device_configuration to do the optimization and calculate the force.

v = 0.2 V, we set
" device_configuration.setCalculator(calculator, initial_state = device_configuration )"
to get the v=0 scf with the v=0.2 "calculator", at this same time v=0.2 scf is stored in device_configuration, which will be used by 0.4 V .

so that's the loop. right ?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5421
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Debugging in Python can be done e.g. in Eclipse.

It seems you have indeed understood the voltage loop correctly. Post further questions if there's anything else you wonder about.