QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: naash on March 29, 2012, 04:11

Title: the script to calculate both -VE and +VE bias for unsymmetrical central region
Post by: naash on March 29, 2012, 04:11
i have been trying to calculate  the above problem using the below script but when i try it only gives me positive bias but no negative how should i set my script to bet the negative bias

#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
    basis_set=basis_set,
    electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
    )

nlsave('liliB-IV.nc', device_configuration)

for bias in numpy.linspace(0.,3.,16)*Volt:
   
    device_configuration.setCalculator(
        calculator(electrode_voltages=(0.5*bias,-0.5*bias)),
        initial_state=device_configuration
    )
    device_configuration.update()

# -------------------------------------------------------------
# Transmission spectrum
# -------------------------------------------------------------
    transmission_spectrum = TransmissionSpectrum(
        configuration=device_configuration,
        energies=numpy.linspace(-3,3,100)*eV,
        kpoints=MonkhorstPackGrid(1,1),
        energy_zero_parameter=AverageFermiLevel,
        infinitesimal=1e-06*eV,
        self_energy_calculator=KrylovSelfEnergy(),
        )
    nlsave('liliB-IV.nc', transmission_spectrum, object_id="transmission %s" % bias)
    nlprint(transmission_spectrum)
Title: Re: the script to calculate both -VE and +VE bias for unsymmetrical central region
Post by: Anders Blom on March 29, 2012, 10:00
Just run the same script but change the line

Code: python
calculator(electrode_voltages=(0.5*bias,-0.5*bias)),

to

Code: python
calculator(electrode_voltages=(-0.5*bias,0.5*bias)),

I note that you don't save the converged calculation anywhere; in case you ever want to recalculate something, like the transmission spectrum with more points, you will be forced to run the self-consistent loop again. I recommend adding a line

Code: python
nlsave('liliB-IV_scf_bias_%g.nc' % bias.inUnitsOf(Volt), device_configuration, object_id="bias %s" % bias)

just after the "update" statement. The new line should be indented on the same level as the update line. Note that we use separate files in this case, as the files grow rather large. If you had done this, you could have avoided re-running the zero-bias calculation for the opposite bias case.