How to interface with external functions ???

Asked by ahh

Dear MG Authors
I want to know how to implement an external file with simple python functions and call that functions into the parameter card ?????
In fact i try that by using import file.py in both _init_ and Parameters.py , but it couldnt read .
Thanks
Hammad

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
ahh
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

You need to modify the UFO model, not the parameter card.

Cheers,

Olivier

On May 24, 2014, at 8:46 PM, Ahmed Hammad <email address hidden> wrote:

> New question #249216 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/249216
>
> Dear MG Authors
> I want to know how to implement an external file with simple python functions and call that functions into the parameter card ?????
> In fact i try that by using import file.py in both _init_ and Parameters.py , but it couldnt read .
> Thanks
> Hammad
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
ahh (ahh) said :
#2

Dear Dr Olivier
Sorry if i couldnt deliver the idea . Indeed i did that modifications to the UFO files " Parameters.py & _init_"
but still can not process .
Thanks
Hammad

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#3

You shouldn’t change init.

Only parameters.py
Remember that we have to translate this information to fortran for any computation so this is important that you follow the UFO convention.

Cheers,

Olivier

On May 24, 2014, at 9:26 PM, Ahmed Hammad <email address hidden> wrote:

> Question #249216 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/249216
>
> Status: Answered => Open
>
> Ahmed Hammad is still having a problem:
> Dear Dr Olivier
> Sorry if i couldnt deliver the idea . Indeed i did that modifications to the UFO files " Parameters.py & _init_"
> but still can not process .
> Thanks
> Hammad
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
ahh (ahh) said :
#4

Thanks Alot dr
In fact i used _init_ to import the new file which contains my functions " by import command" .
According the last answer i should write my functions in separate file and call it inside the parameters.py by import command
but i need to first convert the external file"that contains the new functions" into fortran ???
Am i right ??
Thanks for your interest
Hammad

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#5

Hi Hammad,

> In fact i used _init_ to import the new file which contains my functions “ by import command" .

By doing this you make your UFO model compatible ONLY with python output format. Since 99.5% of our output are either in Fortran or C++.
This basically means that MG5_aMC can not handle your model.
(only the check command might work)

> According the last answer i should write my functions in separate file and call it inside the parameters.py by import command

No you can not use the import command syntax!
Such import will never be converted in Fortran/C++ function.
The only way is to code your function directly inside the parameter definition.

Another solution is to re-express your need in term of Form-Factor and use one of the way describe in this page to do what you want:
https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/FormFactors

Cheers,

Olivier

On May 24, 2014, at 9:46 PM, Ahmed Hammad <email address hidden> wrote:

> Question #249216 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/249216
>
> Status: Answered => Open
>
> Ahmed Hammad is still having a problem:
> Thanks Alot dr
> In fact i used _init_ to import the new file which contains my functions " by import command" .
> According the last answer i should write my functions in separate file and call it inside the parameters.py by import command
> but i need to first convert the external file"that contains the new functions" into fortran ???
> Am i right ??
> Thanks for your interest
> Hammad
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
ahh (ahh) said :
#6

Great Thanks dr Olivier
That helps alot