Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
documentation:language_reference:functions:eigensystem [2016/10/09 22:06] – created Maurits W. Haverkort | documentation:language_reference:functions:eigensystem [2018/11/28 09:01] (current) – Maurits W. Haverkort | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Eigensystem ====== | ||
+ | ### | ||
+ | Eigensystem calculates the eigen-energies and eigen-vectors of an Operator or matrix. The function comes in several flavors. | ||
+ | ### | ||
+ | |||
+ | ====== Eigensystem of matrices ====== | ||
+ | |||
+ | //val, fun = Eigensystem(A)// | ||
+ | |||
+ | ===== Input ===== | ||
+ | |||
+ | * A : Square matrix (table of tables) of doubles | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | * val : Vector (Table of length #A) of doubles representing the eigen values | ||
+ | * fun : Matrix (Table of Tables of length #A by #A) representing the eigen vectors (fun[1] represents the first eigenvector) | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | ### | ||
+ | A small example: | ||
+ | ### | ||
+ | |||
+ | ==== Input ==== | ||
+ | <code Quanty Eigensystem_Matrix.Quanty> | ||
+ | A = {{ 1 , I , 0 }, | ||
+ | {-I , 2 , 1 }, | ||
+ | { 0 , 1 , 5 }} | ||
+ | |||
+ | val, fun = Eigensystem(A) | ||
+ | |||
+ | print(val) | ||
+ | print(fun) | ||
+ | </ | ||
+ | |||
+ | ==== Result ==== | ||
+ | <file Quanty_Output Eigensystem_Matrix.out> | ||
+ | { 0.31866935639502 , 2.3579263675185 , 5.3234042760865 } | ||
+ | { { (0 - 0.82050111444738 I) , 0.55903255238504 , -0.11941744665028 } , | ||
+ | { (0 - 0.56721932561261 I) , -0.77024207841542 , 0.29152937637548 } , | ||
+ | { (0 + 0.070994069063423 I) , 0.30693606176558 , 0.94907855109346 } } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Eigensystem of Operators iteratively found starting from a random state subject to restrictions ====== | ||
+ | |||
+ | //psiList = Eigensystem(Hamiltonian, | ||
+ | |||
+ | ### | ||
+ | calculates the lowest Npsi eigenstates for an operator Hamiltonian. The program uses iterative methods and needs to have a starting point to be defined. Note that the operator Hamiltonian does not know about the number of electrons there are in the system, only the number of orbitals is defined. If these orbitals are occupied or not is not given in the operator. A set of start restrictions is given by a table listing the number of Fermionic modes, Bosonic modes followed by lists including a string that tells the program which orbitals are included in the counting and then a minimum and maximum number of electrons in those orbitals. For example: | ||
+ | <code Quanty > | ||
+ | StartRestrictions = {Nf, Nb, {" | ||
+ | </ | ||
+ | Which would define two electrons in a p-shell. A start restriction of: | ||
+ | <code Quanty > | ||
+ | StartRestrictions = {Nf, Nb, {" | ||
+ | </ | ||
+ | would tell the program to start from two electrons with spin down and either 0,1,2, or 3 electron with spin up. A well defined calculation, | ||
+ | If you want to start with two electrons with spin down and no electrons with spin up one needs: | ||
+ | <code Quanty > | ||
+ | StartRestrictions = {Nf, Nb, {" | ||
+ | </ | ||
+ | The final result must not fulfill the start restrictions, | ||
+ | ### | ||
+ | |||
+ | ===== Input ===== | ||
+ | |||
+ | * // | ||
+ | * // | ||
+ | * //Npsi// : Number of lowest eigenstates to calculate. Calculation speed and memory uses depends on this number. States that are higher in energy then $\approx 10\times k_B \times T$ are not important for any physics and do not need to be calculated. | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | * psiList : A table of Wavefunctions of length //Npsi// | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | ### | ||
+ | A small example: | ||
+ | ### | ||
+ | |||
+ | ==== Input ==== | ||
+ | <code Quanty Eigensystem_Startrestrictions.Quanty> | ||
+ | dofile(" | ||
+ | |||
+ | -- we define an Hamiltonian | ||
+ | Hamiltonian = OppU + 0.1 * Oppldots + 0.000001 * (2*OppSz+OppLz) | ||
+ | |||
+ | -- number of states calculated | ||
+ | Npsi=15 | ||
+ | |||
+ | -- In order to make sure we have a filling of 2 | ||
+ | -- electrons we need to define some restrictions | ||
+ | StartRestrictions = {Nf, Nb, {" | ||
+ | |||
+ | -- We now can create the lowest Npsi eigenstates: | ||
+ | psiList = Eigensystem(Hamiltonian, | ||
+ | |||
+ | -- We define a list of some operators to look at their expectation values | ||
+ | oppList={Hamiltonian, | ||
+ | |||
+ | -- after we've created the eigen states we can look | ||
+ | -- at a list of their expectation values | ||
+ | print(" | ||
+ | for i=1,# | ||
+ | for j=1,# | ||
+ | io.write(string.format(" | ||
+ | end | ||
+ | io.write(" | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Result ==== | ||
+ | <file Quanty_Output Eigensystem_Startrestrictions.out> | ||
+ | < | ||
+ | -2.1033 | ||
+ | -2.0500 | ||
+ | -2.0500 | ||
+ | -2.0500 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Eigensystem of Operators iteratively found starting from a given set of wavefunctions ====== | ||
+ | |||
+ | // | ||
+ | |||
+ | ### | ||
+ | Instead of starting from a random state that fulfills restrictions one can start from a pre-defined state. This can be useful if you have a large system and only want to do perturbation theory, configuration interaction for example, or if you want to calculate the eigen states of the Hamiltonian after making a small change to the Hamiltonian. In the example before we first calculate the eigen-state of the Hamiltonian without spin-orbit coupling and in a next step start from these eigen-states to calculate the Hamiltonian with spin-orbit coupling. | ||
+ | ### | ||
+ | |||
+ | ===== Input ===== | ||
+ | |||
+ | * // | ||
+ | * psiList : A table of Wavefunctions overwritten on output | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | * psiList : A table of Wavefunctions | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | ### | ||
+ | A small example: | ||
+ | ### | ||
+ | |||
+ | ==== Input ==== | ||
+ | <code Quanty Eigensystem_Wavefunction.Quanty> | ||
+ | dofile(" | ||
+ | |||
+ | -- we define an Hamiltonian | ||
+ | Hamiltonian = OppU + 0.000001 * (2*OppSz+OppLz) | ||
+ | |||
+ | -- number of states calculated | ||
+ | Npsi=15 | ||
+ | StartRestrictions = {Nf, Nb, {" | ||
+ | psiList = Eigensystem(Hamiltonian, | ||
+ | |||
+ | oppList={Hamiltonian, | ||
+ | |||
+ | print(" | ||
+ | for i=1,# | ||
+ | for j=1,# | ||
+ | io.write(string.format(" | ||
+ | end | ||
+ | io.write(" | ||
+ | end | ||
+ | |||
+ | Hamiltonian = Hamiltonian + 0.1 * Oppldots | ||
+ | |||
+ | oppList={Hamiltonian, | ||
+ | |||
+ | |||
+ | -- Recalculate eigen states with spin orbit | ||
+ | Eigensystem(Hamiltonian, | ||
+ | |||
+ | print(" | ||
+ | for i=1,# | ||
+ | for j=1,# | ||
+ | io.write(string.format(" | ||
+ | end | ||
+ | io.write(" | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Result ==== | ||
+ | <file Quanty_Output Eigensystem_Wavefunction.out> | ||
+ | < | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | -2.0000 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | < | ||
+ | -2.1033 | ||
+ | -2.0500 | ||
+ | -2.0500 | ||
+ | -2.0500 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | -1.9521 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ====== Options ====== | ||
+ | |||
+ | The last element of Eigensystem can be a table of options. Possible options are: | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Table of contents ====== | ||
+ | {{indexmenu> |