# PartialMeanFieldOperator

PartialMeanFieldOperator(op,rho,indices) returns a copy of op where any 2-particle terms acting on indices are replaced by Hartree-Fock mean-field theory, using the density rho (compare MeanFieldOperator()).

If the option AddDFTSelfInteraction is set to true the electron-self interaction is added on top to simulate the behaviour encountered in DFT.

## Input

• op : An operator.
• rho : A density matrix.
• indices : A list of indices.
• Possible options are:
• AddDFTSelfInteraction : bool defining if the electron self-interaction is to be included (Standard false).

## Output

• PMFop : A copy of op, where any 2-particle interaction acting on indices is replaced by mean-field theory.

## Example

### Input

Example.Quanty
NF = 4

rho = {{0.8,0.3,0,0},{0.3,0.7,0,0},{0,0,0.4,0.5*I},{0,0,-0.5*I,0.2}}

print("Rho:")
print(rho)

op1 = NewOperator("Number",NF,{1},{1},{0.1+I}) + NewOperator("U",NF,{0},{1},{5}) + 3
op2 = NewOperator("Number",NF,{1},{1},{0.00001 + I}) + NewOperator("Number",NF,{2},{2},{1}) + NewOperator("U",NF,{0},{1},{0},{1},{2},{3},{2},{3},{3}) + NewOperator("U",NF,{0},{1},{5})

print("\n\n\n")
print("op1:")
print(op1)
print("PartialMeanFieldOperator(op1, rho, {0,1})")
print(PartialMeanFieldOperator(op1, rho, {0,1}))
print("\n\n\n")
print("op2:")
print(op2)
print("PartialMeanFieldOperator(op2, rho, {0,1})")
print(PartialMeanFieldOperator(op2, rho, {0,1}))
print("PartialMeanFieldOperator(op2, rho, {2})")
print(PartialMeanFieldOperator(op2, rho, {2}))

### Result

Rho:
{ { 0.8 , 0.3 , 0 , 0 } ,
{ 0.3 , 0.7 , 0 , 0 } ,
{ 0 , 0 , 0.4 , (0 + 0.5 I) } ,
{ 0 , 0 , (-0 - 0.5 I) , 0.2 } }

op1:

Operator: CrAn
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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)
|  3.000000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          1 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-01  1.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   4)
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialMeanFieldOperator(op1, rho, {0,1})

Operator:
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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)
|  8.150000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          4 (number of operators of length   2)
C  1 A  1 | -3.900000000000000E+00  1.000000000000000E+00
C  1 A  0 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  1 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  0 | -3.500000000000000E+00 -0.000000000000000E+00

op2:

Operator: CrAn
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          2 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-05  1.000000000000000E+00
C  2 A  2 |  1.000000000000000E+00  0.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          2 (number of operators of length   4)
C  1 C  0 A  3 A  2 | -3.000000000000000E+00
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialMeanFieldOperator(op2, rho, {0,1})

Operator:
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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)
|  5.150000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          5 (number of operators of length   2)
C  1 A  1 | -3.999990000000000E+00  1.000000000000000E+00
C  2 A  2 |  1.000000000000000E+00  0.000000000000000E+00
C  1 A  0 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  1 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  0 | -3.500000000000000E+00 -0.000000000000000E+00

Operator:
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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)
|  5.150000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          6 (number of operators of length   2)
C  1 A  1 | -3.416656666666666E+00  1.000000000000000E+00
C  2 A  2 |  1.333333333333333E+00  0.000000000000000E+00
C  1 A  0 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  1 |  1.500000000000000E+00  0.000000000000000E+00
C  0 A  0 | -2.833333333333333E+00 -0.000000000000000E+00
C  3 A  3 |  1.666666666666667E-01  0.000000000000000E+00

PartialMeanFieldOperator(op2, rho, {2})

Operator:
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (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)
| -0.000000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          2 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-05  1.000000000000000E+00
C  2 A  2 |  1.000000000000000E+00  0.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   4)
C  1 C  0 A  1 A  0 | -5.000000000000000E+00