op2ndx

◼ op2ndx[c[i]] returns the index of the operator c[i] in the basis declared by calling makebasis.

◼ The creation/annihilation type of the operator (i.e. the first index CR or AN) is disregarded.

◼ See also: basis, makebasis, goodopQ, ndx2op, vacuum, ap, vc, vc2ops.

Further examples

Load sneg and declare some quantities

<< sneg`sneg`;
snegfermionoperators[c, d];

Construct a basis for two lattice sites c and d

bz = makebasis[{c[], d[]}]

op2ndx[c[CR, UP]]
op2ndx[c[CR, DO]]
op2ndx[c[AN, UP]]
op2ndx[c[AN, DO]]

op2ndx[d[CR, UP]]
op2ndx[d[CR, DO]]
op2ndx[d[AN, UP]]
op2ndx[d[AN, DO]]

op2ndx[c[any, UP]]
op2ndx[c[any, DO]]
op2ndx[d[any, UP]]
op2ndx[d[any, DO]]

Map[op2ndx, bz] == Range[4]

op2ndx returns unevaluated for operators that do not appear in the basis.

op2ndx[e[CR, UP]]
op2ndx[c[CR, 1, UP]]
op2ndx[c[CR, k, UP]]
op2ndx[c[CR, k, any]]