qtcad.device.schrodinger_poisson module

Self-consistent Schrodinger-Poisson solver.

class Solver(d, subdevice=None, solver_params=None)

Bases: Solver

Self-consistent solver for the Poisson and Schrodinger equation. All units are SI.

Attributes:
  • d (device object) – The device to simulate

  • d_schrod (device object) – The subdevice used by the Schrodinger solver.

  • mixer (mixer object) – Object used to store mixing parameters (linear or broyden), if mixing is used.

  • iter (int) – Number of iterations of the self-consistent loop performed.

  • diff (2D array) – Difference between input and output electron densities in the quantum-confined region

  • psolver (solver object) – The Poisson solver.

  • ssolver (solver object) – The Schrodinger solver

  • nprecorr (2D array or None) – Predictor-corrector expression of the electron density at each global node. If None, exchange- correlation term is ignored. Initialized as None and updated after every predictor-corrector iteration.

  • population_factors (1D array) – Weight of each energy level in the calculation of the electron density.

  • maxiter (int) – Maximum number of iterations in the self-consistent Schrodinger-Poisson loop.

  • tol (float) – Tolerance on the electric potential for the self- consistency criterion.

  • errortype (str) – Type of error to use in the convergence criterion. Relative (‘rel’, ‘relative’) or absolute (‘abs’,’absolute’).

  • output_interval (int) – Number of iterations between outputs.

  • sc_method (str) – Method used for self-consistent solution: under-relaxation (‘underrelax’) or predictor-corrector (‘p-c’).

  • initialization (bool) – Initialize by solving the semiclassical problem (True) or not (False).

  • verbose (bool) – Verbosity level.

  • xc (bool) – Option to specify whether to include the exchange- correlation potential (True) or not (False).

  • use_submesh (bool) – If True, use separate meshes for Schrodinger and Poisson solvers.

  • poisson_solver_params (SolverPrams object) – SolverParams for the Poisson solver in the self-consistent Schrodinger-Poisson loop.

  • schrod_solver_params (SolverPrams object) – SolverParams for the Schrodinger solver in the self-consistent Schrodinger-Poisson loop.

Note

If errortype is ‘rel’, the convergence criterion is

2*||nq_out - nq_in||_2 /||nq_out + nq_in||_2 < tol

If errortype is ‘abs’, the convergence criterion is

max(abs(nq_out - nq_in)) < tol

__init__(d, subdevice=None, solver_params=None)

Initialize from device object d.

Parameters:
  • d (device object) – The device from which to initialize the solver.

  • subdevice (device object) – A subset of the device to use for the Schrodinger solver. If None, use the full device for both Poisson and Schrodinger.

  • solver_params (SolverParams object, optional) – Parameters of the self-consistent solver.

load(filename)

Load the potential, charge densities, energies, eigenfunctions, and population factors from an HDF5 file.

This function reads the phi, rho, rho_prime, eigenfunctions, energies, n, nq, p, pq, Nplus, Nminus, gqc, and population_factors datasets from the specified file and sets them as attributes of the device passed to the solver (self.d). The HDF5 file must contain datasets with these exact names.

Parameters:

filename (str) – Path to the HDF5 file containing the data.

save(filename)

Save the potential, charge densities, energies, eigenfunctions, and population factors to an HDF5 file.

This function writes the device attributes phi, rho, rho_prime, eigenfunctions, energies, n, nq, p, pq, Nplus, Nminus, gqc, and population_factors to the specified HDF5 file. The datasets are created with these exact names for compatibility with the corresponding load function.

Parameters:

filename (str) – Path to the HDF5 file where the data will be saved.

solve(N: int = None, T: float = None)

Iterates the self-consistent solver until a specified convergence criterion is achieved for the electron or hole density (currently, only electrons are considered).

Parameters:
  • N (int or None) – Number of particles that will populate the confined eigenstates of the system. The energy levels of the system are occupied according to the Fermi-Dirac distribution. If N is an int, the Fermi energy is chosen such that the total number of charges is N. If N is None, the Fermi energy extracted from the device (self.d) attribute EF.

  • T (float) – Temperature in Kelvin to use in the Fermi-Dirac distribution for the confined electrons when the number of electrons is fixed, i.e. when N is an integer. If None, the temperature extracted from the device (self.d) attribute T is used. If 0 K, the energy levels are filled by N electrons in increasing order starting from the lowest energy level. Default is None.

class SolverParams(inp_dict=None)

Bases: SolverParams

Parameters to pass to a Schrödinger-Poisson solver.

Attributes:
  • tol (float) – Tolerance to use for the electric potential in the self-consistent Schrödinger-Poisson iterations, in volts. Default: 1e-5.

  • maxiter (int) – Maximum number of iterations in a self-consistent Schrödinger-Poisson loop. Default: 100.

  • errortype (str) – Type of error to use in a convergence criterion. Relative (‘rel’ or ‘relative’) or absolute (‘abs’ or ‘absolute’). Default: ‘abs’.

  • output_interval (int) – Number of iterations between outputs in a self-consistent loop. Default: 1.

  • verbose (bool) – Verbosity level. Default: True.

  • sc_method (str) – Method used for Schrodinger-Poisson solution: under-relaxation (‘underrelax’) or predictor-corrector (‘p-c’). Default: ‘p-c’.

  • initialization (bool) – Initialize by solving the semiclassical problem (True) or not (False). Default: True.

  • xc (bool) – Option to specify whether to include the exchange- correlation potential in the total confinement potential (True) or not (False). Default: False.

  • tuning_param (float) – Tuning parameter to use in the predictor-corrector method. Default: 0.

  • mixing_algo (str) – Mixing algorithm to use. Supported values are “linear”, “broyden”, and “adaptive_linear”. If “adaptive_linear” is used, the mixing is linear, however, the mixing parameter is automatically adjusted during the self-consistent iterations based on the convergence trend. Default: “linear”.

  • mixing_param (float) – Parameter beta (sometimes called alpha) used by the mixer. Must be between 0 and 1. Default: 1.

  • mixing_maxit (int) – Number of iterations to keep in memory in Broyden mixing. Default: 20.

  • guess (2d array or None) – Initial guess to use in first Schrödinger iteration. If None, use default guess (random). Otherwise, must be the wave functions, with global node index first, and state index second. Default: None.

  • bound_state_charges_only (bool) – If True, solves the Poisson equation using only the bound states to compute the charge density. If False, use all states (bound and continuum). If True, sc_method should be set to ‘underrelax’ since the predictor-corrector method will not offer any benefits. Default: False.

  • poisson_solver_params (SolverPrams object) – SolverParams for the Poisson solver in the self-consistent Schrodinger-Poisson loop.

  • schrod_solver_params (SolverPrams object) – SolverParams for the Schrodinger solver in the self-consistent Schrodinger-Poisson loop.

__init__(inp_dict=None)

Instantiate the SolverParams object.

Parameters:

inp_dict (dict, optional) – Dictionary specifying certain solver parameters to be used instead of their default values.