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 -class MadGraph5Error(Exception):
16 """Exception raised if an exception is find 17 Those Types of error will stop nicely in the cmd interface"""
18
19 -class InvalidCmd(MadGraph5Error):
20 """a class for the invalid syntax call"""
21
22 -class aMCatNLOError(MadGraph5Error):
23 """A MC@NLO error"""
24 25 import os 26 import logging 27 import time 28 29 #Look for basic file position MG5DIR and MG4DIR 30 MG5DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), 31 os.path.pardir)) 32 if ' ' in MG5DIR: 33 logging.critical('''\033[1;31mpath to MG5: "%s" contains space. 34 This is likely to create code unstability. 35 Please consider changing the path location of the code\033[0m''' % MG5DIR) 36 time.sleep(1) 37 MG4DIR = MG5DIR 38 ReadWrite = os.access(MG5DIR, os.W_OK) # W_OK is for writing 39 40 if ReadWrite: 41 # Temporary fix for problem with auto-update 42 try: 43 tmp_path = pjoin(MG5DIR, 'Template','LO','Source','make_opts') 44 #1480375724 is 29/11/16 45 if os.path.exists(tmp_path) and os.path.getmtime(tmp_path) < 1480375724: 46 os.remove(tmp_path) 47 shutil.copy(pjoin(MG5DIR, 'Template','LO','Source','.make_opts'), 48 pjoin(MG5DIR, 'Template','LO','Source','make_opts')) 49 except Exception,error: 50 pass 51