Creating a ket¶
Many standard textbook functions can be obtained from the basisbank
-submodule, but creating custom kets from sympy expressions is straight forward.
...from Basisbank¶
For instance, to obtain a predefined basisbank
S-type Slater orbital you may do as follows:
In [1]:
Copied!
import braketlab as bk
exponent = 2.0
weight = 1.0
quantum_number_n = 1.0
quantum_number_l = 2.0
quantum_number_m = 0.0
psi_0 = bk.basisbank.get_sto(exponent,weight,quantum_number_n,quantum_number_l,quantum_number_m) # a Slater type orbital
psi_0
import braketlab as bk
exponent = 2.0
weight = 1.0
quantum_number_n = 1.0
quantum_number_l = 2.0
quantum_number_m = 0.0
psi_0 = bk.basisbank.get_sto(exponent,weight,quantum_number_n,quantum_number_l,quantum_number_m) # a Slater type orbital
psi_0
Out[1]:
$\vert \chi_{2,0}^{2.00} \rangle$
In [2]:
Copied!
psi_0.ket_sympy_expression # show the sympy-expression
psi_0.ket_sympy_expression # show the sympy-expression
Out[2]:
$\displaystyle 1.0 \cdot \left(8.48528137423857 x_{0; 2}^{2.0} - 2.82842712474619 \left(x_{0; 0}^{2.0} + x_{0; 1}^{2.0} + x_{0; 2}^{2.0}\right)^{1.0}\right) e^{- \sqrt{x_{0; 0}^{2.0} + x_{0; 1}^{2.0} + x_{0; 2}^{2.0}} \cdot 2.0}$
In [3]:
Copied!
psi_0.view() # create a view (open the visualization module Evince)
psi_0.view() # create a view (open the visualization module Evince)
Out[3]:
...or from scratch¶
If you would like to instead manually define your ket, you'll have to initialize it from a Sympy-function as follows:
In [4]:
Copied!
import braketlab as bk
import sympy as sp
x,y,z = bk.get_default_variables(0,3) # Particle 0 has 3 coordinates
# This is not strictly necessary, but a safer solution for book-keping many body systems
p = bk.ket( x*sp.sin(2.0*y)/(x**2 + y**2 + z**2)**2, name = "\\varphi" )
p
import braketlab as bk
import sympy as sp
x,y,z = bk.get_default_variables(0,3) # Particle 0 has 3 coordinates
# This is not strictly necessary, but a safer solution for book-keping many body systems
p = bk.ket( x*sp.sin(2.0*y)/(x**2 + y**2 + z**2)**2, name = "\\varphi" )
p
Out[4]:
$\vert \varphi \rangle$
In [5]:
Copied!
p.ket_sympy_expression
p.ket_sympy_expression
Out[5]:
$\displaystyle \frac{1.0 x_{0; 0} \sin{\left(2.0 x_{0; 1} \right)}}{\left(x_{0; 0}^{2} + x_{0; 1}^{2} + x_{0; 2}^{2}\right)^{2}}$
In [6]:
Copied!
p.view()
p.view()
Out[6]:
In [ ]:
Copied!