=== modified file 'madgraph/core/base_objects.py' --- madgraph/core/base_objects.py 2013-11-29 07:28:53 +0000 +++ madgraph/core/base_objects.py 2014-02-18 12:35:08 +0000 @@ -1585,9 +1585,9 @@ which should be define in the param_card.dat""" depend = ('external',) - type = 'real' +# type = 'real' - def __init__(self, name, value, lhablock, lhacode): + def __init__(self, name, value, lhablock, lhacode,type='real'): """Initialize a new ParamCardVariable name: name of the variable value: default numerical value @@ -1598,6 +1598,7 @@ self.value = value self.lhablock = lhablock self.lhacode = lhacode + self.type = type #=============================================================================== === modified file 'madgraph/interface/common_run_interface.py' --- madgraph/interface/common_run_interface.py 2014-02-05 23:28:12 +0000 +++ madgraph/interface/common_run_interface.py 2014-02-18 15:50:39 +0000 @@ -1826,12 +1826,16 @@ self.setP(args[start], key, args[-1]) else: try: - value = float(args[-1]) + value = complex(args[-1]) + valueformat = 'complex' + if value.imag == 0.: + value = value.real + valueformat = 'float' except Exception: logger.warning('Invalid input: Expected number and not \'%s\'' \ % args[-1]) return - self.setP(args[start], key, value) + self.setP(args[start], key, value, format=valueformat) else: logger.warning('invalid set command %s' % line) return @@ -1858,7 +1862,7 @@ logger.info('modify parameter %s of the run_card.dat to %s' % (name, value)) self.run_card[name] = value - def setP(self, block, lhaid, value): + def setP(self, block, lhaid, value, format='float'): if isinstance(value, str): value = value.lower() if value == 'default': @@ -1872,12 +1876,17 @@ return else: try: - value = float(value) + value = complex(value) + format = 'complex' + if value.imag == 0.: + value = float(value.real) + format = 'float' except ValueError: logger.warning('Invalid input: \'%s\' not valid intput.'% value) - logger.info('modify param_card information BLOCK %s with id %s set to %s' %\ - (block, lhaid, value)) + logger.info('modify param_card information BLOCK %s with id %s set to %s with type %s' %\ + (block, lhaid, value, format)) + self.param_card[block].param_dict[lhaid].format = format self.param_card[block].param_dict[lhaid].value = value === modified file 'madgraph/iolibs/export_v4.py' --- madgraph/iolibs/export_v4.py 2014-01-08 09:16:49 +0000 +++ madgraph/iolibs/export_v4.py 2014-02-18 12:36:40 +0000 @@ -3703,6 +3703,10 @@ self.params_indep if param.type == 'complex' and is_valid(param.name)] + complex_parameters += [param.name for param in self.params_ext + if param.type == 'complex' and + is_valid(param.name)] + if complex_parameters: fsock.writelines('double complex '+','.join(complex_parameters)+'\n') fsock.writelines('common/params_C/ '+','.join(complex_parameters)+'\n\n') === modified file 'models/check_param_card.py' --- models/check_param_card.py 2014-01-29 15:48:36 +0000 +++ models/check_param_card.py 2014-02-18 15:53:44 +0000 @@ -24,7 +24,6 @@ def __init__(self, param=None, block=None, lhacode=None, value=None, comment=None): """Init the parameter""" - self.format = 'float' if param: block = param.lhablock lhacode = param.lhacode @@ -37,7 +36,13 @@ self.lhacode = lhacode else: self.lhacode = [] - self.value = value + if value: + if value.imag == 0.: + self.format = 'float' + self.value = float(value.real) + else: + self.format = 'complex' + self.value = complex(value) self.comment = comment def set_block(self, block): @@ -67,7 +72,11 @@ # convert to number when possible try: - self.value = float(self.value) + self.value = complex(self.value) + self.format = 'complex' + if self.value.imag == 0.0: + self.value = float(self.value.real) + self.format = 'float' except: self.format = 'str' pass @@ -117,6 +126,8 @@ return ' %e %s # %s' % ( self.value,' '.join([str(d) for d in self.lhacode]), self.comment) elif self.format == 'int': return ' %s %i # %s' % (' '.join([str(d) for d in self.lhacode]), int(self.value), self.comment) + elif self.format == 'complex': + return ' %s (%e, %e) # %s' % (' '.join([str(d) for d in self.lhacode]), self.value.real, self.value.imag, self.comment) else: if self.lhablock == 'decay': return 'DECAY %s %d # %s' % (' '.join([str(d) for d in self.lhacode]), self.value, self.comment) === modified file 'models/import_ufo.py' --- models/import_ufo.py 2013-12-17 23:25:28 +0000 +++ models/import_ufo.py 2014-02-18 12:39:52 +0000 @@ -884,7 +884,7 @@ for param in self.model.all_parameters: if param.nature == 'external': parameter = base_objects.ParamCardVariable(param.name, param.value, \ - param.lhablock, param.lhacode) + param.lhablock, param.lhacode, type=param.type) else: expr = self.shorten_expr(param.value) === modified file 'models/model_reader.py' --- models/model_reader.py 2014-01-03 09:28:21 +0000 +++ models/model_reader.py 2014-02-18 12:58:24 +0000 @@ -137,7 +137,7 @@ value = runner(scale) exec("locals()[\'%s\'] = %s" % (parameter_dict[block][id].name, value)) - parameter_dict[block][id].value = float(value) + parameter_dict[block][id].value = complex(value) else: # No param_card, use default values