Reusing electrodes in device calculations

A typical study of electronic devices with QuantumATK involves systematically studying the influence of various modifications of the device region. The variation can be atomic positions or types of dopants/vacancies in a semiconductor wire, or a different molecule attached to a nanotube, etc. In any case, the electrodes often remain unchanged. One can therefore calculate the electronic structure of the electrodes only once, and then reuse them in other calculations to save computational time.

In this tutorial you will therefore learn how to reuse the devices electrodes for different calculations, thus saving time by only having to calculate the converged state of the electrodes once.


An QuantumATK device calculation is usually a two-step process: First the self-consistent states of the electrodes are calculated, and then the actual device calculation is done. Any post-SCF analysis and other operations are done after those two steps.

Reusing the initial electrode calculations is done like this: Starting out from a Python script designed for a normal device calculation as outlined just above, you split that calculation into two scripts: One script that calculates and saves the self-consistent state of the electrodes, and another script that reuses those electrodes and starts directly on the device calculation.


Calculator settings
It is important that the parameters used for the electrode calculators are the same as those that will be used in the final device calculation, or at least very similar. Otherwise the electrode Fermi level alignment vs. the device average Fermi level may change, which can cause problems for SCF convergence.

Therefore, first make a decision on the numerical accuracy parameters, such as exchange–correlation functional, temperature, mesh cut-off, basis set, etc., and then stick to these for the whole sequence of calculations.

Moreover, it is absolutely necessary that the electrode and device k-point sampling match each other in the A and B directions! You can not use 3 k-points along A in the device but 7 k-points along A in the electrodes.

Separate scripts for electrodes and device

A bit of scripting is required, but mostly copying/pasting existing lines of Python code:

  1. Start by setting up the full device calculation as you would normally with some representative central region. Use the Script Generator script_generator_icon for this task, and make some good chices for the numerical accuracy parameters to be used.

  2. Save two copies of the script: and

  3. Open in the Editor editor_icon and scroll down to where the device_configuration is defined. It usually looks like illustrated below. Remove those lines.

    device_configuration = DeviceConfiguration(
        [left_electrode, right_electrode]


    The script is only used to compute the electrodes. You may want to remove the definition of the central region altogether to keep things tidy, but it’s not strictly necessary.

  4. Now scroll down towards the end of the script, and remove everything that has to do with the device calculator. That is, remove all lines from the following comment lines to the end of the script:

    # Device Calculator
  5. Add instead the following lines at the end of the script, and save the script as

    nlsave('', left_electrode)
    nlsave('', right_electrode)


    In the case of identical electrodes, delete the three lines involving the “right_electrode”, and remove the “left” prefix from all the remaining variables:

    nlsave('', electrode)
  6. Run the electrode script, e.g. Job Manager job_manager_icon.

  7. Now start modifying the script Starting from the top, remove all the lines involving the left and right electrode configurations, i.e. delete all lines until (but not including)

    # -------------------------------------------------------------
    # Central region
    # -------------------------------------------------------------
  8. Instead, add the following lines at the top of the script, which will read the saved electrodes from file:

    left_electrode = nlread("")[0]
    right_electrode = nlread("")[0]


    In the case of identical electrodes, if only a single electrode calculation was executed and saved, in e.g., use this file for loading both electrodes.

  9. It is recommended, but not strictly necessary, to also remove the definition of the electrode calculators, including the lines in the device calculator:

        [left_electrode_calculator, right_electrode_calculator],

That’s it! You have successfully separated the electrode and device calculation into two scripts. When the electrode calculation is done, you can run, and see that it completely bypasses the electrode calculation.


What’s next?
For each new central region geometry to be computed with these electrodes, just replace the definition of the central_region in, and run the device calculation. Make sure to check the device parameters such as bias voltage, etc.

Alternatively, you can apply steps 7–9 above to any complete device calculation script, keeping the points about the numerical accuracy parameters in mind.