Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
documentation:language_reference:functions:printexpectationvalues [2018/09/24 16:35] – Standard -> Default Simon Heinze | documentation:language_reference:functions:printexpectationvalues [2018/11/13 15:43] – Added code example and mentioned extraLists Simon Heinze | ||
---|---|---|---|
Line 2: | Line 2: | ||
### | ### | ||
- | PrintExpectationValues(psiList, | + | PrintExpectationValues(psiList, |
The function prints a header based on the name of the operator (except in the case of the Hamiltonian, | The function prints a header based on the name of the operator (except in the case of the Hamiltonian, | ||
Line 10: | Line 10: | ||
* psiList : A list of wavefunctions, | * psiList : A list of wavefunctions, | ||
- | * Hamiltonian : Giving the Hamiltonian operator here is optional | ||
* opList : A list of operators for which expectation values are to be calculated | * opList : A list of operators for which expectation values are to be calculated | ||
+ | * Hamiltonian : Giving the Hamiltonian operator here is optional | ||
+ | * Extra : Optional Map in form { {string, | ||
* Possible Options are: | * Possible Options are: | ||
* " | * " | ||
Line 24: | Line 25: | ||
===== Example ===== | ===== Example ===== | ||
- | |||
- | ### | ||
- | Here's no example: | ||
- | ### | ||
==== Input ==== | ==== Input ==== | ||
<code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
- | -- some example code | + | Verbosity(0) |
+ | |||
+ | orbs = {" | ||
+ | Ind, NF = CreateAtomicIndicesDict(orbs) | ||
+ | |||
+ | psiList = {} | ||
+ | for key1,orb1 in pairs(orbs) do | ||
+ | for key2, orb2 in pairs(orbs) do | ||
+ | if key1 == key2 then | ||
+ | det1 = DeterminantString(NF, | ||
+ | psiList[# | ||
+ | elseif key1 < key2 then | ||
+ | det1 = DeterminantString(NF, | ||
+ | det2 = DeterminantString(NF, | ||
+ | psiList[# | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | |||
+ | Hamil = NewOperator(" | ||
+ | Hamil = Hamil + NewOperator(" | ||
+ | Hamil = Hamil + NewOperator(" | ||
+ | Hamil = Hamil + NewOperator(" | ||
+ | Hamil = Hamil + NewOperator(" | ||
+ | Hamil = Hamil + NewOperator(" | ||
+ | Hamil = Hamil + 1e-5*NewOperator(" | ||
+ | Hamil = Hamil - 4 | ||
+ | Hamil = Hamil/2 | ||
+ | Hamil = Hamil + ConjugateTranspose(Hamil) | ||
+ | Hamil.Name = " | ||
+ | |||
+ | opList = {} | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | opList[# | ||
+ | |||
+ | StartRestrictions = {NF,0} | ||
+ | StartRestrictions[3] = {DeterminantString(NF, | ||
+ | StartRestrictions[4] = {DeterminantString(NF, | ||
+ | |||
+ | Restrictions = {NF,0} | ||
+ | Restrictions[3] = {DeterminantString(NF, | ||
+ | |||
+ | NPsi = 15 | ||
+ | psiList = Eigensystem(Hamil, | ||
+ | |||
+ | extraList1 = {" | ||
+ | extraList2 = {" | ||
+ | for i = 1, NPsi do | ||
+ | extraList1[2][i] = 0.5*i | ||
+ | extraList2[2][i] = 5/i | ||
+ | end | ||
+ | extraLists = {extraList1, | ||
+ | |||
+ | Options = {{" | ||
+ | |||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
+ | print(" | ||
+ | PrintExpectationValues(psiList, | ||
</ | </ | ||
==== Result ==== | ==== Result ==== | ||
<file Quanty_Output> | <file Quanty_Output> | ||
- | text produced as output | + | PrintExpectationValues(psiList, |
+ | |||
+ | N_1s N_2s N_2p F0_2p | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 2 | ||
+ | 11 2 | ||
+ | 12 2 | ||
+ | 13 2 | ||
+ | 14 2 | ||
+ | 15 2 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | E | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 3.15048 2 | ||
+ | 11 3.15049 2 | ||
+ | 12 3.18988 2 | ||
+ | 13 3.25049 2 | ||
+ | 14 3.35049 2 | ||
+ | 15 3.3505 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | N_1s N_2s N_2p F0_2p | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 2 | ||
+ | 11 2 | ||
+ | 12 2 | ||
+ | 13 2 | ||
+ | 14 2 | ||
+ | 15 2 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | N_1s N_2s N_2p F0_2p | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 2 | ||
+ | |||
+ | N_1s N_2s N_2p F0_2p | ||
+ | 11 2 | ||
+ | 12 2 | ||
+ | 13 2 | ||
+ | 14 2 | ||
+ | 15 2 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | E | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 3.15048 2 | ||
+ | 11 3.15049 2 | ||
+ | 12 3.18988 2 | ||
+ | 13 3.25049 2 | ||
+ | 14 3.35049 2 | ||
+ | 15 3.3505 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | E | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 3.15048 | ||
+ | |||
+ | E | ||
+ | 11 3.15049 | ||
+ | 12 3.18988 | ||
+ | 13 3.25049 | ||
+ | 14 3.35049 | ||
+ | 15 3.3505 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | E | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 3.15048 | ||
+ | |||
+ | E | ||
+ | 11 3.15049 | ||
+ | 12 3.18988 | ||
+ | 13 3.25049 | ||
+ | 14 3.35049 | ||
+ | 15 3.3505 | ||
+ | |||
+ | |||
+ | |||
+ | PrintExpectationValues(psiList, | ||
+ | |||
+ | E | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 -0.166677 2 | ||
+ | |||
+ | E | ||
+ | 11 -0.066667 2 | ||
+ | 12 0.0333333 2 | ||
+ | 13 0.133343 | ||
+ | 14 0.233343 | ||
+ | 15 3 | ||
</ | </ | ||