Generation succeeds interactively, but script fails.

Asked by Garrett on 2017-11-20

import model_v4 DarkPhoDM
generate p p > chi chi~​

I'm trying to run these commands as a script and they work fine if I type them manually into the terminal, but as a script it simply errors with:

import model_v4 DarkPhoDM
INFO: load particles
INFO: load interactions
INFO: Change particles name to pass to MG5 convention
Defined multiparticle p = g u c d s u~ c~ d~ s~
Defined multiparticle j = g u c d s u~ c~ d~ s~
Defined multiparticle l+ = e+ mu+
Defined multiparticle l- = e- mu-
Defined multiparticle vl = ve vm vt
Defined multiparticle vl~ = ve~ vm~ vt~
Defined multiparticle all = g d u s c d~ u~ s~ c~ a e- mu- ve vm vt e+ mu+ ve~ vm~ vt~ b t b~ t~ z w+ h vp w- ta- chi ta+ chi~
generate p p > chi chi~​
Command "import /opt/MG5_aMC_v2_2_3/testmadgraph.dat" interrupted in sub-command:
"generate p p > chi chi~​" with error:
InvalidCmd : No particle chi~​ in model

Question information

English Edit question
MadGraph5_aMC@NLO Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Garrett (thegrb93) said : #1

My guess is as it moves onto the next command, it's starting a new instance of madgraph and forgetting about the model I just imported. If that's the case, how do you import models using a script?

Garrett (thegrb93) said : #2

I just tried it with this script and it worked.

import model mssm
generate p p > t1 t1~
add process p p > t2 t2~
output -f

Must be some sort of bug with importing the DarkPhoDM model in script (even though works fine when typing it into the terminal).


Can you test with the latest version of the code (2.6.0)? 2.2.3 should be three year old now.
If you still have such bug with 2.6.0, then could you please indicate how you run the script
and if you can attach your model (Note that such type of model is a v4 model which are going to be not supported anymore in a near future since that format is frozen since 2011)



Garrett (thegrb93) said : #4

The bug seems to persist in 2.6.0

I run my script in mg5_aMC with the command: > ./bin/mg5_aMC myscript.dat

Its contents are:
import model_v4 DarkPhoDM
generate p p > chi chi~​

I've uploaded my model here

Hi Garett,

I guess this is a problem of file formatting,
When i copy paste your input, I can reproduce the error.
But if I just write the same line without any copy-past then it works nicely

If I do a diff between the two file (the one working cmd3 and the one who failed (cmd2), you can indeed see that they are a difference, but a difference that can not be seen by the human eyes (at least on my machine).

[2.6.1_bk]$ diff cmd2 cmd3
< generate p p > chi chi~
> generate p p > chi chi~

By investigating a bit more, looks like that you have a weird "space" at the end of the chi~ this space (a remnant of a windows file?) is consider as a normal character entering the name of the particle. making that particle not defined.



Garrett (thegrb93) said : #6

Thanks so much. The carriage return symbol was the problem.