~maddevelopers/mg5amcnlo/2.7.1.3

« back to all changes in this revision

Viewing changes to madgraph/interface/loop_interface.py

  • Committer: olivier Mattelaer
  • Date: 2016-05-12 11:00:18 UTC
  • mfrom: (262.1.150 2.3.4)
  • Revision ID: olivier.mattelaer@uclouvain.be-20160512110018-sevb79f0wm4g8mpp
pass to 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from madgraph import MG4DIR, MG5DIR, MadGraph5Error
27
27
import madgraph.interface.madgraph_interface as mg_interface
28
28
import madgraph.interface.launch_ext_program as launch_ext
 
29
import madgraph.interface.extended_cmd as extended_cmd
29
30
import madgraph.core.base_objects as base_objects
30
31
import madgraph.core.diagram_generation as diagram_generation
31
32
import madgraph.loop.loop_diagram_generation as loop_diagram_generation
538
539
                            me, self._curr_fortran_model)
539
540
            # If all ME's do not share the same maximum loop vertex rank and the
540
541
            # same loop maximum wavefunction size, we need to set the maximum
541
 
            # in coef_specs.inc of the HELAS Source and warn the user that this
542
 
            # might be a problem
 
542
            # in coef_specs.inc of the HELAS Source. The SubProcesses/P* directory
 
543
            # all link this file, so it should be properly propagated
543
544
            if self.options['loop_optimized_output'] and len(matrix_elements)>1:
544
545
                max_lwfspins = [m.get_max_loop_particle_spin() for m in \
545
546
                                                                matrix_elements]
546
 
                try:
547
 
                    max_loop_vert_ranks = [me.get_max_loop_vertex_rank() for me in \
 
547
                max_loop_vert_ranks = [me.get_max_loop_vertex_rank() for me in \
548
548
                                                                matrix_elements]
549
 
                except MadGraph5Error:
550
 
                    pass
551
 
                else:
552
 
                    if len(set(max_lwfspins))>1 or len(set(max_loop_vert_ranks))>1:
553
 
                        self._curr_exporter.fix_coef_specs(max(max_lwfspins),\
 
549
                if len(set(max_lwfspins))>1 or len(set(max_loop_vert_ranks))>1:
 
550
                    self._curr_exporter.fix_coef_specs(max(max_lwfspins),\
554
551
                                                       max(max_loop_vert_ranks))
555
 
                        logger.warning('ML5 has just output processes which do not'+\
556
 
                      ' share the same maximum loop wavefunction size or the '+\
557
 
                      ' same maximum loop vertex rank. This is potentially '+\
558
 
                      ' dangerous. Please prefer to output them separately.')
559
552
 
560
553
        # Just the matrix.f files
561
554
        if self._export_format == 'matrix':
616
609
                                           wanted_couplings)
617
610
            
618
611
        compiler = {'fortran': self.options['fortran_compiler'],
619
 
                    'f2py': self.options['f2py_compiler']}
 
612
                    'f2py': self.options['f2py_compiler'],
 
613
                    'cpp': self.options['cpp_compiler']}
620
614
        
621
615
        if self._export_format in self.supported_ML_format:
622
616
            self._curr_exporter.finalize_v4_directory( \
707
701
        else:
708
702
            self.validate_model()
709
703
 
710
 
        if args[0] == 'process':            
 
704
        loop_filter=None
 
705
        if args[0] == 'process':
 
706
 
 
707
            # Extract potential loop_filter          
 
708
            for arg in args:
 
709
                if arg.startswith('--loop_filter='):
 
710
                    loop_filter = arg[14:]
 
711
                if not isinstance(self, extended_cmd.CmdShell):
 
712
                    raise InvalidCmd, "loop_filter is not allowed in web mode"
 
713
            args = [a for a in args if not a.startswith('--loop_filter=')]
 
714
 
711
715
            # Rejoin line
712
716
            line = ' '.join(args[1:])
713
717
            
717
721
                
718
722
            # Reset Helas matrix elements
719
723
            self._curr_matrix_elements = helas_objects.HelasMultiProcess()
720
 
 
721
 
            # Extract process from process definition
722
 
 
 
724
            
 
725
        # Extract process from process definition
723
726
        myprocdef = self.extract_process(line)
 
727
        # hack for multiprocess:
 
728
        if myprocdef.has_multiparticle_label():
 
729
            # split it in a loop
 
730
            succes, failed = 0, 0
 
731
            for base_proc in myprocdef:
 
732
                try:
 
733
                    self.exec_cmd("add process %s" % base_proc.nice_string(prefix=False, print_weighted=True))
 
734
                    succes += 1
 
735
                except Exception:
 
736
                    failed +=1
 
737
            logger.info("%s/%s processes succeeded" % (succes, failed+succes))
 
738
            if succes == 0:
 
739
                raise
 
740
            else:
 
741
                return
 
742
             
724
743
             
725
744
        # If it is a process for MadLoop standalone, make sure it has a 
726
745
        # unique ID. It is important for building a BLHA library which
739
758
            multiprocessclass=loop_diagram_generation.LoopMultiProcess
740
759
        else:
741
760
            multiprocessclass=diagram_generation.MultiProcess
742
 
        
 
761
 
743
762
        myproc = multiprocessclass(myprocdef, collect_mirror_procs = False,
744
 
                                            ignore_six_quark_processes = False)
 
763
                                            ignore_six_quark_processes = False,
 
764
                                            loop_filter = loop_filter)
745
765
        
746
766
        for amp in myproc.get('amplitudes'):
747
767
            if amp not in self._curr_amps: