[mcstas-users] [EXTERNAL] Re: Multiple samples in a single mcstas instrument?

Wildgruber, Christoph U. wildgrubercu at ornl.gov
Thu Jul 11 14:21:43 CEST 2019


Dear Peter & Erik,

Thanks so much for the confirmation that it can be done and the ‘how to’.
I am determined to try it at some point I am taking your implicit
warnings serious :-)
I also have to look into how my fully loaded mpi-cluster would deal with
reading the intermediary neutron source simultaneously from
many processors… maybe a RAM disk on each node would work…

Thanks again,

Uli


[I sent that again because I didn’t to mcstas-user!]


On 11 Jul 2019, at 03:17, Peter Kjær Willendrup <pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>> wrote:

Hi Uli,


Erik managed to beat me to it! :-)

I would do more or less the same:

1) SPLIT by a bigger amounts, e.g. samples * 10 (samples already allow SPLITS, and now you have a N of these)

2) partition the interval [0 1] corresponding to the number of samples and then rand01() in an EXTEND to randomly choose between them using a WHEN on each

3) One thing to remember:
If getting the intensity “right” i.e. the same as what you would get running each sample alone, I would then do a p *= nsamples; in an EXTEND.



Cheers,

Peter


On 11 Jul 2019, at 08.58, Erik B Knudsen <erkn at fysik.dtu.dk<mailto:erkn at fysik.dtu.dk>> wrote:

Dear Uli,

It can be done if that is what you _really_ want to do, but I would not
recommend it. The solution would be more complicated and likely error
prone than using an intermediary MCPL-file. Also - you would have
rewrite less of the instrument file that way.

If you really want to do this here's a pseudocode solution for two
samples that you could easily extend to more:
You'd have to also set parameters for samples and decalre the variable
samplec - but you knew that :-).

<snip>
COMPONENT a0 = Arm()
AT(0,0,0) RELATIVE something
EXTEND
%{
  samplec==0

%}

SPLIT 2 COMPONENT a1 = Arm()
AT(0,0,0) RELATIVE a0
EXTEND
%{
  samplec++;
%}


COMPONENT sans1 = Sans_SAMPLE(x=X,...)
WHEN (samplec==1) AT(0,0,0) RELATIVE a1

COMPONENT sans2 = Sans_SAMPLE(y=Y,...)
WHEN sample==2) AT(0,0,0) RELATIVE a1


COMPONENT det1 = PSD_monitor(filename="file1")
WHEN(samplec==1) AT(0,0,L) RELATIVE a1

COMPONENT det2 = COPY(det1)(filename="file2")
WHEN(samplec==2) AT(0,0,L) RELATIVE a2
<snip>


cheers
Erik

On 10/07/2019 21:33, Wildgruber, Christoph U. wrote:
Hi,

I read the manual and somehow I think it could be done but I could not
figure out how…

So here is what  I want to do:

I have SANS instrument and want to compare it’s neutron optical performance
for several pairs of sample models. To avoid using virtual sources and minimize the
overall runtime I thought it might be possible to have a loop or something equivalent which
runs the sample & detector part of the instrument multiple times for the same neutrons
arriving at the sample position with a different scattering model.
All other parameters in the sample are the same.

Any suggestions?

Thanks,

Uli

_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users


--
Erik Bergbäck Knudsen, Research Engineer         | DTU | morituri
NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark  |<>-<>|    te
phone: (+45) 2132 6655                           |<>-<>| salutant
_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users


Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
Næstformand for DTU Fysik LSU

DTU Physics


<image001.gif>


Technical University of Denmark


<image002.gif>



Department of Physics
Fysikvej
Building 307
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190711/d849634d/attachment-0001.html>


More information about the mcstas-users mailing list