calcHEP incorrect number string
Posted: 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:
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:
Not sure whether this is the best method, but it fixes the bug I encountered.
Josh
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
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"];
Josh