From gapost at ipta.demokritos.gr Thu Oct 4 15:54:05 2007 From: gapost at ipta.demokritos.gr (George Apostolopoulos) Date: Thu, 04 Oct 2007 16:54:05 +0300 Subject: [neutron-mc] Maxwell random deviate generator Message-ID: <2FC5F098E25EFF47AEF8F02F25780ADC01C6609B@hermes.ipta.demokritos.gr> Dear all, I post here a routine for generating random numbers drawn from the maxwell flux distribution. I thought it may be of interest for McStas. The method follows an example from "Numerical Recipes - 7.3 Rejection Method" Files: maxwell.c : contains the actual routine and also runs a basic test on the validity of the algorithm. maxwell_deviate.pdf : Documents the algorithm in some more detail. Best regards. ****************************************************** Dr. Georgios Apostolopoulos Institute of Nuclear Technology & Radiation Protection National Center for Scientific Research "Demokritos" 15310 Agia Paraskevi Attikis, Greece tel +30-210-650-3731 fax +30-210-653-3431 email: gapost at ipta.demokritos.gr ****************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: Maxwell_Deviate.pdf Type: application/octet-stream Size: 152549 bytes Desc: Maxwell_Deviate.pdf URL: From gapost at ipta.demokritos.gr Thu Oct 4 15:56:06 2007 From: gapost at ipta.demokritos.gr (George Apostolopoulos) Date: Thu, 04 Oct 2007 16:56:06 +0300 Subject: [neutron-mc] Maxwell random deviate generator Message-ID: <2FC5F098E25EFF47AEF8F02F25780ADC01C6609E@hermes.ipta.demokritos.gr> Sorry, forgot to paste the c-code. ****************************************************** Dr. Georgios Apostolopoulos Institute of Nuclear Technology & Radiation Protection National Center for Scientific Research "Demokritos" 15310 Agia Paraskevi Attikis, Greece tel +30-210-650-3731 fax +30-210-653-3431 email: gapost at ipta.demokritos.gr ****************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: maxwell.c Type: application/octet-stream Size: 2349 bytes Desc: maxwell.c URL: From gapost at ipta.demokritos.gr Fri Oct 5 12:44:49 2007 From: gapost at ipta.demokritos.gr (George Apostolopoulos) Date: Fri, 05 Oct 2007 13:44:49 +0300 Subject: [neutron-mc] Maxwell random deviate generator In-Reply-To: <2FC5F098E25EFF47AEF8F02F25780ADC01C6609E@hermes.ipta.demokritos.gr> References: <2FC5F098E25EFF47AEF8F02F25780ADC01C6609E@hermes.ipta.demokritos.gr> Message-ID: <2FC5F098E25EFF47AEF8F02F25780ADC01C66134@hermes.ipta.demokritos.gr> Dear all, I found today a much more elegant solution to this problem. Actually the following three lines of code: { double u1,u2; do u1 = rand01(); while (u1==0.0); do u2 = rand01(); while (u2==0.0); return sqrt(-log(u1*u2)); } generate random velocities with the required Maxwell flux distribution 2*exp(-v^2)*v^3. (v is scaled to the thermal velocity v_T = 2kT/m) What is most interesting for McStas is the following: Generating velocities with the above routine is slower (about 0.6 times) than the standard McStas method of first generating velocities (or equivalently wavelengths) uniformly and then calculating the particle weight. But: the same accuracy of Monte-Carlo results is reached with fewer particle histories when sampling the true distribution. I get roughly a performance improvement of 1.5 to 2 on my computer, depending on compiler. As an example, the small attached program "maxwell2.c" calculates the average with both methods. The output of "maxwell2.c" on my computer with gcc: ************************************************************************ ******** Testing the Maxwell random deviate generator. The value of = 2 will be calculated by 2 methods: 1. Generating random v distributed uniformly in 0.1 < v <5 and multiplying by the distribution weight w = 2*exp(-v^2)*v^3 2. Generating random v distributed according to 2*exp(-v^2)*v^3 1st method N delta/ time(ms) 100 1.888390 1.463e-001 0.000 1000 2.157340 4.092e-002 0.000 10000 2.010312 1.352e-002 0.000 100000 2.004246 4.283e-003 15.000 1000000 1.998229 1.355e-003 172.000 10000000 1.999877 4.282e-004 1690.000 2nd method N delta/ time(ms) 100 2.109436 6.675e-002 0.000 1000 2.007962 2.170e-002 0.000 10000 2.007131 7.057e-003 0.000 100000 2.000076 2.232e-003 16.000 1000000 1.998449 7.057e-004 235.000 10000000 1.999998 2.234e-004 2582.000 ************************************************************************ ***** The pdf file is a short description of the method. Best regards, George -----Original Message----- From: neutron-mc-bounces at risoe.dk [mailto:neutron-mc-bounces at risoe.dk] On Behalf Of George Apostolopoulos Sent: Thursday, October 04, 2007 4:56 PM To: neutron-mc at risoe.dk Subject: [neutron-mc] Maxwell random deviate generator Sorry, forgot to paste the c-code. ****************************************************** Dr. Georgios Apostolopoulos Institute of Nuclear Technology & Radiation Protection National Center for Scientific Research "Demokritos" 15310 Agia Paraskevi Attikis, Greece tel +30-210-650-3731 fax +30-210-653-3431 email: gapost at ipta.demokritos.gr ****************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: maxwell2.pdf Type: application/octet-stream Size: 58804 bytes Desc: maxwell2.pdf URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: maxwell2.c Type: application/octet-stream Size: 2638 bytes Desc: maxwell2.c URL: From gapost at ipta.demokritos.gr Tue Oct 30 17:22:47 2007 From: gapost at ipta.demokritos.gr (George Apostolopoulos) Date: Tue, 30 Oct 2007 18:22:47 +0200 Subject: [neutron-mc] Integrated Flux - Discrepancies between McStas and MCNP Message-ID: <2FC5F098E25EFF47AEF8F02F25780ADC01DD43C9@hermes.ipta.demokritos.gr> Dear all, Being a new user of McStas, but with some experience in Monte-Carlo with MCNP, one of the first things that I tried to understand was how the normalization is handled in McStas. After running some test problems the normalization became clear but I noticed some discrepancies between McStas and MCNP which I cannot understand. Specifically, consider the following simple example: Particles emitted by a square (d x d) surface source are counted by a square monitor, with the same area (d x d), positioned at a distance D. I run this problem both in McStas and MCNP and the results I get agree very well when D>>d but differ by up to 20% when D~d. A plain numerical integration agrees with MCNP, but this requires discussion. You will find a detailed report in the attached document. Best regards ****************************************************** Dr. Georgios Apostolopoulos Institute of Nuclear Technology & Radiation Protection National Center for Scientific Research "Demokritos" 15310 Agia Paraskevi Attikis, Greece tel +30-210-650-3731 fax +30-210-653-3431 email: gapost at ipta.demokritos.gr ****************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: IntegFluxComparison.pdf Type: application/octet-stream Size: 99727 bytes Desc: IntegFluxComparison.pdf URL: From wokaoyan1981 at 126.com Sun Nov 4 10:59:04 2007 From: wokaoyan1981 at 126.com (wokaoyan1981) Date: Sun, 04 Nov 2007 17:59:04 +0800 (CST) Subject: [neutron-mc] question Message-ID: <24016098.3948341194170344469.JavaMail.coremail@bj126app73.126.com> Deal all, I can not open any links in the Component Library Index with my default web browser FIREFOX. Could you please specifically tell me how to solve the problem? My Email address is wokaoyan1981 at 126.com Best regards! Tom Chen -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.willendrup at risoe.dk Mon Nov 5 09:25:40 2007 From: peter.willendrup at risoe.dk (Willendrup, Peter Kj=?ISO-8859-1?B?5g==?=r) Date: Mon, 05 Nov 2007 09:25:40 +0100 Subject: [neutron-mc] Integrated Flux - Discrepancies between McStas and MCNP In-Reply-To: <2FC5F098E25EFF47AEF8F02F25780ADC01DD43C9@hermes.ipta.demokritos.gr> Message-ID: Hello everyone, First of all, thanks to George Apostolopoulos for the detailed bug-report. A detailed study of the found discrepancy between McStas and MCNP / analytics, it turns out that a couple of modifications are needed in the McStas focusing routines. (Specifically, a solid-angle correction to the neutron weight does not fully take source geometry into account.) As also pointed out in George's report on the problem, the effect of the discrepancy is only severe in situations where source size, focusing area and focusing distance are all of the same order. (In most practical cases, the effect is negligible). Corrections to the McStas runtime code and source components will be incorporated in the development version of McStas in a few days, and will be part of the next official release of McStas (available late 2007 / early 2008). Best regards, Peter Willendrup On 10/30/07 5:22 PM, "George Apostolopoulos" wrote: > Dear all, > > Being a new user of McStas, but with some experience in Monte-Carlo with > MCNP, > one of the first things that I tried to understand was how the > normalization is handled > in McStas. After running some test problems the normalization became > clear but > I noticed some discrepancies between McStas and MCNP which I cannot > understand. > > Specifically, consider the following simple example: > Particles emitted by a square (d x d) surface source are counted by a > square > monitor, with the same area (d x d), positioned at a distance D. > > I run this problem both in McStas and MCNP and the results I get agree > very well when > D>>d but differ by up to 20% when D~d. > A plain numerical integration agrees with MCNP, but this requires > discussion. > > You will find a detailed report in the attached document. > > Best regards > > ****************************************************** > Dr. Georgios Apostolopoulos > Institute of Nuclear Technology & Radiation Protection > National Center for Scientific Research "Demokritos" > 15310 Agia Paraskevi Attikis, Greece > > tel +30-210-650-3731 > fax +30-210-653-3431 > email: gapost at ipta.demokritos.gr > ****************************************************** > _______________________________________________ > neutron-mc mailing list > neutron-mc at risoe.dk > http://mailman.risoe.dk/mailman/listinfo/neutron-mc From peter.willendrup at risoe.dk Mon Nov 5 11:13:59 2007 From: peter.willendrup at risoe.dk (Willendrup, Peter Kj=?ISO-8859-1?B?5g==?=r) Date: Mon, 05 Nov 2007 11:13:59 +0100 Subject: [neutron-mc] question In-Reply-To: Message-ID: Hello again Tom, I just did a test-install of firefox on my Windows machine - when trying to click a link in the library index I now get: "Firefox doesn't know how to open this adress, because the protocol (c) isn't associated with any program." - I guess this is what you are seeing? The quick-n-dirty solution to your problem is to modify your c:\mcstas\lib\index.html file and do replacement: c:\mcstas\lib file://c:/mcstas/lib Thanks for reporting this problem, will see what I can do to make this better for the next release. Regards, Peter Willendrup On 11/5/07 9:29 AM, "Willendrup, Peter Kj?r" wrote: > Hello Tom, > > > Could you provide me with a bit more information: > > 1) Which operating system is your computer running? (Linux/Windows/...?) > > 2) What is the exact error message from firefox? > > > Best regards, > > Peter Willendrup > > > On 11/4/07 10:59 AM, "wokaoyan1981" wrote: > >> Deal all, >> >> I can not open any links in the Component Library Index with my default web >> browser FIREFOX. Could you please specifically tell me how to solve the >> problem? My Email address is wokaoyan1981 at 126.com >> >> Best regards! >> >> Tom Chen >> >> >> _______________________________________________ >> neutron-mc mailing list >> neutron-mc at risoe.dk >> http://mailman.risoe.dk/mailman/listinfo/neutron-mc From percival at physics.queensu.ca Tue Nov 20 22:45:29 2007 From: percival at physics.queensu.ca (Aaron M. Percival) Date: Tue, 20 Nov 2007 16:45:29 -0500 Subject: [neutron-mc] Mcformat Problems Message-ID: <000001c82bbe$ab7102f0$025308d0$@queensu.ca> Hi all, I've been having some problems running the mcformat utility on my windows machine. I have two directories that contain results from two runs of the same simulation and I would like to merge the data. In the directories are the data from various detectors, along with the list file from a virtual_input. I run the following command line: C:\>mcformat --format=McStas --force --test --dir=C:\test c:\temp\one c:\temp\two --merge mcformat: Will process and merge/scan 14 data files in 2 directories. And seemingly the process will work, however, when I remove the --test option, I find the following errors: C:\>mcformat --format=McStas --force --dir=C:\test c:\temp\one c:\temp\two --merge mkdir: EEXIST pathname C:\test already exists (not necessarily as a directory). mcformat: Warning: re-using output directory 'C:\test'. mcformat: Will process and merge/scan 14 data files in 2 directories. mkdir: ERROR 22 using mkdir. mcformat: Fatal error accessing C:\test\c:\temp\one. Aborting. And the merging process will not complete. Even if I remove the --dir and --force options, I get the same results. Upon further inspection, it appears as though the error: mcformat: Fatal error accessing C:\test\c:\temp\one is directly related to the --dir option, or if this option is unspecified the current directory, in that mcformat: Fatal error accessing [CURRENT_DIR or option --dir]\c:\temp\one as though the output directory is being concatenated with the first input directory. Furthermore, I do notice that before the fatal error, mcformat.exe does create the desired c:\test folder. Thanks, Aaron ************************************************* Aaron M. Percival M.Sc. Candidate Dept. of Physics, Engineering Physics & Astronomy Queen's University Kingston, Ontario, Canada, K7L 3N6 Office: 613-533-6000 ext. 74789 Fax: 613-533-6463 ************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.willendrup at risoe.dk Tue Nov 20 22:58:44 2007 From: peter.willendrup at risoe.dk (Willendrup, Peter Kj=?ISO-8859-1?B?5g==?=r) Date: Tue, 20 Nov 2007 22:58:44 +0100 Subject: [neutron-mc] Mcformat Problems In-Reply-To: <000001c82bbe$ab7102f0$025308d0$@queensu.ca> Message-ID: Hi there, Thanks for reporting, the bug has been added to our TODO. For now, could you try the workaround mentioned below for me? On 11/20/07 10:45 PM, "Aaron M. Percival" wrote: > I've been having some problems running the mcformat utility on my windows > machine. > > I have two directories that contain results from two runs of the same > simulation and I would like to merge the data. In the directories are the > data from various detectors, along with the list file from a virtual_input. > I run the following command line: A small note here, mcformat currently _does_not_ merge virtual_input files. > mcformat: Fatal error accessing C:\test\c:\temp\one Here is an indication of the problem - windows disklabels should be removed when generating the output dir. Could you instead try the following: C:\>mcformat --format=McStas --force --dir=C:\test \temp\one \temp\two --merge Thanks again, Peter From percival at physics.queensu.ca Wed Nov 21 17:37:23 2007 From: percival at physics.queensu.ca (Aaron M. Percival) Date: Wed, 21 Nov 2007 11:37:23 -0500 Subject: [neutron-mc] Mcformat Problems In-Reply-To: References: <000001c82bbe$ab7102f0$025308d0$@queensu.ca> Message-ID: <000001c82c5c$cb4acef0$61e06cd0$@queensu.ca> Hi Peter, The work around did work, with a slight bug. The files were all successfully merged, however the resultant files were not created in the c:\test folder but in a c:\test\temp\one folder, and an empty c:\test\temp\two folder was also created. Do you plan to incorporate the merging of virtual_input into mcformat files at any point? Thanks again, Aaron -----Original Message----- From: neutron-mc-bounces at risoe.dk [mailto:neutron-mc-bounces at risoe.dk] On Behalf Of Willendrup, Peter Kj?r Sent: Tuesday, November 20, 2007 4:59 PM To: McStas users list at neutron.risoe.dk Subject: Re: [neutron-mc] Mcformat Problems Hi there, Thanks for reporting, the bug has been added to our TODO. For now, could you try the workaround mentioned below for me? On 11/20/07 10:45 PM, "Aaron M. Percival" wrote: > I've been having some problems running the mcformat utility on my windows > machine. > > I have two directories that contain results from two runs of the same > simulation and I would like to merge the data. In the directories are the > data from various detectors, along with the list file from a virtual_input. > I run the following command line: A small note here, mcformat currently _does_not_ merge virtual_input files. > mcformat: Fatal error accessing C:\test\c:\temp\one Here is an indication of the problem - windows disklabels should be removed when generating the output dir. Could you instead try the following: C:\>mcformat --format=McStas --force --dir=C:\test \temp\one \temp\two --merge Thanks again, Peter _______________________________________________ neutron-mc mailing list neutron-mc at risoe.dk http://mailman.risoe.dk/mailman/listinfo/neutron-mc From farhi at ill.fr Wed Nov 21 20:54:25 2007 From: farhi at ill.fr (Emmanuel FARHI) Date: Wed, 21 Nov 2007 20:54:25 +0100 (CET) Subject: [neutron-mc] Mcformat Problems In-Reply-To: <000001c82c5c$cb4acef0$61e06cd0$@queensu.ca> References: <000001c82bbe$ab7102f0$025308d0$@queensu.ca> <000001c82c5c$cb4acef0$61e06cd0$@queensu.ca> Message-ID: <46576.193.49.43.124.1195674865.squirrel@195.83.126.3> Hi Aaron, That's nice you're using mcformat. The merging of virtual sources is not in the high priority list, as usually these are simple files that may be catenated using simple editors. Indeed, a virtual source file contains a header, followed by events, one per line. To merge files manually, one has to remove the second header (using something like a head/tail command in Unix/Linux), and simply do a 'cat a b' or 'more a b'. But in principle, I agree, this is not too much an effort to indeed support virtual sources, so I'll do that some not too far day (but not too close as well). I've corrected the mcformat in our CVS, so that next release will fix the C:\path1\c:\path2 bug that you reported. I've also fixed a potential issue regarding MPI computation which stalls. You just have to replace your current c:\mcstas\lib\share\mcstas-r.c. We can not guaranty that this completely fixes the problem, and are currently running large MPI tests. We would appreciate if you would re-run some simulations that caused problems and could not perform entirely. Thanks for keeping using McStas, and pushing us to improve the software. Emmanuel and Peter. > Hi Peter, > > The work around did work, with a slight bug. The files were all > successfully merged, however the resultant files were not created in the > c:\test folder but in a c:\test\temp\one folder, and an empty > c:\test\temp\two folder was also created. > > Do you plan to incorporate the merging of virtual_input into mcformat > files > at any point? > > Thanks again, > > Aaron > > -----Original Message----- > From: neutron-mc-bounces at risoe.dk [mailto:neutron-mc-bounces at risoe.dk] On > Behalf Of Willendrup, Peter Kj?r > Sent: Tuesday, November 20, 2007 4:59 PM > To: McStas users list at neutron.risoe.dk > Subject: Re: [neutron-mc] Mcformat Problems > > Hi there, > > > Thanks for reporting, the bug has been added to our TODO. For now, could > you > try the workaround mentioned below for me? > > On 11/20/07 10:45 PM, "Aaron M. Percival" > wrote: > >> I've been having some problems running the mcformat utility on my >> windows >> machine. >> >> I have two directories that contain results from two runs of the same >> simulation and I would like to merge the data. In the directories are >> the >> data from various detectors, along with the list file from a > virtual_input. >> I run the following command line: > > A small note here, mcformat currently _does_not_ merge virtual_input > files. > >> mcformat: Fatal error accessing C:\test\c:\temp\one > > Here is an indication of the problem - windows disklabels should be > removed > when generating the output dir. Could you instead try the following: > > C:\>mcformat --format=McStas --force --dir=C:\test \temp\one \temp\two > --merge > > > Thanks again, > > Peter > -- FARHI Emmanuel Groupe DS/CS, ILL4/156, Tel 04 76 20 71 35 ILL, Grenoble -------------- next part -------------- A non-text attachment was scrubbed... Name: mcstas-r.c Type: text/x-csrc Size: 181201 bytes Desc: not available URL: From ricardolopezanton at gmail.com Sun Dec 2 15:54:32 2007 From: ricardolopezanton at gmail.com (Ricardo Lopez Anton) Date: Sun, 02 Dec 2007 15:54:32 +0100 Subject: [neutron-mc] problem with my McStas and windows vista Message-ID: <61FCC4D714FA48608D71553E97F0FEB0@RicardoMainNB> Dear colleagues, I've just installed McStas in my laptop but i'm having problems. I've just tried to run the Vanadium example and I receive the message: Translating instrument definition 'h8_test.instr' into C ... mcstas -t -o "h8_test.c" "h8_test.instr" Compiling simulation h8_test.instr Warning: 'Source_flat' is an obsolete component (not maintained). Warning: 'Monochromator' is an obsolete component (not maintained). Job finished. Compiling C source 'h8_test.c' ... gcc.exe -o "h8_test.exe" "h8_test.c" -lm Compiling simulation h8_test.instr gcc.exe: installation problem, cannot exec `cc1': No such file or directory Job exited abnormally. I.e., it doesn't work (I've tried with different instruments but it's always the same) but in my desktop computer at work it works properly. My laptop has windows vista whereas my desktop computer has Windows XP. How this could be solved? Thank you very much. Dr. Ricardo Lopez Anton -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.willendrup at risoe.dk Sun Dec 2 22:06:15 2007 From: peter.willendrup at risoe.dk (Peter Kjaer Willendrup) Date: Sun, 02 Dec 2007 22:06:15 +0100 (CET) Subject: [neutron-mc] problem with my McStas and windows vista In-Reply-To: <61FCC4D714FA48608D71553E97F0FEB0@RicardoMainNB> References: <61FCC4D714FA48608D71553E97F0FEB0@RicardoMainNB> Message-ID: Hello Ricardo and neutron-mc, On Sun, 2 Dec 2007, Ricardo Lopez Anton wrote: > I've just installed McStas in my laptop but i'm having problems. I've just > tried to run the Vanadium example and I receive the message: > > I.e., it doesn't work (I've tried with different instruments but it's always > the same) but in my desktop computer at work it works properly. My laptop > has windows vista whereas my desktop computer has Windows XP. > > How this could be solved? Currently, McStas is not officially supported on Windows Vista, however Andrei Savici (from ORNL) has reported partial succees in fixing the problem you also see. I will forward his experiences to you outside of this mailinglist. Vista has only just arrived at Risoe, and I have not had the possibility of testing McStas on this platform yet. I will get a copy of Vista as soon as possible and try to have things working for McStas 1.12. Best regards, Peter -- ------------------------------------- Peter Kjaer Willendrup, Cand. Scient Phone: (+45) 46 77 58 62 email: peter.willendrup at risoe.dk -------------------------------------