def prepare_couplings(self, wanted_couplings=[]):
        """Extract the couplings from the model, and store them in
        the two lists coups_indep and coups_dep"""

        # Keep only dependences on alphaS, to save time in execution
        keys = self.model['couplings'].keys()
        keys.sort(key=len)
        for key, coup_list in self.model['couplings'].items():
            if "aS" in key:
                for c in coup_list:
                    if not wanted_couplings or c.name in wanted_couplings:
                        self.coups_dep[c.name] = base_objects.ModelVariable(\
                                                                   c.name,
                                                                   c.expr,
                                                                   c.type,
                                                                   c.depend)
            else:
                for c in coup_list:
                    if not wanted_couplings or c.name in wanted_couplings:
                        self.coups_indep.append(base_objects.ModelVariable(\
                                                                   c.name,
                                                                   c.expr,
                                                                   c.type,
                                                                   c.depend))

        # Convert coupling expressions from Python to C++
        for coup in self.coups_dep.values() + self.coups_indep:
            coup.expr = coup.name + " = " + coup.expr
    def prepare_parameters(self):
        """Extract the parameters from the model, and store them in
        the two lists params_indep and params_dep"""

        # Keep only dependences on alphaS, to save time in execution
        keys = self.model['parameters'].keys()
        keys.sort(key=len)
        params_ext = []
        for key in keys:
            if key == ('external', ):
                params_ext += [
                    p for p in self.model['parameters'][key] if p.name
                ]
            elif 'aS' in key:
                for p in self.model['parameters'][key]:
                    self.params_dep.append(
                        base_objects.ModelVariable(p.name,
                                                   p.name + " = " + p.expr,
                                                   p.type, p.depend))
            else:
                for p in self.model['parameters'][key]:
                    if p.name == 'ZERO':
                        continue
                    self.params_indep.append(
                        base_objects.ModelVariable(p.name,
                                                   p.name + " = " + p.expr,
                                                   p.type, p.depend))

        # For external parameters, want to read off the SLHA block code
        while params_ext:
            param = params_ext.pop(0)
            # Read value from the slha variable
            expression = ""
            assert param.value.imag == 0
            if len(param.lhacode) == 1:
                expression = "%s = slha.get_block_entry(\"%s\", %d, %e);" % \
                             (param.name, param.lhablock.lower(),
                              param.lhacode[0], param.value.real)
            elif len(param.lhacode) == 2:
                expression = "indices[0] = %d;\nindices[1] = %d;\n" % \
                             (param.lhacode[0], param.lhacode[1])
                expression += "%s = slha.get_block_entry(\"%s\", indices, %e);" \
                              % (param.name, param.lhablock.lower(), param.value.real)
            else:
                raise MadGraph5Error(
                    "Only support for SLHA blocks with 1 or 2 indices")
            self.params_indep.insert(
                0, base_objects.ModelVariable(param.name, expression, 'real'))
    def create_param_dict(self):
        """ return {'name': parameterObject}"""

        out = {}
        for key, params in self.model['parameters'].items():
            for param in params:
                out[param.name] = param

        if 'ZERO' not in out.keys():
            zero = base_objects.ModelVariable('ZERO', '0', 'real')
            out['ZERO'] = zero
        return out