~mg5core1/mg5amcnlo/2.6.4

« back to all changes in this revision

Viewing changes to madgraph/interface/Loop_interface.py

1. Fixed many of the first series of points from Olivier's review

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
 
77
77
class LoopInterface(CheckLoop, CompleteLoop, HelpLoop, mg_interface.MadGraphCmd):
78
78
    
 
79
    def __init__(self, mgme_dir = '', *completekey, **stdin):
 
80
        """ Special init tasks for the Loop Interface """
 
81
 
 
82
        mg_interface.MadGraphCmd.__init__(self, mgme_dir = '', *completekey, **stdin)
 
83
        self.setup()
 
84
    
 
85
    def setup(self):
 
86
        """ Special tasks when switching to this interface """
 
87
 
 
88
        # Refresh all the interface stored value as things like generated
 
89
        # processes and amplitudes are not to be reused in between different
 
90
        # interfaces
 
91
        # Clear history, amplitudes and matrix elements when a model is imported
 
92
        # Remove previous imports, generations and outputs from history
 
93
        self.clean_history(remove_bef_lb1='import')
 
94
        # Reset amplitudes and matrix elements
 
95
        self._done_export=False
 
96
        self._curr_amps = diagram_generation.AmplitudeList()
 
97
        self._curr_matrix_elements = helas_objects.HelasMultiProcess()
 
98
        
 
99
        # Set where to look for CutTools installation.
 
100
        # In further versions, it will be set in the same manner as _mgme_dir so that
 
101
        # the user can chose its own CutTools distribution.
 
102
        self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
 
103
        if not os.path.isdir(os.path.join(self._cuttools_dir, 'src','cts')):
 
104
            logger.warning(('Warning: Directory %s is not a valid CutTools directory.'+\
 
105
                           'Using default CutTools instead.') % \
 
106
                             self._cuttools_dir)
 
107
            self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
 
108
    
79
109
    def do_generate(self, line, *args,**opt):
80
110
 
81
111
        # Check args validity
143
173
            if answer != 'y':
144
174
                raise self.InvalidCmd('Stopped by user request')
145
175
 
146
 
        if os.path.isdir(os.path.join(self._mgme_dir, 'loop_material')):
 
176
        if os.path.isdir(os.path.join(self._mgme_dir, 'Template/loop_material')):
147
177
            self._curr_exporter = loop_exporters.LoopProcessExporterFortranSA(\
148
178
                                        self._mgme_dir, self._export_dir, not noclean,\
149
 
                                        os.path.join(self._mgme_dir, 'loop_material'),\
 
179
                                        os.path.join(self._mgme_dir, 'Template/loop_material'),\
150
180
                                        self._cuttools_dir)
151
181
        else:
152
182
            raise MadGraph5Error('MG5 cannot find the \'loop_material\' directory'+\