sop
Introduced in 0.99
Synopsis

Provides cartesian and ladder spin operators.

S = sop(SpinSystem,Comps)
[S1,S2,...] = sop(SpinSystem,Comps1,Comps2,...)
... = sop(...,'sparse');
Description

This is the most fundamental function in the EasySpin toolbox. sop returns the matrix representation of spin operators. The representation is in the product basis |mI1,mI2,mI3,..>. with the basis functions in descending mI order (left to right). E.g. for a system with one electron-1/2 and one nucleus with spin 1/2 the states are ordered as |1/2,1/2>, |1/2,-1/2>, |-1/2,1/2>, |-1/2,-1/2>.

SpinSystem is either a spin system structure or a vector containing the spin quantum numbers. Comps is a string specifying one operator component for each spin in SpinSystem. Elements of Comps can be 'e' (identity), 'x' (Ix), 'y' (Iy), 'z' (Iz), '+' (Ip) or '-' (Im). The order in Comps corresponds to the order in SpinSystem. E.g. for a 3-spin system Comps = 'ye-' yields [eqn].

More than one component string can be specified, in which case sop computes all operators at once. Of course, there must be a corresponding number of output arguments.

If 'sparse' is given as last argument, spin operatore matrices are returned in sparse instead of full form.

Examples
Splus = sop(1/2,'+')
Splus =
     0     1
     0     0
SzIx = sop([1/2 1/2],'zx')
SzIx =
         0    0.2500         0         0
    0.2500         0         0         0
         0         0         0   -0.2500
         0         0   -0.2500         0

To compute multiple operators with one call, use for example

[Sx,Sy,Sz] = sop(1,'x','y','z');
Sx =
         0    0.7071         0
    0.7071         0    0.7071
         0    0.7071         0
Sy =
        0                  0 - 0.7071i        0
        0 + 0.7071i        0                  0 - 0.7071i
        0                  0 + 0.7071i        0
Sz =
     1     0     0
     0     0     0
     0     0    -1
See also

spin operators, stev