Farhi farhi at ill.fr
Thu Jul 6 18:11:23 CEST 2000

Hello Kristian,

As I told you last time you passed at the ILL, I have applied to a
permanent position at the ILL in the Computer Simulation group.
And that's OK !
So, starting from September 1st, I'll have more time to give to
scientific computer stuff (less local contact, experiments, etc...).

We have now some McStas simulations that are nearly finished (not
including mines): IN6, IN10, IN16, D10, IN14, and I think I should
gather ILL McStas users soon to exchange ideas about what should be fine
for McStas evolutions, components and instruments.

Well, in fact I had not a lot of time for McStas since my last email.
I now turn back to it !
Before I go on with my general source/flux adapter (that should be able
to simulate any kind of neutron beam), I'd like to ask you a few

1) would it be possible to put, in the TRACE section, some bits of C
code, e.g.:


COMPONENT ... blahblah

long my_local_variable;

my_local_variable = 5;

COMPONENT ... blahblah = bouh(a=my_local_variable)

my_local_variable = 6;

COMPONENT ... blahblah = bouh(a=my_local_variable)

This avoids to create n variables if we only need 2 or 3 temporary
variables to pass parameters to components.

2) would it be possible, for numerical component parameters, to indicate
(in TRACE) an expression instead of a single variables name, e.g.:

COMPONENT ... blahblah = bouh(a=my_local_variable*2)

for strings, I guess it's more complicated, but we could think about

COMPONENT ... blahblah = bouh(a=sprintf("file= %s other stuff",

even though it is not straight forward...

3) about neutron polarisation, I'm lost.
Should I use s1,s2 for spin components (that make them run with the
'normal' mcstas), or should I use sx,sy,sz and the component could only
work in POLARISATION mode ?
Example : Monitor_nD could detect the neutron spin, but should there be
2 versions of this component, one for normal and 1 for polarisation
analysis ?
For the time being, I use s1 s2 because I'm sure it works for everybody.
If I use sx,sy,sz, these variables are not known except if one uses
I think a definitive choice should be made before people write too many
components handling spin...
I would prefer sx,sy,sz of course, but these should be defined in
'normal' mcstas else a 'polarisation' component will not compile in
normal mode (and vice-versa).

I probably plan to put in all my components things like
#ifdef sz
blahblah with sz
things considering that sz = 0 (s1=sx, s2=sy)

If you choose to use sx,sy,sz for sure, then we should tell everybody to
change their component sources (and handle s1 s2 in mcstas with warning
message saying how to change to better code)

4) Concerning the flux_adapter, I will probably define an 'auto focus'
mode that will set the beam divergence in order to match the preceeding
component. If I want to rather focus on the next component, I need to
use something like:

COMPONENT Flux_adapter

COMPONENT blahblah that follows

COMPONENT Flux_adapter_monitor

The Flux_adapter_monitor should record (in a short learning stage) the
neutrons that pass through the component blahblah, and then compute the
required divergences for a better MC shot.

Perhaps it could check the presence of a Monitor_nD component, and get
from it some divergence values.

Or (simple) I use standard divergences (manual focussing, giving values
in component option string or no focussing).

5) Would it be possible to define a macro
that would append the current component/instrument name root and
#define name component+name
just as component and instrument parameters

Cheers !


Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html     \|/ ____ \|/
TAS-Group, Institut Laue-Langevin (ILL) Grenoble            ~@-/ oO \-@~
Avenue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France   /_( \__/ )_\
Work :Tel (33/0) 4 76 20 71 83. Fax (33/0) 4 76 48 39 06       \__U_/
La Grande Arche, Chateau d'Uriage, 38410 Saint Martin d'Uriage 04 76 59 73 94

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20000706/467baa1e/attachment.html>

More information about the mcstas-users mailing list