Hi, Thank you for your example. I know that sympy.physics support second quantization. What I want to do is trying to make a uniform interface to do both first quantization and second quantization. For example, if I tell the computer that (a+) is the operator that put one electron into the (1 particle) ground state, when I put (a+)|0>, the computer automatically returns the ground state of system . I also hope that the computer is more smart, for example, the computer should know when to apply wicks theorem to do further calculation and you don't have to explicitly tell it to do so.
Answer your question: I will make symbolic density matrix (if approved by GSoC). On Monday, March 23, 2015 at 11:27:35 AM UTC-4, [email protected] wrote: > > Hi Xiang, > > I am not familiar with GSoC and I can't comment on that, but SymPy does > support second quantization. There is a second quantization module with > fermionic and bosonic annihilation/creation operators, Wicks theorem, > support for contractions and normal ordering as well as evaluation of > Kronecker deltas. There is also a sample demonstrating derivation of the > CCSD (Coupled Cluster Singles and Doubles) equations here: > https://github.com/sympy/sympy/blob/master/examples/intermediate/coupled_cluster.py > > I am currently working to extend the second quantization module to support > different Fock spaces. I adopted a very simple and practical approach which > is to associate a Fock space label to the indices of creation/annihilation > operator. The indices already carry the information whether they are > above/below the Fermi level, hence it seemed convenient to simply add the > Fock space info there. > > Apparently you want to work with different Hilbert spaces in first > quantization, so I guess your ideas of creating new classes to handle that > seem good to me there. Would your density matrices be able to work with > completely symbolic quantities ? > I am going to need symbolic density matrices for my work, but I have not > really thought yet about how to get them into SymPy. Maybe I could derive a > class from Indexed which would support the special algebraic operations I > need. > > Le jeudi 19 mars 2015 20:04:03 UTC-4, Xiang Gao a écrit : >> >> Hi, >> >> Below are my initial thought on what to do for sympy.physics. I didn't >> wrote plans about second quantization because it require more thinking and >> discussing and it's better to work on this part first. Since there are a >> lot of changes, I think I need to discuss first. Do you have any >> suggestions about that? >> >> *Current status:* >> >> 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 the >> direct product |a>|b> and calculate the Hilbert space it is in. 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: * >> >> To solve these problems, reorganize maybe helpful. I suggest reorganize in >> the following way: >> >> 1. The class HilbertSpace takes 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 all exact solutions in quantum mechanics and quantum field >> theory as classes in package sympy.physics.quantum.ExcatSolutions. >> >> 6. Implement partial trace and trace >> >> >> >> *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 >> > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/24fd6722-42ce-46f4-b4d8-33720a304867%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
