calcHEP incorrect number string

Report the bugs you found
Post Reply
JPEllis
Posts: 71
Joined: 28. Apr 2016, 10:34

calcHEP incorrect number string

Post by JPEllis » 21. Feb 2018, 11:38

Hi,

When Mathematica converts numbers with large exponents to strings, it has the habit of creating a multi-line string:

Code: Select all

ToString[2.99597*^-19]

          -19
2.99597 10
which is fine for terminal output, but creates issues when SARAH is trying to write to the calcHEP model files. One instance where I had an error is near line 1948 of calchep.m which causes the exact issue above when outputting the width of the muon for example.

A fix seems to be to encapsulate getWidthNumerical[list[[i,1]],j,k] in FortranForm before calling ToString:

Code: Select all

WriteString[varsFile, InsString[CalcHepWidth[list[[i,1]],j,k],lVN] <>"|" <> InsString[ToString[FortranForm[getWidthNumerical[list[[i,1]],j,k]]],lVV]<>"| width \n"];
Not sure whether this is the best method, but it fixes the bug I encountered.

Josh
Joshua Ellis jpellis.me

FStaub
Site Admin
Posts: 822
Joined: 13. Apr 2016, 14:05

Re: calcHEP incorrect number string

Post by FStaub » 23. Feb 2018, 14:31

Yes, that seem to be a proper solution.
Florian

Post Reply