Hi, To merge this to 2.6.3, we have to keep such change minimal for the moment. So I have had the bare minimum to the current status. This is a) detect fully identical expression --same string-- and merge them b) remove couplings exactly equals to zero (no point to keep them obviously) This is pretty minimal and quite save. for loop_sm this does not do anything in the unitary gauge. (but make few simplification in the feynman gauge) for the loop_qcd_qed_sm, they are 148 coupling equals to zero, so this makes some cool cleaning. Now we can also not push this in 2.6.3 to be save. They are nothing crucial in such change and can easily wait months to be include. Cheers, Olivier === modified file 'models/import_ufo.py' --- models/import_ufo.py 2018-06-01 08:46:21 +0000 +++ models/import_ufo.py 2018-06-13 15:01:47 +0000 @@ -14,7 +14,7 @@ ################################################################################ """ How to import a UFO model to the MG5 format """ - +import collections import fractions import logging import os @@ -530,8 +530,10 @@ self.add_CTinteraction(interaction_info, color_info) - for interaction in self.interactions: + for interaction in list(self.interactions): self.optimise_interaction(interaction) + if not interaction['couplings']: + self.interactions.remove(interaction) self.model.set('conserved_charge', self.conservecharge) @@ -584,6 +586,32 @@ def optimise_interaction(self, interaction): + + # Check if two couplings have exactly the same definition. + # If so replace one by the other + if not hasattr(self, 'iden_couplings'): + coups = collections.defaultdict(list) + coups['0'].append('ZERO') + for coupling in self.ufomodel.all_couplings: + #if isinstance(coupling.value, str): + coups[str(coupling.value)].append( coupling.name) + + self.iden_couplings = {} + for idens in [c for c in coups.values() if len(c)>1]: + for i in range(1, len(idens)): + self.iden_couplings[idens[i]] = idens[0] + + # apply the replacement by identical expression + for key, coup in list(interaction['couplings'].items()): + if coup in self.iden_couplings: + interaction['couplings'][key] = self.iden_couplings[coup] + if interaction['couplings'][key] == 'ZERO': + del interaction['couplings'][key] + + + + + # we want to check if the same coupling is used for two lorentz strucutre # for the same color structure. to_lor = {} @@ -1807,9 +1835,9 @@ self.remove_couplings(self.del_coup) # modify interaction to avoid to have identical coupling with different lorentz - for interaction in self.get('interactions'): + for interaction in list(self.get('interactions')): self.optimise_interaction(interaction) - + # deal with parameters parameters = self.detect_special_parameters() self.fix_parameter_values(*parameters, simplify=rm_parameter, On 13 Jun 2018, at 14:36, Valentin Hirschi <