def generate_matrix_elements(self): """Helper function to generate the matrix elements before exporting""" # Sort amplitudes according to number of diagrams, # to get most efficient multichannel output self._curr_amps.sort(lambda a1, a2: a2.get_number_of_diagrams() - \ a1.get_number_of_diagrams()) cpu_time1 = time.time() ndiags = 0 if not self._curr_matrix_elements.get_matrix_elements(): self._curr_matrix_elements = \ loop_helas_objects.LoopHelasProcess(self._curr_amps, optimized_output = self.options['loop_optimized_output']) ndiags = sum([len(me.get('diagrams')) for \ me in self._curr_matrix_elements.\ get_matrix_elements()]) # assign a unique id number to all process uid = 0 for me in self._curr_matrix_elements.get_matrix_elements(): uid += 1 # update the identification number me.get('processes')[0].set('uid', uid) cpu_time2 = time.time() return ndiags, cpu_time2 - cpu_time1
'structure_repository') for pos in pos_list: diag_content[gen_line][pos] = amplitude.get('diagrams')[pos] # register the full amplitutde process_diag = {} process_diag['g g > g g'] = list(range(200, 230)) #[0, 12] process_diag['d d~ > e+ e- mu+ mu-'] = list(range(72)) cmd = MasterCmd() cmd.do_import('model %s' % model_path) # Create the diagrams for gen_line, pos_list in process_diag.items(): print(gen_line, ':', end=' ') gen_line_with_order = gen_line + ' [virt=QCD]' cmd.do_generate(gen_line_with_order) #Look for decay chains amplitude = cmd._curr_amps[0] print(len(amplitude.get('diagrams'))) matrix_elements = loop_helas_objects.LoopHelasProcess(cmd._curr_amps) matrix_element = matrix_elements.get('matrix_elements')[0] diag = matrix_element.get_base_amplitude().get('diagrams') diag_content['FULL %s' % gen_line] = {} for pos in pos_list: diag_content['FULL %s' % gen_line][pos] = diag[pos] # Store the diagrams file_test_diagram = open(os.path.join(_file_path , \ '../../input_files/test_draw_nlo.obj'), 'w') pickle.dump(diag_content, file_test_diagram) print('done')