Package madgraph
[hide private]
[frames] | no frames]

Source Code for Package madgraph

 1  ################################################################################ 
 2  # 
 3  # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors 
 4  # 
 5  # This file is a part of the MadGraph5_aMC@NLO project, an application which  
 6  # automatically generates Feynman diagrams and matrix elements for arbitrary 
 7  # high-energy processes in the Standard Model and beyond. 
 8  # 
 9  # It is subject to the MadGraph5_aMC@NLO license which should accompany this  
10  # distribution. 
11  # 
12  # For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch 
13  # 
14  ################################################################################ 
15  from __future__ import absolute_import 
16 -class MadGraph5Error(Exception):
17 """Exception raised if an exception is find 18 Those Types of error will stop nicely in the cmd interface"""
19
20 -class InvalidCmd(MadGraph5Error):
21 """a class for the invalid syntax call"""
22
23 -class aMCatNLOError(MadGraph5Error):
24 """A MC@NLO error"""
25 26 import os 27 import logging 28 import time 29 30 #Look for basic file position MG5DIR and MG4DIR 31 MG5DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), 32 os.path.pardir)) 33 if ' ' in MG5DIR: 34 logging.critical('''\033[1;31mpath to MG5: "%s" contains space. 35 This is likely to create code unstability. 36 Please consider changing the path location of the code\033[0m''' % MG5DIR) 37 time.sleep(1) 38 MG4DIR = MG5DIR 39 ReadWrite = os.access(MG5DIR, os.W_OK) # W_OK is for writing 40 41 if ReadWrite: 42 # Temporary fix for problem with auto-update 43 try: 44 tmp_path = pjoin(MG5DIR, 'Template','LO','Source','make_opts') 45 #1480375724 is 29/11/16 46 if os.path.exists(tmp_path) and os.path.getmtime(tmp_path) < 1480375724: 47 os.remove(tmp_path) 48 shutil.copy(pjoin(MG5DIR, 'Template','LO','Source','.make_opts'), 49 pjoin(MG5DIR, 'Template','LO','Source','make_opts')) 50 except Exception as error: 51 pass 52 53 ADMIN_DEBUG = False 54 if os.path.exists(os.path.join(MG5DIR,'bin', 'create_release.py')): 55 if os.path.exists(os.path.join(MG5DIR,'.bzr')): 56 ADMIN_DEBUG = True 57