Skip to content

Commit

Permalink
Merge pull request #918 from madgraph5/couplings_order
Browse files Browse the repository at this point in the history
Couplings order
  • Loading branch information
valassi authored Jul 29, 2024
2 parents 5502223 + 4cb6968 commit dfe59f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/model_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
logger = logging.getLogger('madgraph.PLUGIN.CUDACPP_OUTPUT.model_handling')


#------------------------------------------------------------------------------------

# AV - import the independent 2nd copy of the export_cpp module (as PLUGIN_export_cpp), previously loaded in output.py
Expand Down Expand Up @@ -1751,6 +1752,14 @@ class PLUGIN_GPUFOHelasCallWriter(helas_call_writers.GPUFOHelasCallWriter):
# - PLUGIN_GPUFOHelasCallWriter(GPUFOHelasCallWriter)
# This class


def __init__(self, *args, **opts):

self.wanted_ordered_dep_couplings = []
self.wanted_ordered_indep_couplings = []
super().__init__(*args,**opts)


# AV - replace helas_call_writers.GPUFOHelasCallWriter method (improve formatting of CPPProcess.cc)
# [GPUFOHelasCallWriter.format_coupling is called by GPUFOHelasCallWriter.get_external_line/generate_helas_call]
# [GPUFOHelasCallWriter.get_external_line is called by GPUFOHelasCallWriter.get_external]
Expand Down Expand Up @@ -1787,10 +1796,12 @@ def format_coupling(self, call):
aliastxt = 'PARAM'
name = 'cIPD'
elif model.is_running_coupling(coup):
if coup not in self.wanted_ordered_dep_couplings: self.wanted_ordered_dep_couplings.append(coup)
alias = self.couporderdep
aliastxt = 'COUPD'
name = 'cIPC'
else:
if coup not in self.wanted_ordered_indep_couplings: self.wanted_ordered_indep_couplings.append(coup)
alias = self.couporderindep
aliastxt = 'COUPI'
name = 'cIPC'
Expand Down Expand Up @@ -1825,8 +1836,10 @@ def format_coupling(self, call):
call = call.replace('CD_ACCESS', 'CI_ACCESS')
call = call.replace('m_pars->%s%s' % (sign, coup),
'COUPs[ndcoup + %s], %s' % (alias[coup]-len(self.couporderdep), '1.0' if not sign else '-1.0'))

if newcoup:
self.couplings2order = self.couporderdep | self.couporderindep
model.cudacpp_wanted_ordered_couplings = self.wanted_ordered_dep_couplings + self.wanted_ordered_indep_couplings
return call

# AV - new method for formatting wavefunction/amplitude calls
Expand Down
5 changes: 3 additions & 2 deletions epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ def generate_subprocess_directory(self, subproc_group, fortran_model, me=None):
return out
# AV (default from OM's tutorial) - add a debug printout
def convert_model(self, model, wanted_lorentz=[], wanted_coupling=[]):
misc.sprint('Entering PLUGIN_ProcessExporter.convert_model (create the model)')
if hasattr(model , 'cudacpp_wanted_ordered_couplings'):
wanted_coupling = model.cudacpp_wanted_ordered_couplings
del model.cudacpp_wanted_ordered_couplings
return super().convert_model(model, wanted_lorentz, wanted_coupling)


# AV (default from OM's tutorial) - add a debug printout
def finalize(self, matrix_element, cmdhistory, MG5options, outputflag):
"""Typically creating jpeg/HTML output/ compilation/...
Expand Down

0 comments on commit dfe59f1

Please sign in to comment.