Still the 2e9...

Per-Olof Åstrand per-olof.aastrand at risoe.dk
Tue Mar 20 17:26:37 CET 2001


Hi,

I'm in the middle of the workshop so I can't check things carefully
right now, but if it is urgent I have a possible explanation.

A check if  two variables declared as double are strictly equal may fail
due to rounding errors. If something like (double1 .eq. double2) occurs
it should be changed to something like (abs(double1-double2) .le. tiny)
where tiny is a small number (e.g. 10^-2). I will look at it later on,
but it may save you some time doing time-consuming checks. These kind of
rounding errors will also typically show up differently on different
platforms or for different compilers.

Furthermore, the same problem may occur in various components. Users
writing components should be careful about counters counting the number
of neutron events. Such mistakes will not make the simulation run
forever, but it will give wrong results.

Best regards,

Per-Olof Åstrand


Emmanuel Farhi wrote:

> Hy all,
>
> That's true, a double is coded on twice the length of a long int. Thus
> we should not have any trouble in counting. The 'double' counter is
> thus ok. Anyway, I do not undestand why sometimes, the comparison
> expression to test the end of the simulation just stucks, and the
> simulation never ends.
>
> I will study that further, and that's why I passed to long, to be sure
> the counter is precise, and does not contain an uncertainty. Sure
> using a long limits the counting to 2e9 (or 4e9 is unsigned).
> Probably usng a 'long double' would even be better.
>
> So, sorry !
>
> For the tme being, please use the 1.4.1 version (with ncount and
> run_num as doubles).
> I will try to put a kind of basic debugger for 'stuck' simulations in
> the signal hander.
>
> Cheers.
> Emmanuel.
>
> Rob Kreuger wrote:
>
>> Hello,
>>
>> as far as I could figure out a double has 15 significant digits, so
>> counting should work up to something like 10^14. Beyond that it
>> won't work
>> anymore. But a 100P neutrons should be enough for the moment, unless
>> you
>> have a supercomputer. So I can't see why Emmanuel still has
>> problems.
>>
>> cheers,
>> Rob Kreuger
>>
>> farhi> Hy,
>> farhi>
>> farhi> I just realized that the '2e9' bug is still there, but more
>> vicious.
>> farhi> in fact, I passed ncount and run_num to long, because there
>> may be
>> farhi> rounding errors when using float numbers, and comparisons. I
>> got
>> farhi> unending simulations...
>> farhi>
>> farhi> Please use the attached files ! (lib/mcstas)
>> farhi> Changing that requires to update Monitor_nD...
>> (lib/mcstas/monitors)
>> farhi>
>> farhi> Cheers.
>> farhi>
>> farhi> --
>> farhi> What's up Doc ?
>> farhi> --------------------------------------------
>> farhi> Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html   \|/
>> ____ \|/
>> farhi> CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble
>> ~@-/ oO \-@~
>> farhi> 6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_(
>> \__/ )_\
>> farhi> Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 48 39 06
>> \__U_/
>> farhi>
>> farhi>
>> farhi>
>>
>> +-----
>> --------------------------------------------------------------+
>> | Rob Kreuger                    | Email: Rob.Kreuger at iri.tudelft.nl
>> |
>> | Tel: (+31) 015 278 3900        |
>> |
>> +
>> -------------------------------+-----------------------------------+
>>
>> | Radiation Technology group     | Neutron Scattering group
>> |
>> | GEM project                    | Scans PROJECT
>> |
>> | Tel: (+31) 015 278(5244)       | Tel: (+31) 015 278(6814)
>> |
>> | Fax: (+31) 015 278(6422)       | Fax: (+31) 015 278(8303)
>> |
>> +
>> -------------------------------+-----------------------------------+
>>
>> | IRI                            | Mekelweg 15
>> |
>> | Delft University of Technology | 2629 JB  Delft
>> |
>> | Tel: (+31) 015 278(5022)       | Netherlands
>> |
>> +
>> -------------------------------------------------------------------+
>
> --
> What's up Doc ?
> --------------------------------------------
> Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
> CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
> 6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
> Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 48 39 06     \__U_/
>
>

--
Per-Olof Åstrand
Dept. of Chemistry, University of Copenhagen
and Materials Research Department, Risø National Laboratory
per-olof.aastrand at theory.ki.ku.dk or per-olof.aastrand at risoe.dk
http://www.ki.ku.dk and http://www.risoe.dk






More information about the mcstas-users mailing list