# Operators

Operators are defined in second quantization. Any operator can be written as:
$$
\begin{eqnarray}
\nonumber O = && \alpha^{(0,0)} 1 \\
\nonumber + \sum_i && \alpha^{(1,0)}_i a^{\dagger}_i + \alpha^{(0,1)}_i a_i \\
\nonumber + \sum_{i,j} && \alpha^{(2,0)}_{i,j} a^{\dagger}_ia^{\dagger}_j + \alpha^{(1,1)}_{i,j} a^{\dagger}_ia_j + \alpha^{(0,2)}_{i,j} a_ia_j \\
+ \sum_{i,j,k} && ... .
\end{eqnarray}
$$
In Quanty one can create a creation operator on spin-orbital $0$ ($a^{\dagger}_0$) with the function *NewOperator()*.

- Example.Quanty
-- Creation operator on spin-orbital 0 OppC0 = NewOperator("Cr",NF,0)

Annihilation operators are created by replacing the string *“Cr”* by *“An”*:

- Example.Quanty
-- Annihilation operator on spin-orbital 0 OppA0 = NewOperator("An",NF,0)

One is allowed to multiply operators, either with (complex) numbers or by other operators as well as to add operators. In this way one is able to create all possible operators needed.

- Example.Quanty
OppC0 = NewOperator("Cr",NF,0) OppA0 = NewOperator("An",NF,0) -- Create the number operator on spin-orbital -- 0 by multiplying a creation with an -- annihilation operator OppN0 = OppC0 * OppA0 -- Identity operator Opp1 = OppC0 * OppA0 + OppA0 * OppC0

The number operator can be created directly using the string “Number” in the function NewOperator()

- Example.Quanty
-- Number operator on spin-orbital 0 OppN0 = NewOperator("Number",NF,0,0)

One can create sums over creation, annihilation or number operators directly. The operator \begin{equation} O_1 = 0.1 a_0^{\dagger} + 0.2 a_1^{\dagger} + 0.3 a_3^{\dagger}, \end{equation} is created in Quanty by adding a list of indices and prefactors.

- Example.Quanty
-- Operator O_1 OppO1 = NewOperator("Cr", NF, {0,1,2}, {0.1,0.2,0.3})

Although this allows you to create all possible operators it is not really practical. Quanty has defined many standard operators which can be used directly. In the section on standard operators we describe these.