Skip to content

GSoC 2015 Application Xiang Gao : Adjust the structure of sympy.physics.quantum and implement all exact solutions

Gao, Xiang edited this page Mar 23, 2015 · 18 revisions

TODO: this is just a start. I've just pasted my idea here with awful format and without following the template. I will making it follow the template and easier to read soon

About me

I'm a 1st year graduate student on computational chemistry at University of Florida. I received my bachelor of science in physics and bachelor of engineering in computer science and technology at University of Science and Technology of China in 2014.

Contact Information

Name: Xiang Gao

Email: qasdfgtyuiop@gmail.com

GitHub: zasdfgbnm

Programming Background and Environment

Language: very familiar with C and C++; familiar with python, php, java, HTML, javascript, LaTeX, Fortran, etc.

System: Now using Mac OS X. Familiar with the usage of Linux; have a little basic knowledge in Linux kernel. Have experience in developing a simple (very simple) character device drive. Familiar with Windows

Editor: Vim

The relationship of wavefunction, bra, ket, operator, Hilbert space, and second quantization are not dealt in a good way. For example, in sympy.physics.hydrogen, sympy.physics.qho_1d, and sympy.physics.sho, the wavefunctions and energy levels are defined, however there is no corresponding object of class Ket is defined. It is impossible for me to get the corresponding Ket object of the eigenstates of these systems. Another example is that, it is impossible for me to do the following calculation: |a> is in space A, |b> is in space B, I want to deal with states in the direct product space and calculate the partial trace. Another example is, in Configuration Interaction and Coupled Cluster theory in theoretical chemistry, creation and annihilation operator is used to populate electrons of a molecule to excited state, there are a lot of algebra in this area on second quantization, but sympy don’t support it yet.

Ways of Improvement:

  1. Modify the class HilbertSpace to take a string parameter to denote different spaces.
  2. When a Ket is initialized, two parameters must be given: one is the Hilbert space that this Ket is in another is can be a string or a Symbol. If the Ket is initialized with a string, the behavior of this Ket is similar to numbers (the members in sympy.core.numbers) in sympy. If the Ket is initialized with a Symbol, the behavior will be similar to a symbol (the members in sympy.core.symbol) in sympy.
  3. Implement |x>, |p>, operator x, operator p, in the class sympy.physics.quantum.Space1D; implement |xyz>, |rθφ>, |pxpypz> and operators in the class sympy.physics.quantum.Space3D. The constructor of class Space1D and class Space3D takes the Hilbert space as its parameter. Implement angular momentums as sympy.physics.quantum.AngularMomentum.
  4. Override the operator “in” in python, so that whether a Ket belongs to a space can be tested by: “myket in myspace”
  5. Implement partial trace and trace.
  6. Implement all exact solutions in quantum mechanics (and if possible, quantum field theory) as classes in package sympy.physics.quantum.ExcatSolutions.
  7. Implement second quantization.

Expected Result:

Sample Code 1

>>>h1 = HilbertSpace(“H1”)
>>>h2 = HilbertSpace(“H2”)
>>>myket1 = Ket(h1,’a’)
>>>myket2 = Ket(h2,’b’)
>>>myket1 in h1
True
>>>myket2 in h1
False
>>>myket1*myket2 in h1*h2 #direct product
True
>>>myket1*myket1
Error: undefined operation
>>>myket1+myket2
Error: undefined operation

Sample code 2:

>>>h1 = HilbertSpace(“H1”)  # Hilbert space of particle 1
>>>sp1 = Space3D(h1)
>>>hydrogen1 = HydrogenLike(h1)
>>>h2 = HilbertSpace(“H2”)  # Hilbert space of particle 1
>>>sp2 = Space3D(h2)
>>>ho2 = HarmonicOscillator3D(h2)
>>>sp1.r_theta_phi_bra*hydrogen1.eigenstate(n=0,l=0,m=0)
Should output the wave function with variable r,theta,phi here
>>>sp2.xyz_bra*ho2.coherent_state(n=0,l=0,m=0)
Should output the wave function with variable x,y,z of coherent state of quantum harmonic oscillator.
>>> sp1.r_theta_phi_bra*ho2.coherent_state(n=0,l=0,m=0)
Error, incompatible space

Sample code 3:

>>>h1 = HilbertSpace(“H1”)
>>>h2 = HilbertSpace(“H2”)
>>>a1 = AngularMomentum(h1)
>>>a2 = AngularMomentum(h2)
>>>total_L = a1 + a2
>>>total_L.hilbert_space()
should output direct product of h1 and h2
>>>(a1.eigenbra(j=1/2,m=1/2)*a2.eigenbra(j=3,m=0)) * total_L.eigenket(j=3/2,m=1/2)
Should output Clebsch-Gordan coefficient

Sample code 4:

>>>h1 = HilbertSpace(“H1”)
>>>h2 = HilbertSpace(“H2”)
>>>h3 = HilbertSpace(“H3”)
>>>h4 = HilbertSpace(“H4”)
>>>density_matrix = … # codes that defines density matrix here
>>>density_matrix.trace()
Should output the trace
>>>density_matrix.trace(h1,h2)
Should output the result of the partial trace

Sample code 5:

>>>h1 = HilbertSpace(“H1”)
>>>ket1 = Space3D(h1).pxpypz_ket()
>>>sq = SecondQuantization(h1)
>>>sq.hilbert_space()
FockSpace(H1) = vacuum + H1+H1*H1+H1*H1*H1+…
>>>h = … # define some operator
>>>h.hilbert_space()
H1*H1
>>>h2 = sq.second_quantize(h,ket1)
express h in second quantization form
>>>h2.hilbert_space()
FockSpace(H1)
>>>sq.vacuum_bra*sq.create_bra(ket1)*sq.create_bra(ket1)*h2*sq.annihilate_ket(ket1)*sq.vacuum_ket
apply wick’s theorem to do calculation
Clone this wiki locally