~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/core/color_amp.py

  • Committer: olivier Mattelaer
  • Date: 2015-03-05 00:14:16 UTC
  • mfrom: (258.1.9 2.3)
  • mto: (258.8.1 2.3)
  • mto: This revision was merged to the branch mainline in revision 259.
  • Revision ID: olivier.mattelaer@uclouvain.be-20150305001416-y9mzeykfzwnl9t0j
partial merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
        the colorize dictionary (produced by the colorize routine)
235
235
        associated to diagram with index index. Keep track of simplification
236
236
        results for maximal optimization."""
237
 
 
 
237
        import madgraph.various.misc as misc
238
238
        # loop over possible color chains
239
239
        for col_chain, col_str in colorize_dict.items():
240
240
            # Create a canonical immutable representation of the the string
241
241
            canonical_rep, rep_dict = col_str.to_canonical()
242
 
 
243
242
            try:
244
243
                # If this representation has already been considered,
245
 
                # recycle the result. 
 
244
                # recycle the result.                               
246
245
                col_fact = self._canonical_dict[canonical_rep].create_copy()
247
246
            except KeyError:
248
247
                # If the representation is really new
272
271
                # for matching, we have to multiply col_fact by it.
273
272
                for cs in col_fact:
274
273
                    cs.coeff = cs.coeff * col_str.coeff
275
 
                # Must simplify once to put traces in a canonical ordering
276
 
                col_fact = col_fact.simplify()
277
 
 
 
274
                # Must simplify up to two times at NLO (since up to two traces
 
275
                # can appear with a loop) to put traces in a canonical ordering.
 
276
                # If it still causes issue, just do a full_simplify(), it would
 
277
                # not bring any heavy additional computational load.
 
278
                col_fact = col_fact.simplify().simplify()
 
279
                
278
280
                # Here we need to force a specific order for the summed indices
279
281
                # in case we have K6 or K6bar Clebsch Gordan coefficients
280
282
                for colstr in col_fact: colstr.order_summation()
288
290
                                col_chain,
289
291
                                col_str.coeff,
290
292
                                col_str.is_imaginary,
291
 
                                col_str.Nc_power)
 
293
                                col_str.Nc_power,
 
294
                                col_str.loop_Nc_power)
292
295
                try:
293
296
                    self[immutable_col_str].append(basis_entry)
294
297
                except KeyError: