Merge lp:~maddevelopers/mg5amcnlo/new_diagram_symmetry into lp:~madteam/mg5amcnlo/trunk
- new_diagram_symmetry
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 117 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/new_diagram_symmetry |
Merge into: | lp:~madteam/mg5amcnlo/trunk |
Diff against target: |
224 lines (+125/-11) 6 files modified
UpdateNotes.txt (+5/-2) madgraph/VERSION (+1/-1) madgraph/core/diagram_generation.py (+8/-3) madgraph/interface/launch_ext_program.py (+1/-1) madgraph/various/process_checks.py (+4/-4) tests/unit_tests/core/test_diagram_generation.py (+106/-0) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/new_diagram_symmetry |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Mattelaer | Approve | ||
Tim Stelzer | Pending | ||
Review via email: mp+59119@code.launchpad.net |
Commit message
Description of the change
- Created a fast diagram tag which uniquely identifies a diagram up to permutations of external legs, and replaced the slow MG4-style diagram symmetry by a symmetry determination based on this tag.
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Thanks for your review as usual!
> 1) at line 147 of diagram_
> they are a line:
> except TimeOutError:
> I didn't see any way to pass in that position.
This is just left by mistake - since the time is no longer an issue, I
meant to completely remove the timeout.
> 2) I was very disturbed about the functions:
> add_link and add_vertex_id
> a) Why are they class_method? (static_
> b) I would prefer the names get_link and get_vertex_id (they didn't add anything to anything, this associate that they are class method is very disturbing)
> c) Do you really nedd a function add_vertex_id. Using that function is longuer than calling directly vertex.get('id').
The point of this is that the DiagramTag is completely general, and
can be used for many different types of diagram identifications, with
different properties (e.g., identifying matrix elements or color
flows). The most natural way to accomplish this is to create a
daughter class, which overrides only these functions. So it's
necessary to have them as classfunctions. I'd be happy to change the
names to get_link and get_vertex_id.
> 3) DiagramTagChain
> Could you put here comment on what are the argument of the __init__
> especially the end_chain that I didn't understand.
> All that class is very hard to read, so may be good to add comment in it.
> But add those in the init, may clarify enough the situation. So I propose that you add those comment, and then I will re-review this part.
Ok I will do.
> This is not implemented, is it?
Color ordered flows are not implemented at all in this version, so the
answer is of course not.
Many thanks!
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Hi Johan,
> > 2) I was very disturbed about the functions:
> > add_link and add_vertex_id
> > a) Why are they class_method? (static_
> this case)
> > b) I would prefer the names get_link and get_vertex_id (they didn't add
> anything to anything, this associate that they are class method is very
> disturbing)
> > c) Do you really nedd a function add_vertex_id. Using that function is
> longuer than calling directly vertex.get('id').
>
> The point of this is that the DiagramTag is completely general, and
> can be used for many different types of diagram identifications, with
> different properties (e.g., identifying matrix elements or color
> flows). The most natural way to accomplish this is to create a
> daughter class, which overrides only these functions. So it's
> necessary to have them as classfunctions. I'd be happy to change the
> names to get_link and get_vertex_id.
Ok that's fine to have a dedicated function then. But I still don't understand
why to make it as a classmethod, while they are no reference at all to the class attribute.
Thanks,
Olivier
- 119. By Johan Alwall
-
Merged with remove_
vertex_ in_diagram_ generation branch - 120. By Johan Alwall
-
Facilitated reading the DiagramTag and DiagramTagChainLink classes
Johan Alwall (johan-alwall) wrote : | # |
Hello Olivier,
Thanks again for your review. I have updated the classes with more describing names and better comments. Please let me know if you like it the way it is now.
Many thanks,
Johan
- 121. By Johan Alwall
-
Removed symmetry_max_time in the config file (from previous merge)
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Thanks Johan,
this is much more readable now.
but please remove the
@classmethod
They are just pointless and confusing.
Johan Alwall (johan-alwall) wrote : | # |
Ok I replaced with staticmethod.
Cheers,
Johan
Olivier Mattelaer (olivier-mattelaer) wrote : | # |
Ok perfect!!
Thanks,
Olivier
- 122. By Olivier Mattelaer
-
debug id=0 in case of more than one interactions for a given vertex.
- 123. By Olivier Mattelaer
-
solve a definition problem with check gauge
- 124. By Olivier Mattelaer
-
merge with Johan modification.
- 125. By Olivier Mattelaer
-
update Date/Version
- 126. By Olivier Mattelaer
-
nicer way to dealt with the multiple interactions problem when we remover id=0
- 127. By Johan Alwall
-
Added test for multiple interactions for the same particles
Preview Diff
1 | === modified file 'UpdateNotes.txt' |
2 | --- UpdateNotes.txt 2011-05-03 02:10:43 +0000 |
3 | +++ UpdateNotes.txt 2011-05-03 19:31:13 +0000 |
4 | @@ -1,8 +1,9 @@ |
5 | Update notes for MadGraph 5 (in reverse time order) |
6 | |
7 | -1.1.1 (02/05/11): JA: Replaced (slow) diagram symmetry determination by |
8 | + |
9 | +1.1.1 (03/05/11): JA: Replaced (slow) diagram symmetry determination by |
10 | evaluation with fast identification based on diagram tags. |
11 | - JA: Replacing the "p=-p" id=0 vertex produced by diagram |
12 | + JA+OM: Replacing the "p=-p" id=0 vertex produced by diagram |
13 | generation algorithm already in the diagram generation, |
14 | simplifying drawing, helas objects and color. |
15 | JA: Fixed compiler warnings for unary operator. |
16 | @@ -10,6 +11,8 @@ |
17 | (needed for NLO implementations). |
18 | OM: Improved and more elegant "open" implementation for |
19 | the user interface. |
20 | + OM: minor fixes related to checking the gauge |
21 | + |
22 | 1.1.0 (21/04/11): JA: Removed hard limit on number of external particles in |
23 | MadEvent, allowing for unlimited length decay chains there |
24 | (up to 14 final state particles successfully integrated). |
25 | |
26 | === modified file 'madgraph/VERSION' |
27 | --- madgraph/VERSION 2011-05-03 02:10:43 +0000 |
28 | +++ madgraph/VERSION 2011-05-03 19:31:13 +0000 |
29 | @@ -1,2 +1,2 @@ |
30 | version = 1.1.1 |
31 | -date = 2011-05-02 |
32 | +date = 2011-05-03 |
33 | |
34 | === modified file 'madgraph/core/diagram_generation.py' |
35 | --- madgraph/core/diagram_generation.py 2011-04-25 23:41:00 +0000 |
36 | +++ madgraph/core/diagram_generation.py 2011-05-03 19:31:13 +0000 |
37 | @@ -345,14 +345,19 @@ |
38 | # vertex, by replacing the (incoming) last leg of the |
39 | # next-to-last vertex with the (outgoing) leg in the |
40 | # last vertex |
41 | + vertices = copy.copy(vertices) |
42 | lastvx = vertices.pop() |
43 | - nexttolastvertex = vertices[-1] |
44 | - legs = nexttolastvertex.get('legs') |
45 | + nexttolastvertex = copy.copy(vertices.pop()) |
46 | + legs = copy.copy(nexttolastvertex.get('legs')) |
47 | ntlnumber = legs[-1].get('number') |
48 | lastleg = filter(lambda leg: leg.get('number') != ntlnumber, |
49 | lastvx.get('legs'))[0] |
50 | # Replace the last leg of nexttolastvertex |
51 | legs[-1] = lastleg |
52 | + nexttolastvertex.set('legs', legs) |
53 | + vertices.append(nexttolastvertex) |
54 | + diagram.set('vertices', vertices) |
55 | + |
56 | if res: |
57 | logger.info("Process has %d diagrams" % len(res)) |
58 | |
59 | @@ -389,7 +394,7 @@ |
60 | # Special treatment for decay chain legs |
61 | |
62 | if curr_leglist.can_combine_to_0(ref_dict_to0, is_decay_proc): |
63 | - # Extract the interaction id associated to the vertex |
64 | + # Extract the interaction idassociated to the vertex |
65 | vertex_ids = self.get_combined_vertices(curr_leglist, |
66 | copy.copy(ref_dict_to0[tuple(sorted([leg.get('id') for \ |
67 | leg in curr_leglist]))])) |
68 | |
69 | === modified file 'madgraph/interface/launch_ext_program.py' |
70 | --- madgraph/interface/launch_ext_program.py 2011-04-30 02:06:00 +0000 |
71 | +++ madgraph/interface/launch_ext_program.py 2011-05-03 19:31:13 +0000 |
72 | @@ -467,7 +467,7 @@ |
73 | #suitable for LINUX which doesn't have open command. |
74 | |
75 | # first for eps_viewer |
76 | - if not eps_viewer: |
77 | + if not cls.eps_viewer: |
78 | cls.eps_viewer = cls.find_valid(['gv', 'ggv', 'evince'], 'eps viewer') |
79 | |
80 | # Second for web browser |
81 | |
82 | === modified file 'madgraph/various/process_checks.py' |
83 | --- madgraph/various/process_checks.py 2011-04-15 04:15:48 +0000 |
84 | +++ madgraph/various/process_checks.py 2011-05-03 19:31:13 +0000 |
85 | @@ -90,8 +90,8 @@ |
86 | #=============================================================================== |
87 | # Helper function evaluate_matrix_element |
88 | #=============================================================================== |
89 | - def evaluate_matrix_element(self, matrix_element, p = None, full_model = None, |
90 | - gauge_check = False, auth_skipping = None, output='m2'): |
91 | + def evaluate_matrix_element(self, matrix_element, p=None, full_model=None, |
92 | + gauge_check=False, auth_skipping=None, output='m2'): |
93 | """Calculate the matrix element and evaluate it for a phase space point |
94 | output is either m2, amp, jamp |
95 | """ |
96 | @@ -669,9 +669,9 @@ |
97 | auth_skipping = True, reuse = False) |
98 | |
99 | # Set all widths to zero for gauge check |
100 | - for particle in full_model.get('particles'): |
101 | + for particle in evaluator.full_model.get('particles'): |
102 | if particle.get('width') != 'ZERO': |
103 | - full_model.get('parameter_dict')[particle.get('width')] = 0. |
104 | + evaluator.full_model.get('parameter_dict')[particle.get('width')] = 0. |
105 | |
106 | return run_multiprocs_no_crossings(check_gauge_process, |
107 | multiprocess, |
108 | |
109 | === modified file 'tests/unit_tests/core/test_diagram_generation.py' |
110 | --- tests/unit_tests/core/test_diagram_generation.py 2011-04-25 02:04:49 +0000 |
111 | +++ tests/unit_tests/core/test_diagram_generation.py 2011-05-03 19:31:13 +0000 |
112 | @@ -1669,6 +1669,112 @@ |
113 | for diagram, order in zip(diagrams, orders): |
114 | self.assertEqual(diagram.get('orders'),order) |
115 | |
116 | + def test_multiple_interaction_identical_particles(self): |
117 | + """Test the case with multiple interactions for identical particles |
118 | + """ |
119 | + |
120 | + mypartlist = base_objects.ParticleList(); |
121 | + myinterlist = base_objects.InteractionList(); |
122 | + |
123 | + # A quark U and its antiparticle |
124 | + mypartlist.append(base_objects.Particle({'name':'u', |
125 | + 'antiname':'u~', |
126 | + 'spin':2, |
127 | + 'color':3, |
128 | + 'mass':'zero', |
129 | + 'width':'zero', |
130 | + 'texname':'u', |
131 | + 'antitexname':'\bar u', |
132 | + 'line':'straight', |
133 | + 'charge':2. / 3., |
134 | + 'pdg_code':2, |
135 | + 'propagating':True, |
136 | + 'is_part':True, |
137 | + 'self_antipart':False})) |
138 | + u = mypartlist[-1] |
139 | + antiu = copy.copy(u) |
140 | + antiu.set('is_part', False) |
141 | + |
142 | + # A gluon |
143 | + mypartlist.append(base_objects.Particle({'name':'g', |
144 | + 'antiname':'g', |
145 | + 'spin':3, |
146 | + 'color':8, |
147 | + 'mass':'zero', |
148 | + 'width':'zero', |
149 | + 'texname':'g', |
150 | + 'antitexname':'g', |
151 | + 'line':'curly', |
152 | + 'charge':0., |
153 | + 'pdg_code':21, |
154 | + 'propagating':True, |
155 | + 'is_part':True, |
156 | + 'self_antipart':True})) |
157 | + |
158 | + g = mypartlist[-1] |
159 | + |
160 | + # two different couplings u u g |
161 | + |
162 | + myinterlist.append(base_objects.Interaction({ |
163 | + 'id': 1, |
164 | + 'particles': base_objects.ParticleList(\ |
165 | + [antiu, \ |
166 | + u, \ |
167 | + g]), |
168 | + 'color': [], |
169 | + 'lorentz':['L1'], |
170 | + 'couplings':{(0, 0):'GQCD'}, |
171 | + 'orders':{'QCD':1}})) |
172 | + |
173 | + myinterlist.append(base_objects.Interaction({ |
174 | + 'id': 2, |
175 | + 'particles': base_objects.ParticleList(\ |
176 | + [antiu, \ |
177 | + u, \ |
178 | + g]), |
179 | + 'color': [], |
180 | + 'lorentz':['L1'], |
181 | + 'couplings':{(0, 0):'GEFF'}, |
182 | + 'orders':{'EFF':1}})) |
183 | + |
184 | + # 3 gluon vertex |
185 | + self.myinterlist.append(base_objects.Interaction({ |
186 | + 'id': 1, |
187 | + 'particles': base_objects.ParticleList(\ |
188 | + [self.mypartlist[0]] * 3), |
189 | + 'color': [], |
190 | + 'lorentz':['L1'], |
191 | + 'couplings':{(0, 0):'G'}, |
192 | + 'orders':{'QCD':1}})) |
193 | + |
194 | + mymodel = base_objects.Model() |
195 | + mymodel.set('particles', mypartlist) |
196 | + mymodel.set('interactions', myinterlist) |
197 | + |
198 | + myleglist = base_objects.LegList() |
199 | + |
200 | + myleglist.append(base_objects.Leg({'id':21, |
201 | + 'state':False})) |
202 | + myleglist.append(base_objects.Leg({'id':21, |
203 | + 'state':False})) |
204 | + myleglist.append(base_objects.Leg({'id':2, |
205 | + 'state':True})) |
206 | + myleglist.append(base_objects.Leg({'id':-2, |
207 | + 'state':True})) |
208 | + |
209 | + myproc = base_objects.Process({'legs':myleglist, |
210 | + 'model':mymodel}) |
211 | + |
212 | + myamplitude = diagram_generation.Amplitude() |
213 | + myamplitude.set('process', myproc) |
214 | + |
215 | + self.assertEqual(len(myamplitude.get('diagrams')), 8) |
216 | + |
217 | + goal_lastvx = set([21,2,-2]) |
218 | + for diag in myamplitude.get('diagrams'): |
219 | + self.assertEqual(set([l.get('id') for l in \ |
220 | + diag.get('vertices')[-1].get('legs')]), |
221 | + goal_lastvx) |
222 | |
223 | #=============================================================================== |
224 | # Muliparticle test |
Hi Johan, this is very impressive,
As usual, I have some little technical point/suggestion:
1) at line 147 of diagram_ symmetry. py:
they are a line:
except TimeOutError:
I didn't see any way to pass in that position.
To my understanding the only way to raise this type of error is already catched. But the
signal.alarm(0) is not in the try, which creates a small gap (10^-5s) where indeed the error can be raise. So I would recommend to put the signal.alarm(0) inside the try to avoid this type of problem (this is also valid for my own code).
2) I was very disturbed about the functions: method/ standard seems more suitable in this case)
add_link and add_vertex_id
a) Why are they class_method? (static_
b) I would prefer the names get_link and get_vertex_id (they didn't add anything to anything, this associate that they are class method is very disturbing)
c) Do you really nedd a function add_vertex_id. Using that function is longuer than calling directly vertex.get('id').
3) DiagramTagChain Link(object)
Could you put here comment on what are the argument of the __init__
especially the end_chain that I didn't understand.
All that class is very hard to read, so may be good to add comment in it.
But add those in the init, may clarify enough the situation. So I propose that you add those comment, and then I will re-review this part.
Concerning:
More importantly however, I think this will enable solving the problem of how to identify color flows contributing to a given channel (topology). I'm pretty sure that the color flows contributing to a given topology are given by:
All permutations of identical external particles within subdiagrams, and between subdiagrams. Example (all gluons, number are external particle number):
(1,2 > 1)(3,4 > 3)(1,3,5) (1,2,3,4,5) has contributions also from (2,1 > 1)(3,4 > 3)(1,3,5) (2,1,3,4,5), (1,2 > 1)(4,3 > 3)(1,3,5) (1,2,4,3,5) and (2,1 > 1)(4,3 > 3)(1,3,5) (2,1,4,3,5), and also (3,4 > 3)(1,2 > 1)(3,1,5) and all permutations of (3,4) and (1,2); These can be summarized as all permutations of leg numbers in the diagram which gives the same tag if leg number is included as a relevant property of the tag.
This is not implemented, is it?
Thanks,
Olivier