Ok, I modifed the ivcurve.py script ever so slightly to add the functionality to initialize the first calculation from an existing checkpoint file. The script is attached.
The only change is a new keyword to
runIVcurve called
initialize_from, which should be an scf object that the first calculation will be initialized from. So, if I have an existing converged zero bias calculation in a file called "zerobias.nc", I would use the NEW ivcurve.py this way:
import ivcurve
voltages=[0.1,0.2,0.3]*Volt
zerobias_scf = restoreSelfConsistentCalculation("zerobias.nc")
ivcurve.runIVcurve (
twoprobe_configuration,
two_probe_method,
runtime_parameters,
voltages,
vnl_filename='myfile.vnl', sample_name='mysample',
current_k_point_sampling = (1,1),
current_number_of_points = 100,
initialize_from = zerobias_scf
)
iv = ivcurve.extractIVcurveFromVNLFile('myfile.vnl','mysample')
ivcurve.plotIVCurve(iv,'iv.png')
Note that this is not a complete script; you should add it to whatever script defines the
two_probe_method and
twoprobe_configuration (just noticed the asymmetry of those variable names! but that's how VNL does it...).
Actually, this version of the script allows for perhaps an even nicer way to take advantage of the VNL generated scripts...!
Instead of the above, where you should remove the
executeSelfConsistentCalculation() statement from the VNL-generated script, we can let VNL set up the zero bias calculation, and use that. So, we would
keep the VNL-generated script intact (don't add any analysis options to it!), and just append these lines to the end:
import ivcurve
voltages=[0.1,0.2,0.3]*Volt
# Insert zero-bias current into VNL file
vnl_filename='myfile.vnl'
sample_name='mysample'
if processIsMaster():
f = VNLFile(vnl_filename)
f.addToSample(0.*Ampere,sample_name,'Current at 0.0 V bias')
ivcurve.runIVcurve (
twoprobe_configuration,
two_probe_method,
runtime_parameters,
voltages,
vnl_filename=vnl_filename, sample_name=sample_name,
current_k_point_sampling = (1,1),
current_number_of_points = 100,
initialize_from = scf
)
iv = ivcurve.extractIVcurveFromVNLFile('myfile.vnl','mysample')
ivcurve.plotIVCurve(iv,'iv.png')
Don't forget to change the filenames, k-points, etc to fit your specific system.
Note the insertion of the zero-bias current into the VNL file, otherwise we don't get a current calculation for zero bias!
There are end-less variations to scripts like this, which is the power of NanoLanguage, although it does require a bit of programming knowledge to take advantage of it.