rounding errors?

Kristian Nielsen kristian.nielsen at risoe.dk
Tue Feb 23 11:24:30 CET 1999


> Your plots in fact look much better than mine. Conversion between k, Q,
> v, E and lambda seems to be the problem.
> Which formula do you use for calculating Q? For Q=3D8.88577 I calculate an
> energy of 81.0425meV at 45=B0? I calculate it with
> Q=3D4*PI*sin(theta)/lambda
> with E(meV)=3D81.80425/lamda(AA)**2.
> Do I have the wrong formula? 81.80425 is correct.

These are the McStas conversion constants (from mcstas-r.h):

v[m/s] = 629.719 * k[1/AA]
       = 437.3949 * sqrt(E[meV])

Thus:

E[meV] = (k[1/AA]*629.719/437.3949)**2
k[1/AA] = sqrt(E[meV])*437.3949/*629.719

Q[1/AA] = 4*PI*sin(theta)/lambda
        = 2*k*sin(theta)
        = 2*sin(theta)*sqrt(E[meV])*437.3949/*629.719

E=81.0425  meV gives Q=8.8430 1/AA
E=81.80425 meV gives Q=8.8844 1/AA

Does that clarify? Anyway, this again shows how nice it would be to have
support for unit conversions in McStas. Won't be in the upcoming
release, though.

 - Kristian.






More information about the mcstas-users mailing list