# Differences

This shows you the differences between two versions of the page.

 — documentation:language_reference:functions:newoperator [2016/10/10 09:41] (current) 2016/10/09 21:48 Maurits W. Haverkort created 2016/10/09 21:48 Maurits W. Haverkort created Line 1: Line 1: + ====== NewOperator ====== + ### + //​NewOperator(name,​ ...)// creates one of the standard operators as described in the section on standard operators. + ### + + ### + //​NewOperator(Nf,​ Nb, CreationTable)//​ can be used to create any operator of the form: + \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} + The format of //​CreationTable//​ for the above listed operator is: + //​NewOperator(Nf,​ Nb, {{$i_1$,​$j_1$,​$k_1$,​$\alpha_{i,​j,​k}$},​{$i_1$,​$j_1$,​$\alpha_{i,​j}$},​...})//​ + Whereby positive indices create a particle, negative indices annihilate a particle. Index $i$ for 0 to Nf-1 label Fermions, from Nf to Nf+Nb label Bosons. $\alpha$ can be either a real or a complex number. NewOperator can take a forth element specifying options. + ### + + ===== Input ===== + + * Nf : Integer + * Nb : Integer + * CreationTable : Table of tables, whereby each table is a list of orbital indices where a particle needs to be created (positive) or annihilated (negative) and a prefactor (real or complex number). Note that -0 and +0 are different. + * Possible options + * "​Restrictions"​ A list specifying restrictions when applying the operator to a wave-function. + * "​Name"​ a string specifying the name of the operator + * "​NBitsKey"​ a list of integers specifying the number of bits in the key used for the hash lookup tables. Only useful when a lot of operations are done on the operators. Not used when Operator * Wavefunction is calculated. + + + ===== Output ===== + + * O : Operator + + ===== Example ===== + + ### + description text + ### + + ==== Input ==== + ​ + Nf = 5 + Nb = 0 + O = NewOperator(Nf,​ Nb, {{             10}, + ​{0,​-0, ​        3}, + ​{0,​1,​2,​3,​4, ​ 1+I}}, + {{"​Name","​Liberty"​}}) + print(O) + ​ + + ==== Result ==== + ​ + Operator: Liberty + QComplex ​        ​= ​         2 (Real==0 or Complex==1 or Mixed==2) + MaxLength ​       =          5 (largest number of product of lader operators) + NFermionic modes =          5 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) + NBosonic modes   ​= ​         0 (Number of bosonic modes (phonon modes, ...) in the one particle basis) + + Operator of Length ​  0 + QComplex ​     =          0 (Real==0 or Complex==1) + N             ​= ​         1 (number of operators of length ​  0) + |  1.000000000000000E+01 + + Operator of Length ​  5 + QComplex ​     =          1 (Real==0 or Complex==1) + N             ​= ​         1 (number of operators of length ​  5) + C  4 C  3 C  2 C  1 C  0 |  1.000000000000000E+00 ​ 1.000000000000000E+00 + ​ + + ===== Table of contents ===== + {{indexmenu>​.#​1}}