Page 1 of 1

calcHEP incorrect number string

Posted: 21. Feb 2018, 11:38
by JPEllis
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

Re: calcHEP incorrect number string

Posted: 23. Feb 2018, 14:31
by FStaub
Yes, that seem to be a proper solution.
Florian