| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| documentation:language_reference:functions:newoperator [2025/11/20 03:29] – external edit 127.0.0.1 | documentation:language_reference:functions:newoperator [2026/11/17 07:05] (current) – Maurits W. Haverkort |
|---|
| ====== NewOperator ====== | ====== NewOperator ====== |
| | ;;# |
| | <color #ed1c24>Modified in 0.9.1</color> |
| | ;;# |
| |
| ### | ### |
| //NewOperator(name, ...)// creates one of the standard operators as described in the section on standard operators. | //NewOperator(name, ...)// creates one of the standard operators as described in the section on standard operators. A "Basis" option on the last position selects the one particle basis the orbitals are in, see below. //[[documentation:language_reference:functions:angularmomentumoperators|AngularMomentumOperators()]]// creates several of the standard operators of a single atomic shell in one call. The operators //[[documentation:standard_operators:dirac_operator|"Dirac"]]//, //[[documentation:standard_operators:atomic_coulomb_repulsion|"AU"]]// and //[[documentation:standard_operators:nuclear_multipole|"NuclearMultipole"]]// act on atomic orbitals given by their radial functions, see below. |
| ### | ### |
| |
| \end{eqnarray} | \end{eqnarray} |
| The format of //CreationTable// for the above listed operator is: | 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}$},...})// | //NewOperator(Nf, Nb, { {$i_1$,$j_1$,$k_1$,$\alpha_{i_1,j_1,k_1}$},{$i_2$,$j_2$,$\alpha_{i_2,j_2}$},...})// |
| 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. | 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. |
| ### | ### |
| * "Name" a string specifying the name of the operator | * "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. | * "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. |
| | * "Basis" a string either "Y", "Z", "K", or "jjz" specifying the one particle orbital basis used for a standard operator related to an atomic (spherical) shell. Options are: |
| | |
| | ^ value ^ basis ^ order of the indices ^ |
| | | "Y" | spherical harmonics $Y_{l,m}$, the default | //IndexUp// and //IndexDn// both hold the $2l+1$ orbitals from $m=-l$ to $m=l$ | |
| | | "Z" | tesseral harmonics, the real combinations of $Y_{l,m}$ and $Y_{l,-m}$ | as for "Y", in the order of //[[documentation:language_reference:functions:ytozmatrix|YtoZMatrix()]]//, sine first, then cosine | |
| | | "K" | cubic harmonics, defined for $l \leq 3$ | as for "Y", in the order of //[[documentation:language_reference:functions:ytokmatrix|YtoKMatrix()]]//, by irreducible representation | |
| | | "jjz" | eigenstates of $j$ and $j_z$ | //IndexUp// holds the $2l$ states of $j=l-1/2$ and //IndexDn// the $2l+2$ states of $j=l+1/2$, both from $j_z=-j$ to $j_z=j$, in the order of //[[documentation:language_reference:functions:ytojjzmatrix|YtojjzMatrix()]]// | |
| |
| |
| * O : Operator | * O : Operator |
| |
| ===== Example ===== | ===== Example 1 ===== |
| | ;;# |
| | <color #ed1c24>New in 0.9.1</color> |
| | ;;# |
| | |
| | <code Quanty Example.Quanty> |
| | -- the atomic operators of Ne on its own Dirac-Fock orbitals |
| | G, F, Atom = CalculateAtomicBasisFunctions(10) |
| | indices, NF = CreateAtomicIndicesList(Atom.Labels, {{"Kappas", true}}) |
| | |
| | H0 = NewOperator("Dirac", NF, 10, indices, G, F, Atom.Nucleus) -- kinetic energy, rest mass and nucleus |
| | U = NewOperator("AU", NF, indices, G, F) -- Coulomb interaction |
| | |
| | M = OperatorToMatrix(H0) |
| | for i, label in ipairs(Atom.Labels) do |
| | local k = indices[i][1] + 1 |
| | print(string.format("<%s|h_D|%s> = %12.6f Hartree", label, label, M[k][k])) |
| | end |
| | psi = NewWavefunction(NF, 0, {{string.rep("1", NF), 1}}) |
| | print(string.format("<psi|H0 + U|psi> = %.8f Hartree, Atom.Etot = %.8f Hartree", psi*(H0 + U)*psi, Atom.Etot)) |
| | </code> |
| | |
| | <file Quanty_Output Example.out> |
| | <1s1/2|h_D|1s1/2> = -49.978118 Hartree |
| | <2s1/2|h_D|2s1/2> = -11.130511 Hartree |
| | <2p1/2|h_D|2p1/2> = -10.106977 Hartree |
| | <2p3/2|h_D|2p3/2> = -10.086830 Hartree |
| | <psi|H0 + U|psi> = -128.69193053 Hartree, Atom.Etot = -128.69193053 Hartree |
| | </file> |
| |
| ### | ### |
| description text | The diagonal elements of the Dirac operator are the one particle energies (kinetic energy and attraction by the nucleus) of the Dirac-Fock orbitals. Together with the Coulomb interaction, the energy of the Slater determinant of the closed-shell atom is its Dirac-Fock total energy. |
| | ### |
| | |
| | ===== Example 2 ===== |
| | |
| | ### |
| | A general operator defined by creation (positive index) and annihilation (negative index) numbers |
| ### | ### |
| |
| ===== Table of contents ===== | ===== Table of contents ===== |
| {{indexmenu>.#1}} | {{indexmenu>.#1}} |
| | |
| | |
| | |
| | |
| | |