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

Erik B Knudsen erkn at fysik.dtu.dk
Thu Jul 11 08:58:22 CEST 2019

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 :-).

COMPONENT a0 = Arm()
AT(0,0,0) RELATIVE something


AT(0,0,0) RELATIVE a0

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


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
> 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

More information about the mcstas-users mailing list