Author Topic: extraction of potential drop between two metal centres calculated in a loop  (Read 2680 times)

0 Members and 1 Guest are viewing this topic.

Offline Mausumi Chattopadhyaya

  • Regular QuantumATK user
  • **
  • Posts: 10
  • Country: in
  • Reputation: 0
    • View Profile
I have calculated the potential difference between two atomic centres and transmission spectrum for different bias using the following script:

# -------------------------------------------------------------
# Transmission spectrum
# -------------------------------------------------------------
def transmission(configuration):
    # Calculate the transmission spectrum and save it in a file
    transmission_spectrum = TransmissionSpectrum(
    configuration=device_configuration,
    energies=numpy.linspace(-3,3,200)*eV,
    kpoints=MonkhorstPackGrid(1,1),
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    self_energy_calculator=KrylovSelfEnergy(),
    )
    nlsave('/home/swapanchem/Desktop/Fe-Fe-complex/fefe-ls-dz/fefe-ls-loop-transmission-iv.nc', transmission_spectrum)

# Read in the converged zero-bias calculation
device_configuration = nlread('/home/swapanchem/Desktop/Fe-Fe-complex/fefe-ls-dz/fefe-ls-loop-iv.nc', DeviceConfiguration)[0]
calculator = device_configuration.calculator()
   
# Calculate and save the transmission spectrum for zero bias
transmission(device_configuration)

# Define the bias voltages for the I-V curve
voltage_list=[0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,-0.1,-0.15,-0.2,-0.25,-0.3,-0.35,-0.4,-0.45,-0.5,]*Volt

# Loop over the bias voltages
for voltage in voltage_list:
    # Set electrode voltages and use the self-consistent state
    # of the previous calculation as starting guess
    device_configuration.setCalculator(
          calculator(electrode_voltages=(voltage, 0.0*Volt)),
          initial_state=device_configuration)

    # Calculate and save the transmission spectrum for each bias
    transmission(device_configuration)

# -------------------------------------------------------------
# Effective potential
# -------------------------------------------------------------
def EfffectivePotential(configuration):
    # Calculate the transmission spectrum and save it in a file
    effective_potential = EffectivePotential(
    configuration=device_configuration,
    )
    nlsave('fefe-ls-loop-pd.nc', effective_potential)

# Read in the converged zero-bias calculation
device_configuration = nlread('fefe-ls-loop-iv.nc', DeviceConfiguration)[0]
calculator = device_configuration.calculator()
   
# Calculate and save the Electrostatic difference potential for zero bias
EfffectivePotential(device_configuration)

# Define the bias voltages for the I-V curve
voltage_list=[0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,-0.1,-0.15,-0.2,-0.25,-0.3,-0.35,-0.4,-0.45,-0.5,]*Volt

# Loop over the bias voltages
for voltage in voltage_list:
    # Set electrode voltages and use the self-consistent state
    # of the previous calculation as starting guess
    device_configuration.setCalculator(
          calculator(electrode_voltages=(voltage, 0.0*Volt)),
          initial_state=device_configuration)

    # Calculate and save the esdp for each bias
    EfffectivePotential(device_configuration)

Now I want to extract the value of potential drop between the two centres at different bias. I know how to calculate the said potential difference at a single bias. For this I uses the following script:

echo "pot = nlread('ti2c66-fm-epot1v-1v.nc', EffectivePotential)[0]
p1 = pot.evaluate(2.07218823*Ang,3.57884614*Ang,13.28806914*Ang)
p2 = pot.evaluate(2.38069829*Ang,3.55537652*Ang,22.30382852*Ang)
print p1
print p2
print (p2-p1)*27.2" > pot-ti2c66-fm-epot1v-1v.py

atkpython pot-ti2c66-fm-epot1v-1v.py > pot-ti2c66-fm-epot1v-1v.out

Now my question is how to extract the value of potential difference from a single netcdf file where it has been calculated for different biases in a loop.  kindly help me to sort out this problem.

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
check:
http://www.quantumwise.com/documents/tutorials/latest/ATKTutorialDevice/index.html/chap.iv.html#sect1.iv.one

# Read the electrostatic difference potentials
potential = nlread('li-h2.nc', ElectrostaticDifferencePotential)

# Calculate the voltage drop
voltage_drop = potential[1]-potential[0]

# Save the voltage drop, properly labeled
nlsave('li-h2.nc', voltage_drop, object_id='voltagedrop')