Пример #1
0
def generate_directories_fks_async(i):
    """generates directories in a multi-core way"""

    arglist = glob_directories_map[i]

    curr_exporter = arglist[0]
    mefile = arglist[1]
    curr_fortran_model = arglist[2]
    ime = arglist[3]
    nme = arglist[4]
    path = arglist[5]
    olpopts = arglist[6]

    infile = open(mefile, 'rb')
    me = cPickle.load(infile)
    infile.close()

    # here we need to find the OS configuration from the matrix-elements
    os_couplings = []
    os_lorentz = []
    for real_me in me.real_processes:
        madstr_fks.find_os_divergences(real_me)
        real_me.os_matrix_elements = [\
            helas_objects.HelasDecayChainProcess(os_amp).combine_decay_chain_processes()[0]
            for os_amp in real_me.os_amplitudes]

        os_couplings.extend(
            sum([
                c for osme in real_me.os_matrix_elements
                for c in osme.get_used_couplings()
            ], []))
        os_lorentz.extend(
            sum([
                osme.get_used_lorentz() for osme in real_me.os_matrix_elements
            ], []))

    calls = curr_exporter.generate_directories_fks(me, curr_fortran_model, ime,
                                                   nme, path, olpopts)
    nexternal = curr_exporter.proc_characteristic['nexternal']
    ninitial = curr_exporter.proc_characteristic['ninitial']
    processes = me.born_matrix_element.get('processes')

    #only available after export has been done, so has to be returned from here
    max_loop_vertex_rank = -99
    if me.virt_matrix_element:
        max_loop_vertex_rank = me.virt_matrix_element.get_max_loop_vertex_rank(
        )

    return [
        calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial,
        nexternal, processes, os_couplings, os_lorentz
    ]
Пример #2
0
    def __init__(self, fksmulti, **args):
        """initialise as a FKSMultiProcess, then add the OS informations
        """
        super(FKSHelasMultiProcessWithOS, self).__init__(fksmulti, args)
        # now one has to add the OS informations
        # this may not be the best/most optimal way to go, but at least
        # requires no changes in the core fks stuff
        for born_me in self['matrix_elements']:
            for real_me in born_me.real_processes:
                real_me.os_ids = []
                real_me.os_daughter_pos = []
                real_me.os_diagrams = []
                real_me.os_matrix_elements = []

        for born in fksmulti['born_processes']:
            # we need to use pdgs here because otherwise mirror processes are identified
            born_pdgs = [l['id'] for l in born.born_proc['legs']]
            for real in born.real_amps:
                real_pdgs = [l['id'] for l in real.process['legs']]
                if not real.os_amplitudes:
                    continue
                #now we have to find the matching born and real
                # in the helas process
                for born_me in self['matrix_elements']:
                    born_me_pdg_list = [[
                        l['id'] for l in p['legs']
                    ] for p in born_me.born_matrix_element['processes']]
                    if not born_pdgs in born_me_pdg_list:
                        continue
                    for real_me in born_me.real_processes:
                        real_me_pdg_list = [[
                            l['id'] for l in p['legs']
                        ] for p in real_me.matrix_element['processes']]
                        if not real_pdgs in real_me_pdg_list:
                            continue
                        real_me.os_ids += real.os_ids
                        real_me.os_daughter_pos += real.os_daughter_pos
                        real_me.os_diagrams += real.os_diagrams
                        real_me.os_matrix_elements += [\
                            helas_objects.HelasDecayChainProcess(os_amp).combine_decay_chain_processes()[0]
                            for os_amp in real.os_amplitudes]
Пример #3
0
        print(gen_line, ':', end=' ')
        gen_line_with_order = gen_line + ' QCD=99'
        cmd.exec_cmd('generate ' + gen_line_with_order)
        if output:
            gen_line = 'OUTPUT:'+gen_line
            #cmd.export.generate_matrix_elements()
            try:
                cmd.do_output('/tmp/MGPROC -f')
            except: 
                pass
        #Look for decay chains
        if ',' in gen_line:
            amp = cmd._curr_amps[0]
            import madgraph.core.helas_objects as helas_objects
            matrix_elements = \
            helas_objects.HelasDecayChainProcess(amp).combine_decay_chain_processes()
            if matrix_elements:
                amplitude = matrix_elements[0].get('base_amplitude')     
        else:
            amplitude = cmd._curr_amps[0]
        print(len(amplitude['diagrams']))
            
                                                    
        diag_content[gen_line] = {}
        for pos in pos_list:
            diag_content[gen_line][pos] = amplitude['diagrams'][pos]


    # Store the diagrams  
    file_test_diagram = open(os.path.join(_file_path , \
                                    '../input_files/test_draw.obj'), 'w')