There are two different kind of gain/absorption calculations which is given by nextnano.NEGF:
From the Green's functions calculated in steady-state, the populations are extracted in the Wannier-Stark basis. The linewidths are also calculated in this basis. The semiclassical gain/absorption spectrum is then calculated according to:
$$ g(\hbar \omega) = \sum_{i \neq j} (\rho_j - \rho_i) ~ d_{ij}^2 ~ \frac{\Gamma_{ij}}{(\hbar\omega-E_{ij})^2+\Gamma_{ij}^2/4} \frac{e^2 ~ E_{ij}} {\hbar ~ \epsilon_0 \sqrt{\epsilon_r} ~ c} $$
where
This semiclassical gain calculation has the following limitations:
For the above reasons, the quantum treatment described below using perturbation theory is much more accurate.
In this case the perturbation due to an a.c. electric field along $z$ is considered. The perturbating Hamiltonian reads in the Lorenz Gauge: $$ H_{ac} = e ~ z ~ \delta F ~ e^{-i\omega t} $$ where the amplitude $\delta F$ of the electric field is small and can be considered as a perturbation. The response Green's function $\delta G^<(E,\omega)$ is calculated within linear response theory. As shown by Wacker (Phys. Rev. B 66, 085336 (2002)), the Green's function linear response reads: $$ \delta G^R(E,\omega) = G^R(E+\hbar\omega) (H_{ac}+\delta\Sigma^R(E,\omega))G^R(E) $$
$$ \delta G^<(E,\omega) = G^R(E+\hbar\omega) H_{ac} G^<(E) \\ + G^<(E+\hbar\omega) H_{ac} G^A(E) \\ + G^R(E+\hbar\omega) \delta\Sigma^R(E,\omega) G^<(E) \\ + G^R(E+\hbar\omega) \delta\Sigma^<(E,\omega) G^A(E) \\ + G^<(E+\hbar\omega) \delta\Sigma^A(E,\omega) G^A(E) $$
In the self-consistent gain calculation, the 3 last terms are accounted. Indeed, to account for them, the self-energies $\delta\Sigma (E,\omega)$ need to be calculated from $\delta G^<(E,\omega)$, requiring a self-consistent loop. This self-consistent Gain calculation is activated by the command
<Gain> <GainMethod>1</GainMethod> ... </Gain>
in the input file. On the other hand, in the case of this command option 0 (not recommended in general though much faster), the 3 terms involving self-energies are neglected.
From this Green's function response, the a.c. conductivity is calculated: $$ \sigma(\omega) = \frac{\delta j(\omega)}{\delta F} $$ where the current a.c. response reads $$ \delta j(\omega) = Tr(\delta G^< J) $$
where $J$ is the current operator.
By default the self-consistent gain calculation is not performed at the boundaries between periods. Indeed, while the perturbating term $H_{ac}$ in the Lorenz gauge is in principle not periodic, it is considered as periodic in the default case to speed up the simulation.
Hence, for periodic quantum cascade structures, it should be avoided that the boundary between periods is chosen at a place where an optical transition takes place in the energy range of interest. This can be easily checked in the position-resolved gain.
However, in the case of short period QCLs, this cannot be done. To restore the correct periodic boundary condition for the gain calculation, the following command should be used.
<Gain> <GainMethod>1</GainMethod> ... <Self_consistent_boundary>yes</Self_consistent_boundary> </Gain>
The bulk relative permittivity, or dielectric constant, is assumed to be given by the Lyddane–Sachs–Teller relation:
$$ \epsilon^{\text{bulk}}_{\text{r}}(\omega) = \epsilon_{\infty} + (\epsilon_{\text{static}}-\epsilon_{\infty}) \frac{\omega_{\text{TO}}}{\omega^2_{\text{TO}}-\omega^2 + i \omega \gamma_{\text{TO}}}$$
where $\gamma_{\text{TO}}$ is the intrinsic linewidth of transverse optical phonon due to damping into other phonons by anharmonicity of the crystal. It can be set in the input file using
<Scattering> … <PhononDamping Unit="meV">2.0</PhononDamping> </Scattering>
In the self-consistent gain calculation, the quantity which is actually calculated is the a.c. conductivity $\sigma(\omega)$.
The complex relative permittivity which is output is then:
$$ \epsilon_{\text{r}}(\omega) = \epsilon^{\text{bulk}}_{\text{r}}(\omega) - i \frac{\sigma(\omega)}{\omega \epsilon_0} $$
Finally the gain reads
$$ g(\omega) = -\frac{\text{Re}(\sigma(\omega))}{\epsilon_{\text{r}}(\omega)} $$