This module defines the data type 'spin', which represents 2×2 complex matrices in spin space. The module overloads common arithmetic operators to work with the new data type, and defines and exports the Pauli matrices as constants. To make it easier to interact with common differential equation solvers, which often operate on real state vectors, the assignment operator is overloaded in such a way that 'spin' can be easily imported/exported to a real vector(8).
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(spin), | public, | parameter | :: | pauli0 | = | spin(reshape([(1, 0), (0, 0), (0, 0), (1, 0)], [2, 2], order=[2, 1])) | |
type(spin), | public, | parameter | :: | pauli1 | = | spin(reshape([(0, 0), (1, 0), (1, 0), (0, 0)], [2, 2], order=[2, 1])) | |
type(spin), | public, | parameter | :: | pauli2 | = | spin(reshape([(0, 0), (0, -1), (0, 1), (0, 0)], [2, 2], order=[2, 1])) | |
type(spin), | public, | parameter | :: | pauli3 | = | spin(reshape([(1, 0), (0, 0), (0, 0), (-1, 0)], [2, 2], order=[2, 1])) | |
type(spin), | public, | parameter, dimension(0:3) | :: | pauli | = | [pauli0, pauli1, pauli2, pauli3] |
Matrix inverse
Matrix trace
Calculate the trace of the spin matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spin), | intent(in) | :: | this |
Matrix sum
Complex conjugation
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
complex(kind=wp), | public | :: | matrix(2,2) | = | 0.0_wp | Encapsulate a spin matrix |
generic, public :: spin => cons_rscalar, cons_cscalar, cons_cmatrix, cons_rvector, cons_spin | |
generic, public :: assignment(=) => assr_rscalar, assr_cscalar, assr_cmatrix, assr_rvector, assl_cmatrix, assl_rvector | |
generic, public :: operator(+) => addl_rscalar, addr_rscalar, addl_cscalar, addr_cscalar, addl_cmatrix, addr_cmatrix, add_spin | |
generic, public :: operator(-) => subl_rscalar, subr_rscalar, subl_cscalar, subr_cscalar, subl_cmatrix, subr_cmatrix, sub_spin | |
generic, public :: operator(*) => mull_rscalar, mulr_rscalar, mull_cscalar, mulr_cscalar, mull_cmatrix, mulr_cmatrix, mul_spin | |
generic, public :: operator(/) => divr_rscalar, divr_cscalar | |
generic, public :: operator(**) => expr_iscalar |