# run{}¶

Specifications for the program execution (program flow)

Note

There are **two** syntaxes for `run{}`

.

- New syntax
recommended syntax for versions newer than 2020-05-01. We specify new syntax in this documentation.

- Deprecated syntax
used in versions older than 2020-04-30. Nevertheless, it will still work in later versions. Deprecated syntax is specified here.

## structure_only{ }¶

If present, calculation is aborted after structure setup, similarly to when the command line flag `-s`

or `--structure`

is set. But differently from the command line flag, if `last_region`

is present, partical structure initialization is performed. This is useful for debugging your structure definition, e.g. if you have a 2D or 3D simulation with many material regions, contact regions, doping regions and generation regions overlapping each other in a complictated way. The files in the output directory Structure/ will then reflect this partial initialization. (Note that in case not all regions are used here, some initialization and output steps related to strain, poisson, current, quantum, cbr, optics, etc. will be omitted in order to avoid inconsistencies.)

- last_region{ <integer> }

- value
any integer >= 1

- default
1000000

Example:

run{ structure_only{ last_region = 5 } }The simulation prints out the structure up to the (last) region index 5.

## strain{ }¶

It solves the strain equation

## poisson{ }¶

It solves the Poisson equation

## quantum{ }¶

It solves the Schrödinger equation. Exchange–correlation effects (optional) can be included and are calculated from the quantum density. Then the Schrödinger equation is solved again but this time including the exchange-correlation potential energy.

## current_poisson{ }¶

It solves the coupled current and Poisson equations self-consistently.

- fast_poisson

- value

`yes`

or`no`

- default

`no`

If enabled, Newton iterations for Poisson in the middle of the classical current-Poisson iteration will be limited to 1. Note that enabling this setting may also influence stability of convergence or change the optimal value for

`alpha_fermi`

. Typically,`yes`

increases the number of iterations but significantly reduces the overall execution time.- multi_stage_solve

- value

`yes`

or`no`

- default

`no`

Flag in order to solve classical current equation first with recombination/generation switched off in order to get a good starting point, and then with recombination/generation switched on (if any recombination models are switched on). Can be used to improve convergence in some situations but may increase runtime in others.

- system_solve

- value

`yes`

or`no`

- default

`no`

Alternative new iteration method for classical current-Poisson. This Newton method may provide better convergence for some systems (but may require different values of convergence parameters).

`yes`

results in Fermi levels and potential being simultaneously updated as a system of unknowns during the iteration. Irrespective of its value,`system_solve`

always takes the value of`current_repetitions`

into account.- iterations

- value
any integer >= 1

- default
100

Number of iterations for current-Poisson solver

- fermi_limit

- value
any float between 0.0 and 10.0

- default
2.0

Defines how far the quasi-Fermi levels can move above the highest / below the lowest contact. Except in case of huge bandgaps and extreme photogeneration, the defaults should not require any change. At the same time, in the absence of any externally induced photogeneration, these values could be set to zero in order to stabilize the iteration.

- current_repetitions

- value
any integer >= 1

- default
1

Number of current-density iterations. The current equations are repeatedly solved for the quasi-Fermi levels with the densities fixed. The current equation for the electrons and for the holes are solved independently with a common and fixed recombination term. For each iteration, the densities are adjusted according to the new quasi-Fermi levels of the previous iteration.

`current_repetitions`

defines number of these repetitions. If generation/recombination is present, using a value > 1 (e.g. 5) may stabilize the iteration and sometimes enable faster convergence (larger alpha_fermi may also be possible then).- limit_repetitions

- value

`yes`

or`no`

- default

`no`

If enabled, the current-density loop is exited early as soon as

`residual_fermi`

is reached by the quasi-Fermi levels.- residual

- value
any float > 0.0

- default
1e5 cm

^{-2}(1D)1e3 cm

^{-1}(2D)1e-3 [dimensionless] (3D)

Residual occupation changes.

- residual_fermi

- value
any float > 0.0

- default

`1e-5`

#`[eV]`

Residual Fermi level changes. This value is also used during

`quantum_current_poisson{ }`

- alpha_fermi

- value
any float between 1e-5 and 1.0

- default
1.0

Dimensionless underrelaxation parameter for Fermi level. The final quasi-Fermi level for electrons after each iteration is calculated as follows:

\(E_{F,n}\) = ( \(E_{F,n}\) of previous iteration ) * ( 1 -

`alpha_fermi`

) + ( \(E_{F,n}\) of actual iteration ) *`alpha_fermi`

This Fermi level is then input to the next iteration. The same holds for the Fermi level \(E_{F,p}\) for holes. The value of

`alpha_fermi`

will change due to`alpha_scale`

during the iterations. The actually used`alpha_fermi`

is now included in iteration_current_poisson.dat and iteration_quantum_current_poisson_details.dat.- alpha_iterations

- value
any integer >= 1

- default
1000

Number of alpha iterations

- alpha_scale

- value
any float between 0.1 and 1.0

- default
0.998

Alpha scale. Both for classical and for quantum iterations, alpha_fermi will be reduced further as:`alpha_fermi`

<- max(`alpha_fermi`

*`alpha_scale`

, 1e-5)at each iteration step once the number of iterations exceeds alpha_iterations.Use this feature to improve convergence (particularly confergence of Fermi levels) towards the end of the iteration. Note that decreasing

`alpha_fermi`

too fast (a problem with older versions) will result in the iteration stalling (only the residuals of the densities but none of the Fermi levels decrease). The total current equation may then not be properly conserved.- output_log

- value

`yes`

or`no`

- default

`yes`

NOTE:Both conditions specified by`residual`

and`residual_fermi`

must hold in order to consider a calculation as converged.

## quantum_poisson{ }¶

It solves the **Schrödinger-Poisson** equations self-consistently. When `quantum_poisson{}`

is desired, note that additionally either `poisson{}`

or `current_poisson{}`

is required.

- iterations

- value
integer

- default
30

number of iterations, i.e. self-consistency cycles

- residual

- value
any float > 0.0

- default
1e5 cm

^{-2}(1D)1e3 cm

^{-1}(2D)1e-3 [dimensionless] (3D)

residual of the integrated total charge carrier dinsity changes. Note that this is dimension dependent and default is: 1e5/cm

^{2}(1D), 1e3/cm (2D), 1e-3[dimensionless] (3D). This applies to exact Schrödinger equation, not to subspace Schrödinger equation)Note

If you do not include enough eigenstates, the convergence behavior might be affected as the occupation of the eigenstates is not considered in a useful way.

- use_subspace

- value

`yes`

or`no`

- default
yes

solve Schrödinger equation within subspace of eigenvectors of previous iteration as long as achieved residual is larger than desired

`residual * residual_factor`

and at least in every second iteration- subspace_iterations

- value
any integer between 1 and 1000

- subspace_residual_factor

- value
any float >= 2.0

- default
1e12

controls the number of subspace iterations

It holds for use_subspace =

`yes`

:if (residual in densities > residual * subspace_residual_factor) {use only approximate quantum solutions} else {alternate one exact and subspace_iterations approximate quantum solutions}terminate iteration when residual in densities < residual for exact quantum solutionUse

`subspace_iterations`

> 1 to further reduce computational load (i.e. runtime) from exact quantum solutions (the best value is system-dependent). Note that the number of iterations may not change or even increase. In rare cases (e.g. when a huge number of eigenvalues is computed), selecting`use_subspace = no`

may be faster.- alpha_potential

- value
any float between 0.001 and 1

- default
1.0

In case of stubborn convergence problems which do not appear to have any root cause such as not enough eigenvalues and which appear not to respond to any change in other parameters, try using a mildly smaller value than 1.0 such as 0.5.

Using values smaller than 1.0 per default is not recommended, as the run time is expected to increase as 1/

`alpha_potential`

for normally converging input files.- output_log

- value

`yes`

or`no`

- default
yes

Output of convergence of Schrödinger-Poisson equation (residuals for

`quantum_poisson`

) into the logfile iteration_quantum_poisson.dat

## quantum_current_poisson{ }¶

It solves the **Schrödinger-Current-Poisson** equations self-consistently. When `quantum_current_poisson{}`

is desired, note that additionally either `poisson{}`

or `current_poisson{}`

is required and `current_poisson`

must be defined in the input file..

- iterations

- value
integer

- default
30

see

`quantum_poisson{}`

- residual

- default
1e5 (1D) / 1e3 (2D) / 1e-3 (3D)

see

`quantum_poisson{}`

- use_subspace

- value

`yes`

or`no`

- default
yes

see

`quantum_poisson{}`

- subspace_iterations

- value
any integer between 1 and 1000

see

`quantum_poisson{}`

- subspace_residual_factor

- value
any float >= 2.0

- default
1e12

see

`quantum_poisson{}`

- fermi_limit

- value
any float between 0.0 and 10.0

- default
2.0

see

`quantum_poisson{}`

- current_repetitions

- default
2

number of current-density iterations. The current equation is repeatedly solved for the quasi-Fermi levels. For each iteration, the densities are adjusted according to the new quasi-Fermi levels of the previous iteration.

`current_repetitions`

defines number of these repetitions. If generation/recombination is present, using a value > 1 (e.g. 5) may stabilize the iteration and sometimes enable faster convergence (larger`alpha_fermi`

may also be possible then).- limit_repetitions

- value

`yes`

or`no`

- default
yes

If enabled, the current-density loop is exited early as soon as

`residual_fermi`

is reached by the quasi-Fermi levels.- residual_fermi

- value
any float > 0.0

- default
1e-5 [eV]

- alpha_fermi

- value
any float between 1e-5 and 1.0

- default
1.0

The Fermi level is underrelaxed between repetitions using an underrelaxation parameter for the Fermi levels. It should be used once an oscillation of residuals is observed while self-consistently solving the Poisson and Schrödinger (and current) equations to improve convergence. For further information, please read comments on

`alpha_fermi`

parameter above- alpha_iterations

- value
any integer >= 1

- default
1000

number of alpha iterations

- alpha_scale

- value
any float between 0.1 and 1.0

- default
0.998

Both for classical and for quantum iterations,

`alpha_fermi`

will be reduced further as`alpha_fermi <- max( alpha_fermi * alpha_scale , 1e-5)`

at each iteration step once the number of iterations exceeds alpha_iterations. Use this feature to improve convergence (particularly confergence of Fermi levels) towards the end of the iteration. Note that decreasing`alpha_fermi`

too fast (a problem with older versions) will result in the iteration stalling (only the residuals of the densities but none of the Fermi levels decrease). The total current equation may then not be properly conserved.- alpha_potential

- value
any float between 0.001 and 1

- default
1.0

In case of stubborn convergence problems which do not appear to have any root cause such as not enough eigenvalues and which appear not to respond to any change in other parameters, try using a mildly smaller value than 1.0 such as 0.5.

Using values smaller than 1.0 per default is not recommended, as the run time is expected to increase as 1/

`alpha_potential`

for normally converging input files.- output_log

- value

`yes`

or`no`

- default
yes

Output of convergence of (quantum) current-Poisson equation (residuals for

`quantum_current_poisson`

) into the logfile iteration_quantum_current_poisson.dat

Note

Both conditions specified by `residual`

and `residual_fermi`

are only checked between iterations but not between repetitions.

## Examples¶

run{ structure_only{} # If present, calculation is aborted after structure setup. }run{} # just sets up the device geometryrun{ strain{} # solves the strain equation }run{ strain{} # solves the strain equation quantum{} # and then the Schrödinger equation }run{ strain{} # solves the strain equation poisson{} quantum_poisson{} # } # solves the Schrödinger and Poisson equations self-consistentlyrun{ strain{} # solves the strain equation current_poisson{} # solves the coupled current and Poisson equations self-consistently quantum_current_poisson{} # solves the Schrödinger, Poisson and current equations self-consistently }run{ quantum{} # solves the Schrödinger equation optics{} # calculates optical properties }Using the new syntax (

`quantum_poisson{}`

,`quantum_current_poisson{}`

), the classical computations (`poisson{}`

or`current_poisson{}`

) can be specified independent from the quantum calculation to be performed, e.g. it is now possible to combine`poisson{}`

with`quantum_current_poisson{}`

to bypass the classical current calculations.

## Restrictions¶

**Poisson**: Only maximally one of`poisson{}`

and`current_poisson{}`

can be defined, which defines the classical equation to be solved (also as first stage before possibly solving any quantum mechanics). If neither is set, only fixed potentials will be used.**Quantum**: If quantum mechanics is desired, one of`quantum{}`

,`quantum_density{}`

,`quantum_poisson{}`

, and`quantum_current_poisson{}`

must be set.The quantum equations to be solved - only quantum, quantum with self-consistent density/exchange, self-consistent quantum-Poisson, and self-consistent quantum-current-Poisson - are only defined by the choice of

`quantum{}`

,`quantum_density{}`

,`quantum_poisson{}`

, and`quantum_current_poisson{}`

, irrespective of the choice of the classical solution method. Note that one of`poisson{}`

and`current_poisson{}`

must be set when`quantum_poisson{}`

or`quantum_current_poisson{}`

is desired. Use`poisson{}`

in conjunction with`quantum_current_poisson{}`

to skip classical current calculations.Quantum with self-consistent density/exchange is solved by selection of

`quantum_density{}`

(users can change parameters in there as needed).

## Further remarks¶

2019-01-24: At the end of

`current_poisson{}`

, Poisson is now solved once to make the band structure consistent with the Fermi levels. In case of incomplete convergence, the partly converged output is then more in line with physical intuition.Input residuals and tolerances are rescaled to various internal units (often in a dimension-dependent manner, i.e. they are different for 1D, 2D and 3D simulations) before being passed to low-level numerical routines like ARPACK, LAPACK, BLAS, nonlinear solvers, etc. Therefore, diagnostic output from low-level numerical solvers usually contains values which are completely different from those which are output by the high-level physics routines or output into files.

- There are logfiles that track the converence behavior of the iterations during the simulation.
The convergence information for the respective self-consistent equations can be plotted. It is best to use a logarithmic scale.

iteration_current_poisson.dat

`current_poisson{}`

Convergence of coupled Current-Poisson with classical densitiesiteration_quantum_density.dat

`quantum_density{}`

Convergence of Schrödinger equation with self-consistent density/exchangeiteration_quantum_poisson.dat

`quantum_poisson{}`

Convergence of outer iteration loop for Schrödinger-Poissoniteration_quantum_current_poisson.dat

`quantum_current_poisson{}`

Convergence of outer iteration loop, i.e. for Current-Poisson-Schrödinger with quantumiteration_quantum_current_poisson_details.dat

`quantum_current_poisson{}`

Convergence of current equation, i.e. for Current-Poisson with quantum densities