====== DensityMatrix ====== ### //DensityMatrix(psi, OrbitalTable, options)// creates the density matrix of psi $a^{\dagger}_{\tau}a^{\phantom{\dagger}}_{\tau'}$ for the orbitals included in orbitaltable. It returns a table. ### ===== Input ===== * psi : Wavefunction or a list of wavefunctions * OrbitalTable : Vector (table) of unsigned integers. Orbitals start at 0. If the table is not given, all orbitals will be included. * options: a list of options. Currently, only one option can be given: { {"Tensor", bool} }, where bool can be true or false. This option can be used when a list of wavefunctions are given. If the option is set to true, the density matrix is taken with respect to all wavefunctions $\langle \psi_{n} | a^{\dagger}_{\tau}a^{\phantom{\dagger}}_{\tau'} | \psi_{n'} \rangle $. The default value is false, where those density matrices with $n = n'$ will be calculated. The output will be a matrix of density matrices. ===== Output ===== * rho : Matrix (Table of Tables) of reals of dimension #OrbitalTable ===== Example ===== ### description text ### ==== Input ==== dofile("../definitions.Quanty") print("For the wave-function") print(psi1) print("the density matrix is") rho = DensityMatrix(psi1) print(rho) print("the density matrix of orbital 1 and 4 is (counting starts at 0)") rho = DensityMatrix(psi1,{1,4}) print(rho) ==== Result ==== For the wave-function WaveFunction: Wave Function QComplex = 0 (Real==0 or Complex==1) N = 2 (Number of basis functions used to discribe psi) NFermionic modes = 6 (Number of fermions in the one particle basis) NBosonic modes = 0 (Number of bosons in the one particle basis) # pre-factor Determinant 1 9.486832980505E-01 100010 2 3.162277660168E-01 110000 the density matrix is { { 1 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0.1 , 0 , 0 , 0.3 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0.3 , 0 , 0 , 0.9 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 } } the density matrix of orbital 1 and 4 is (counting starts at 0) { { 0.1 , 0.3 } , { 0.3 , 0.9 } } ===== Table of contents ===== {{indexmenu>.#1}}