qtcad.device.operators module
Compute matrix elements of operators
- class qtcad.device.operators.Gate(d, gate, V, phys_d=None, NL=True, params=None, base_bias=None)
Bases:
Gate
Computes the operator associated with a change in voltage applied to a gate.
- Attributes:
subdevice (boolean) – Whether or not the device over which the operator is defined is a subdevice of the physical device (stored in the
phys_d
attribute). If it is not, the device over which the operator is defined must be identical to the physical device.phys_d (device object) – Physical device describing the full system over which the (Poisson) boundary conditions are enforced.
solver (PoissonSolver) – Poisson solver to be used in the calculation of U_matrix. It will either be a linear or a non-linear Poisson solver.
params (SolverParams) – Solver parameters to pass to the Poisson solver.
Note
Because the
Gate
class is a subclass of theHamiltonianOperator
class it has the attributes and methods of theHamiltonianOperator
class in addition to the ones listed here.- __init__(d, gate, V, phys_d=None, NL=True, params=None, base_bias=None)
Constructor for the Gate operator
- Parameters:
d (Device object) – Device for which the eigenfunctions and energies attributes have been computed (via e.g. the Schrodinger solver)
gate (string or list of strings) – Label or list of labels for the gate or gates for which we wish to modify the voltage.
V (float or numpy array) – This input must be consistent with the gate input. If gate is a string, V should be a float and represent the voltage applied to the gate. If gate is a list of strings then V must be a 1D array where each entry is the voltage applied to the corresponding gate.
subdevice (SubDevice object) – Subdevice of the device d which contains the eigenfunctions and energies.
phys_d (Device object or None) – Physical device over which the physical gates are defined. If None, assume that the physical device is the same as d.
NL (boolean) – Whether or not to use the non-linear Poisson solver when solving for the operator. If False, the linear Poisson solver is used.
params (SolverParams object) – Solver parameters of the solver.
base_bias (float or numpy array) – Base bias configuration. Voltages applied to the gate(s) before modulations are induced. This input must be consistent with the gate input. If None, the base configuration is assumed to be the one stored in the device.
Note
The d input can be any object that contains eigenfunctions, energies, and mesh parameters. These include Device objects, but also other operators.
- get_operator_matrix()
Compute the matrix representation of an operator (quantity defined over global nodes of the mesh).
- Returns:
(2D array) – Matrix represention of the operator in the subspace defined by self.eigenfunctions.
- get_operator_matrix_element(bra, ket)
Compute a single matrix element of an operator (quantity defined over global nodes of the mesh).
- Parameters:
bra (int) – Row index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
ket (int) – Column index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
- Returns:
(complex) – Matrix element of the matrix representation of the operator.
- solve()
Computes the new eigenstates of the system by diagonalizing \(H_0 + U\). \(H_0\) is a diagonal matrix with
energies
on its diagonal.
- class qtcad.device.operators.HamiltonianOperator(d, U)
Bases:
HamiltonianOperator
Operator that has units of energy. Can be thought of as additional piece to the full Hamiltonian, \(H = H_0 + U\), which can be diagonalized using nearly-degenerate perturbation theory. The unperturbed Hamiltonian, \(H_0\), is constructed by placing the energies of the input device on the diagonal of a matrix. The perturbation, \(U\), is constructed by taking matrix elements of the operator.
- Attributes:
eigenfunctions (numpy array) – Eigenfunctions of the system. If the solve method has not been called, this attribute stores the eigenfunctions of the unperturbed system. If the solve method has been called, this attribute stores the the eigenfunctions of the system including the perturbation. In the latter case, the eigenbasis of the system prior to performing the perturbation-theory calculation are stored in
eigenfunctions_old
. The first index runs over the different eigenstates, the second runs over the positions (same order as in self.mesh.glob_nodes), and the third (if it exists) runs over the spin/bands.energies (numpy array) – Eigenenergies of the system. If the solve method has not been called, this attribute stores the eigenenergies of the unperturbed system. If the solve method has been called, this attribute stores the the eigenenergies of the system including the perturbation. In the latter case, the eigenenergies of the system prior to performing the perturbation-theory calculation are stored in
energies_old
.states (numpy array) – 2D array. Columns correspond to the eigenvectors of perturbed system, i.e. \(H_0 + U\) in the subspace spanned by
eigenfunctions_old
. (\(H_0\) is the matrix withenergies_old
on its diagonal).eigenfunctions_old (numpy array) – The eigenbasis of the system prior to diagonalizing \(H_0 + U\). The first index runs over the different eigenstates, the second runs over the positions (same order as in self.mesh.glob_nodes), and the third (if it exists) runs over the spin.
energies_old (numpy array) – The eigenenergies of the system prior to to diagonalizing \(H_0 + U\).
Note
Because the
HamiltonianOperator
class is a subclass of theOperator
class it has the attributes and methods of theOperator
class in addition to the ones listed here.- __init__(d, U)
Constructor for the HamiltonianOperator class
- Parameters:
d (Device object) – Any object that possesses mesh, energies, and eigenfunctions attributes (where the eigenfunctions are defined over the mesh). Typically, this will be device object for which the eigenfunctions and energies attributes have been computed (via e.g. the Schrodinger solver).
U (function or numpy array) – The Hamiltonian operator defined over all global nodes. If it is a function, it should have 3 inputs, namely the x, y, and z coordinates, and it should output either a scalar (in the case of a single band calculation) or a numpy array (in the case of a multiband calculation). If it is a numpy array, it should have one dimension that runs over the global nodes for a single-band calculation and should be a 3D array where the first index runs over the global nodes and the next 2 indices run over the bands in the case of a multiband calculation.
Note
The d input can be any object that contains eigenfunctions, energies, and mesh attributes. These include Device objects, but also other operators.
- get_operator_matrix()
Compute the matrix representation of an operator (quantity defined over global nodes of the mesh).
- Returns:
(2D array) – Matrix represention of the operator in the subspace defined by self.eigenfunctions.
- get_operator_matrix_element(bra, ket)
Compute a single matrix element of an operator (quantity defined over global nodes of the mesh).
- Parameters:
bra (int) – Row index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
ket (int) – Column index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
- Returns:
(complex) – Matrix element of the matrix representation of the operator.
- solve()
Computes the new eigenstates of the system by diagonalizing \(H_0 + U\). \(H_0\) is a diagonal matrix with
energies
on its diagonal.
- class qtcad.device.operators.Operator(d, U)
Bases:
Operator
Class that allows users to compute the matrix operator form of operators in the eigenbasis of a device.
- Attributes:
eigenfunctions (numpy array) – Eigenfunctions of the system.
energies (numpy array) – Eigenenergies of the system.
mesh (Mesh object) – Mesh over which the eigenfunctions are defined.
local (boolean) – Whether or not integrals should be computed over local nodes. If not, they are computed over global nodes.
multiband (boolean) – Whether or not the eigenfunctions have a band index.
U (numpy array) – Operator defined over the mesh.
U_matrix (2D numpy array) – Operator matrix in the basis of self.eigenfunctions.
- __init__(d, U)
Constructor for the Operator class
- Parameters:
d (Device object) – Any object that possesses mesh, energies, and eigenfunctions attributes (where the eigenfunctions are defined over the mesh). Typically, this will be device object for which the eigenfunctions and energies attributes have been computed (via e.g. the Schrodinger solver).
U (function or numpy array) – The operator defined over all global nodes. If it is a function, it should have 3 inputs, namely the x, y, and z coordinates, and it should output either a scalar (in the case of a single band calculation) or a numpy array (in the case of a multiband calculation). If it is a numpy array, it should have one dimension that runs over the global nodes for a single-band calculation and should be a 3D array where the first index runs over the global nodes and the next 2 indices run over the bands in the case of a multiband calculation.
Note
The d input can be any object that contains eigenfunctions, energies, and mesh attributes. These include Device objects, but also other operator objects.
- get_operator_matrix()
Compute the matrix representation of an operator (quantity defined over global nodes of the mesh).
- Returns:
(2D array) – Matrix represention of the operator in the subspace defined by self.eigenfunctions.
- get_operator_matrix_element(bra, ket)
Compute a single matrix element of an operator (quantity defined over global nodes of the mesh).
- Parameters:
bra (int) – Row index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
ket (int) – Column index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
- Returns:
(complex) – Matrix element of the matrix representation of the operator.
- class qtcad.device.operators.Zeeman(d, B, g=None)
Bases:
Zeeman
Compute matrix elements of the Zeeman operator.
- Attributes:
B (numpy array) – Magnetic field defined over all global nodes (if self.local = False) or local nodes (if self.local = True).
g (numpy array) – g-tensor defined over all global nodes (if self.local = False) or local nodes (if self.local = True). Only initialized for electron calculations.
kappa (numpy array) – kappa hole Zeeman parameter defined over all global nodes (if self.local = False) or local nodes (if self.local = True). Only initialized for hole calculations.
q (numpy array) – q hole Zeeman parameter defined over all global nodes (if self.local = False) or local nodes (if self.local = True). Only initialized when specified for hole calculations. If not specified, it is assumed that q = 0 for all nodes.
eigenfunctions_no_spin (numpy array) – Eigenfunctions without a spin spin index. Only used in spinless electron calculations.
energies_no_spin (numpy array) – Energies of spinless electrons.
Note
For spinless electrons, the Zeeman operator will add a spin index. The eigenenergies and eigenfunctions of the system before the spin index is added are stored in the attributes
energies_no_spin
andeigenfunctions_no_spin
Because the
Zeeman
class is a subclass of theHamiltonianOperator
class it has the attributes and methods of theHamiltonianOperator
class in addition to the ones listed here.- __init__(d, B, g=None)
Constructor for the Zeeman operator
- Parameters:
d (Device object) – Device for which the eigenfunctions and energies attributes have been computed (via e.g. the Schrodinger solver)
B (function or numpy array) – If a function, defined over the coordinates, x, y, and z that describes the magnetic field over space. Can also be a 1D numpy array of length 3 giving a constant magnetic field over all space, or a 2D numpy array where the first index runs over the global nodes and the second over the components of the magnetic field.
g (function or numpy array or tuple) – For electrons, if a function, defined over the coordinates, x, y, and z that describes the g-tensor over space. Can also be a 2D 3 x 3 array giving a constant g-tensor over all space, or a 3D numpy array where the first index runs over the global nodes and the second and third indices run over the components of the g-tensor. If None then g is taken from the output of the
get_electron_g_factor
method ofd
. For holes, we can have a tuple whose first entry gives the kappa g-tensor (Zeeman coupling to spin-3/2 matrices, J_i) and the second entry gives the q g-tensor (Zeeman coupling to spin-3/2 matrices cubed, J_i^3). If we do not have a tuple, then we assume q=0. If None, kappa and q taken from the output of theget_hole_Zeeman_params
method ofd
.
- get_operator_matrix()
Compute the matrix representation of an operator (quantity defined over global nodes of the mesh).
- Returns:
(2D array) – Matrix represention of the operator in the subspace defined by self.eigenfunctions.
- get_operator_matrix_element(bra, ket)
Compute a single matrix element of an operator (quantity defined over global nodes of the mesh).
- Parameters:
bra (int) – Row index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
ket (int) – Column index of the matrix element we wish to compute. Indices are based on the ordering of self.eigenfunctions.
- Returns:
(complex) – Matrix element of the matrix representation of the operator.
- solve()
Computes the new eigenstates of the system by diagonalizing \(H_0 + U\). \(H_0\) is a diagonal matrix with
energies
on its diagonal.