qtcad.atoms.analysis module
Tools to analyse results of tight-binding simulations, including calculations of probabilities, calculations of operator elements, and 3D visualization of wavefunctions.
- qtcad.atoms.analysis.analyze_dot(atoms: Atoms, psi: Wavefunction, verbose: bool = False) dict
Compute the mean position, standard deviation, and size of an electron in an input state.
- Parameters:
atoms (qtcad.atoms.atoms.Atoms) – Atomic structure on which the state wavefunction is defined.
psi (qtcad.atoms.schrodinger.Wavefunction) – Wavefunction of the state.
verbose (bool, optional) – Whether the geometric properties of the state are printed. Default: False.
- Returns:
dict – Dictionary containing the mean position, standard deviation, and size (defined as four times the standard deviation) of the electron wavefunction.
- qtcad.atoms.analysis.get_operator_element(psi_l: Wavefunction, psi_r: Wavefunction, op: spmatrix = None) float | complex
Compute the matrix element with the following bra-ket notation: \(\langle L\! \mid\! A\! \mid\! R \rangle\).
- Parameters:
psi_l (qtcad.atoms.schrodinger.Wavefunction) – Wavefunction of the state \(\lvert L \rangle\) that left-multiplies the operator in the bra-ket.
psi_r (qtcad.atoms.schrodinger.Wavefunction) – Wavefunction of the state \(\lvert R \rangle\) that right-multiplies the operator in the bra-ket.
operator (scipy.sparse.spmatrix, optional) – Operator \(A\). If None, the identity operator is used, in which case the computed bra-ket is simply the overlap between the two states. Default: None.
- Returns:
float or complex – Value of the operator element \(\langle L\! \mid\! A\! \mid\! R \rangle\).
- qtcad.atoms.analysis.get_operator_from_fem(atoms: Atoms, tb_orbs: str, tb_spin: bool, mesh: Mesh, quantity: ndarray, method: str = 'nearest', verbose: bool = True) csr_matrix
Project a quantity defined over a finite-element mesh onto a tight-binding basis to obtain a tight-binding operator.
- Parameters:
atoms (qtcad.atoms.atoms.Atoms) – Atomic structure on which the quantity is to be interpolated to define the operator.
tb_orbs (str) – Atomic orbital basis set to be used in the tight-binding model, which may either be “sp3” for an \(sp^3\) basis, “sp3s*” for an \(sp^3s^{\star}\) basis, or “sp3d5s*” for an \(sp^3d^5s^{\star}\) basis. In a typical simulation, it may be set to the attribute
tb_orbs
of aqtcad.atoms.wavefunction.Wavefunction
object onto which the operator is to be applied.tb_spin (bool) – Whether a spin component is to be included in the tight-binding basis. If False, it is assumed the basis is composed of the atomic orbitals only. If True, it is assumed the basis is twice as large and is composed of the tensor products of the atomic orbitals with the spin up and spin down states. In a typical simulation, it may be set to the attribute
tb_spin
of aqtcad.atoms.wavefunction.Wavefunction
object onto which the operator is to be applied.mesh (qtcad.device.mesh3d.Mesh) – Finite-element mesh.
quantity (Numpy.ndarray) – Quantity defined on the global or local nodes of the finite-element mesh.
method (str, optional) – Method used to interpolate the quantity on the atomic position grid; options are “nearest” for nearest-neighbor interpolation, “linear” for linear interpolation, and “cubic” for cubic interpolation. Default: “nearest”.
verbose (bool, optional) – Whether the progress of the interpolation calculation is printed. Default: True.
- Returns:
Scipy.sparse.csr_matrix – Diagonal matrix corresponding to the finite-element quantity in the tight-binding basis.
- qtcad.atoms.analysis.save_vtu(atoms: Atoms, out_dict: dict, path: str | Path, units: str = 'A', verbose: bool = True) None
Save a dictionary of quantities defined on an atomic structure into a
.vtu
file.Data pertaining to the chemical species of each atom in the structure is also saved into the
.vtu
file.- Parameters:
atoms (qtcad.atoms.atoms.Atoms) – Atomic structure on which the quantities are defined.
out_dict (dict) – Dictionary of quantities defined on the atomic structure; these quantities must be vectors (Numpy.ndarray), each element of which is the value of the quantity on the atom with corresponding index in
atoms.atom_pos
.path (str or pathlib.Path) – Path to the
.vtu
file.units (str, optional) – Units of length in the
.vtu
file, which may either be “SI” for metres or “A” for angstroms. Default: “A”.verbose (bool, optional) – Whether messages regarding the file path and size are printed. Default: True.