################################################################################ # # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors # # This file is a part of the MadGraph5_aMC@NLO project, an application which # automatically generates Feynman diagrams and matrix elements for arbitrary # high-energy processes in the Standard Model and beyond. # # It is subject to the MadGraph5_aMC@NLO license which should accompany this # distribution. # # For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch # ################################################################################ """A user friendly command line interface to access all MadGraph5_aMC@NLO features. Uses the cmd package for command interpretation and tab completion. """ import os import shutil import time import logging import re import madgraph from madgraph import MG4DIR, MG5DIR, MadGraph5Error import madgraph.interface.madgraph_interface as mg_interface import madgraph.interface.extended_cmd as cmd import madgraph.interface.launch_ext_program as launch_ext import madgraph.interface.extended_cmd as extended_cmd import madgraph.core.base_objects as base_objects import madgraph.core.diagram_generation as diagram_generation import madgraph.loop.loop_diagram_generation as loop_diagram_generation import madgraph.loop.loop_base_objects as loop_base_objects import madgraph.loop.loop_helas_objects as loop_helas_objects import madgraph.core.helas_objects as helas_objects import madgraph.iolibs.export_v4 as export_v4 import madgraph.iolibs.helas_call_writers as helas_call_writers import madgraph.iolibs.file_writers as writers import madgraph.interface.launch_ext_program as launch_ext import madgraph.various.misc as misc import madgraph.fks.fks_base as fks_base import aloha # Special logger for the Cmd Interface logger = logging.getLogger('cmdprint') #useful shortcut pjoin = os.path.join class CheckLoop(mg_interface.CheckValidForCmd): def check_display(self, args): """ Check the arguments of the display diagrams command in the context of the Loop interface.""" mg_interface.MadGraphCmd.check_display(self,args) if all([not amp['process']['has_born'] for amp in self._curr_amps]): if args[0]=='diagrams' and len(args)>=2 and args[1]=='born': raise self.InvalidCmd("Processes generated do not have born diagrams.") if args[0]=='diagrams' and len(args)>=3 and args[1] not in ['born','loop']: raise self.InvalidCmd("Can only display born or loop diagrams, not %s."%args[1]) def check_tutorial(self, args): """check the validity of the line""" if len(args) == 0: #this means mg5 tutorial args.append('MadLoop') else: return mg_interface.CheckValidForCmd.check_tutorial(self,args) def check_add(self, args): """ If no model is defined yet, make sure to load the right loop one """ if not self._curr_model: pert_coupl_finder = re.compile(r"^(?P.+)\s*\[\s*((?P