Merge lp:~maddevelopers/mg5amcnlo/aloha_debug_spin32 into lp:~madteam/mg5amcnlo/trunk
- aloha_debug_spin32
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | Olivier Mattelaer |
Merged at revision: | not available |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/aloha_debug_spin32 |
Merge into: | lp:~madteam/mg5amcnlo/trunk |
Diff against target: |
702 lines (+364/-90) 4 files modified
aloha/__init__.py (+1/-0) aloha/aloha_lib.py (+37/-15) aloha/aloha_object.py (+139/-39) tests/unit_tests/various/test_aloha.py (+187/-36) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/aloha_debug_spin32 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Johan Alwall (community) | Approve | ||
Priscila de Aquino | Pending | ||
Review via email: mp+70943@code.launchpad.net |
Commit message
Description of the change
ALOHA UPDATE
* Allow a New Object PSlash
* DEFINE SPIN 3/2 propagator (Not full support of spin3/2 yet)
* Change Sigma definition to i/4 [gamma_mu, gamma_nu]
FIX
* allow for power of mass larger than two
* fix a problem when adding two spinorial tensor with index not define in the same order
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
> Besides that I'm happy to see that you have written proper tests
> for all new functionality.
Sure, that's very very important in the case of aloha where the
structure of the code is quite advance and tricky.
> Did you also test the bugs that you fixed?
In fact that the test of the new functionality who make me discover
those bugs.
But beyond those tests, I have indeed add some specific tests
associated to those bugs.
Thanks,
Olivier
On 09-août-11, at 23:13, Johan Alwall wrote:
> Review: Needs Information
> Hello Olivier,
>
> For the ALOHA-specific parts I don't have any opinion, there I trust
> you and Priscila. Besides that I'm happy to see that you have
> written proper tests for all new functionality. Did you also test
> the bugs that you fixed?
>
> Thanks!
> Johan
> --
> https:/
> aloha_debug_
> Your team MadDevelopers is subscribed to branch lp:~maddevelopers/
> madgraph5/
Johan Alwall (johan-alwall) : | # |
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
I discussed with Priscila, and she also approve :D
So I'm going to merge it.
Preview Diff
1 | === modified file 'aloha/__init__.py' |
2 | --- aloha/__init__.py 2010-06-09 22:12:44 +0000 |
3 | +++ aloha/__init__.py 2011-08-09 19:07:29 +0000 |
4 | @@ -0,0 +1,1 @@ |
5 | +#depth = 0 # for debug |
6 | \ No newline at end of file |
7 | |
8 | === modified file 'aloha/aloha_lib.py' |
9 | --- aloha/aloha_lib.py 2011-03-21 16:10:45 +0000 |
10 | +++ aloha/aloha_lib.py 2011-08-09 19:07:29 +0000 |
11 | @@ -264,7 +264,8 @@ |
12 | new = self[0].expand() |
13 | for item in self[1:]: |
14 | obj = item.expand() |
15 | - new += obj |
16 | + new += obj |
17 | + |
18 | return new |
19 | |
20 | |
21 | @@ -421,6 +422,7 @@ |
22 | maxvar = maxvar.__class__(maxvar.variable) |
23 | if max <= 1: |
24 | #no factorization possible |
25 | + #aloha.depth -=1 |
26 | return self |
27 | else: |
28 | # split in MAXVAR * NEWADD + CONSTANT |
29 | @@ -430,6 +432,7 @@ |
30 | #fill NEWADD and CONSTANT |
31 | for term in self: |
32 | if maxvar == term: |
33 | + term = term.copy() |
34 | term.power -= 1 |
35 | if term.power: |
36 | newadd.append(term.simplify()) |
37 | @@ -453,15 +456,21 @@ |
38 | constant.append(term) |
39 | |
40 | #factorize the result |
41 | - if len(newadd) > 1: |
42 | + try: |
43 | + cur_len = len(newadd) |
44 | + except: |
45 | + cur_len = 0 |
46 | + if cur_len > 1: |
47 | try: |
48 | newadd = newadd.factorize() |
49 | - except: |
50 | - raise Exception('fail to factorize') |
51 | + except Exception, error: |
52 | + raise |
53 | + #raise Exception('fail to factorize: %s' % error) |
54 | else: |
55 | #take away the useless AddVariable to going back to a Variable class |
56 | newadd = newadd[0] |
57 | |
58 | + |
59 | # recombine the factor. First ensure that the power of the object is |
60 | #one. Then recombine |
61 | if maxvar.power > 1: |
62 | @@ -484,10 +493,11 @@ |
63 | if constant: |
64 | constant = constant.factorize() |
65 | #aloha.depth -=1 |
66 | - #print ' ' * 4 * aloha.depth + 'return', AddVariable([newadd, constant]) |
67 | + # ' ' * 4 * aloha.depth + 'return', AddVariable([newadd, constant]) |
68 | return AddVariable([newadd, constant]) |
69 | else: |
70 | if constant.vartype == 5 and constant != 0: |
71 | + #aloha.depth -=1 |
72 | return AddVariable([newadd, constant]) |
73 | #aloha.depth -=1 |
74 | #print ' ' * 4 * aloha.depth + 'return:', newadd |
75 | @@ -824,7 +834,10 @@ |
76 | |
77 | def __eq__(self, obj): |
78 | """ identical if the variable is the same """ |
79 | - return not obj.vartype and self.variable == obj.variable |
80 | + if hasattr(obj,'vartype'): |
81 | + return not obj.vartype and self.variable == obj.variable |
82 | + else: |
83 | + return False |
84 | |
85 | def __str__(self): |
86 | text = '' |
87 | @@ -918,7 +931,7 @@ |
88 | """ expand each part of the product and combine them. |
89 | Try to use a smart order in order to minimize the number of uncontracted indices. |
90 | """ |
91 | - |
92 | + |
93 | self.unused = self[:] # list of not expanded |
94 | # made in a list the intersting starting point for the computation |
95 | basic_end_point = [var for var in self if var.contract_first] |
96 | @@ -927,7 +940,6 @@ |
97 | |
98 | while self.unused: |
99 | #Loop untill we have expand everything |
100 | - |
101 | if not current: |
102 | # First we need to have a starting point |
103 | try: |
104 | @@ -1196,9 +1208,16 @@ |
105 | return self.representation |
106 | else: |
107 | return self.prefactor * self.representation |
108 | - else: |
109 | - # not possible to have power beyon 2 |
110 | + elif self.power == 2: |
111 | + # not possible to have power beyon 2 except for scalar object |
112 | return self.prefactor * self.representation * self.representation |
113 | + else: |
114 | + assert self.lorentz_ind == self.spin_ind == [] |
115 | + name = self.representation.get_rep([0]).variable |
116 | + new = ScalarVariable(name, prefactor=self.prefactor, |
117 | + power=self.power) |
118 | + return LorentzObjectRepresentation( |
119 | + new, self.lorentz_ind, self.spin_ind) |
120 | |
121 | def create_representation(self): |
122 | raise self.VariableError("This Object %s doesn't have define representation" % self.__class__.__name__) |
123 | @@ -1298,7 +1317,6 @@ |
124 | def __add__(self, obj, fact=1): |
125 | assert(obj.vartype == 4 == self.vartype) # are LorentzObjectRepresentation |
126 | |
127 | - |
128 | if self.lorentz_ind != obj.lorentz_ind or self.spin_ind != obj.spin_ind: |
129 | # if the order of indices are different compute a mapping |
130 | switch_order = [] |
131 | @@ -1316,7 +1334,7 @@ |
132 | index = obj.spin_ind.index(value) |
133 | except: |
134 | raise self.LorentzObjectRepresentationError("Invalid" + \ |
135 | - "addition. Object doen't have the same indices") |
136 | + "addition. Object doen't have the same indices %s != %s" % (self.spin_ind, obj.spin_ind) ) |
137 | else: |
138 | switch_order.append(self.nb_lor + index) |
139 | switch = lambda ind : tuple([ind[switch_order[i]] for i in range(len(ind))]) |
140 | @@ -1324,20 +1342,24 @@ |
141 | # no mapping needed (define switch as identity) |
142 | switch = lambda ind : (ind) |
143 | |
144 | - assert tuple(self.lorentz_ind) == tuple(switch(obj.lorentz_ind)), '%s!=%s' % (self.lorentz_ind, switch(obj.lorentz_ind)) |
145 | - |
146 | + |
147 | + assert tuple(self.lorentz_ind+self.spin_ind) == tuple(switch(obj.lorentz_ind+obj.spin_ind)), '%s!=%s' % (self.lorentz_ind+self.spin_ind, switch(obj.lorentz_ind+self.spin_ind)) |
148 | + assert tuple(self.lorentz_ind) == tuple(switch(obj.lorentz_ind)), '%s!=%s' % (tuple(self.lorentz_ind), switch(obj.lorentz_ind)) |
149 | + |
150 | # define an empty representation |
151 | - new = LorentzObjectRepresentation({}, obj.lorentz_ind, self.spin_ind) |
152 | + new = LorentzObjectRepresentation({}, obj.lorentz_ind, obj.spin_ind) |
153 | |
154 | # loop over all indices and fullfill the new object |
155 | if fact == 1: |
156 | for ind in self.listindices(): |
157 | value = obj.get_rep(ind) + self.get_rep(switch(ind)) |
158 | + #value = self.get_rep(ind) + obj.get_rep(switch(ind)) |
159 | new.set_rep(ind, value) |
160 | else: |
161 | for ind in self.listindices(): |
162 | #permute index for the second object |
163 | value = self.get_rep(switch(ind)) + fact * obj.get_rep(ind) |
164 | + #value = fact * obj.get_rep(switch(ind)) + self.get_rep(ind) |
165 | new.set_rep(ind, value) |
166 | |
167 | return new |
168 | |
169 | === modified file 'aloha/aloha_object.py' |
170 | --- aloha/aloha_object.py 2011-03-17 10:52:14 +0000 |
171 | +++ aloha/aloha_object.py 2011-08-09 19:07:29 +0000 |
172 | @@ -59,6 +59,44 @@ |
173 | self.lorentz_ind, []) |
174 | |
175 | #=============================================================================== |
176 | +# Pslash |
177 | +#=============================================================================== |
178 | +class PSlash(aloha_lib.LorentzObject): |
179 | + """ Gamma Matrices """ |
180 | + |
181 | + #gamma0 = [[0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0]] |
182 | + #gamma1 = [[0, 0, 0, 1], [0, 0, 1, 0], [0, -1, 0, 0], [-1, 0, 0, 0]] |
183 | + #gamma2 = [[0, 0, 0, -complex(0,1)],[0, 0, complex(0,1), 0], |
184 | + # [0, complex(0,1), 0, 0], [-complex(0,1), 0, 0, 0]] |
185 | + #gamma3 = [[0, 0, 1, 0], [0, 0, 0, -1], [-1, 0, 0, 0], [0, 1, 0, 0]] |
186 | + # |
187 | + #gamma = [gamma0, gamma1, gamma2, gamma3] |
188 | + |
189 | + def __init__(self, spin1, spin2, particle, prefactor=1): |
190 | + |
191 | + self.particle = particle |
192 | + aloha_lib.LorentzObject.__init__(self,[], [spin1, spin2], \ |
193 | + prefactor=prefactor) |
194 | + |
195 | + def create_representation(self): |
196 | + """create representation""" |
197 | + p0 = aloha_lib.ScalarVariable('P%s_0' % self.particle) |
198 | + p1 = aloha_lib.ScalarVariable('P%s_1' % self.particle) |
199 | + p2 = aloha_lib.ScalarVariable('P%s_2' % self.particle) |
200 | + p3 = aloha_lib.ScalarVariable('P%s_3' % self.particle) |
201 | + |
202 | + |
203 | + gamma = { |
204 | + (0, 0): 0, (0, 1): 0, (0, 2): p0-p3, (0, 3): -1*p1+1j*p2, |
205 | + (1, 0): 0, (1, 1): 0, (1, 2): -1*p1-1j*p2, (1, 3): p0+p3, |
206 | + (2, 0): p0+p3, (2, 1): p1-1j*p2, (2, 2): 0, (2, 3): 0, |
207 | + (3, 0): p1+1j*p2, (3, 1): p0-p3, (3, 2): 0, (3, 3): 0} |
208 | + |
209 | + |
210 | + self.representation = aloha_lib.LorentzObjectRepresentation(gamma, |
211 | + self.lorentz_ind,self.spin_ind) |
212 | + |
213 | +#=============================================================================== |
214 | # Mass |
215 | #=============================================================================== |
216 | class Mass(aloha_lib.LorentzObject): |
217 | @@ -180,7 +218,52 @@ |
218 | {(0,): self.sub0, (1,): self.sub1, \ |
219 | (2,): self.sub2, (3,): self.sub3}, |
220 | self.lorentz_ind, []) |
221 | - |
222 | + |
223 | +#=============================================================================== |
224 | +# Spin3/2 |
225 | +#=============================================================================== |
226 | +class Spin2(aloha_lib.LorentzObject): |
227 | + """ Helas Object for a Spin2""" |
228 | + |
229 | + def __init__(self, lorentz, spin, particle, prefactor=1): |
230 | + |
231 | + self.particle = particle |
232 | + |
233 | + aloha_lib.LorentzObject.__init__(self, [lorentz], [spin], \ |
234 | + prefactor=prefactor) |
235 | + |
236 | + def create_representation(self): |
237 | + |
238 | + self.sub00 = aloha_lib.ScalarVariable('R%s_1' % self.particle) |
239 | + self.sub01 = aloha_lib.ScalarVariable('R%s_2' % self.particle) |
240 | + self.sub02 = aloha_lib.ScalarVariable('R%s_3' % self.particle) |
241 | + self.sub03 = aloha_lib.ScalarVariable('R%s_4' % self.particle) |
242 | + |
243 | + self.sub10 = aloha_lib.ScalarVariable('R%s_5' % self.particle) |
244 | + self.sub11 = aloha_lib.ScalarVariable('R%s_6' % self.particle) |
245 | + self.sub12 = aloha_lib.ScalarVariable('R%s_7' % self.particle) |
246 | + self.sub13 = aloha_lib.ScalarVariable('R%s_8' % self.particle) |
247 | + |
248 | + self.sub20 = aloha_lib.ScalarVariable('R%s_9' % self.particle) |
249 | + self.sub21 = aloha_lib.ScalarVariable('R%s_10' % self.particle) |
250 | + self.sub22 = aloha_lib.ScalarVariable('R%s_11' % self.particle) |
251 | + self.sub23 = aloha_lib.ScalarVariable('R%s_12' % self.particle) |
252 | + |
253 | + self.sub30 = aloha_lib.ScalarVariable('R%s_13' % self.particle) |
254 | + self.sub31 = aloha_lib.ScalarVariable('R%s_14' % self.particle) |
255 | + self.sub32 = aloha_lib.ScalarVariable('R%s_15' % self.particle) |
256 | + self.sub33 = aloha_lib.ScalarVariable('R%s_16' % self.particle) |
257 | + |
258 | + rep = {(0,0): self.sub00, (0,1): self.sub01, (0,2): self.sub02, (0,3): self.sub03, |
259 | + (1,0): self.sub10, (1,1): self.sub11, (1,2): self.sub12, (1,3): self.sub13, |
260 | + (2,0): self.sub20, (2,1): self.sub21, (2,2): self.sub22, (2,3): self.sub23, |
261 | + (3,0): self.sub30, (3,1): self.sub31, (3,2): self.sub32, (3,3): self.sub33} |
262 | + |
263 | + |
264 | + self.representation= aloha_lib.LorentzObjectRepresentation( rep, \ |
265 | + self.lorentz_ind, self.spin_ind) |
266 | + |
267 | + |
268 | #=============================================================================== |
269 | # Spin2 |
270 | #=============================================================================== |
271 | @@ -279,7 +362,9 @@ |
272 | # Sigma |
273 | #=============================================================================== |
274 | class Sigma(aloha_lib.LorentzObject): |
275 | - """ Gamma Matrices """ |
276 | + """ Sigma Matrices """ |
277 | + |
278 | + |
279 | |
280 | #zero = [[0,0,0,0]]*4 |
281 | #i = complex(0,1) |
282 | @@ -303,69 +388,69 @@ |
283 | # [inv(sigma02), inv(sigma12), zero, sigma23],\ |
284 | # [inv(sigma03), inv(sigma13), inv(sigma23), zero]] |
285 | |
286 | - sigma={(0, 2, 0, 1): -1, (3, 1, 2, 0): 0, (3, 2, 3, 1): 0, (1, 3, 1, 3): 0, |
287 | - (2, 3, 3, 2): 1, (2, 1, 3, 1): 0, (0, 2, 2, 1): 0, (3, 1, 0, 0): 0, |
288 | + sigma={(0, 2, 0, 1): -0.5, (3, 1, 2, 0): 0, (3, 2, 3, 1): 0, (1, 3, 1, 3): 0, |
289 | + (2, 3, 3, 2): 0.5, (2, 1, 3, 1): 0, (0, 2, 2, 1): 0, (3, 1, 0, 0): 0, |
290 | (2, 3, 3, 1): 0, (3, 3, 1, 2): 0, (3, 1, 0, 3): 0, (1, 1, 0, 3): 0, |
291 | - (0, 1, 2, 2): 0, (3, 2, 3, 2): -1, (2, 1, 0, 1): 0, (3, 3, 3, 3): 0, |
292 | + (0, 1, 2, 2): 0, (3, 2, 3, 2): -0.5, (2, 1, 0, 1): 0, (3, 3, 3, 3): 0, |
293 | (1, 1, 2, 2): 0, (2, 2, 3, 2): 0, (2, 1, 2, 1): 0, (0, 1, 0, 3): 0, |
294 | - (2, 1, 2, 2): -1, (1, 2, 2, 1): 0, (2, 2, 1, 3): 0, (0, 3, 1, 3): 0, |
295 | + (2, 1, 2, 2): -0.5, (1, 2, 2, 1): 0, (2, 2, 1, 3): 0, (0, 3, 1, 3): 0, |
296 | (3, 0, 3, 2): 0, (1, 2, 0, 1): 0, (3, 0, 3, 1): 0, (0, 0, 2, 2): 0, |
297 | (1, 2, 0, 2): 0, (2, 0, 0, 3): 0, (0, 0, 2, 1): 0, (0, 3, 3, 2): 0, |
298 | - (3, 0, 1, 1): -1j, (3, 2, 0, 1): -1, (1, 0, 1, 0): 1j, (0, 0, 0, 1): 0, |
299 | - (0, 2, 1, 1): 0, (3, 1, 3, 2): 1j, (3, 2, 2, 1): 0, (1, 3, 2, 3): 1j, |
300 | + (3, 0, 1, 1): -0.5j, (3, 2, 0, 1): -0.5, (1, 0, 1, 0): 0.5j, (0, 0, 0, 1): 0, |
301 | + (0, 2, 1, 1): 0, (3, 1, 3, 2): 0.5j, (3, 2, 2, 1): 0, (1, 3, 2, 3): 0.5j, |
302 | (1, 0, 3, 0): 0, (3, 2, 2, 2): 0, (0, 2, 3, 1): 0, (1, 0, 3, 3): 0, |
303 | - (2, 3, 2, 1): 0, (0, 2, 3, 2): -1, (3, 1, 1, 3): 0, (1, 1, 1, 3): 0, |
304 | - (1, 3, 0, 2): 0, (2, 3, 0, 1): 1, (1, 1, 1, 0): 0, (2, 3, 0, 2): 0, |
305 | + (2, 3, 2, 1): 0, (0, 2, 3, 2): -0.5, (3, 1, 1, 3): 0, (1, 1, 1, 3): 0, |
306 | + (1, 3, 0, 2): 0, (2, 3, 0, 1): 0.5, (1, 1, 1, 0): 0, (2, 3, 0, 2): 0, |
307 | (3, 3, 0, 3): 0, (1, 1, 3, 0): 0, (0, 1, 3, 3): 0, (2, 2, 0, 1): 0, |
308 | - (2, 1, 1, 0): 0, (3, 3, 2, 2): 0, (2, 3, 1, 0): 1, (2, 2, 2, 3): 0, |
309 | - (0, 3, 0, 3): 0, (0, 1, 1, 2): 0, (0, 3, 0, 0): -1j, (2, 3, 1, 1): 0, |
310 | + (2, 1, 1, 0): 0, (3, 3, 2, 2): 0, (2, 3, 1, 0): 0.5, (2, 2, 2, 3): 0, |
311 | + (0, 3, 0, 3): 0, (0, 1, 1, 2): 0, (0, 3, 0, 0): -0.5j, (2, 3, 1, 1): 0, |
312 | (1, 2, 3, 0): 0, (2, 0, 1, 3): 0, (0, 0, 3, 1): 0, (0, 3, 2, 0): 0, |
313 | - (2, 3, 1, 2): 0, (2, 0, 1, 0): -1, (1, 2, 1, 0): 0, (3, 0, 0, 2): 0, |
314 | + (2, 3, 1, 2): 0, (2, 0, 1, 0): -0.5, (1, 2, 1, 0): 0, (3, 0, 0, 2): 0, |
315 | (1, 0, 0, 2): 0, (0, 0, 1, 1): 0, (1, 2, 1, 3): 0, (2, 3, 1, 3): 0, |
316 | - (2, 0, 3, 0): 0, (0, 0, 1, 2): 0, (1, 3, 3, 3): 0, (3, 2, 1, 0): -1, |
317 | - (1, 3, 3, 0): 0, (1, 0, 2, 3): -1j, (0, 2, 0, 0): 0, (3, 1, 2, 3): -1j, |
318 | - (3, 2, 3, 0): 0, (1, 3, 1, 0): -1j, (3, 2, 3, 3): 0, (0, 2, 2, 0): 0, |
319 | - (2, 3, 3, 0): 0, (3, 3, 1, 3): 0, (0, 2, 2, 3): 1, (3, 1, 0, 2): 0, |
320 | - (1, 1, 0, 2): 0, (3, 3, 1, 0): 0, (0, 1, 2, 3): 1j, (1, 1, 0, 1): 0, |
321 | + (2, 0, 3, 0): 0, (0, 0, 1, 2): 0, (1, 3, 3, 3): 0, (3, 2, 1, 0): -0.5, |
322 | + (1, 3, 3, 0): 0, (1, 0, 2, 3): -0.5j, (0, 2, 0, 0): 0, (3, 1, 2, 3): -0.5j, |
323 | + (3, 2, 3, 0): 0, (1, 3, 1, 0): -0.5j, (3, 2, 3, 3): 0, (0, 2, 2, 0): 0, |
324 | + (2, 3, 3, 0): 0, (3, 3, 1, 3): 0, (0, 2, 2, 3): 0.5, (3, 1, 0, 2): 0, |
325 | + (1, 1, 0, 2): 0, (3, 3, 1, 0): 0, (0, 1, 2, 3): 0.5j, (1, 1, 0, 1): 0, |
326 | (2, 1, 0, 2): 0, (0, 1, 2, 0): 0, (3, 3, 3, 0): 0, (1, 1, 2, 1): 0, |
327 | (2, 2, 3, 3): 0, (0, 1, 0, 0): 0, (2, 2, 3, 0): 0, (2, 1, 2, 3): 0, |
328 | - (1, 2, 2, 2): 1, (2, 2, 1, 0): 0, (0, 3, 1, 2): 0, (0, 3, 1, 1): 1j, |
329 | + (1, 2, 2, 2): 0.5, (2, 2, 1, 0): 0, (0, 3, 1, 2): 0, (0, 3, 1, 1): 0.5j, |
330 | (3, 0, 3, 0): 0, (1, 2, 0, 3): 0, (2, 0, 0, 2): 0, (0, 0, 2, 0): 0, |
331 | - (0, 3, 3, 1): 0, (3, 0, 1, 0): 0, (2, 0, 0, 1): 1, (3, 2, 0, 2): 0, |
332 | + (0, 3, 3, 1): 0, (3, 0, 1, 0): 0, (2, 0, 0, 1): 0.5, (3, 2, 0, 2): 0, |
333 | (3, 0, 1, 3): 0, (1, 0, 1, 3): 0, (0, 0, 0, 0): 0, (0, 2, 1, 2): 0, |
334 | (3, 1, 3, 3): 0, (0, 0, 0, 3): 0, (1, 3, 2, 2): 0, (3, 1, 3, 0): 0, |
335 | - (3, 2, 2, 3): -1, (1, 3, 2, 1): 0, (1, 0, 3, 2): -1j, (2, 3, 2, 2): 0, |
336 | - (0, 2, 3, 3): 0, (3, 1, 1, 0): 1j, (1, 3, 0, 1): 1j, (1, 1, 1, 1): 0, |
337 | + (3, 2, 2, 3): -0.5, (1, 3, 2, 1): 0, (1, 0, 3, 2): -0.5j, (2, 3, 2, 2): 0, |
338 | + (0, 2, 3, 3): 0, (3, 1, 1, 0): 0.5j, (1, 3, 0, 1): 0.5j, (1, 1, 1, 1): 0, |
339 | (2, 1, 3, 2): 0, (2, 3, 0, 3): 0, (3, 3, 0, 2): 0, (1, 1, 3, 1): 0, |
340 | - (3, 3, 0, 1): 0, (2, 1, 3, 3): 1, (0, 1, 3, 2): 1j, (1, 1, 3, 2): 0, |
341 | + (3, 3, 0, 1): 0, (2, 1, 3, 3): 0.5, (0, 1, 3, 2): 0.5j, (1, 1, 3, 2): 0, |
342 | (2, 1, 1, 3): 0, (3, 0, 2, 1): 0, (0, 1, 3, 1): 0, (3, 3, 2, 1): 0, |
343 | (2, 2, 2, 2): 0, (0, 1, 1, 1): 0, (2, 2, 2, 1): 0, (0, 3, 0, 1): 0, |
344 | - (3, 0, 2, 2): -1j, (1, 2, 3, 3): -1, (0, 0, 3, 2): 0, (0, 3, 2, 1): 0, |
345 | - (2, 0, 1, 1): 0, (2, 2, 0, 0): 0, (0, 3, 2, 2): 1j, (3, 0, 0, 3): 0, |
346 | + (3, 0, 2, 2): -0.5j, (1, 2, 3, 3): -0.5, (0, 0, 3, 2): 0, (0, 3, 2, 1): 0, |
347 | + (2, 0, 1, 1): 0, (2, 2, 0, 0): 0, (0, 3, 2, 2): 0.5j, (3, 0, 0, 3): 0, |
348 | (1, 0, 0, 3): 0, (1, 2, 1, 2): 0, (2, 0, 3, 1): 0, (1, 0, 0, 0): 0, |
349 | - (0, 0, 1, 3): 0, (2, 0, 3, 2): 1, (3, 2, 1, 3): 0, (1, 3, 3, 1): 0, |
350 | + (0, 0, 1, 3): 0, (2, 0, 3, 2): 0.5, (3, 2, 1, 3): 0, (1, 3, 3, 1): 0, |
351 | (1, 0, 2, 0): 0, (2, 2, 0, 2): 0, (0, 2, 0, 3): 0, (3, 1, 2, 2): 0, |
352 | (1, 3, 1, 1): 0, (3, 1, 2, 1): 0, (2, 2, 0, 3): 0, (3, 0, 0, 1): 0, |
353 | - (1, 3, 1, 2): 0, (2, 3, 3, 3): 0, (0, 2, 2, 2): 0, (3, 1, 0, 1): -1j, |
354 | + (1, 3, 1, 2): 0, (2, 3, 3, 3): 0, (0, 2, 2, 2): 0, (3, 1, 0, 1): -0.5j, |
355 | (3, 3, 1, 1): 0, (1, 1, 0, 0): 0, (2, 1, 0, 3): 0, (0, 1, 2, 1): 0, |
356 | - (3, 3, 3, 1): 0, (2, 1, 0, 0): -1, (1, 1, 2, 0): 0, (3, 3, 3, 2): 0, |
357 | - (0, 1, 0, 1): -1j, (1, 1, 2, 3): 0, (2, 2, 3, 1): 0, (2, 1, 2, 0): 0, |
358 | + (3, 3, 3, 1): 0, (2, 1, 0, 0): -0.5, (1, 1, 2, 0): 0, (3, 3, 3, 2): 0, |
359 | + (0, 1, 0, 1): -0.5j, (1, 1, 2, 3): 0, (2, 2, 3, 1): 0, (2, 1, 2, 0): 0, |
360 | (0, 1, 0, 2): 0, (1, 2, 2, 3): 0, (2, 0, 2, 1): 0, (2, 2, 1, 1): 0, |
361 | - (1, 2, 2, 0): 0, (2, 2, 1, 2): 0, (0, 3, 1, 0): 0, (3, 0, 3, 3): 1j, |
362 | - (2, 1, 3, 0): 0, (1, 2, 0, 0): 1, (0, 0, 2, 3): 0, (0, 3, 3, 0): 0, |
363 | - (2, 0, 0, 0): 0, (3, 2, 0, 3): 0, (0, 3, 3, 3): -1j, (3, 0, 1, 2): 0, |
364 | + (1, 2, 2, 0): 0, (2, 2, 1, 2): 0, (0, 3, 1, 0): 0, (3, 0, 3, 3): 0.5j, |
365 | + (2, 1, 3, 0): 0, (1, 2, 0, 0): 0.5, (0, 0, 2, 3): 0, (0, 3, 3, 0): 0, |
366 | + (2, 0, 0, 0): 0, (3, 2, 0, 3): 0, (0, 3, 3, 3): -0.5j, (3, 0, 1, 2): 0, |
367 | (1, 0, 1, 2): 0, (3, 2, 0, 0): 0, (0, 2, 1, 3): 0, (1, 0, 1, 1): 0, |
368 | - (0, 0, 0, 2): 0, (0, 2, 1, 0): 1, (3, 1, 3, 1): 0, (3, 2, 2, 0): 0, |
369 | - (1, 3, 2, 0): 0, (1, 0, 3, 1): 0, (2, 3, 2, 3): 1, (0, 2, 3, 0): 0, |
370 | + (0, 0, 0, 2): 0, (0, 2, 1, 0): 0.5, (3, 1, 3, 1): 0, (3, 2, 2, 0): 0, |
371 | + (1, 3, 2, 0): 0, (1, 0, 3, 1): 0, (2, 3, 2, 3): 0.5, (0, 2, 3, 0): 0, |
372 | (3, 1, 1, 1): 0, (2, 3, 2, 0): 0, (1, 3, 0, 0): 0, (3, 1, 1, 2): 0, |
373 | (1, 1, 1, 2): 0, (1, 3, 0, 3): 0, (2, 3, 0, 0): 0, (2, 0, 2, 0): 0, |
374 | (3, 3, 0, 0): 0, (1, 1, 3, 3): 0, (2, 1, 1, 2): 0, (0, 1, 3, 0): 0, |
375 | - (3, 3, 2, 0): 0, (2, 1, 1, 1): 1, (2, 0, 2, 2): 0, (3, 3, 2, 3): 0, |
376 | - (0, 1, 1, 0): -1j, (2, 2, 2, 0): 0, (0, 3, 0, 2): 0, (3, 0, 2, 3): 0, |
377 | - (0, 1, 1, 3): 0, (2, 0, 2, 3): -1, (1, 2, 3, 2): 0, (3, 0, 2, 0): 0, |
378 | + (3, 3, 2, 0): 0, (2, 1, 1, 1): 0.5, (2, 0, 2, 2): 0, (3, 3, 2, 3): 0, |
379 | + (0, 1, 1, 0): -0.5j, (2, 2, 2, 0): 0, (0, 3, 0, 2): 0, (3, 0, 2, 3): 0, |
380 | + (0, 1, 1, 3): 0, (2, 0, 2, 3): -0.5, (1, 2, 3, 2): 0, (3, 0, 2, 0): 0, |
381 | (0, 0, 3, 3): 0, (1, 2, 3, 1): 0, (2, 0, 1, 2): 0, (0, 0, 3, 0): 0, |
382 | - (0, 3, 2, 3): 0, (3, 0, 0, 0): 1j, (1, 2, 1, 1): -1, (1, 0, 0, 1): 1j, |
383 | - (0, 0, 1, 0): 0, (2, 0, 3, 3): 0, (3, 2, 1, 2): 0, (1, 3, 3, 2): -1j, |
384 | + (0, 3, 2, 3): 0, (3, 0, 0, 0): 0.5j, (1, 2, 1, 1): -0.5, (1, 0, 0, 1): 0.5j, |
385 | + (0, 0, 1, 0): 0, (2, 0, 3, 3): 0, (3, 2, 1, 2): 0, (1, 3, 3, 2): -0.5j, |
386 | (1, 0, 2, 1): 0, (3, 2, 1, 1): 0, (0, 2, 0, 2): 0, (1, 0, 2, 2): 0} |
387 | |
388 | def __init__(self, lorentz1, lorentz2, spin1, spin2, prefactor=1): |
389 | @@ -687,6 +772,21 @@ |
390 | VectorPropagator = lambda l1, l2, part: complex(0,1) * (-1 * Metric(l1, l2) + OverMass2(part) * \ |
391 | Metric(l1,'I3')* P('I3', part) * P(l2, part)) |
392 | |
393 | +#Spin3halfPropagator = lambda mu, nu, s1, s2, part: -1*( Gamma(-1,s1,s2)*P(-1,part) + Identity(s1,s2)*Mass(part)) * (Metric(mu,nu)-Metric(mu,'I3')*P('I3',part)*P(nu,part)*OverMass2(part)) \ |
394 | +# - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ |
395 | +# (Gamma('alpha',-2,-3) * P('alpha', part) - Identity(-2,-3) * Mass(part)) \ |
396 | +# * (Gamma(nu, -3, s2) + Identity(-3, s2) * P(nu, part) * Mass(part) * OverMass2(part) ) \ |
397 | +# -1*( Gamma(-1,s1,s2)*P(-1,part) + Identity(s1,s2)*Mass(part)) * (Metric(mu,nu)-Metric(mu,'I3')*P('I3',part)*P(nu,part)*OverMass2(part)) \ |
398 | + |
399 | +Spin3halfPropagator = lambda mu, nu, s1, s2, part: - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ |
400 | + (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \ |
401 | + ( Gamma(nu, -3, s2)+ Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) |
402 | + |
403 | +Spin3halfPropagator = lambda mu, nu, s1, s2, part: - 1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \ |
404 | + (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \ |
405 | + ( Gamma(nu, -3, s2)+ Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) |
406 | + |
407 | + |
408 | Spin2masslessPropagator = lambda mu, nu, alpha, beta: complex(0,1/2)*( Metric(mu, alpha)* Metric(nu, beta) +\ |
409 | Metric(mu, beta) * Metric(nu, alpha) - Metric(mu, nu) * Metric(alpha, beta)) |
410 | |
411 | |
412 | === removed file 'models/mssm/._.DS_Store' |
413 | Binary files models/mssm/._.DS_Store 2010-08-11 15:35:33 +0000 and models/mssm/._.DS_Store 1970-01-01 00:00:00 +0000 differ |
414 | === modified file 'tests/unit_tests/various/test_aloha.py' |
415 | --- tests/unit_tests/various/test_aloha.py 2011-07-22 12:29:10 +0000 |
416 | +++ tests/unit_tests/various/test_aloha.py 2011-08-09 19:07:29 +0000 |
417 | @@ -16,6 +16,7 @@ |
418 | the output of the Feynman Rules.""" |
419 | from __future__ import division |
420 | |
421 | +import math |
422 | import os |
423 | import time |
424 | import aloha.aloha_object as aloha_obj |
425 | @@ -25,6 +26,7 @@ |
426 | import models.sm.object_library as object_library |
427 | import tests.unit_tests as unittest |
428 | |
429 | + |
430 | class TestVariable(unittest.TestCase): |
431 | |
432 | def setUp(self): |
433 | @@ -474,7 +476,6 @@ |
434 | sum = p1 * p2 + p1 * p3 + 2 * p1 + 2 *p1 * p2 * p4 |
435 | sum = sum.factorize() |
436 | #Should return p1*(p2(2*p4 + 1) + p3 + 2) |
437 | - |
438 | self.assertEqual(sum.__class__,aloha_lib.MultVariable) |
439 | self.assertEqual(len(sum),2) |
440 | for fact in sum: |
441 | @@ -580,6 +581,32 @@ |
442 | self.assertEqual(eval(str(expr1)), value) |
443 | |
444 | |
445 | + def test_factorization5(self): |
446 | + """check that P [gamma + P/M] == (/p+M) [Onshell]""" |
447 | + |
448 | + P1_0 = aloha_lib.ScalarVariable('p1') |
449 | + P1_1 = aloha_lib.ScalarVariable('p2') |
450 | + P1_2 = aloha_lib.ScalarVariable('p3') |
451 | + P1_3 = aloha_lib.ScalarVariable('p4') |
452 | + M1 = aloha_lib.ScalarVariable('m1') |
453 | + |
454 | + p1, p2, p3, p4, m1 = 1,2,3,4,5 |
455 | + |
456 | + data = (P1_0**2 * M1 - P1_1**2 * M1 + M1) |
457 | + value = eval(str(data)) |
458 | + data2 = data.factorize() |
459 | + self.assertEqual(eval(str(data2)), value) |
460 | + |
461 | + #check that original object is still un-touched |
462 | + self.assertEqual(eval(str(data)), value) |
463 | + |
464 | + |
465 | + |
466 | + |
467 | + |
468 | + |
469 | + |
470 | + |
471 | |
472 | class TestMultVariable(unittest.TestCase): |
473 | |
474 | @@ -1245,7 +1272,96 @@ |
475 | self.assertEqual(low_level.get_rep(ind).__class__, aloha_lib.MultVariable) |
476 | self.assertEqual(low_level.get_rep(ind), aloha_lib.ScalarVariable('M3') |
477 | * aloha_lib.ScalarVariable('P2_%s' % ind[0])) |
478 | - |
479 | + |
480 | + |
481 | + def test_spin32propagator(self): |
482 | + """check various property of the spin3/2 propagator""" |
483 | + |
484 | + Metric = aloha_obj.Metric |
485 | + P = aloha_obj.P |
486 | + OM = aloha_obj.OverMass2 |
487 | + Gamma = aloha_obj.Gamma |
488 | + Identity = aloha_obj.Identity |
489 | + t = 1 |
490 | + mu, nu, s0, s1, s2 = 2,3,4,5,6 |
491 | + |
492 | + zero = P(mu,t) * aloha_obj.Spin3halfPropagator(mu,nu,s1,s2, t) |
493 | + zero = zero.expand() |
494 | + P1_0, P1_1, P1_2, P1_3 = 2,0,0,0 |
495 | + OM1 = 1/(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
496 | + M1 = math.sqrt(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
497 | + for ind in zero.listindices(): |
498 | + data = zero.get_rep(ind) |
499 | + self.assertAlmostEqual(eval(str(zero.get_rep(ind))),0) |
500 | + |
501 | + def test_mass_overmass(self): |
502 | + """check various property of the spin3/2 propagator""" |
503 | + |
504 | + Metric = aloha_obj.Metric |
505 | + P = aloha_obj.P |
506 | + OM = aloha_obj.OverMass2 |
507 | + Gamma = aloha_obj.Gamma |
508 | + Identity = aloha_obj.Identity |
509 | + Gamma = aloha_obj.Gamma |
510 | + PSlash = aloha_obj.PSlash |
511 | + Mass = aloha_obj.Mass |
512 | + OverMass2 = aloha_obj.OverMass2 |
513 | + Identity = aloha_obj.Identity |
514 | + t = 1 |
515 | + mu, nu, s0, s1, s2 = 2,3,4,5,6 |
516 | + Spin3halfPropagator = lambda nu, s1, s2, part: (P(-1,part)**2 - Mass(part)*Mass(part)) * \ |
517 | + (Mass(part) * Identity(-3, s2) ) |
518 | + |
519 | + #- 1/3 * (PSlash(s1,-2,part) + Identity(s1, -2) * Mass(part))* \ |
520 | + # (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \ |
521 | + # (P(-1,part)**2 - Mass(part)*Mass(part)) |
522 | + # (Mass(part) * Identity(-3, s2) ) |
523 | + |
524 | + zero = Spin3halfPropagator(nu,s1,s2, t) |
525 | + zero = zero.expand() |
526 | + P1_0, P1_1, P1_2, P1_3 = 2,0,0,0 |
527 | + OM1 = 1/(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
528 | + M1 = math.sqrt(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
529 | + M99 = M1 |
530 | + for ind in zero.listindices(): |
531 | + data = zero.get_rep(ind) |
532 | + self.assertAlmostEqual(eval(str(zero.get_rep(ind))),0) |
533 | + |
534 | + |
535 | + |
536 | + |
537 | + def test_part_spin32propagator(self): |
538 | + P = aloha_obj.P |
539 | + OM = aloha_obj.OverMass2 |
540 | + Gamma = aloha_obj.Gamma |
541 | + Identity = aloha_obj.Identity |
542 | + Mass = aloha_obj.Mass |
543 | + Pslash = aloha_obj.PSlash |
544 | + part = 1 |
545 | + mu, nu, s0, s1, s2,s3 = 2,3,4,5,6,7 |
546 | + |
547 | + |
548 | + paranthesis = (Gamma(mu,s1,s2) + Identity(s1, s2) * P(mu, part) * Mass(part) * OM(part)) * Gamma(nu,s2,s3) |
549 | + paranthesis = Gamma(mu,s1,s2) * Gamma(nu,s2,s3) + Identity(s1, s2) * P(mu, part) * Mass(part) * OM(part) * Gamma(nu,s2,s3) |
550 | + #paranthesis = Gamma(mu,s1,s2) * Gamma(nu,s2,s3) |
551 | + goal = (Pslash(s1,s2,part) + Mass(part) * Identity(s1,s2) ) * Gamma(nu, s2, s3) |
552 | + #goal = Pslash(s1,s2,part) * Gamma(nu, s2, s3) |
553 | + goal2= P(mu,part) * paranthesis |
554 | + goal2 = P(mu,part) * Gamma(mu,s1,s2) * Gamma(nu,s2,s3) + Identity(s1, s2) * P(mu,part) * P(mu, part) * Mass(part) * OM(part) * Gamma(nu,s2,s3) |
555 | + zero = goal2 - goal |
556 | + |
557 | + #zero = zero.simplify() |
558 | + zero=zero.expand() |
559 | + P1_0, P1_1, P1_2, P1_3 = 20,3,4,5 |
560 | + OM1 = 1/(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
561 | + M1 = math.sqrt(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
562 | + for ind in zero.listindices(): |
563 | + data = zero.get_rep(ind) |
564 | + self.assertEqual(eval(str(data)),0) |
565 | + |
566 | + |
567 | + |
568 | + |
569 | def test_spin2propagator(self): |
570 | """Check that the two definition are coherent""" |
571 | |
572 | @@ -2189,18 +2305,18 @@ |
573 | prod_gam2 = Gamma(2,1,2) * Gamma(1,2,3) |
574 | self.assertNotEqual(prod_gam, prod_gam2) |
575 | |
576 | - # Sigma_mu_nu * Sigma_mu_nu = 12* Id |
577 | + # Sigma_mu_nu * Sigma_mu_nu = 3* Id |
578 | sigma_cont = Sigma(1,2,1,2) * Sigma(1,2,2,1) |
579 | sigma_cont = sigma_cont.expand().simplify() |
580 | - self.assertEqual(sigma_cont.get_rep((0,)), 48) |
581 | + self.assertEqual(sigma_cont.get_rep((0,)), 12) |
582 | |
583 | - # Sigma_mu_nu * Gamma_nu = 3i * Gamma_nu # Trace |
584 | + # Sigma_mu_nu * Gamma_nu = 3/2i * Gamma_nu # Trace |
585 | prod = Sigma(1,2,'a','b') * Gamma(2,'b','a') |
586 | prod = prod.expand().simplify() |
587 | self.assertEqual(prod.get_rep((0,)), 0) |
588 | |
589 | - # Sigma_mu_nu * Gamma_nu = 3i * Gamma_nu # Full |
590 | - zero = Sigma(1,2,'a','b') * Gamma(2,'b','c') - complex(0,3) * Gamma(1,'a','c') |
591 | + # Sigma_mu_nu * Gamma_nu = 3/2i * Gamma_nu # Full |
592 | + zero = Sigma(1,2,'a','b') * Gamma(2,'b','c') - complex(0,3/2) * Gamma(1,'a','c') |
593 | zero = zero.expand().simplify() |
594 | for ind in zero.listindices(): |
595 | self.assertEqual(zero.get_rep(ind), 0, '%s != 0.0for %s' % \ |
596 | @@ -2231,7 +2347,44 @@ |
597 | self.assertEqual(zero.get_rep(ind), 0, '%s != 0.0for %s' % \ |
598 | (zero.get_rep(ind), ind)) |
599 | |
600 | - |
601 | + |
602 | + def test_Pslashproperty(self): |
603 | + """Test Pslash""" |
604 | + |
605 | + Gamma = aloha_obj.Gamma |
606 | + P = aloha_obj.P |
607 | + M = aloha_obj.Mass |
608 | + PSlash = aloha_obj.PSlash |
609 | + Identity = aloha_obj.Identity |
610 | + |
611 | + |
612 | + ps1 = PSlash(1,2,3).simplify().expand().simplify() |
613 | + |
614 | + ps2 = Gamma(-1,1,2) * P(-1,3) |
615 | + ps2 = ps2.simplify().expand().simplify() |
616 | + zero = ps1 - ps2 |
617 | + zero = zero.simplify() |
618 | + for ind in zero.listindices(): |
619 | + self.assertEqual(zero.get_rep(ind), 0, '%s != 0.0for %s' % \ |
620 | + (zero.get_rep(ind), ind)) |
621 | + |
622 | + |
623 | + #checking that (/p + m)(/p-m)=0 (for onshell) |
624 | + expr = (PSlash(1,2,1)+ M(1))*(PSlash(2,3,1)-M(1)) |
625 | + P1_0, P1_1, P1_2, P1_3 = 7,2,3,5 |
626 | + M1 = math.sqrt(P1_0 **2 - P1_1 **2 -P1_2 **2 -P1_3 **2) |
627 | + |
628 | + for ind in zero.listindices(): |
629 | + data = zero.get_rep(ind) |
630 | + self.assertAlmostEqual(eval(str(data)), 0) |
631 | + |
632 | + #checking that (/p + m)(/p-m)(P)=0 (for onshell) |
633 | + expr = (PSlash(1,2,1)+ M(1))*(PSlash(2,3,1)-M(1))*(Gamma(4,3,4)*Identity(3,4) * P(4,1)) |
634 | + for ind in zero.listindices(): |
635 | + data = zero.get_rep(ind) |
636 | + self.assertAlmostEqual(eval(str(data)), 0) |
637 | + |
638 | + |
639 | def testGammaAlgebraDefinition(self): |
640 | """Test the coherence between gamma/gamma5/sigma/projector""" |
641 | Gamma = aloha_obj.Gamma |
642 | @@ -2322,34 +2475,32 @@ |
643 | self.assertEqual(metric, metric2) |
644 | |
645 | |
646 | - #Sigma_mu_nu = i/2 * [Gamma_mu, Gamma_nu] |
647 | - sigma = complex(0, 1/2) * (Gamma(1,1,2)*Gamma(2,2,3) - Gamma(2,1,2)*Gamma(1,2,3)) |
648 | - |
649 | - #handly build |
650 | - sigma_2 = aloha_lib.LorentzObjectRepresentation({},[2,1],[3,1]) |
651 | - prod_gam = Gamma(1,1,2) * Gamma(2,2,3) |
652 | - prod_gam = prod_gam.expand().simplify() |
653 | - for ind in prod_gam.listindices(): |
654 | - if ind[0] == ind[1]: |
655 | - sigma_2.set_rep(ind, 0) |
656 | - else: |
657 | - value = complex(0, 1)* (prod_gam.get_rep(ind)) |
658 | - sigma_2.set_rep(ind, value) |
659 | - |
660 | - sigma_3 = Sigma(1,2,1,3) |
661 | - diff1 = sigma - sigma_3 |
662 | - diff1 = diff1.simplify() |
663 | - diff1 = diff1.expand() |
664 | - diff1 = diff1.simplify() |
665 | - |
666 | - for ind in diff1.listindices(): |
667 | - self.assertEqual(diff1.get_rep(ind), 0) |
668 | - |
669 | - diff1 = sigma.expand() + -1 * sigma_2 |
670 | - diff1 = diff1.simplify() |
671 | - for ind in diff1.listindices(): |
672 | - self.assertEqual(diff1.get_rep(ind), 0, 'not zero %s for %s' |
673 | - % (diff1.get_rep(ind),ind )) |
674 | + |
675 | + sigma = complex(0, 1/4) * (Gamma(1,3,2)*Gamma(2,2,1) - Gamma(2,3,2)*Gamma(1,2,1)) |
676 | + sigma2 = sigma.expand() |
677 | + |
678 | + zero = Sigma(1,2,3,1) - sigma |
679 | + zero = zero.expand() |
680 | + for ind in zero.listindices(): |
681 | + self.assertEqual(zero.get_rep(ind), 0) |
682 | + |
683 | + mu, nu, rho, sigma = 1,2,3,4 |
684 | + commutator = Sigma(mu,nu,1,2) * Sigma(rho, sigma,2,3) - Sigma(rho,sigma,1,2) * Sigma(mu, nu,2,3) |
685 | + algebra = -1j * Metric(mu,rho) * Sigma(nu,sigma,1,3) + \ |
686 | + 1j * Metric(nu,rho) * Sigma(mu,sigma,1,3) + \ |
687 | + -1j * Metric(nu,sigma) * Sigma(mu,rho,1,3) + \ |
688 | + 1j * Metric(mu,sigma) * Sigma(nu,rho,1,3) |
689 | + |
690 | + zero = commutator - algebra |
691 | + zero = zero.simplify().expand().simplify() |
692 | + for ind in zero.listindices(): |
693 | + self.assertEqual(zero.get_rep(ind), 0) |
694 | + |
695 | + |
696 | + |
697 | + |
698 | + |
699 | + |
700 | |
701 | # def test_Spin2Contraction(self): |
702 | # """check spin2 contraction""" |
Hello Olivier,
For the ALOHA-specific parts I don't have any opinion, there I trust you and Priscila. Besides that I'm happy to see that you have written proper tests for all new functionality. Did you also test the bugs that you fixed?
Thanks!
Johan