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

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Tue Jul 16 09:36:38 CEST 2019


Hi Uli,

I am afraid you have done this the “right” way in the sense that indeed, all of the SASmodels functions have the same name…

(In fact, the way they are used from the component is by means of a hack, simply a compiler #define clause, hence requiring a recompile of one wants to use a different model…)

We are thinking of ways of doing this better, but haven’t exactly settled on the “right” way just yet.

Cheers,

Peter

On 15 Jul 2019, at 20.29, Wildgruber, Christoph U. <wildgrubercu at ornl.gov<mailto:wildgrubercu at ornl.gov>> wrote:

Hi again,

so here is a little update…
To get my instrument with multiple instances of SANSCurve.comp (attached) compiled I had to
- or at least thats what I thought - move the functions “CountLines” and “LoadCurve” into the
main body of the instr(ument) file (attached). However despite the uneventful execution of
the code only the first of the five I(q) data sets was used to simulate a SANS curve.
Being suspicious about my understanding of how ‘split’ should/would work I cloned SANSCurve.comp
and used SANSCurve_1.comp … SANSCurve_5.comp.
Again the code ran without problems but still ignored all but the first I(q) data I specified.
At this point I started to wonder if there is a problem with the scope of the variables
 - especially “Q’ and ‘I’ - as defined in SANSCurve.
After renaming ‘I’ to “I-1’ … ‘I-5’ and ‘Q’ to ‘Q-1 … Q-5’ in my SANSCurve Clones I got the desired results.
I consulted the manual (and Lee Robertson :-) but still could not figure out how I should modifiy
my instrument and/or SANSCurve.comp.

I suspect there is a right way to do it and I am curious how that would look like.

Any ideas/suggestions?

Thanks so much,

Uli





> On 12 Jul 2019, at 09:26, Erik B Knudsen <erkn at fysik.dtu.dk<mailto:erkn at fysik.dtu.dk>> wrote:
>
> Hi Uli,
> Excellent! Great news. Always happy to help!
> When it all works and you are satisfied with it - please consider
> contributing your instrument file to the project. It might help other
> users 8-).
>
> cheers
> Erik
>
> On 12/07/2019 14:21, Wildgruber, Christoph U. wrote:
>> Hi Erik & Peter,
>>

>> it is working really well and I’d say it is pretty efficient :-)
>> The only other thing I had to do was to move two function definition
>> from SANSCurve inot the
>> instrument to avoid ‘redefinition’ complaints from the compiler.
>> All I need to do now is to make sure the output is valid…
>>
>> Thanks again for your help,
>>
>> Uli
>>
>>
>>> On 11 Jul 2019, at 14:28, Wildgruber, Christoph U.
>>> <wildgrubercu at ornl.gov<mailto:wildgrubercu at ornl.gov> <mailto:wildgrubercu at ornl.gov>> wrote:
>>>
>>> Hi Erik,
>>>
>>> thanks for the immediate response, I’ll give it a try right away…
>>> The error message threw me off...
>>>
>>> Thanks, again
>>>
>>> Uli
>>>
>>>
>>>> On 11 Jul 2019, at 14:23, Erik B Knudsen <erkn at fysik.dtu.dk<mailto:erkn at fysik.dtu.dk>
>>>> <mailto:erkn at fysik.dtu.dk>> wrote:
>>>>
>>>> Dear Christoph,
>>>>
>>>> In your instrument file there are two missing ; (line 186 and 194), a
>>>> switched %} line 187, and a double '==' where it should say '=' (line
>>>> 187). Some of these were due to me being a bit too fast of the mark this
>>>> morning, so sorry for that. The attached version has these things fixed
>>>> - I can't test it completely since I lack your SANS-component but it
>>>> should get you a bit further. Good Luck!
>>>>
>>>> cheers
>>>> Erik
>>>>
>>>>
>>>> On 11/07/2019 19:57, Wildgruber, Christoph U. wrote:
>>>>> Hi again,
>>>>>
>>>>> so I did try the basic ‘SPLIT 2’ approach but I end up with an
>>>>> unexpected compile time error (RHEL 7, mcstas 2.5, mpi enabled)…
>>>>> I must be missing something really basic…
>>>>>
>>>>> Here is the result:
>>>>> ==============
>>>>>
>>>>> Setting environment:
>>>>> MCSTAS_OVERRIDE=
>>>>> /usr/local/mcstas/2.5/tools/Python/mcgui/../mccodelib/../../..
>>>>>
>>>>> MCSTAS_CFLAGS_OVERRIDE=
>>>>> -g -O2 -lm
>>>>>
>>>>> MCSTAS_CC_OVERRIDE=
>>>>> gcc
>>>>>
>>>>> MCSTAS_MPICC_OVERRIDE=
>>>>> mpicc
>>>>>
>>>>> mcrun -c BER_SANS_guide_elliptical_optimize_2.1.instr -n0
>>>>>
>>>>> INFO: No output directory specified (--dir)
>>>>> INFO: Using directory:
>>>>> "BER_SANS_guide_elliptical_optimize_2.1_20190711_134948"
>>>>> INFO: Regenerating c-file: BER_SANS_guide_elliptical_optimize_2.1.c
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:246.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:258.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:266.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:274.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:284.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:294.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:304.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:314.
>>>>> Info:    'PSD_monitor_rad' is a contributed component.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:321.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:328.
>>>>> Info:    'SANSQMonitor' is a contributed component.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:338.
>>>>> Reference to undefined component instance a1 at line
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr:347.
>>>>> McStas: 12 Errors encountered during parse of
>>>>> BER_SANS_guide_elliptical_optimize_2.1.instr.
>>>>> compile thread done
>>>>>
>>>>>
>>>>> I attach the instr file in case you get a chance to try to compile it…
>>>>>
>>>>> So what is going on?
>>>>>
>>>>>
>>>>> Thanks so much,
>>>>>
>>>>>
>>>>> Uli
>>>>>
>>>>
>>>> --
>>>> Erik Bergbäck Knudsen, Research Engineer         | DTU | morituri
>>>> NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark  |<>-<>|    te
>>>> phone: (+45) 2132 6655                           |<>-<>| salutant
>>>> <SANS_test.instr>
>>>
>>
>
> --
> Erik Bergbäck Knudsen, Research Engineer         | DTU | morituri
> NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark  |<>-<>|    te
> phone: (+45) 2132 6655                           |<>-<>| salutant

<SANSCurve.comp><BER_SANS.instr>


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

DTU Physics


[cid:b6339554-7f28-441d-9f31-5944f811397c at win.dtu.dk]


Technical University of Denmark


[cid:e108e480-fcab-46e2-9531-b38165079572 at win.dtu.dk]



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/20190716/c8b6b1d1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 58 bytes
Desc: image001.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190716/c8b6b1d1/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1055 bytes
Desc: image002.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190716/c8b6b1d1/attachment-0003.gif>


More information about the mcstas-users mailing list