~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/iolibs/export_v4.py

mwrge with 2.7.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
885
885
        # Make sure aloha is in quadruple precision if needed
886
886
        old_aloha_mp=aloha.mp_precision
887
887
        aloha.mp_precision=self.opt['mp']
888
 
 
 
888
        self.model = model
889
889
        # create the MODEL
890
890
        write_dir=pjoin(self.dir_path, 'Source', 'MODEL')
891
891
        model_builder = UFO_model_to_mg4(model, write_dir, self.opt + self.proc_characteristic)
2042
2042
        open(pjoin(self.dir_path,'__init__.py'),'w')
2043
2043
        open(pjoin(self.dir_path,'SubProcesses','__init__.py'),'w')
2044
2044
 
2045
 
        if 'mode' in self.opt and self.opt['mode'] == "reweight":
 
2045
        if False:#'mode' in self.opt and self.opt['mode'] == "reweight":
2046
2046
            #add the module to hande the NLO weight
2047
2047
            files.copytree(pjoin(MG5DIR, 'Template', 'RWGTNLO'),
2048
2048
                          pjoin(self.dir_path, 'Source'))
2050
2050
                           pjoin(self.dir_path, 'Source', 'PDF'))
2051
2051
            self.write_pdf_opendata()
2052
2052
            
2053
 
        if self.prefix_info:
 
2053
        if self.prefix_info: 
2054
2054
            self.write_f2py_splitter()
2055
2055
            self.write_f2py_makefile()
2056
2056
            self.write_f2py_check_sa(matrix_elements,
2107
2107
      CALL SETPARA(PATH)  !first call to setup the paramaters
2108
2108
      RETURN
2109
2109
      END
 
2110
      
 
2111
      
 
2112
      subroutine CHANGE_PARA(name, value)
 
2113
      implicit none
 
2114
CF2PY intent(in) :: name
 
2115
CF2PY intent(in) :: value
 
2116
 
 
2117
      character*512 name
 
2118
      double precision value
 
2119
 
 
2120
      include '../Source/MODEL/input.inc'
 
2121
      include '../Source/MODEL/coupl.inc'
 
2122
 
 
2123
      SELECT CASE (name)
 
2124
         %(parameter_setup)s
 
2125
         CASE DEFAULT
 
2126
            write(*,*) 'no parameter matching', name, value
 
2127
      END SELECT
 
2128
 
 
2129
      return
 
2130
      end
 
2131
      
 
2132
    subroutine update_all_coup()
 
2133
    implicit none
 
2134
     call coup()
 
2135
    return 
 
2136
    end
 
2137
      
2110
2138
 
2111
2139
    subroutine get_pdg_order(PDG)
2112
2140
  IMPLICIT NONE
2161
2189
        if min_nexternal != max_nexternal:
2162
2190
            text.append('endif')
2163
2191
 
 
2192
        params = self.get_model_parameter(self.model)
 
2193
        parameter_setup =[]
 
2194
        for key, var in params.items():
 
2195
            parameter_setup.append('        CASE ("%s")\n          %s = value' 
 
2196
                                   % (key, var))
 
2197
 
2164
2198
        formatting = {'python_information':'\n'.join(info), 
2165
2199
                          'smatrixhel': '\n'.join(text),
2166
2200
                          'maxpart': max_nexternal,
2167
2201
                          'nb_me': len(allids),
2168
2202
                          'pdgs': ','.join(str(pdg[i]) if i<len(pdg) else '0' 
2169
2203
                                             for i in range(max_nexternal) for pdg in allids),
2170
 
                          'prefix':'\',\''.join(allprefix)
 
2204
                          'prefix':'\',\''.join(allprefix),
 
2205
                          'parameter_setup': '\n'.join(parameter_setup),
2171
2206
                          }
2172
2207
        formatting['lenprefix'] = len(formatting['prefix'])
2173
2208
        text = template % formatting
2174
2209
        fsock = writers.FortranWriter(pjoin(self.dir_path, 'SubProcesses', 'all_matrix.f'),'w')
2175
2210
        fsock.writelines(text)
2176
2211
        fsock.close()
 
2212
    
 
2213
    def get_model_parameter(self, model):
 
2214
        """ returns all the model parameter
 
2215
        """
 
2216
        params = {}
 
2217
        for p in model.get('parameters')[('external',)]:
 
2218
            name = p.name
 
2219
            nopref = name[4:] if name.startswith('mdl_') else name
 
2220
            params[nopref] = name
2177
2221
            
 
2222
            block = p.lhablock
 
2223
            lha = '_'.join([str(i) for i in p.lhacode])
 
2224
            params['%s_%s' % (block.upper(), lha)] = name
 
2225
 
 
2226
        return params                      
 
2227
                                        
 
2228
        
 
2229
        
 
2230
        
 
2231
         
2178
2232
    def write_f2py_check_sa(self, matrix_element, writer):
2179
2233
        """ Write the general check_sa.py in SubProcesses that calls all processes successively."""
2180
2234
        # To be implemented. It is just an example file, i.e. not crucial.