Home
Component Manual for the Neutron Ray
Contents
1. 0 L L L L L L L L L 0 0 01 0 02 0 03 0 04 0 05 0 06 0 07 0 08 0 09 0 1 Momentum transfer Q 7 Figure 5 1 A typical reflectivity curve for a supermirror Eq 5 2 The used values are m 4 Ro 1 Qe 0 02 A a 6 49 A W 1 300 A 5 2 Guide The guide section Name Guide Author System Input parameters w1 h1 we ha l m reflect Optional parameters Ro Qc W a Notes validated no gravitation support The component Guide models a guide tube consisting of four flat mirrors The guide is centered on the z axis with rectangular entrance and exit openings parallel to the x y plane The entrance has the dimensions w1 h and placed at z 0 The exit is of dimensions w2 h2 and is placed at z l where l is the guide length See figure 5 2 The reflecting properties are given by the values of Ro m Qc W and a as for Mirror or alternatively from the reflectivity file reflect Guide may produce wrong results with gravitation support Use Guide gravity section 5 4 in this case or the Guide_channeled in section 5 3 5 2 1 Guide geometry and reflection For computations on the guide geometry we define the planes of the four guide sides by giving their normal vectors pointing into the guide and a point lying in the plane ny 1 0 we w1 2 O7 w 2 0 0 ny 1 0 w2 w1 2 O3 w 2 0 0 n 0 1 h2 h1 2 Of 0 h1 2 0 ni 0 1 hg
2. Risg R 1538 rev ed EN IRIIS D e me Component Manual for the Neutron Ray Tracing Package McStas Version 1 12 Peter Kj r Willendrup Erik Knudsen Kim Lefmann and Emmanuel Farhi Isotropic Sqw concentric arrangement 5 h z fy 0 N Vf T j SAY 0 02 G 0 01 PNG z m Ris DTU Roskilde Denmark May 2011 Abstract The software package McStas is a tool for carrying out Monte Carlo ray tracing simulations of neutron scattering instruments with high complexity and precision The simulations can compute most aspects of the performance of instruments and samples and can thus be used to optimize the use of existing equipment design new instru mentation and carry out full virtual experiments McStas is based on a unique design where an automatic compilation process translates high level textual instrument de scriptions into efficient ANSI C code This design makes it simple to set up typical simulations and also gives essentially unlimited freedom to handle more unusual cases This report constitutes the component manual for McStas and together with the manual for the McStas system it contains full documentation of all aspects of the program It covers a description of all official components of the McStas package with some theoretical background Selected test instruments and representative McStas simulations performed with these instruments are described in the User Manual This r
3. component there were also minor problems which are all corrected in the meantime For the guides several trajectories through different kinds of guides straight convergent divergent were calculated analytically and positions directions and losses of reflections compared to the values calculated in the components This was done for Guide and Guide_gravity in the latter case calculations were performed with and without gravity Additionally a cross check against the VITESS guide module was performed Waviness chamfers and channels were not checked After correction of a bug in Guide_gravity both components worked perfectly within the conditions tested Source_gen was cross checked against the VITESS source module for the case of 3 Maxwellians describing the moderator characteristic and typical sizes the guide and its distance to the moderator It showed the same line shape as a functions of wavelength and divergence and the same absolute values 1 8 Disclaimer bugs We would like to emphasize that the usage of both the McStas software as well as its components are the responsability of the users Indeed obtaining accurate and reliable results requires a substantial work when writing instrument descriptions This also means that users should read carefully both the documentation from the manuals 2 and from 14 Riso R 1538 rev ed EN the component itself using mcdoc comp before reporting errors Most anomal
4. to be the full path of the directory containing the table files BASH export MCTABLES usr local lib mcstas contrib ISIS _tables TCSH setenv MCTABLES usr local lib mcstas contrib ISIS _tables In Windows this can be done using the My Computer properties and selecting the Ad vanced tab and the Environment variables button This can of course be overridden by placing the appropriate moderator h face files in the working directory The module requires a set of variables listed in Table 3 3 and described below The Face variable determines the moderator surface that will be viewed There are two types of Face variable i Views from the centre of each moderator face defined by the name of the moderator for TS1 Water H2 CH4 Merlin and TS2 Hydrogen Groove Narrow Broad ii Views seen by each beamline for TS1 Prisma Maps crisp etc and for TS2 E1 E9 East and W1 W9 West The McStas distribution includes some example moderator files for TS1 water h2 ch4 and TS2 broad narrow hydrogen groove but others are available at http www isis rl ac uk Computing Software MC including instrument specific mod els Variables EO and E1 define an energy window for sampled neutrons This can be used to increase the statistical accuracy of chopper and mirrored instruments However E0 and E1 cannot be equal although they can be close By default these arguments select energy in meV if negative values are given selecti
5. 2 Initialize the label of the user variable optional INITIALIZE vA Gites MONND_USER_TITLE UserMonitor 1 Log time ht The value 1 could be 2 or 3 for the user2 user3 variable 3 Set the user variable value in a TRACE component EXTEND block TRACE C COMPONENT blah blah_comp 118 Riso R 1538 rev ed EN EXTEND attach a value to useri in UserMonitor could be much more comlex here MONND_USER_VALUE UserMonitor 1 log t AF Crs 4 Tell the Monitor_nD instance to record user variables TRACE CE COMPONENT UserMonitor Monitor_nD options auto user1 C590 Setting the user variable values may either make use of the neutron parameters x y z VX Vy VZ t Sx Sy sz p access the internal variables of the component that sets the user variables in this example those from the blah instance access any component OUTPUT parameter using the MC_GETPAR C macro see chapter B or simply use a global instrument variable Instrument parameters can not be used directly Example Number of neutron bounces in a guide In the following example we show how the number of bounces in a polygonal guide may be monitored Let us have a guide made of many Guide_gravity instances We declare a global simulation variable nbounces set it to 0 for each neutron entering the guide and sum up all bounces from each section accessing the Gvars OUTPUT variable of component Guide_gravity Then we
6. A typical neutron trajectory in the rotating frame right frame z x is rewwe 2000 0 an Together with the equation for a non accelerated linear propagation r r vt the orthogonal transformation produces a curve in the Z X plane known as archidemic spiral as can be seen in figure 6 4 The two vector components s t z 2 follow the equation Ais z r z t a zo vz t cos 5 t zo ve t sin 5 t Yi E x t zo vz t sin d t xo vz t cos d t For a fixed chopper rotation speed the neutron trajectory tends to strech from a spiral curve for slow neutrons to a straight line for fast neutrons For real Fermi chopper settings v about 100 Hz on IN6 at the ILL neutron trajectories are found to be nearly straight for 1000 m s neutron velocities 41 The basis of the algorithm is to find the intersections of these spiral trajectories with the chopper outer cylinder and then the slit package in the rotating frame For this purpose the Ridders s root finding method was implemented 42 in order to solve z t dor z t d 6 3 This method provides faster and more accurate intersection determination than other common algorithms E g the secant method fails more often and may give wrong results outside chopper whereas the bisection method a k a Picard dichotomy is slightly slower Standard slit packages non super mirror The neutrons are first propagated to the outer c
7. If the direct beam e g after a monochromator or sample should not be simulated it is possible to emulate an ideal beamstop so that only the scattered beam is left without the use of Beamstop This method is useful for instance in the case where only neutrons scattered from a sample are of interest The example below removes the direct beam and any background signal from other parts of the instrument COMPONENT MySample V_sample AT EXTEND ht if SCATTERED ABSORB ht Riso R 1538 rev ed EN 39 File name Description Be trm Berylium filter for cold neutron spectrometers e g k lt 1 55 A l HOPG trm Highly oriented pyrolithic graphite for 2 filtering e g ther mal beam at k 1 64 2 662 and 4 1 T Sapphire trm Sapphire Al203 filter for fast neutrons k gt 6 A7 Table 4 1 Some transmission data files to be used with e g the Filter_gen component 4 4 Filter_gen A general filter using a transmission table Name Filter_gen Author System Input parameters Tmin imar Umins Umars Tile Optional parameters options Notes validated flat filter This component is an ideal flat filter that changes the neutron flux according to a 1D input table text file Filter_gen may act as a source options set or a filter options multiply default mode The table itself is a 2 column free format file which accept comment lines The first table colum
8. Optional parameters Notes The component Sans_spheres models a sample of small independent spheres of radius R which are uniformly distributed in a rectangular volume Zw X yp X zt with a volume fraction The absorption cross section density for the spheres is og in units of m specified for neutrons at 2200 m s Absorption and incoherent scattering from the medium is neglected The difference in scattering length density the contrast between the hard spheres and the medium is called Ap d denotes the distance to the presumed circular SANS detector of radius R A usage example of this component can be found in the Neutron site tests SANS in strument from the mcgui 8 5 1 Small angle scattering cross section The neutron intensity scattered into a solid angle AQ for a flat isotropic SANS sample in transmission geometry is given by 8 doy aq D where W is the neutron flux T is the sample transmission A is the illuminated sample area and Zmax the length of the neutron path through the sample In this component we consider only scattering from a thin solution of monodisperse hard spheres of radius R where the volume specific scattering cross section is given by 8 I q VAQT Azmax 8 35 do dQ 2 where f q js oo n is the number density of spheres and V 4 37 R is the sphere volume The density is thus n V Multiple scattering is ignored a n Ap V f a 8 36 8 5
9. The polarization vector P is then defined as P a A 1 so that 1 lt P lt 1 For a neutron beam which contains N neutrons each with a polarization P the beam polarization is defined as P Bg A 2 Riso R 1538 rev ed EN 127 If we have one common quantization direction e g a magnetic field direction each neutron will either be spin up t or spin down and the polarization can be expressed as pals A 3 Pe Tey where v n is the number of neutrons with spin up down For a given neutron the probability of the neutron being spin up P T is n nyt ny n 2 14 P ps ny my 2 _ A 4 my ny m ny 2 and P 1 P t 1 P 2 The expectation value of the spin operator 6 which can be expressed by the Pauli matrices is the polarization vector P P x a x The most general form of the spin wave function x for a neutron spin 1 2 is OS OT bx A 5 where y and x are eigenfunction of o and the complex coefficients a and b satisfy Jal b 1 By calculation we find P xlGelx 2Re a b A 6 P xl ylx 2Im a b A 7 P xl zlx lal OP A 8 This shows the relation of the polarization vector to the neutron wave function The neutron magnetic moment operator can be expressed in terms of as fin Un A 9 which as shown above is related to the polarization vector In our simulation we represent the polarization by
10. and should better be placed at the same position with AT 0 0 0 RELATIVE PREVIOUS 126 Riso R 1538 rev ed EN Appendix A Polarization in McStas P Christiansen Ris June 3 2011 A 1 Introduction In the current release of McStas there are components with polarization capabilities At the moment all such components should be understood as under development as the amount of testing and debugging of these components is small and there are known problems Here we shall report on what have been done so far We first describe the polarization vector and how it is related to the neutron wave function section A 2 and then the physics of simple components that we need in McStas is reviewed section A 3 In the last two sections the actual McStas polarization components are first described section A 4 and a list of test instruments in McStas is given section A 5 We rely heavily on the books 53 54 for the physics where the detailed calculations can be found The notation used here and in 54 is P scalar P vector P unit vector operator and vector of operators A 2 The Polarization Vector The spin of the neutron is represented by an operator for which only a single component can be measured at one time Each single measurement will give a value 1 2 but if we could make a large number of measurements on the same neutron state in each of the three axis directions and then make the average we get 8
11. auto time is a theta time of flight banana detector e options x bins 30 limits 0 05 0 05 y will set the monitor to look at x and y For y default bins 20 and limits values monitor dimensions are used e options x y auto all bins 30 will determine itself the required limits for x and y e options multiple x bins 30 y limits 0 05 0 05 all auto will monitor the neutron x and y in two 1D files e options x y z kx ky kz all auto will monitor each of theses variables in six 1D files e options x y z kx ky kz list all all auto will monitor all theses neutron variables in one long list one row per neutron event e options multiple x y z kx ky kz and list 2000 all auto will monitor all theses neutron variables in one list of 2000 events and in six 1D files e options Signal energy x y is a PSD monitor recording the mean energy of the beam as a function of x and y 9 8 7 Monitoring user variables There are two ways to monitor any quantity with MonitornD This may be e g the number of neutron bounces in a guide or the wavevector and energy transfer at a sample The only requirement is to define the user1 and optionally user2 user3 variables of a given Monitor_nD instance 116 Riso R 1538 rev ed EN McStas monitor Monitor_nD equivalent Divergence_monitor DivLambda_monitor DivPos_monitor E_monitor EPSD monitor Hdiv_monitor L_monitor Monitor_4PI Monitor PSDcyl_ monito
12. An introduction to the liquid state Academic Press London 1967 H E Fischer A C Barnes and P S Salmon Rep Prog Phys 69 233 2006 V F Sears Adv Phys 24 1 1975 S W Lovesey Theory of neutron scattering from condensed matter Oxford Clarendon Press 1984 W Gavin Williams Polarized Neutrons Oxford Clarendon Press 1988 P A Seeger and L L Daemen Nucl Instr Meth 457 338 2001 W H Press S A Teukolsky W T Vetterling and B P Flannery Numerical Recipes in C Cambridge University Press 1986 Risd R 1538 rev ed EN Index Bugs 10 45 46 87 Coherent and incoherent isotropic scatterer 91 Concentric components 73 91 Coordinates system 7 Data files 7 Diffraction 73 78 86 Environment variable BROWSER 8 MCSTAS 8 133 140 Incoherent elastic scattering 70 78 Incoherent inelastic scattering 72 Inelastic scattering 88 91 Keyword include 133 EXTEND 8 18 114 134 GROUP 134 MCDISPLAY 134 OUTPUT PARAMETERS 115 SHARE 133 Library 133 adapt_tree lib 141 Components data 8 10 140 misc 117 monitors 105 optics 34 48 samples 67 share 133 sources 18 mestas r see Library Run time monitor_nd lib 140 read_table lib Read_Table 7 138 Run time 133 Risg R 1538 rev ed EN ABSORB 133 ALLOW_BACKPROP 133 MC_GETPAR 115 134 NAME_CURRENT_COMP 134 POS_A_COMP 134 POS_A_CURRENT_COMP 134 PROP_DT 133 PROP_GRAV_DT 133 PROP
13. Da t 24 Celt ae 8 24 where a t T ki ke is given in local coordinates for 7 It can be shown that equation 8 24 can be re written as 1 1 T t a t to M t to 2 Cle eget 8 25 where M B DB is a2 x 2 symmetric and positive definite matrix to M B Do is a 2 vector and a tiM ty o Do is a real number Note that this is a two dimensional Gaussian not necessarily normalized in t with center to and axis defined by M 86 Riso R 1538 rev ed EN To choose kp we sample t from the 2 dimensional Gaussian distribution 8 25 To do this we first construct the Cholesky decomposition of the matrix 5M 1 This gives a 2x 2 matrix L such that LLT iM 1 and is possible since M is symmetric and positive definite It is given by 4 V11 0 E 2 where SM Pad M2 v12 _ i2 V12 V22 Vv V22 pn Now let g 91 92 be two random numbers drawn form a Gaussian distribution with mean 0 and standard deviation 1 and let t Lg t The probability of a particular t is then 1 P t dt se 29 9dg 8 26 1 1 1 Tir 1 e a l t to L t to qt 2 Qn detL eed DRE i T 2 Sto Mato dt 8 28 2r det L j where we used that g L t to so that dg grdt This is just the normalized form of 8 25 Finally we set kj ki P t and kp ki k p kt to normalize the length of kg to correct for the small error introduced by approximating the E
14. System Peter Link FRM 2 Input parameters Zw Yh S4P Mh Nv Mh NW Ro Q Th Tv Optional parameters dy 7 h w verbose transmit reflect Notes In reflecting geometry non polarized This component simulates an array of infinitely thin single crystals with a single scattering vector perpendicular to the surface and a mosaic spread This component is used to simulate a singly or doubly curved monochromator or analyzer in reflecting geometry The component uses rectangular pieces of monochromator material as described in Monochro mator_curved The scattering vector is named Q and as described in Monochroma tor_flat multiples of Q will be applied Other important parameters are the piece height and width yn and zw respectively the horizontal and vertical mosaicities 7 and ny respectively If just one mosaicity 7 is specified this the same for both directions The number of pieces vertically and horizontally are called ny and ny respectively and the vertical and horizontal radii of curvature are named ry and rp respectively All single crystals are positioned in the same vertical plane but tilted accordingly to the curvature radius The constant monochromator reflectivity Ro can be replaced by a file of tabulated re flectivities reflect rfl in MCSTAS data In the same sense the transmission can be modeled by a tabulated file transmit for non reflected neutrons trm in MCSTAS data The most useful of th
15. and the units on the axis are not necessarily meaningful Setting the filename to NULL disables the output of the sampling distribution 3 7 1 Optimization disclaimer A warning is in place here regarding potentially wrong results using optimization tech niques It is highly recommended in any case to benchmark optimized simulations against non optimized ones checking that obtained results are the same but hopefully with a much improved statistics 3 7 2 The adaption algorithm The adaptive importance sampling works by subdividing the initial neutron phase space into a number of equal sized bins The division is done on the three dimensions of energy 30 Riso R 1538 rev ed EN horizontal position and horizontal divergence using Neng Npos and Naiv number of bins in each dimension respectively The total number of bins is therefore Npin NengNposNaiv 3 5 Each bin 7 is assigned a sampling weight w the probability of emitting a neutron within bin is Wi N in 22 wy In order to avoid false learning the sampling weight of a bin is kept larger than Wmin defined as P i 3 6 Nbin Wmin gt gt Wj 0 lt B lt 1 3 7 Npbin 1 I This way a small fraction 6 of the neutrons are sampled uniformly from all bins while the fraction 1 8 are sampled in an adaptive way Compared to a uniform sampling of the phase space where the probability of each bin is 1 Npin the neutron weight must be adjusted a
16. minimum value of 1st column vector double max_x maximum value of 1st column vector Available functions to read a single vector matrix are e Table Init amp Table rows columns returns an allocated Table structure Use rows columns 0 not to allocate memory and return an empty table Calls to Table_Init are optional since initialization is being performed by other functions already e Table_Read amp Table filename block reads numerical block number block 0 to catenate all data from text file filename into Table which is as well initialized in the process The block number changes when the numerical data changes its size or a comment is encoutered lines starting by If the data could not be read then Table data is NULL and Table rows 0 You may then try to read it using Table_Read_Offset_Binary Return value is the number of elements read e Table_Read_Offset amp T able filename block amp offset nrows does the same as Table_Read except that it starts at offset offset 0 means begining of file and reads Nrows lines 0 for all The offset is returned as the final offset reached after reading the Nrows lines 142 Riso R 1538 rev ed EN e Table Read_Offset_Binary amp Table filename type block amp offset Nrows Ncolumns does the same as Table_Read_Offset but also specifies the type of the file may be float or double the number n ows of rows to read each of them hav
17. n x y I x y Mo a y The arrays are written to a file filename and can be read e g by the tool meplot see the system manual Riso R 1538 rev ed EN 111 9 6 Divergence monitor A divergence sensitive monitor Name Divergence_monitor Author System Input parameters Tmin Tmax Ymin Ymax Nv Nh Nv max Mh max filename Optional parameters Notes The component Divergence_monitor is a two dimensional monitor which resembles PSD Monitor As for this component the detector window is set by the x and y input coordinates Divergence_ monitor is sensitive to the neutron divergence defined by mph tan v vz and ny tan t vy vz The neutron counts are being histogrammed into Ny X Np pixels The divergence range accepted is in the vertical direction 7y max Nv max and similar for the horizontal direction The output from PSD_monitor is the integrated counts n I M2 as well as three two dimensional arrays of counts n nv m v m Mo mv m The arrays are written to a file filename and can be read e g by the tool MC_plot see the system manual 9 7 DivPos_monitor A divergence and position sensitive monitor Name DivPos_monitor Author System Input parameters Tmin Tmax Ymin Ymax Nz Nh Nh max filename Optional parameters Notes DivPos_monitor is a two dimensional monitor component which is sensitive to both horizontal position x and hor
18. set is drawn and the process is iterated until success or at last removal of the neutron event These latter absorptions are then reported at the end of the simulation as it never occurs in reality neutrons that scatter do find a suitable q w set The S q w data sets should be as wide a possible in q and w range else scattering conditions will be limited by the reduced data set specially multiple scattering estimates On the other hand when q and w ranges are too large some Monte Carlo choices lead to scattering temptatives in non useful regions of S which reduces dramatically the algorithm efficiency The best settings are 1 to have the widest q and w range for S q w data sets 2 to either set wmax and gmaz to the maximum scatterable energy and wavevectors 3 or alternatively request the automatic range optimisation by setting parameter auto_qw 1 This is recommended but may sometimes miss a few neutrons if the q w beam range has been guessed too small Focusing the q and w range e g with auto_qw 1 to the one being able to scatter the incoming beam when using the component does improve significantly the speed of the computation Additionally if you restrict the scattering to the first order only parameter order 1 then you may specify the angular vertical extension d of the scattering area to gain optimised focusing This option does not apply when handling multiple scattering which emits in 47 man
19. that measures just one number with errorbars per simulation This effect is mirrored by any of the 1 or 2 dimensional components we support e g the PSD_monitor In case additional functionality of monitors is required the few code lines of existing monitors can easily be modified However the ultimate solution is the use of the Swiss army knife of monitors Moni tor nD that can face almost any simulation requirement but will prove challenging for users who like to perform own modifications Ris R 1538 rev ed EN 109 9 1 TOF monitor The time of flight monitor Name TOF_monitor Author System Input parameters Tmin Cmax Ymin Ymax Nchan to t1 filename Optional parameters At Notes The component TOF monitor has a rectangular opening in the x y plane given by the x and y parameters like for Slit The neutron ray is propagated to the plane of the monitor by the kernel call PROP_ZO A neutron ray is counted if it passes within the rectangular opening given by the x and y limits Special about TOF_monitor is that it is sensitive to the arrival time t of the neutron ray Like in a real time of flight detector the time dimension is binned into small time intervals Hence this monitor maintains a one dimensional histogram of counts The nchan time intervals begin at t and end at t alternatively the interval length is specified by At As usual in time of flight analysis all times are
20. 1471 2002 C Schanzer P Boni U Filges and T Hils Nucl Instr Meth A 529 63 2004 G Zsigmond K Lieutenant and S Manoshin et al Nucl Instr Meth A 529 218 2004 K Lieutenant J Phys Condens Matter 17 S167 2005 Grimmett G R and Stirzakerand D R Probability and Random Processes 2nd Edition Clarendon Press Oxford 1992 See http www nea fr html dbprog tripoli abs html See http mcenpx lanl gov and http menp lanl gov See http www hmi de projects ess vitess K N Clausen D F McMorrow K Lefmann G Aeppli T E Mason A Schr der M Issikii M Nohara and H Takagi Physica B 241 243 50 55 1998 Y Blanc ILL Report 88BL21G 1983 W H Press S A Teukolsky W T Vetterling and B P Flannery Numerical Recipes 2nd Edition Cambridge University Press 2002 Ris R 1538 rev ed EN 149 43 44 45 46 47 48 49 50 5l 52 53 54 55 56 150 G E Bacon Neutron Diffraction Oxford University Press 1975 G L Squires Thermal Neutron Scattering Cambridge University Press 1978 Crystallographica Oxford Cryosystem 1998 See http www crystallographica com Fullprof powder refinement See http www llb cea fr fullweb fp2k fp2k htm Bischoff FG Yeater ML and Moore WE Nuclear Science and Engineering 48 266 1972 M W Johnson Harwell report AERE R 7682 March 1974 J R D Copley Comput Phys Commun 7 289 1974 P A Egelstaff
21. 2 Algorithm All neutrons which hit the sample volume are scattered Hence no direct beam is simulated For scattered neutrons the following steps are taken 1 Choose a value of q uniformly in the interval 0 qmaxl 2 Choose a polar angle a for the q vector uniformly in 0 7 3 Scatter the neutron according to q 4 Calculate and apply the correct weight factor correction 90 Riso R 1538 rev ed EN 8 5 3 Calculating the weight factor The scattering position is found by a Monte Carlo choice uniformly along the whole un scattered beam path with the sample length ltn giving f 1 lmn The direction focusing on the detector gives in an small angle approximation fo d TR a Hence the total weight tranformation factor becomes Tj lean TR et d 47 n Ap V F q exp Lal 8 37 where Ha is the linear attenuation factor due to absorption and is the total neutron path length within the sample This component does NOT simulate absolute intensities This latter depends on the detector parameters Some alternative implementations exist as contributed components The SANS test example instrument exists in the distribution for this component Riso R 1538 rev ed EN 91 8 6 Phonon simple A simple phonon sample Name Phonon_simple Author Kim Lefmann Ris National Laboratory Input parameters To h Toc Ttarget Ytarget Ztarget Tabs linc Q b c M DW T Optional pa
22. 4 5400 Ab initio MD He4_liq_coh sqw 1 34 0 0 00747 0 240 Measured Ne_lig_tot sqw 2 62 0 008 0 039 24 56 591 Measured Rb_liq_coh sqw and Rb_liq_inc sqw 6 32 0 5 0 38 312 46 1300 Classical MD Rb_liq_tot sqw 6 32 0 5 0 38 312 46 1300 Measured Table 1 3 Liquids of the McStas library 7 8 Low c and high Gabs materials are high lighted 1 7 Component validation Some components were checked for release 1 9 the Fermi choppers the velocity selectors 2 of the guide components and Source_gen The results are sumarized in a talk available online http www ill fr tas mcstas doc ValMcStas pdf Velocity selector and Fermi chopper were treated as black boxes and the resulting line shapes cross checked against analytical functions for some cases The component Se lector showed no dependence on the distance between guide and selector axe This is corrected at the moment Apart from that the component yielded correct results That was different with the Fermi chopper components The component Chopper_Fermi which has been part of the McStas distribution for a long time gave wrong results and was re moved from the package The new Vitess_ChopperFermi transferred from the VITESS package showed mainly correct behaviour Little bugs were corrected after the first tests At the moment there is only the problem left that it underestimates the influence of a shadowing cylinder With the contributed FermiChopper
23. AA Samples praan te hk Boe ol Penge Pade Gels Me Bae ees 136 A 5 Tests With New Components 2 000000 2 eee 136 B Libraries and conversion constants 137 B 1 Run time calls and functions mcstas r 2 00004 137 B 1 1 Neutron propagation 0 00000 eee eee 137 B 1 2 Coordinate and component variable retrieval 138 B 1 8 Coordinate transformations 2 2 000005 139 Riso R 1538 rev ed EN B 1 4 Mathematical routines 0 0 0 0 0 0 0 000000048 140 B 1 5 Output from detectors 2 2 0 0 000000 ee ee ee 140 B 1 6 Ray geometry intersections 2 0 02 004 141 B 1 7 Random numbers 0 2 0000 eee eee ee 141 B 2 Reading a data file into a vector matrix Table input read_table lib 142 B3 Monitor nl Library isa 22 20 San Ga ad hoe ee ea Po eee 144 B 4 Adaptive importance sampling Library 145 B S Vitess import export Library 3 gach eek Oe o Mie a eee BS SA 145 B 6 Constants for unit conversion etc 2 2 ee 145 C The McStas terminology 146 Bibliography 148 Index and keywords 150 Riso R 1538 rev ed EN T Preface and acknowledgements This document contains information on the neutron scattering components which are the building blocks for defining instruments in the Monte Carlo neutron ray tracing program McStas version 1 12 The initial release in October 1998 of version 1 0 was presented in Ref 1 Th
24. E NO DEEE 8 41 ea Tan i ki 2Md kj J kej n 2 5 where the Jacobian reads mn O J 1 Fah Oke di k 8 42 Riso R 1538 rev ed EN 93 A rough order of magnitude consideration gives Ph x 1 Ja 1 nk 5 z 1l hk n 2Mdi k the total scattering cross section 4r Nb as it must be The differential cross section per unit volume is found from 8 41 by replacing N with 1 Vo The total weight transformation now becomes jr Hence a x N pm and the phonon cross section becomes a fraction of kg hn 1 1 i Ulintmax sAQ 2d ot 8 43 Ti Minbmax sAN E a Md me I Reg n 2 5 oy where n is the number of possible dispersion values in the chosen direction The Test_Phonon test example instrument exists in the distribution for this component 94 Riso R 1538 rev ed EN Isotropic Sqw concentric arrangement Figure 8 6 An He sample in a cryostat simulated with the Isotropic_Sqw component in concentric geometry 8 7 Isotropic Sqw A general S q w coherent and incoher ent scatterer Name Isotropic Sqw Author V Hugouvieux E Farhi Input parameters Sqw coh Ocoh SAWINC Cinc Vp Cabs T Xwidth heights Zdepth T thickness Optional parameters qmin maz min max dd order Notes validated Vanadium Rb PowderN more accurate for pow ders The sample component Isotropic_Sqw has been developed in order to simulate neutron scat
25. Monte Carlo choice and kg is found see below 7 Adjust the neutron weight as dictated by the Monte Carlo choices made 8 Repeat from 2 until the neutron is transmitted to simulate multiple scattering For point 2 the distance dist between a reciprocal lattice point and the Ewald sphere is considered small enough to allow scattering if it is less than five times the maximum axis of the Gaussian dist lt 5 max oj 02 03 8 4 3 Choosing the outgoing wave vector The final wave vector kg must lie on the intersection between the Ewald sphere and the Gaussian ellipsoid Since 7 and Ad d are assumed small the intersection can be approximated with a plane tangential to the sphere see figure 8 5 The tangential point Riso R 1538 rev ed EN 85 Tangential plane Figure 8 5 The scattering triangle in the single crystal is taken to lie on the line between the center of the Ewald sphere k and the reciprocal lattice point 7 Since the radius of the Ewald sphere is ki this point is o ki p l p T where p ki T The equation for the plane is P t o Bt t e R 8 23 Here B bj b2 is a 3 x 2 matrix with the two generators for the plane b and b2 These are arbitrary unit vectors in the plane being perpendicular to each other and to the plane normal n p p Each t defines a potential final wave vector k t ki P t The value of the 3 dimensional Gaussian for this kg is 1 1 T _ a t
26. Run time calls and functions mcstas r Here we list a number of preprogrammed macros which may ease the task of writing component and instrument definitions B 1 1 Neutron propagation Propagation routines perform all necessary operations to transport neutron rays from one point to an other Except when using the special ALLOW_BACKPROP call prior to exectuting any PROP_ propagation the neutron rays which have negative propagation times are removed automatically e ABSORB This macro issues an order to the overall McStas simulator to interrupt the simulation of the current neutron history and to start a new one Riso R 1538 rev ed EN 137 PROP _ZO Propagates the neutron to the z 0 plane by adjusting x y z and t accordingly from knowledge of the neutron velocity vx vy vz If the propagation time is negative the neutron ray is absorbed except if a ALLOW_BACKPROP preceeds it For components that are centered along the z axis use the _intersect functions to determine intersection time s and then a PROP_DT call PROP_DT dt Propagates the neutron through the time interval dt adjusting x y z and t accordingly from knowledge of the neutron velocity This macro auto matically calls PROP_GRAV_DT when the gravitation option has been set for the whole simulation PROP_GRAV_DT dt Az Ay Az Like PROP_DT but it also includes gravity using the acceleration Az Ay Az In addition to adjusting x y z and t also
27. Telefax 45 4677 4013
28. accessed from the instrument in which the component is used using MC_GETPAR Run time C code contained in the files mcstas r c and mcstas r h included in the McStas distribution that declare functions and variables used by the generated simulations Risd R 1538 rev ed EN e Setting parameter Similar to a definition parameter but with the restriction that the value of the parameter must be a number Riso R 1538 rev ed EN 147 Bibliography 1 2 10 11 12 13 14 15 16 17 18 19 20 148 K Lefmann and K Nielsen Neutron News 10 20 23 1999 Peter Willendrup Emmanuel Farhi Kim Lefmann and Klaus Lieutenant User and Programmers Guide to the Neutron Ray Tracing Package McStas Version 1 9 Risoe Report 2005 See http www mcstas org See http neutron risoe dk McZilla See http mensi risoe dk See http neutron eu net en ICSD Inorganic Crystal Structure Database See http icsd ill fr A J Dianoux and G Lander ILL Neutron Data Booklet OCP Science 2003 H Maier Leibnitz and T Springer Reactor Sci Technol 17 217 1963 D F R Mildner Nucl Instr Meth A290 189 1990 R A Lowde J Nucl Energy Part A Reactor Sci 11 69 1960 J R D Copley Nucl Instr Meth A510 318 2003 E Fermi J Marshall and L Marshall Phys Rev 72 193 1947 J Peters Nucl Instr Meth A540 419 2005 C D Clark E W J Mitchell D W Palmer and I H Wil
29. and an options string describing what to detect and what to do with the signals in clear language The width Yneights Zdepth May also be used to enter dimensions Eventhough the possibilities of Monitor_nD are numerous its usage remains as simple as possible specially in the options parameter which understands normal language The formatting of the options parameter is free as long as it contains some specific keywords that can be sometimes followed by values The no or not option modifier will revert next option The all option can also affect a set of monitor configuration parameters see below As the usage of this component enables to monitor virtually anything and thus the combinations of options and parameters is infinite we shall only present the most ba sic configuration The reader should refer to the on line component help using e g mcdoc Monitor_nD comp 9 8 1 The Monitor_nD geometry The monitor shape can be selected among seven geometries 1 square The default geometry is flat rectangular in xy plane with dimensions Tmin Tmax Ymin Ymax OF Vwidth Yheight 2 box A rectangular box with dimensions Zwidth Yheight Zdepth 3 disk When choosing this geometry the detector is a flat disk in xy plane The radius is then radius max abs ii Tmax Ymin Ymax Twidth 2 Yneight 2 9 2 4 sphere The detector is a sphere with the same radius as for the disk geometry 5 cylinder The detect
30. and creation of one phonon is considered represented by the plus and minus sign in the dispersion delta functions respectively In the equation exp 2W is the Debye Waller factor DW and Vo is the volume of the unit cell The sum runs over the reciprocal lattice vectors 7 over the polarisation index p and the N allowed wave vectors q within the Brillouin zone where N is the number of unit cells in the crystal Further eg is the polarization unit vectors wq p the phonon dispersion and the Bose factor is ng p Rexp wqp kBT 1 71 We have simplified this expression by assuming no polarization dependence of the disper sion giving s gt eqp K We assume that the inter atomic interaction is nearest neighbour only so that the phonon dispersion becomes di q c1 a4 2 Sq 8 39 92 Ris R 1538 rev ed EN where z 12 is the number of nearest neighbours and sq pn C0S Q Tnn where in turn Ynn is the lattice positions of the nearest neighbours This dispersion relation may be modified with a small effort since it is given as a separate c function attatched to the component To calculate do dQ we need to transform the q sum into an integral over the Brillouin zone by ae NV 2n 3 Joz d q The k sum can now be removed by expanding the q integral to infinity All in all the partial differential cross section reads do akt 1 Aw 1 1 o fmm ee ee na FF ILC w 4 d q dq at 1 1
31. and it would be nice to support tabulated magnetic field files However the framework developed for Pol_simpleBfield is very general and should easily facilitate these changes A 4 4 Samples V_sample Modified the sample so that the scattered neutron has P 1 3P Note that this component does not handle multiple scattering so this approach is correct If the components handled multiple scattering the polarization should be set to P 1 3 P where n is the number of scatterings A 5 Tests With New Components All the test instruments can be found in the McStas examples folder go to Neutron site tests in mcgui There are basically two kind of tests The first kind of tests shows that the polarizing component can reproduce the same results as a similar non polarizing component Test_Monochromators instr Intercomparison of Monochromator_flat and Monochro mator_pol Test_Pol_Bender_Vs_Guide_Curved instr Intercomparison of Guide_curved and Pol_bender The second type of test illustrates the polarizing capabilities of the component 136 Test_Magnetic_Constant instr Constant magnetic field Test_Magnetic_Majorana instr Linearly decreasing field with small transverse com ponent Test_Magnetic_Rotation instr Rotating magnetic field Test_Magnetic_Userdefined instr Example of how to make a user defined analytic magnetic field that can also depend on time Test_Pol_Bender instr Illustrates beam
32. as taken by a non scattered neutron although we here assume that all simulated neutrons are being scattered According to 2 9 the neutron weight factor is now adjusted by the amount milla 9 plea exp h b u e Te 8 7 In analogy with the source components it is possible to define interesting directions for the scattering One will then try to focus the scattered neutrons choosing a g Q which peaks around these directions To do this one uses 8 7 where the fraction y Q g Q corrects for the focusing One must choose a proper distribution so that g Q gt 0 in every interesting direction If this is not the case the Monte Carlo simulation gives incorrect results All samples have been constructed with a focusing and a non focusing option Riso R 1538 rev ed EN 73 R Figure 8 2 The geometry of the hollow cylinder vanadium sample 8 0 3 Future development of sample components There is still room for much more development of functionality in McStas samples A more general SANS sample is under development In addition a reflectometry sample will soon be developed In the mean time you may use the SiC contributed component In general all samples are assumed to be homogeneous There would also be potential in developing an inhomogeneous sample e g with spatially varying lattice constant relevant for stress strain scanners Inhomogeneously absorbing sample for tomography could also be possible Furt
33. ask Monitor_nD to look at that value DECLARE ht double nbounces At TRACE CER COMPONENT Guide_in Arm AT EXTEND ht nbounces 0 ht COMPONENT Guidel Guide_gravity AT RELATIVE PREVIOUS EXTEND ht if SCATTERED nbounces GVars N_reflection 0 ht many guide instances copy paste and change names automatically COMPONENT COPY Guide1l COPY Guide1l AT RELATIVE PREVIOUS EXTEND Riso R 1538 rev ed EN 119 if SCATTERED nbounces GVars N_reflection 0 hy monitor nbounces COMPONENT UserMonitor Monitor_nD useri nbounces usernamel Number of bounces options auto user1 AT ere 9 8 8 Monitoring neutron parameter correlations PreMonitor_nD The first imediate usage of the Monitor nD component is when one requires to identify cross correlations between some neutron parameters e g position and divergence aka phase space diagram This latter monitor would be merely obtained with options x dx auto bins 30 This example records the correlation between position and divergence of neutrons at a given instrument location Name PreMonitor_nD Author System E Farhi Input parameters comp Optional parameters Notes But it is also possible to search for cross correlation between two part of the instrument simulation One example is the acceptance phase diagram which shows the neutron car acteristics at the input requi
34. at least mathematically plausible and which works as expected in the two common cases Riso R 1538 rev ed EN 83 1 isotropic mosaic and 2 two mosaic directions horizontal and vertical mosaic perpendicular to a scattering vector The basis for the model is a three dimensional Gaussian distribution in Euler angles giving the orientation probability distribution for the micro crystals that is the misorientation is given by small rotations around the X Y and Z axes with the rotation angles having in general different Gaussian probability distributions For given scattering vector T a rotation of the micro crystals around an axis parallel to 7 has no effect on the direction of the scattering vector Suppose we form the intersection between the three dimensional Gaussian in Euler angles and a plane through the origin perpendicular to 7 This gives a two dimensional Gaussian say with axes defined by unit vectors g and g and mosaic widths 7 and nz We now let the mosaic for T be defined by rotations around g and gy with angles having Gaussian distributions of widths 7 and n2 Since g1 gz and T are perpendicular a small rotation of T around g will change 7 in the direction of g The two axes of the Gaussian mosaic in reciprocal space that are perpendicular to 7 will thus be given by tT72g and TMGo We now derive a quantitative expression for the scattering cross section of the crystal in the model For this we introduc
35. but does not affect the neutron parameters The display is updated in regular intervals of the full simulation the default step size is 10 but it may be changed using the percent parameter from 0 to 100 The estimated computation time is displayed at the begining and actual simulation time is shown at the end Additionally setting the flag_save to 1 results in a regular save of the data files during the simulation This means that is is possible to view the data before the end of the computation and have also a trace of it in case of computer crash The achieved percentage of the simulation is stored in these temporary data files Technically this save is equivalent to sending regularly a USR2 signal to the running simulation The optional profile parameter when set to a file name will produce the number of statistical events reaching each component in the simulation This may be used to identify positions where events are lost 10 7 Beam spy A beam analyzer Name Beam_spy Author System Input parameters Optional parameters Notes should overlap previous component This component is at the same time an Arm and a simple Monitor It analyzes all neutrons reaching it and computes statistics for the beam as well as the intensity This component does not affect the neutron beam and does not contain any propagation call Thus it gets neutrons from the previous component in the instrument description
36. choice 2 3 1 Direction focusing ooa ee ee Adaptive and Stratified sampling o ooo a Accuracy of Monte Carlo simulations o aoo a 2 00004 3 Source components 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 0 1 Neutron flux 2 Source simple A simple continuous source with a flat energy wavelength SPECtIUM aa gan Sk eet OG Seek Os Pa Ma eae Bub E Source_div A continuous source with specified divergence Source _Maxwell_3 A continuous source with a Maxwellian spectrum Source_gen A general continuous source 2 eee Moderator A time of flight source pulsed 04 ISIS moderator ISIS pulsed moderators 0004 3 6 1 Introduction oae e c3 sa nod Bey aed as Sk a A Re eX 3 6 2 Using the McStas Module 0 00200 005 3 6 3 Comparing TS1 and TS2 204 SA BUGS is 205 hi eRe Me Oud ne ROR ot Me A a Source_adapt A neutron source with adaptive importance sampling Riso R 1538 rev ed EN 10 10 10 11 11 12 12 14 14 16 16 17 17 18 19 19 20 21 22 22 24 24 25 25 26 26 27 27 28 28 30 3 7 1 Optimization disclaimer 0 000002 eee 3 7 2 The adaption algorithm 0000 3 7 3 The implementation 2 000000 22 ee eee 3 8 Adapt_check The adaptive importance sampling monitor 3 9 Source_Optimizer A general Optimizer for McStas 3 9 1 The optimiz
37. energy which in binned in nchan bins between Emin and Emax in meV The output parameters from E_monitor are the total counts and a file with 1 dimensional data vs E similar to TOF_monitor 9 4 L_monitor The wavelength sensitive monitor Name L_monitor Author System Input parameters Tmin Tmax Ymin Ymax chan Amin Amax filename Optional parameters Notes The component L_monitor is very similar to TOF_monitor and E_monitor This component is just sensitive to the neutron wavelength The wavelength spectrum is output in a one dimensional histogram between Amin and Amax measured in A As for the two other 1 dimensional monitors this component outputs the total counts and a file with the histogram 9 5 PSD_monitor The PSD monitor Name PSD_monitor Author System Input parameters Lmin max Ymin Ymax Nx Ny filename Optional parameters Notes The component PSD_monitor resembles other monitors e g TOF_Monitor and also propagates the neutron ray to the detector surface in the x y plane where the detector window is set by the x and y input coordinates The PSD monitor though is not sensitive to the arrival time of the neutron ray but rather to its position The rectangular monitor window given by the x and y limits is divided into nz x ny pixels The output from PSD_monitor is the integrated counts n J M2 as well as three two dimensional arrays of counts
38. factor fpack can be specified default value of 1 The inelastic scattering takes place as a quasielastic Lorentzian component which is chosen with probability foe The broadening of the signal is given by Tr HWHM In addition a tunneling signal is present with a probability of ftun and a tunneling energy of Etun The tunneling peaks are weighted by the usual factor kp k The total scattering cross section is given by do Ce Gine dOdE LH ag x 1 for finet 6 fiw 8 9 T Jina ke hw r 2 fi fong 8l Erm fw 4 Bun l The component takes care that faz ftun lt 1 otherwise an error is returned The component accounts for absorption but not multiple scattering To obtain intensities similar to real measured ones we therefore do not take attenuation from scattering into account for the outgoing neutron ray 76 Riso R 1538 rev ed EN 8 3 PowderN A general powder sample Name Powder_N Author System Input parameters radius thickness h cwidth yheight zdepth Cabs Cinc VC foack reflections format DW concentic and more Optional parameters Notes The powder diffraction component PowderN models a powder sample with background coming only from incoherent scattering and no multiple scattering At the users choice a given percentage of the incoming events may be transmitted attenuated to model the direct beam The component can also assume conc
39. global coordinates is 1 1 T U y 7 TD U y 7 2 G y Page a 8 21 The elastic coherent cross section is then given by do 27 8 4 2 The algorithm The overview of the algorithm used in the Single crystal component is as follows 1 Check if the neutron intersects the crystal If not no action is taken 2 Search through a list of reciprocal lattice points of interest selecting those that are close enough to the Ewald sphere to have a non vanishing scattering probability From these compute the total coherent cross section Ccoh see below the absorption 2200 m s gt gt and the total cross section Otot Ocoh t ine A abs cross section Cabs 72200 3 The transmission probability is exp e where is the length of the flight path through the crystal A Monte Carlo choice is performed to determine whether the neutron is transmitted Optionally the user may set a fixed Monte Carlo probability for the first scattering event for example to boost the statistics for a weak reflection 4 For non transmission the position at which the neutron will interact is selected from an exponential distribution A Monte Carlo choice is made of whether to scatter coherently or incoherently Absorption is treated by weight adjustment see below 5 For incoherent scattering the outgoing wave vector kf is selected with a random direction 6 For coherent scattering a reciprocal lattice vector is selected by a
40. h1 2 Ok 0 h1 2 0 46 Ris R 1538 rev ed EN w Z hy wW Figure 5 2 The geometry used for the guide component An Figure 5 3 Neutron reflecting from mirror v and v are the initial and final velocities respectively and n is a vector normal to the mirror surface In the following we refer to an arbitrary guide side by its origin O and normal n With these definitions the time of intersection of the neutron with a guide side can be computed by considering the projection onto the normal O3 ro ng a ven B 3 5 3 where a and 8 are indices for the different guide walls assuming the values h v and 1 2 respectively For a neutron that leaves the guide directly through the guide exit we have l Zo 5 4 texit Uz The reflected velocity vs of the neutron with incoming velocity v is computed by the formula Vi Ve Vi 2n ine 5 5 This expression is arrived at by again considering the projection onto the mirror nor mal see figure 5 3 The reflectivity of the mirror is taken into account as explained in section 5 1 Riso R 1538 rev ed EN 47 5 2 2 Algorithm 1 2 G 8 The neutron is initially propagated to the z 0 plane of the guide entrance If it misses the entrance it is ABSORB ed Otherwise repeatedly compute the time of intersection with the four mirror sides and the guide exit The smallest
41. i bin Yo Yo iat pini 3 16 3 7 3 The implementation The heart of the algorithm is a discrete distribution p The distribution has N bins 1 N Each bin has a value v the probability of bin i is then yf 4 vj Two basic operations are possible on the distribution An update adds a number a to a bin setting v7 oes a A search finds for given input b the minimum i such that b lt So yy 3 17 j l The search operation is used to sample from the distribution p If r is a uniformly dis tributed random number on the interval 0 ae vj then 7 search r is a random number distributed according to p This is seen from the inequality i 1 i yu KRS Su 3 18 j 1 j 1 32 Ris R 1538 rev ed EN from which r ba Vj vi Fa vj which is an interval of length v Hence the probability of i is v owes vj The update operation is used to adapt the distribution to the problem at hand during a simulation Both the update and the add operation can be performed very efficiently As an alternative you may use the Source_Optimizer component see section 3 9 3 8 Adapt_check The adaptive importance sampling mon itor Name Adapt_check Author K Nielsen Input parameters source_comp Optional parameters Notes validated The component Adapt_check is used together with the Source_adapt component see section 3 7 for details When placed somewhere in an instrument using Source_adapt as a s
42. in a way which enables to describe complex imbricated set ups i e what you need to simulate sample environments To do so one has first to use hollow shapes then keep in mind that each surrounding geometry should be first declared before the central position usually the sample with the concentric 1 parameter but also duplicated with an other instance name at a symmetric position with regards to the centre as in the example shown in Fig 8 6 COMPONENT s_in Isotropic_Sqw thickness 0 001 radius 0 02 yheight 0 015 Sqw_coh Al laz concentric 1 AT 0 0 1 RELATIVE a COMPONENT sample Isotropic_Sqw xwidth 0 01 yheight 0 01 zdepth 0 01 Sqw_coh Rb_ligq_coh sqw AT 0 0 1 RELATIVE a COMPONENT s_out Isotropic_Sqw thickness 0 001 radius 0 02 yheight 0 015 Sqw_coh Al 1laz AT 0 0 1 RELATIVE a Central component may be of any type not specifically an Isotropic_Sqw instance It could be for instance a Single crystal or a PowderN In principle the number of surrounding shells is not restricted The only restriction is that neutrons that scatter in 47 can not come back in the instrument description so that some of the multiple scattering events are lost Namely in the previous example neutrons scattered by the outer wall of the cryostat s_out can not come back to the sample or to the other cryostat wall s_in As these neutrons have usually few chances to reach the rest of the simulation we expect that the approximati
43. incoming wave vector k and lattice vector T only a single final wave vector ky is allowed In general this wavevector will not fulfill the conditions for elastic scattering ky kj In a real crystal however reflections are not perfectly sharp Because of imperfection and finite size effects there will be a small region around 7 in reciprocal space of possible scattering vectors Single_crystal simulates a crystal with a mosaic spread 7 and a lattice plane spacing uncertainty Ad d In such crystals the reflections will not be completely sharp there will be a small region around each reciprocal lattice point of the crystal that contains valid scattering vectors We model the mosaicity and Ad d of the crystal with 3 dimensional Gaussian functions in reciprocal space see figure 8 4 Two of the axes of the Gaussian are perpendicular to the reciprocal lattice vector T and model the mosaicity The third one is parallel to 7 and models Ad d We assume that the mosaicity is small so that the possible directions of the scattering vector may be approximated with a Gaussian in rectangular coordinates If the mosaic is isotropic the same in all directions the two Gaussian axes perpendicular to 7 are simply arbitrary normal vectors of equal length given by the mosaic But if the mosaic is anisotropic the two perpendicular axes will in general be different for each scattering vector In the absence of anything better Single_crystal uses a model which is
44. k Fy k Fy K A 32 The values of VkFy and VkFy are then between 1 and 1 and unit less like the reflection probabilities In the following we ignore k and just talk about Fyy K and Fm K In principle there are four solutions for Fy K and Fyy amp so in the code we currently choose the values where Fy K Fiu Ry and Fy Fu K R so that Fy amp gt 0 and Fiy K gt Fu rk We then find Pa L VA A 33 Fulk UM AR A 34 When Fy K and Fy rK are determined from these equations Eq A 28 and Eq A 29 can easily be used to handle any situation This solution is both used for monochromators and guides It is not clear that this solution is correct If we make a simple example with Ry 1 and R 0 25 then we could in principle have four solutions but let us just quote the two where Fy amp is positive since the last two are found by inserting a minus before all the solutions and this does not change the physics The two solutions are Fy K 0 75 Fu K 0 25 and Fmy k 0 75 Fy 0 25 All solutions gives the same cross section but if the Riso R 1538 rev ed EN 133 incoming beam is polarized and only then the outgoing beam will have two different polarization values since P Fy K Fyy and 72 7 P Fyy are different for the two solutions It seems that one needs some additional information to choose between the two solutions NB The simplifyi
45. keep Reference 1 keep Neutrons that will reach monitor 4 The Source_Optimizer transforms the bad neutrons into good ones from the Op timized source The resulting optimised flux is normalised to the non optimized 34 Riso R 1538 rev ed EN one Reference 3 19 Poptimized Pinitial Optimized and thus the overall flux at Monitor_Optimizer location is the same as without the optimizer Usually the process sends more good neutrons from the Optimized source than that in the Reference one The energy and velocity spectra of neutron beam is also kept as far as possible For instance an optimization of v will induce a modification of vz or vy to try to keep v constant 5 When the continuous optimization option is activated by default the process loops to Step 3 every step percent of the simulation This parameter is computed automatically usually around 10 in auto mode but can also be set by user During steps 1 and 2 some non optimized neutrons with original weight Pinitial May lead to spikes on detector signals This is greatly improved by lowering the weight p during these steps with the smooth option The component optimizes the neutron parameters on the basis of independant variables 1D phase space optimization However it usually does work fine when these variables are correlated which is often the case in the course of the instrument simulation The memory requirements of the component a
46. ki 2M hwy a 5 w di x 8 40 Nb 8 6 2 The algorithm All neutrons which hit the sample volume are scattered into a particular range of solid angle AQ like many other components One of the difficult things in scattering from a dispersion is to take care to fulfill the dispersion criteria and to find the correct weight transformation In Phonon_simple the following steps are taken 1 If the sample is hit calculate the total path length inside the sample otherwise leave the neutron ray unchanged 2 Choose a scattering point inside the sample 3 Choose a direction for the final wave vector kp within AQ 4 Calculate possible values of kp so that the dispersion relation is fulfilled for the corresponding value of kr There is always at least one possible k value 43 5 Choose one of the calculated kf values 6 Propagate the neutron to the scattering point and adjust the neutron velocity ac cording to kg 7 Calculate and apply the correct weight factor correction see below 8 6 3 The weight transformation Before making the weight transformation we need to calculate the probability for scatter ing along one certain direction Q from one phonon mode To do this we must integrate out the delta functions in the cross section 8 40 We here use that hw h k k 2mn K ki keke and the integration rule f 5 f x df dx 0 Now we reach do d o ke h2 62 1 1 zm gogg
47. n We seek only one value of n namely the one which makes nQo closest to the projection of 2k onto Qo see figure 7 1 Once n has been determined the Bragg angle 0 can be computed The angle a is the amount one would need to turn the nominal scattering vector Qo for the monochromator to be in Bragg scattering condition We now use a to compute the probability of reflection from the mosaic crystal Preflect Roel 7 2 66 Ris R 1538 rev ed EN 2k sin 20 V V Figure 7 2 Scattering into the part of the Debye Scherrer cone covered by the mosaic The probability Prefect is used in a Monte Carlo choice to decide whether the neutron is transmitted or reflected In the case of reflection the neutron will be scattered into the Debye Scherrer cone with the probability of each point on the cone being determined by the mosaic The Debye Scherrer cone can be described by the equation kf ki cos 26 sin 20 c cos y bsin yw yp 73 7 7 3 where b is a vector perpendicular to k and Qo c is perpendicular to k and b and both b and c have the same length as k see figure 7 2 When choosing y and thereby ke only a small part of the full 7 7 range will have appreciable scattering probability in non backscattering configurations The best statistics is thus obtained by sampling only from a suitably narrow range The small deviation angle a of the nominal scattering vector nQo corresponds to a A
48. neutron energies the flux decay is assumed to be exponential W E t exp t r E 3 3 where the decay constant is given by TO E lt Ee P OMRE BII E gt By 3 4 The decay parameters are 79 in ws Ee and y both in meV Other pulsed source models are available from contributed components See section 3 11 3 6 ISIS_moderator ISIS pulsed moderators Name ISIS_moderator Author S Ansell and D Champion ISIS Input parameters Face E0 E1 dist rw yh Angle SAC Optional parameters modXsize modYsize Notes Validated Low statistics above 20 A Kink aroung 9 A 26 Riso R 1538 rev ed EN 3 6 1 Introduction The following document describes the functions obtained for models of TS2 as described in Table 3 2 target 3 4cm diameter tantalum clad tungsten reflector Be D20 80 20 at 300K Composite Moderator H2 CH4 Coupled Groove 3x8 3 cm 26K solid CH Hydrogen 12x11cm 22K liquid H Poisoned Moderator solid CH 26K Decoupled Narrow Gd poison at 2 4 cm 8 vanes Broad 3 3 cm not fully decoupled PreModerators 0 85 cm and 0 75 cm H20 Table 3 2 Description of Models TS1 model is from the tungsten target as currently installed and positioned The model also includes the MERLIN moderator this makes no significant difference to the other moderator faces 3 6 2 Using the McStas Module You MUST first set the environment variable MCTABLES
49. on coordi nates and return the resulting Coord structure rot_set_rotation Rotation t dz dy oz Get transformation matrix for rotation first gx around x axis then around y and last around z t should be a Rotation 3 3 double matrix rot_mul Rotation t1 Rotation t2 Rotation t3 performs t3 1 2 rot_copy Rotation dest Rotation src performs dest src for Rotation arrays t rot transpose Rotation src Rotation dest performs dest src rot_apply Rotation t Coords a returns a Coord structure which is t a B 1 4 Mathematical routines NORM z y z Normalizes the vector x y z to have length 1 scalar_prod az dy az bz by bz Returns the scalar product of the two vectors az ay az and bz by bz vec_prod amp a z amp ay amp a b2 by bz Cx Cy Cz Sets az dy az equal to the vector prod uct br by bz X Cr Cy z rotate amp 2 amp y amp 2 Vz Vy Vz P dxdy 4z Set x y z to the result of rotating the vector Uz Vy Uz the angle in radians around the vector az ay az normal_vec amp n amp n amp nz x y z Computes a unit vector nz Ny nz normal to the vector x y z solve_2nd_order t A B C Solves the 2 order equation At Bt C 0 and returns the smallest positive solution into pointer t B 1 5 Output from detectors Details about using these functions are given in the McStas User Manual 140 DETECTOR _OUT_OD Used t
50. over samples that contribute little The method can achieve improvements of a factor of ten or sometimes several hundred in simulations where only a small part of the initial phase space contains useful neutrons This component uses the correlation between neutron energy initial direction and initial position The physical characteristics of the source are similar to those of Source_simple see section 3 1 The source is a thin rectangle in the x y plane with a flat energy spectrum in a user specified range The flux per area per steradian per Angstrom per second is specified by the user The initial neutron weight is given by Eq 3 2 using AX as the total wavelength range of the source A later version of this component will probably include a A dependence of the flux We use the input parameters dist cw and yh to set the focusing as for Source_simple section 3 1 The energy range will be from Eo dE to Eo dE filename is used to give the name of a file in which to output the final sampling destribution see below Neng Npos and Naiv are used to set the number of bins in each dimensions Good general purpose values for the optimization parameters are a 8 0 25 The number of bins to choose will depend on the application More bins will allow better adaption of the sampling but will require more neutron histories to be simulated before a good adaption is obtained The output of the sampling distribution is only meant for debugging
51. relates to the internal def inition of the reciprocal space Possibly related to this the model of anistropic mosaic is broken always use a non zero isotropic mosaic Also always use a non zero value of the Ad d parameter The Single_crystal component models a thick flat single crystal with multiple scatter ing and absorption with elastic coherent scattering An elastic incoherent background may also be simulated It may be used to describe samples for diffraction but also for accurate monochromator descriptions The component is currently under further review The current documentation is outdated especially with respect to the model of crystal mosaicity The input parameters for the component are cwidth yheight and zdepth to define the dimensions of the crystal in meters area is centered delta_d_d to give the value of Ad d no unit az ay az bz by bz and cz cy cz to define the axes of the direct lattice of the crystal the sides of the unit cell in units of Angstrom and reflections a string giving the name of the file with the list of structure factors to consider The mosaic is specified either isotropically as mosaic or anisotropically as mosaic_h rotation around the Y axis mosaic_v rotation around the Z axis and mosaic_n rotation around the X axis in all cases in units of full width half maximum minutes of arc Optionally the absorption cross section at 2200 m s and the incoherent cross section m
52. single layer of the mirror material At higher values of Q the reflectivity starts falling linearly with a slope a until a soft cut off at Q MQ The width of this cut off is denoted W See the example reflection curve in figure 5 1 It is important to notice that when m lt 1 the reflectivity remains constant at R Ro up to q Qc and not m Qc This means that m lt 1 parameters behave like m 1 materials Alternatively the Mirror Guide and Guide_gravity components may use a reflectivity table reflect which 1st column is q A and 2nd column as the reflectivity R in 0 1 For this purpose we provide m 2 and m 3 reflectivity files from SwissNeutronics supermirror_m2 rfl and supermirror_m3 rfl in MCSTAS 1lib data 5 1 2 Algorithm The function of the component can be described as 1 Propagate the neutron ray to the plane of the mirror 2 If the neutron trajectory intersects the mirror plate it is reflected otherwise it is left untouched 3 Reflection of the incident velocity vj vz vy vz gives the final velocity vp Ux Uy U z 4 Calculate Q 2myvz h 5 The neutron weight is adjusted with the amount 7 R Q 6 To avoid spending large amounts of computation time on very low weight neutrons neutrons for which the reflectivity is lower than about 1071 are ABSORB ed Riso R 1538 rev ed EN 45 Supermirror reflectivity m 4 T T T Reflectivity p o S D T 0 4 0 2
53. slit openings of height h and angular width 69 The slits are symmetrically disposed on the disc If unset the slit height h will extend to the centre of the disc h R The DiskChopper is self centering meaning that the centre of the slit openings will automatically be positioned at the centre of the beam axis see figure 6 1 To override this behaviour set the paramter compat 1 positioning the chopper centre at height R as implemented in the original Chopper component Optionally each slit can have a central absorbing insert a beamstop of angular width 01 For more exotic chopper definitions use the GROUP keyword see below for an example The direction of rotation can be controlled which allows to simulate e g counter rotating choppers The phase or time delay to in seconds is defined by the time where the first of the n slits is positioned at the top As an alternative an angular phase can be given using the o parameter 52 Riso R 1538 rev ed EN By default neutrons hitting outside the physical extent of the disc are absorbed This behaviour can be overruled by setting parameter abs_out 0 A y Optional beamstop of width 6 Figure 6 1 Sketch of a disc chopper with geometry parameters When simulating the chopping of a continuous beam most of the neutrons could easily be lost To improve efficiency one can set the flag IsFirst which will allow every neutron ray to pass the DiskChopper but modif
54. sphere of radius rjc at the position target Ytarget Ztarget in the local coordinate system This gives an angular distribution in a small angle approximation of 1 ge y 2 2 9 0 7 8 8 The focusing can alternatively be performed on a rectangle with dimensions wyocus Afocus or uniformly in angular space in a small angle approximation using Woc angle Mfoc angle The focusing location can be picked to be a downstream component by specifying target_index When calculating the neutron path length within the cylinder the kernel function cylinder_intersect is used twice once for the outer radius and once for the inner radius Multiple scattering is not included in this component To obtain intensities similar to real measured ones we therefore do not take attenuation from scattering into account for the outgoing neutron ray 8 1 2 Remark on functionality When simulating a realistic incoherent hollow cylinder sample one finds that the resulting direction dependence of the scattered intensity is not isotropic This is explained by the variation of attenuation with scattering angle One test result is shown in the instrument example chapter of the McStas User Manual The Samples_vanadium and Samples_incoherent test example instruments exist in the distribution for this component Riso R 1538 rev ed EN 75 8 2 Tunneling sample An incoherent inelastic scatterer Name Tunneling sample Author System Inpu
55. the signal lt variable gt word is used in the options The cm2 option will ask to normalize the flux to the monitor section surface and the capture option uses the gold foil integrated capture flux weightening up to the cadmium cut off 0 5eV d v d 9 5 E Dae oP The auto option is probably the most useful one it asks the monitor to determine auto matically the best limits for each variable in order to obtain the most significant monitored histogram This option should preceed each variable or be located after all variables in which case they are all affected On the other hand one may manually set the limits with the limits min max option The log and abs options should be positioned before each variable to specify logarithmic binning and absolute value respectively The borders option will monitor variables that are outside the limits These values are then accumulated on the borders of the signal 9 8 4 The output files By default the file names will be the component name followed by a time stamp and automatic extensions showing what was monitored such as MyMonitor x You can also set the filename in options with the file keyword followed by the file name that you want The extension will then be added if the name does not contain a dot Finally the filename parameter may also be used The output files format are standard 1D or 2D McStas detector files The no file option will una
56. to display both the catalog of the McStas library e g using mcdoc as well as the documentation of specific components e g with mcdoc text name mcdoc file comp The first line will search for all components matching the name and display their help section as text For instance mcdoc laz will list all available Lazy data files whereas mcdoc text Monitor will list most Monitors The second example will display the help corresponding to the file comp component using your BROWSER setting or as text if unset The help option will display the command help as usual An overview of the component library is also given at the McStas home page 3 and in the User Manual 2 12 Ris R 1538 rev ed EN MCSTAS data Ocoh Cine Cabs Tm c Note File name barns barns barns K m s Ag laz 4 407 0 58 63 3 1234 9 2600 Al203 sapphire laz 15 683 0 0188 0 4625 2273 Al laz 1 495 0 0082 0 231 933 5 5100 lau Au laz 7 32 0 43 98 65 1337 4 1740 BAC laz 19 71 6 801 3068 2718 Ba laz 3 23 0 15 29 0 1000 1620 Be laz 7 63 0 0018 0 0076 1560 13000 BeO laz 11 85 0 003 0 008 2650 lau Bi laz 9 148 0 0084 0 0338 544 5 1790 C60 lau 5 551 0 001 0 0035 C_diamond laz 5 551 0 001 0 0035 4400 18350 lau C_graphite laz 5 551 0 001 0 0035 3800 18350 lau Cd laz 3 04 3 46 2520 594 2 2310 Cr laz 1 660 1 83 3 05 2180 5940 Cs laz 3 69 0 21 29 0 301 6 1090 cin liquid Cu laz 7 485 0 55 3 78 1357 8 3570 Fe laz 11 22 0 4 2 56 1811 4910 Ga l
57. used by the components Source_adapt and Adapt_check It performs adaptive importance sampling of neutrons for simulation efficiency optimiza tion Refer to these components for implementation examples and ask the authors for more details B 5 Vitess import export Library This library is used by the components Vitess_input and Vitess_output as well as the mcestas2vitess utility Refer to these components for implementation examples and ask the authors for more details B 6 Constants for unit conversion etc The following predefined constants are useful for conversion between units Name Value Conversion from Conversion to DEG2RAD 27 360 Degrees Radians RAD2DEG 360 27 Radians Degrees MIN2RAD 27 360 60 Minutes of arc Radians RAD2MIN 360 60 27 Radians Minutes of arc V2K 101 my h Velocity m s k vector A K2V 107 R my k vector A7 Velocity m s VS2E mn 2e Velocity squared m s72 Neutron energy meV SE2V 2e mn Square root of neutron en Velocity m s ergy meV FWHM2RMS 1 8 log 2 Full width half maximum Root mean square standard deviation RMS2FWHM 8 log 2 Root mean square stan Full width half maxi dard deviation mum MNEUTRON 1 67492 107 kg Neutron mass my HBAR 1 05459 10734 Js Planck constant h PI 3 14159265 T FLT MAX 3 40282347E 38F a big float value Ris R 1538 rev ed EN 145 Appendix C The McStas terminology This is a s
58. w S q P w dw 8 59 Pa q w 8 60 100 Riso R 1538 rev ed EN g S q 0 g qo amp E3 S P Q a y N Energy transter meV s amp Energy transfer meV g A z e o amp o o 05 35 0 o 1 15 2 2 3 35 4 Momentum transfer A o amp o amp g o 2 25 Momentum transfer A Figure 8 7 Centre Model of dynamic structure factor S q w for l He left probability distribution g horizontal axis of energy transfers vertical axis density of states right probability distribution gq w vertical axis of momentum transfers horizontal axis for a given energy transfer hw 1 1 meV from which we choose randomly a wavevector transfer q knowing the energy transfer w These two probability distributions extracted from S q w are shown in Fig 8 7 for a model S q w function built from the LHe elementary excitation Data from Donnelly Then a selection between energy gain and loss is performed with the detailed balance ratio e w ksT In the case of Stokes processes the neutron can not loose more than its own energy to the sample dynamics so that hw lt E This condition breaks the symmetry between up scattering and down scattering Solving selection rules and choosing the scattered wave vector The next step is to check that the conservation laws 2 Ri E i k2 8 61 q ki kf 8 62 can be satisfied These conditions are closely
59. 000000008 115 9 8 4 The output files 20 0000 2020222 eee 115 9 8 5 Monitor equivalences aooo a 116 9 8 6 Usage examples 0 0 00 2 eee ee 116 9 8 7 Monitoring user variables 0 000000 pees 116 9 8 8 Monitoring neutron parameter correlations PreMonitornD 120 10 Special purpose components 121 10 1 Virtual_output Saving the first part of a split simulation 122 10 2 Virtual_input Starting the second part of a split simulation 122 10 3 Res_sample A sample like component for resolution calculation 123 10 4 TOF_Res_sample A sample like component for TOF resolution calculation 124 10 5 Res_monitor The monitor for resolution calculation 124 10 6 Progress_bar Simulation progress and automatic saving 126 10 7 Beam_spy A beam analyzer 2 0 ee 126 A Polarization in McStas 127 A d Introductions oi erin ea ee A a PES PR RS 127 A 2 The Polarization Vector 2 0 ee 127 A 2 1 Example Magnetic fields ooa aa 129 A 3 Polarized Neutron Scattering aoaaa ee ee ee 130 A 3 1 Example Nuclear scattering 222000 131 A 3 2 Example Polarizing Monochromator and Guides 132 A 4 New McStas Components 00 00002 eee ee 134 AAT Polarizers o apt Pangea dd cheer ok amp So du Ga bhi oy bo ed 134 A42 Dev ctOEs ang oc ha ke Bia ae E e Re eR Be ek aos 135 A 4 3 Magnetic fields 2 2 2 20 20002 pee ee 135
60. 20 A A 130 Ris R 1538 rev ed EN Inserting Eq A 16 in Eq A 19 and Eq A 20 results in the two master equations for polarized neutron scattering Trpd t 6184 a P P iP at x A 21 and Tr t ft amp t P t P t P P t i t x xP i Px t A 22 Based on these two equations and the interaction potentials all the results presented in the following are derived in 53 A 3 1 Example Nuclear scattering The nuclear scattering potential for a crystal is p 1 ae Vn K SS exp ik Ria Ala z Plat Tia A 23 ld so that a 1 A OS 2 exp ik Rid 5 Biala A 24 BS exp i Ria Aja A 25 ld where I is the nuclear spin operator and the constants A and B are related to the nuclear scattering lengths bt and b7 as A I 1 bt Ib7 2I 1 and B b b7 2I 1 To calculate the polarization cross section and outgoing polarization we have to average over the nuclear spin which we assume is random oriented so that terms linear in three last terms in Eq A 21 disappears The scattering cross section ends up being see 53 p 159 do dQ gt 1 S exp ie Ra Rya lAa 8 a a Aa a zl Bal Lala 1 A 26 Lda where the first term is the coherent cross section and the second term is the site incoherent cross section Both terms are independent of P as expected for a system without a pre ferred internal dire
61. A Goddess ee a 69 7 4 Phase space transformer moving monochromator 69 8 Samples 71 8 0 1 Neutron scattering notation 2 0000 2 eee 72 8 0 2 Weight transformation in samples focusing 72 8 0 3 Future development of sample components 74 8 1 V_ sample An incoherent scatterer the V sample 74 8 1 1 Physics and algorithm 0 00 000 008 75 8 1 2 Remark on functionality aa 0008 75 8 2 Tunneling sample An incoherent inelastic scatterer o oo aaa 76 8 3 PowderN A general powder sample ooo oaa a a 77 8 3 1 Files formats powder structures 0 00000 00 G 77 8 3 2 Geometry physical properties concentricity 78 8 3 3 Powder scattering 2 0 0 02 0 ee ee ee 79 S34 Alporithiniis cies seg sat Wk tac ase eect Bee gah oe Eo ee PE es ss 81 8 4 Single crystal The single crystal component 82 8 4 1 The physical model 0 020000 00 2 eee 82 8 4 2 Vheraleorithiy dorae ina Bod we ok a Slab ab he HG eS 85 8 4 3 Choosing the outgoing wave vector 1 0 eee eee 85 8 4 4 Computing the total coherent cross section 87 8 4 5 Implementation details 2 0 0 0 a es 88 8 5 Sans_spheres A sample of hard spheres for small angle scattering 90 8 5 1 Small angle scattering cross section 02 000 90 80 25 AlPOribhir aeiia few ey bat g a el Be dn et ae ery el eae 90 8 5 3 Calculati
62. Arm Author System Input parameters none Optional parameters none Notes The component Arm is empty is resembles an optical bench and has no effect on the neutron ray The purpose of this component is only to provide a standard means of defining a local coordinate system within the instrument definition Other components may then be positioned relative to the Arm component using the McStas meta language The use of Arm components in the instrument definitions is not required but is recommended for clarity Arm has no input parameters The first Arm instance in an instrument definition may be changed into a Progress_bar component in order to display on the fly the simulation progress and possibly save inter mediate results 4 2 Slit A beam defining diaphragm Name Slit Author System Input parameters Tmin Tmax Ymin Ymax Optional parameters r Peut Notes The component Slit is a very simple construction It sets up an opening at z 0 and propagates the neutrons onto this plane by the kernel call PROP_Z0 Neutrons within 38 Riso R 1538 rev ed EN the slit opening are unaffected while all other neutrons are discarded by the kernel call ABSORB By using Slit some neutrons contributing to the background in a real experiment will be neglected These are the ones that scatter off the inner side of the slit penetrates the slit material or clear the outer edges of the slit T
63. EN As described in section 10 3 the Res_monitor should be used in connection with one of the components Res_sample or TOF_Res_sample the name of which should be passed as an input parameter to Res_monitor For example COMPONENT mysample Res_sample COMPONENT det Res_monitor res_sample_comp mysample The output file is in ASCII format one line per scattering event with the following columns e ki the three components of the initial wave vector e ke the three components of the final wave vector e r the three components of the position of the scattering event in the sample e pi the neutron weight just after the scattering event e pr the relative neutron weight adjustment from sample to detector so the total weight in the detector is pip From kj and kf we may compute the scattering parameters x ki ke and hw h 2mn k k The vectors are given in the local coordinate system of the resolution sample component The wave vectors are in units of OY the energy transfer in meV The output parameters from Res_monitor are the three count numbers Nsum psum and p2sum and the handle file of the output file Riso R 1538 rev ed EN 125 10 6 Progress bar Simulation progress and automatic sav ing Name Progress_bar Author System Input parameters percent flag_save profile Optional parameters Notes This component displays the simulation progress and status
64. Notes validated no gravitation support The component Mirror models a single rectangular neutron mirror plate It can be used as a sample component or to e g assemble a complete neutron guide by putting multiple mirror components at appropriate locations and orientations in the instrument definition much like a real guide is build from individual mirrors In the local coordinate system the mirror lies in the first quadrant of the x y plane with one corner at 0 0 0 The input parameters of this component are the rectangular mirror dimensions l h and the values of Ro m Qe W and a for the mirror reflectivity As a special case if m 0 then the reflectivity is zero for all Q i e the surface is completely absorbing This component may produce wrong results with gravitation 5 1 1 Mirror reflectivity To compute the reflectivity of the supermirrors we use an empirical formula derived from experimental data 40 see Fig 5 1 The reflectivity is given by Ro if Q lt Qe ia 1 Ro 1 tanh Q mQ W 1 a Q Q if Q gt Qe ay 44 Risd R 1538 rev ed EN Here Q is the length of the scattering vector in T defined by Mn Q ki ke i vi vel 5 2 m being the neutron mass The number m in 5 1 is a parameter determined by the mirror materials the bilayer sequence and the number of bilayers As can be seen R Ro for Q lt Qe where Qe is the critical scattering wave vector for a
65. RELATIVE PREVIOUS ROTATED 0 L n d R 180 PI 0 RELATIVE PREVIOUS COMPONENT CG_Out Arm AT 0 0 L n RELATIVE PREVIOUS The Guide component should be duplicated n times by copy paste but changing the instance name e g CG_1 CG_2 CG_n This may be automated with the COPY or the JUMP ITERATE mechanisms see User manual An implementation of a continuous curved guide has been contributed as component Guide_curved Riso R 1538 rev ed EN 51 Chapter 6 Moving optical components Choppers and velocity selectors We list in this chapter some moving optical components like choppers that may be used for TOF class instrument simulations and velocity selector used for partially monochro matize continuous beams 6 1 DiskChopper The disc chopper Name DiskChopper Author Peter Willendrup Riso System Input parameters 00 R h w n to bo Optional parameters IsFirst npulse Notes Based on Chopper by P Bernhardt extensions K Hewitt Klen and R Bewey To cut a continuous neutron beam into short pulses or to control the pulse shape in time from a pulsed source one can use a disc chopper see figure 6 1 This is a fast rotating disc with the rotating axis parallel to the neutron beam The disk consists of neutron absorbing materials To form the pulses the disk has openings through which the neutrons can pass Component DiskChopper is an infinately thin absorbing disc of radius R with n
66. _ZO 133 RESTORE_NEUTRON 134 ROT_A_COMP 134 ROT_A_CURRENT_COMP 134 SCATTER 133 SCATTERED 134 STORE_NEUTRON 134 Shared see Library Components share vitess lib 141 MCNP 33 Monitors 105 Adaptive importance sampling monitor 29 Banana shape 112 Beam analyzer 122 Capture flux 111 Custom monitoring user variables Mon itor nD 112 Divergence monitor 108 Divergence position monitor 108 Energy monitor 107 Neutron parameter correlations PreMon itor_nD 116 Number of neutron bounces in a guide 115 Position sensitive detector PSD 107 Position sensitive monitor recording mean energy 112 Resolution monitor see Samples Resolution 151 function The All in One monitor Monitor_nD 109 Time of flight monitor 106 TOF2E monitor 106 Wavelength monitor 107 Monte Carlo method 12 Accuracy 17 Adaptive sampling 16 Direction focusing 15 Stratified sampling 16 Multiple scattering 78 91 Optics 34 40 48 Beam stop 35 Bender non polarizing 46 Curved guides polygonal model 47 Disc chopper 48 Fermi Chopper 46 51 55 Filter 36 Guide with channels straight non fo cusing 45 Guide with channels and gravitation han dling straight 46 Linear collimator 37 Mirror plane 40 Monochromator 61 Monochromator curved 64 Monochromator thick 65 phase space transformer 65 Phonon scattering 88 Powder multiple diffraction line 73 Resolution function sample fo
67. a linear combinaison of the coherent and incoherent parts as NS q w 8 44 oS q w Oronoco Gs w ale CincSinclq w 8 45 where the subscripts coh and inc stand for the coherent and incoherent contributions respectively We define its norm on a selected q range IS I l S G wilaadie 8 46 The norm limg co S q for large q values and can only be defined on a restricted q range Some easily measureable coherent quantities in a liquid are the static pair correlation function g r and the structure factor S q defined as pg r N ler 7 T 8 47 i 1 ji s J d 8 48 1 p J g F 1e t ar 8 49 14 af lg r 1 ara in isotropic materials 8 50 The latter expression in isotropic materials may be Fourier transformed as g r 1 ef Po 1 ay 8 51 Both g r and S q converge to unity for large r and q values respectively and they are representative of the atoms spatial distribution In a liquid lim 9 S q pkgTxr where XT vr is the compressibility 50 51 In perfect gases S q 1 for all q These quantities are obtained experimentally from diffractometers In principle Sinc q 1 in all materials but a q dependence is rather usual partly due to the Debye Waller factor ent uw Anyway Sinc q converges to unity at high q The static pair correlation function g r is the probability to find a neighbouring atom at a given distance unitless Since g 0 0 Eq 8 51 provides
68. a useful normalisation sum rule for coherent S q q S q 1 dq 2n7p for coherent contribution 8 52 0 Riso R 1538 rev ed EN 97 This means that the integrated oscillations around 1 of Scon q are directly related to the density of the material p In practice the function q is often known on a restricted range q 0 qmaz due to either limitations in the sample molecular dynamics simulation or the measurement itself In first approximation we consider that Eq 8 52 can be applied in this range i e we neglect the large q contributions provided S q 1 converges faster than 1 q This is usually true after 2 3 oscillations of S q in liquids Then in isotropic liquid like materials Eq 8 52 provides a normalisation sum rule for S 8 7 3 Theoretical side scattering in the sample The Eq 8 44 controls the scattering in the whole sample volume Its implementation in a propagative Monte Carlo neutron code such as McStas can be summarised as follows 1 Compute the propagation path length in the material by geometrical intersections between the neutron trajectory and the sample volume 2 Evaluate the total cross section from the integration of the scattering law over the accessible dynamical range Section 8 7 3 3 Use the total cross section to determine the probability of interaction for each neutron along the path length and select a scattering position 4 Weight neutron interaction with the
69. absorption probability and select the type of interaction coherent or incoherent 5 Select the wave vector and energy transfer from the dynamic structure factor S q w used as a probability distribution Section 8 7 3 Apply the detailed balance 6 Check whether selection rules can be solved Section 8 7 3 If they cannot repeat 5 This procedure is iterated until the neutron leaves the sample We shall now detail the key steps of this implementation Evaluating the cross sections and interaction probability Following Sears 52 the total scattering cross section for incoming neutrons with initial No ffk e f am dQdE hfe q w dQdB 8 53 where the integration runs over the entire space and all final neutron energies As the dynamic structure factor is defined in the g w space the integration requires a variable change Using the momentum conservation law and the solid angle relation Q 27 1 cos were is the solid angle opening we draw oS q w N J I ir dis 8 54 98 Riso R 1538 rev ed EN energy Ei is This integration runs over the whole accessible g w dynamical range for each incoming neutron In practice the knowledge of the dynamic structure factor is defined over a limited area with q qmin Umax and w wmin Wmaz which is constrained by the method for obtaining S q w i e from previous experiments molecular dynamics simulations and analytical models It is desirable that thi
70. according to Eq 3 2 with Y A replaced by 2e LM A T The component Source_gen see section 3 4 works on the same principle but provides more options concerning wavelength energy range specifications shape etc Maxwellian parameters for some continuous sources are given in Table 4 1 As nobody knows exactly the characteristics of the sources it is not easy to measure spectrum there these figures should be used with caution 3 4 Source gen A general continuous source Name Source_gen Author System E Farhi ILL Input parameters w h zw yh Eo AE Ti To T3 1 I2 I5 Optional parameters r Ao dA Emin Emax Amin Amaz Notes Validated for Maxwellian expressions t 0 This component is a continuous neutron source rectangular or circular which aims at a rectangular target centered at the beam The angular divergence is given by the dimensions of the target The shape may be rectangular dimension h and w or a disk of radius r The wavelength energy range to emit is specified either using center and half width or using minimum and maximum boundaries alternatively for energy and wavelength The flux spectrum is specified with the same Maxwellian parameters as in component Source_Maxwell_3 refer to section 3 3 Maxwellian parameters for some continuous sources are given in Table 3 1 As nobody knows exactly the characteristics of the sources it is not easy to measure spectrum there these figure
71. actual A The reflection probability is a Gaussian in AX ABragg With the peak reflectivity and polarization calculated as described in section A 3 2 NB Note that this monochromator reflects the neutrons billiard like In Monochromator_flat the mosaicity of the reflecting crystal is taken into account but the d spread is not taken into account One should implement d spread and mosaicity in a way similar to what is done in Single crystal Risd R 1538 rev ed EN e Pol mirror Plane with a reflection probability for up and down There are 3 options always reflect always transmit or random select transmit reflect NB Note that at the moment the plane only reflects from one side because it uses PROP_ZO e Pol_bender Curved guide with the possibilities to insert multiple slits and have the end gap parallel to the entrance or following the guide angle It is possible to select different coatings mirror parameters for each of the four sides e Pol_guide_vmirror Straight guide with non polarizing coatings with two polariz ing super mirrors sitting in a V shape inside Note that for all the polarizing guides it is possible to define analytical functions or use tables for the up and down reflectivity descriptions A 4 2 Detectors e Pol monitor One defines a vector m mz my mz for the monitor and mea sures the projection of the spin along this vector i e m S e PolLambda_monitor Measures the projection of th
72. age is that we are then sure that each sub space is well represented in the final integrals This means that instead of shooting N events we define D partitions and shoot r N D events in each partition In conjunction with adaptive sampling we may define partitions so that they represent interesting distributions e g from events scattered on a monochromator or a sample The sum of partitions should equal the total space integrated by the Monte Carlo method and each partition must be sampled randomly In the case of McStas the stratified sampling is used when repeating events such as in the Virtual sources Virtual_input Vitess_input Virtual mcnp_input Virtual_tripoli4_input and when using the SPLIT keyword in the TRACE section on instrument descriptions We emphasize here that the number of repetitions r should not exceed the dimensionality of the Monte Carlo integration space which is d 10 for neutron events and the dimensionality of the partition spaces i e the number of random generators following the stratified sampling location in the instrument 20 Riso R 1538 rev ed EN Records Accurarcy 10 10 104 2 5 10 1 10 0 25 107 0 05 Table 2 1 Accuracy estimate as a function of the number of statistical events used to estimate an integral with McStas 2 5 Accuracy of Monte Carlo simulations When running a Monte Carlo the meaningfull quantities are obtained by integrating random e
73. artment May 2008 Groups own reg number s Project contract No Pages Tables Illustrations References 154 2 15 10 Abstract Max 2000 char The software package McStas is a tool for carrying out Monte Carlo ray tracing simulations of neutron scattering instruments with high complexity and precision The simulations can compute all aspects of the performance of instruments and can thus be used to optimize the use of existing equipment design new instrumentation and carry out virtual exper iments for e g training experimental planning or data analysis McStas is based on a unique design where an automatic compilation process translates high level textual in strument descriptions into efficient ANSI C code This design makes it simple to set up typical simulations and also gives essentially unlimited freedom to handle more unusual cases This report constitutes the reference manual for McStas and together with the manual for the McStas components it contains full documentation of all aspects of the program It covers the various ways to compile and run simulations a description of the meta language used to define simulations and some example simulations performed with the program Descriptors Neutron Instrumentation Monte Carlo Simulation Software Available on request from Information Service Department Riso DTU Afdelingen for Informationsservice Riso DTU P O Box 49 DK 4000 Roskilde Denmark Phone 45 4677 4004
74. ath taking into account the secondary extinction and absorption probability In this process the neutron is considered to be a particle or an attenuated wave Once a scattering position has been assigned the neutron interacts with a material excita tion Here we turn to the wave description of the neutron which interacts with the whole sample volume The distribution of excitations which determines their relative intensity in the scattered beam is simply the dynamic structure factor or scattering law S q w We shall build probability distributions from the scattering law in order to improve the efficiency of the method by favoring the q w choice towards high S q w regions The neutron leaves the scattering point when a suitable q w choice has been found to satisfy the conservation laws The method is iterated until the neutron leaves the volume of the material therefore allowing multiple scattering contributions which will be considered in more details below No experimental method makes it possible to accurately measure the multiple scattering contribution even though it can become significant at low q transfers below the first diffraction maximum where the single scattering coherent signal is weak in most mate rials This is why attemps have been made to reduce the multiple scattering contribution by partitioning the sample with absorbing layers However this is not always applicable thus makiong the simulation approach very va
75. ation algorithm 3 9 2 Using the Source_Optimizer 0004 3 10 Monitor_Optimizer Optimization locations for the SOurCeZO PtMIZEH sha Sep eee Ad chav end MAS ie Ona wed 4 oes 3 11 Other sources components contributed pulsed sources virtual sources event TLS Vda ien Ue 8 cp iets Pattee Se he at a eRe elke te oh ee ak Beam optical components Arms slits collimators and filters 4 1 Arm The generic component 00 000002 eee ee 4 2 Slit A beam defining diaphragm 2 2 0004 4 3 Beamstop A neutron absorbing area ooo a 4 4 Filter_gen A general filter using a transmission table 4 5 Collimator_linear The simple Soller blade collimator 4 5 1 Collimator transmission 0 0 020200000204 e Aid 2 4 Algorithme 26 4 a soak coy a a ee eR oe ea 4 6 Collimator_radial A radial Soller blade collimator Reflecting optical components mirrors and guides 5 1 Mirror The single mirror 0 0 0 eee ee eee 5 11 Mirror reflectivity ssi 2 ais nodal ae Bonk ee ee la i eg Bob ALGORITHM ve fry garane y Sean lenge oe de Sa eda Ss Hoke Bott eee ch Sw GD galled 5 2 Guide The guide section sooo a 5 2 1 Guide geometry and reflection 20 020004 52 2 ALCOR e cacy i hee Sot agni d ie Apts OR WG ark 4s e 5 3 Guide_channeled A guide section component with multiple channels 53 1 Algorithm 2 s 84 h eae w
76. att Phonon_simple X 1 Isotropic Sqw X X X X 2 X Powder1 1 line X 1 PowderN N lines X 1 Sans_spheres colloid 1 Single_crystal X X 2 X V_sample X QE broad 1 Tunneling sample X X QE broad 1 Table 8 1 Processes implemented in sample components Absorption 1 single only 2 with secondary 8 0 1 Neutron scattering notation In sample components we use the notation common for neutron scattering where the wave vector transfer is denoted the scattering vector q k k 8 1 In analygo the energy transfer is given by he fiw Ey Ep 5 k k 8 2 8 0 2 Weight transformation in samples focusing Within many samples the incident beam is attenuated by scattering and absorption so that the illumination varies considerably throughout the sample For single crystals this phenomenon is known as secondary extinction 43 but the effect is important for all samples In analytical treatments attenuation is difficult to deal with and is thus often ignored making a thin sample approximation In Monte Carlo simulations the beam attenuation is easily taken care of as will be shown below In the description we ignore multiple scattering which is however implemented in some sample components The sample has an absorption cross section per unit cell of of and a scattering cross section per unit cell of of The neutron path length in the sample before the scattering event is denoted by l and the pat
77. ave access to a global data set containing incoherent scattering as well e g the result of a previous experiment use Sqw_coh parameter set the Cecon parameter to the sum of both contributions Ceoh Cinc and set Cine 1 This way we only use one of the two implemented scattering channels Such global data sets may originate from previous experiments as far as you have applied all known corrections multiple scattering geometry In any case the accuracy of the S q w data limits the q and w resolution of the simulation eventhough a bilinear interpolation is performed in order to smooth binning The sampling of data files should then be as thin as possible If the Sqw_inc parameter is left unset but the Gine is not zero an isotropic incoherent elastic scattering is used just like the V sample component see section 8 1 Anyway as explained below it is also possible to simulate the elastic scattering from a powder file see below File formats S q w inelastic scattering The format of the data files is free text consisting of three numerical blocks separated by empty lines or comments in the following order 1 A vector of length m containing wavevector q values in A7 2 A vector of length n containing energy w values in meV 3 A matrix of size m rows by n columns of S q w values in meV Any line beginning with any character of is considered to be a comment and lines which can not be read as vectors matr
78. ay be given as absorption and incoherent in barns with default of zero and p_transmit may be assigned a fixed Monte Carlo probability for transmission through the crystal without any interaction The user must specify a list of reciprocal lattice vectors T to consider along with their structure factors F The user must also specify the coordinates in direct space of the unit cell axes a b and c from which the reciprocal lattice will be computed See section 8 4 5 for file format specifications In addition to coherent scattering Single_crystal also handles incoherent scattering and absorption The incoherent scattering cross section is supplied by the user as a constant Cinc The absorption cross section is supplied by the user at 2200 m s so the actual F 3 2200 m s cross section for a neutron of velocity v is Cabs 022007 8 4 1 The physical model The textbook expression for the scattering cross section of a crystal is 44 ch 3 Oo T 3 S vo 2 6 7 k F 8 18 82 Ris R 1538 rev ed EN Figure 8 4 Ewald sphere construction for a single neutron showing the Gaussian broad ening of reciprocal lattice points in their local coordinate system Here F is the structure factor defined in section 8 3 N is the number of unit cells Vo is the volume of an individual unit cell and k k is the scattering vector is a 3 dimensional delta function in reciprocal space so for given
79. az 6 675 0 16 2 75 302 91 2740 Gd laz 29 3 151 49700 1585 2680 Ge laz 8 42 0 18 2 2 1211 4 5400 H20_ice_lh laz 7 75 160 52 0 6652 273 Hg laz 20 24 6 6 372 3 234 32 1407 I2 laz 7 0 0 62 12 3 386 85 In laz 2 08 0 54 193 8 429 75 1215 K laz 69 0 27 2 1 336 53 2000 LiF laz 4 46 0 921 70 51 1140 Li laz 0 454 0 92 70 5 453 69 6000 Nb laz 8 57 0 0024 1 15 2750 3480 Ni laz 13 3 5 2 4 49 1728 4970 Pb laz 11 115 0 003 0 171 600 61 1260 Pd laz 4 39 0 093 6 9 1828 05 3070 Pt laz 11 58 0 13 10 3 2041 4 2680 Rb laz 6 32 0 5 0 38 312 46 1300 Se_alpha laz 7 98 0 32 11 7 494 3350 Se_beta laz 7 98 0 32 11 7 494 3350 Si laz 2 163 0 004 0 171 1687 2200 SiO2_quartza laz 10 625 0 0056 0 1714 846 lau SiO2_quartzb laz 10 625 0 0056 0 1714 1140 lau Sn_alpha laz 4 871 0 022 0 626 505 08 Sn_beta laz 4 871 0 022 0 626 505 08 2500 Ti laz 1 485 2 87 6 09 1941 4140 Tl laz 9 678 0 21 3 43 577 818 V laz 0184 4 935 5 08 2183 4560 Zn laz 4 054 0 077 1 11 692 68 3700 Zr laz 6 44 0 02 0 185 2128 3800 Table 1 2 Powders of the McStas library 7 8 Low c and high cabs materials are high lighted Files are given in LAZY format but may exist as well in Crystallographica lau format as well Riso R 1538 rev ed EN 13 MCSTAS data Ocoh Cine Cabs Tm c Note File name barns barns barns K m s Cs_lig_tot sqw 3 69 0 21 29 0 301 6 1090 Measured Ge_liq_coh sqw and Ge_liq_inc sqw 8 42 0 18 2 2 1211
80. cell Then we come to the formal equivalence in the powder case 44 integration over Debye Scherrer cones Scoh q Tp zla F in a powder 8 65 ea 8 65 for each lattice Bragg peak wave vector g The normalisation rule Eq 8 52 can not usually be applied for powders as the S q is a set of Dirac peaks for which the f q 5 q dq is difficult to compute and q does not converge to unity for large q Each F Dirac contribution may be broaden when specifiying a diffraction peak width Of course the component PowderN see section 8 3 can handle powder samples efficiently faster better accuracy but does not take into account multiple scattering nor secondary extinction which is significant for materials with large absorption cross sections On the other side the current Isotropic Sqw component assumes a powder packing factor of 1 massive sample To change into a lower packing factor use a lower powder density 102 Riso R 1538 rev ed EN Important remarks and limitations Since the choice of the interaction type we know that the neutron must scatter with an appropriate kr outgoing wave vector If any of the choices in the method fails 1 the two roots kf and kr are imaginary which means that conservation laws can not be satisfied and for instance the selected energy transfer is higher than the incoming neutron energy 2 the radius of the target circle is imaginary that is cos 0 gt 1 then a new q w
81. ci vans 6 13 6 13 where r is the distance from the rotation axis We ignore the variation of r along the neutron path and use just the average value 6 5 Selector another approach to describe a rotating ve locity selector Name Selector Author System Input parameters zrmin emax ymin ymax len num width radius a feq Optional parameters Notes validated position is center of input aperture The component Selector describes the same kind of rotating velocity selector as V_selector compare description there but it uses different parameters and a different algorithm The position of the apertures relative to the z axis usually the beam centre is defined by the four parameters rmin rcmaz ymin ymax Entry and exit apertures are always identical and situated directly before and behind the rotor There are num blades of thickness width twisted by the angle a in degrees on a length len The selector rotates with a speed feq in rotation per second its axle is in a distance radius below the z axis First the neutron is propagated to the entrance window The loss of neutrons hitting the thin side of the blades is taken into account by multiplying the neutron weight by a factor Riso R 1538 rev ed EN 63 p r 0ilr 8o 6 14 bo 360 num 6 15 6 is the opening between two blades for the distance r between the neutron position at the entrance and the selector axle The differenc
82. complex However as illustrated in Figure A 1 the typical setup has many geometrical constraints R 0 7 P 7 P and amp x 7 x k 7 which simplifies the problem In 53 the calculation for a centrosymmetric ferromagnetic crystal is done and inserting the constraints above one finds 53 Eq 10 96 and Eq 10 110 132 Riso R 1538 rev ed EN da dQ P do dQ Fy K 2Fy 48 Fru e P Fru ee A 28 P Fy k Fur 12 Fr e 207 P Ev 1 A 29 NB Note that in 54 Eq 2 2 25 there is a minus in front of the second term in Eq A 28 We have not been able to understand this discrepancy which is probably due to notation Most other authors agree with the minus in front of the second term e g Squires and Francis Tasset For a beam which is initially unpolarized we find the outgoing polarization to be n2F Ny K Fy K A 2F ny Kh Fy kK dod Farley P A 30 so that the beam is fully polarized along 7 if Fy K F i k What we use to characterize the polarizing monochromator in practice is not Fy and Fyy but instead the reflection probabilities R and R for the reflection of interest If we assume that the reflection probabilities are directly proportional to the cross sections with proportionality constant k i e Ry kdo dQ P 7 and Ry kdo dQ P 7 then we can use Eq A 28 to determine Fy K and Fyy K Ry k Fn Fu K A 31 R
83. components are available for new facilities in a number of con tributed components e SNS contrib SNS_source e ISIS contrib ISIS_moderator see section 3 6 e ESS project ESS_moderator_long and ESS_moderator_short When no analytical model e g a Maxwellian distribution exits one may have access to measurements estimated flux distributions event files and better to MCNP Triploli4 neutron event records The following components are then useful e misc Virtual_input can read a McStas event file in text or binary format often bringing an order of magnitude speed up See section 10 2 e contrib Virtual_tripoli4_input does the same but from event files text format obtained from the Tripoli 37 reactor simulation program Such files are usually huge e contrib Virtual_mcnp_input can read MCNP PTRAC event files text format obtained from the MCNP 38 reactor simulation program Such files are usually huge e misc Vitess_input can read Vitess 39 neutron event binary files e optics Filter_gen reads a 1D distribution from a file and may either modify or set the flux according to it See section 4 4 Riso R 1538 rev ed EN 37 Chapter 4 Beam optical components Arms slits collimators and filters This chapter contains a number of optical components that is used to modify the neutron beam in various ways as well as the generic component Arm 4 1 Arm The generic component Name
84. ction The polarization in the final state is do zE TE P S eplin Ria Rya P Aal v saa lAa Aal lB Puda 1 dQ iara 12 A 27 Ris R 1538 rev ed EN 131 Comparing Eq A 26 and Eq A 27 we find that 1 The nuclear coherent polarization is the same as the initial polarization 2 The same is true for the incoherent scattering due to the random isotope distribution 3 The nuclear incoherent scattering due to the random nuclear spin orientations has polarization P 1 3P for a random nuclear spin the associated Pauli matrix will 2 3 of the time point in the direction of 6 and y which according to Eq A 17 flips the spin For Vanadium where there is only one isotope and coherent scattering is negligible we find P 1 3P There is however one catch If the probability for multiple scattering is large one has to take into account that after two scattering one has P 2 1 9P and so forth The average polarization after a thick vanadium target is therefore a sum of different contributions A 3 2 Example Polarizing Monochromator and Guides Figure A 1 Principle and geometry of a polarizing monochromator In a polarized monochromator and polarizing guides we have a ferromagnetic crystal in an external magnetic field The scattering potential is now both nuclear no internal direction and magnetic internal direction so in general the outgoing polarization can be quite
85. ctions Except for a few materials with absorption resonances in the cold thermal energy range the absorption cross section for an incoming neutron of velocity v 2E m where m is 3 2200 the neutron mass is computed as Gaps Ei 07700 var where 7200 the literature 8 We now determine the total cross section accounting for both scattering and absorption is obtained from Otot Ei Cabs Ei os Ei 8 56 The neutron trajectory intersection with the sample geometry provides the total path length in the sample derit to the exit Defining the linear attenuation u E Ptol Ei the probability that the neutron event is transmitted along path derit is eH Bi dexit If the neutron event is transmitted it leaves the sample In previous Monte Carlo codes such as DISCUSS 48 MSC 47 and MSCAT 49 each neutron event is forced to scatter to the detector area in order to improve the sample scattering simulation statistics and reduce the computing time The corresponding instrument model is limited to a neutron event source a sample and a detector It is equaly possible in the current implementation to force neutron events to scatter by applying a correction factor mo 1 e H Filderit to the neutron statistical weight However the McStas instrument model is often build from a large sequence of components Eventhough the instrument description starts as well with a neutron event source more than one sample may be encountere
86. ctivate monitor and make it a single OD monitor detecting integrated flux and counts The verbose option will display the nature of the monitor and the names of the generated files The 2D output When you ask the Monitor_nD to monitor only two variables e g options x y a single 2D file of intensity versus these two correlated variables will be created The 1D output The Monitor_nD can produce a set of 1D files one for each monitored variable when using 1 or more than 2 variables or when specifying the multiple keyword option The List output The Monitor_nD can additionally produce a list of variable values for neutrons that pass into the monitor This feature is additive to the 1D or 2D output By default only 1000 events will be recorded in the file but you can specify for instance list 3000 neutrons or list all neutrons This last option might require a lot of memory and generate huge files Riso R 1538 rev ed EN 115 9 8 5 Monitor equivalences In the following table 9 1 we show how the Monitor_nD may substitute any other McStas monitor 9 8 6 Usage examples e COMPONENT MyMonitor Monitor_nD xmin 0 1 xmax 0 1 ymin 0 1 ymax 0 1 options energy auto limits will monitor the neutron energy in a single 1D file a kind of E_monitor e options banana theta limits 10 130 bins 120 y bins 30 is a theta height banana detector e options banana theta limits 10 130
87. d The length of the collimator blades is denoted L while the distance between blades is called d The collimating effect is taken care of by employing an approximately triangular trans mission through the collimator of width FWHM which is given in arc minutes t e 60 is one degree If 6 0 the collimating effect is disabled so that the component only consists of two rectangular apertures For a more detailed Soller collimator simulation taking every blade into account it is possible to use Channeled_guide with absorbing walls see section 5 3 y A A Ymax i aean M i z p Ymin cee vey ee i L 1 i 1 L t 1 x gt Tmin Tmax d Figure 4 1 The geometry of a simple Soller blade collimators The real Soller collimator seen from the top left and a sketch of the component Soller right The symbols are defined in the text 4 5 1 Collimator transmission The horizontal divergence a is defined as the angle between the neutron path and the vertical y z plane along the collimator axis We then define the collimation angle as the maximal allowed horizontal divergence 6 tan d L see Fig 4 1 Neutrons Riso R 1538 rev ed EN 41 Radial collimator eee IAA uuni yim oo Figure 4 2 A radial collimator with a horizontal divergence ang
88. d e g when the initial energy and direction of the neutron ray is decided at the source it is important to adjust the neutron weight so that the combined effect of neutron weight change and Monte Carlo probability of making this particular choice equals the actual physical properties we like to model Let us follow up on the simple example of transmission The probability of transmitting the real neutron is P but we make the Monte Carlo choice of transmitting the neutron ray each time fmc 1 This must be reflected on the choice of weight multiplier 7 given by the master equation fuct P 2 9 This probability rule is general and holds also if e g it is decided to transmit only half of the rays fmc 0 5 An important different example is elastic scattering from a powder sample where the Monte Carlo choices are the particular powder line to scatter from the scattering position within the sample and the final neutron direction within the Debye Scherrer cone 2 3 1 Direction focusing An important application of weight transformation is direction focusing Assume that the sample scatters the neutron rays in many directions In general only neutron rays in some of these directions will stand any chance of being detected These directions we call the interesting directions The idea in focusing is to avoid wasting computation time on neutrons scattered in the other directions This trick is an instance of what in Monte Carlo terminology i
89. d within each component during the simulation Simulation by weight adjustment is performed whenever possible This includes e Transmission through filters and windows e Transmission through Soller blade collimators and velocity selectors in the approx imation which does not take each blade into account e Reflection from monochromator and analyser crystals with finite reflectivity and mosaicity e Reflection from guide walls e Passage of a continuous beam through a chopper e Scattering from all types of samples 2 2 1 Statistical errors of non integer counts In a typical simulation the result will consist of a count of neutrons histories rays with different weights The sum of these weights is an estimate of the mean number of neutrons hitting the monitor or detector per second in a real experiment One may write the counting result as where N is the number of rays hitting the detector and the vertical bar denote averaging By performing the weight transformations the statistical mean value of I is unchanged However N will in general be enhanced and this will improve the accuracy of the simu lation To give an estimate of the statistical error we proceed as follows Let us first for simplicity assume that all the counted neutron weights are almost equal p p and that we observe a large number of neutrons N gt 10 Then N almost follows a normal distribution with the uncertainty o N VN Henc
90. d in the course of the neutron propagation and multiple detectors may be positioned anywhere in space as well as other instrument components e g neutron optics This implies that neutron events Riso R 1538 rev ed EN 99 scattered from a sample volume should not focus to a single area Indeed transmitted events may reach other scattering materials and it is not desirable to force all neutron events to scatter The correction factor 7 is then not applied and neutron events can be transmitted through the sample volume The simulation efficiency for the scattering then drops significantly but enables to model much more complex arrangements such as concentric sample environments magnets and monochromator mechanical parts and neutron filters If the neutron is not transmitted the neutron statistical weight is multiplied by a factor pra E 8 57 tot Ei to account for the fraction of absorbed neutrons along the path and we may in the follow ing treat the event as a scattering event Additionally the type of interaction coherent or incoherent is chosen randomly with fractions Ccon Ei and Cinel Ei The position of the neutron scattering event along the neutron trajectory length dexit is determined by 27 48 ds In 1 1 e7 Ei dezit 8 58 where is a random number in 0 1 This expression takes into account secondary ex tinction originating from the decrease of the beam intensity through the sample self shie
91. e Royal Veterinary and Agricultural University DK K Lefmann Ris Isotropic_Sqw isotropic inelastic sample powder liquid glass elastic inelastic scattering from S q w data E Farhi V Hugouvieux ILL SANS_ A collection of samples for SANS H Frielinghaus FZ Jiilich We would like to kindly thank all McStas component contributors This is the way we improve the software alltogether The McStas project has been supported by the European Union initially through the XENNI program and the RTD Cool Neutrons program in FP4 In FP5 McStas was supported strongly through the SCANS program Currently in FP6 McStas is sup ported through the Joint Research Activity MCNSI under the Integrated Infrastructure Initiative NMI3 see the WWW home pages 5 6 If you appreciate this software please subscribe to the neutron mc risoe dk email list send us a smiley message and contribute to the package We also encourage you to refer to this software when publishing results with the following citations e K Lefmann and K Nielsen Neutron News 10 3 20 1999 e P Willendrup E Farhi and K Lefmann Physica B 350 735 2004 Riso R 1538 rev ed EN 9 Chapter 1 About the component library This McStas Component Manual consists of the following major parts e An introduction to the use of Monte Carlo methods in McStas e A thorough description of system components with one chapter per major categ
92. e comp Note that comp is not given as a string A component of the vector is referred to as POS_A_COMP comp i where i is x y or z ROT_A_COMP comp and ROT R COMP comp give the orientation of the component comp as rotation matrices absolute orientation and the orientation rela tive to its previous component respectively Note that comp is not given as a string Riso R 1538 rev ed EN A component of a rotation matrice is referred to as ROT_A COMP comp m n where m and n are 0 1 or 2 e INDEX_CURRENT_COMP is the number index of the current component starting from 1 e POS_A COMP_INDEX index is the absolute position of component index POS A COMP INDEX INDEX_CURRENT_COMP is the same as POS_A_CURRENT_COMP You may use POS_A_COMP_INDEX INDEX_CURRENT_COMP 1 to make for instance your component access the position of the next component this is usefull for automatic targeting A component of the vector is referred to as POS_A COMP_INDEX index i where i is x y or z e POS_R_COMP_INDEX works the same as above but with relative coordinates e STORE NEUTRON indez x y Zz vx vy vz t S SY SZ p stores the current neu tron state in the trace history table in local coordinate system index is usually IN DEX_CURRENT_COMP This is automatically done when entering each component of an instrument e RESTORE NEUTRON indez x y z V vy VZ t sx sy 852Z p restores the neu tron state to the one a
93. e the statistical uncertainty of the observed intensity becomes o I VNp I VN 2 4 as is used in real neutron experiments where p 1 For a better approximation we return to Eq 2 3 Allowing variations in both N and p we calculate the variance of the resulting intensity assuming that the two variables are independent o I 07 N p N 0 p 2 5 Assuming as before that N follows a normal distribution we reach o N p Np Further assuming that the individual weights p follow a Gaussian distribution which in some cases is far from the truth we have N o p o X2 pi No p and reach o I N P o pi 2 6 This is not correct in a situation where the detector counts a large fraction of the neutrons in the simulation but we will neglect that for now 18 Riso R 1538 rev ed EN The statistical variance of the p s is estimated by o p D gt p Np N 1 The resulting variance then reads N Qe 7 D9 o o n De F 2 7 For almost any positive value of N this is very well approximated by the simple expression o7 1 amp Ss p2 2 8 As a consistency check we note that for all p equal this reduces to eq 2 4 In order to compute the intensities and uncertainties the detector components in McStas will keep track of N X p I 0 pl and Mo o p 2 3 Weight factor transformations during a Monte Carlo choice When a Monte Carlo choice must be performe
94. e a local coordinate system for each reciprocal lattice point T and use for vectors written in local coordinates The origin is 7 the first axis is parallel to 7 and the other two axes are perpendicular to 7 In the local coordinate system the 3 dimensional Gaussian is given by 2 2 2 1 1 3 3 5 G x1 2 3 Phot o3 03 8 19 SSS eE v 2T 010203 The axes of the Gaussian are 0 TAd d and o2 o3 nT Here we used the assumption that 7 is small so that tann 7 with 7 given in radians By introducing the diagonal matrix 507 0 0 D 0 408 0 2 0 0 993 equation 8 19 can be written as 1 1 G x g TEDE 8 20 v 2T 010203 again with x x1 2 x3 written in local coordinates To get an expression in the coordinates of the reciprocal lattice of the crystal we introduce a matrix U such that if y y1 y2 y3 are the global coordinates of a point in the crystal reciprocal lattice then U y 7 are the coordinates in the local coordinate system for T The matrix U is given by UT 1 2 Gs where 1 tg and ig are the axes of the local coordinate system written in the global coordinates of the reciprocal lattice Thus ti T T and z and z are unit vectors perpendicular to 1 and to each other The matrix U is unitarian that is U UT The translation between global and local coordinates is x U y 7T y UTxr rT 84 Ris R 1538 rev ed EN The expression for the 3 dimensional Gaussian in
95. e beam is uniform over the specified energy range Eo AE in meV or alternatively the wavelength range Ao 6A in The source divergences are 6 and 6 FWHM in degrees If the gauss flag is set to 0 default the divergence distribution is uniform otherwise it is Gaussian This component may be used as a simple model of the beam profile at the end of a guide or at the sample position 24 Riso R 1538 rev ed EN 3 3 Source Maxwell 3 A continuous source with a Maxwellian spectrum Name Source_Maxwell_3 Author System Input parameters h w dtoc cw Yh Mow Ahighs J1 Th Optional parameters I2 To I3 T3 Notes Validated t 0 This component is a source with a Maxwellian energy wavelength distribution sampled in the range Ajow tO Anigh The initial neutron ray position is chosen randomly from within a rectangle of area h x w in the z 0 plane The initial neutron ray direction is focused within a solid angle defined by a rectangular target of width xw height yh parallel to the xy plane placed at 0 0 dfo The energy distribution used is a sum of 1 2 or 3 Maxwellians with temperatures T to T3 and integrated intensities I to Is For one single Maxwellian the intensity in a small wavelength interval A X dA is I M 7T dX where M A T1 2a exp a A X is the normalized Maxwell distribu tion a 949 0 K A T The initial weight of the created neutron ray po is calculated
96. e between 4 and 0 is determined by the blade thickness The neutron is now propagated to the exit window If it is outside the regarded channel between the two actual blades it is lost otherwise it remains in the exit plane WARNING Differences between Selector and V_selector e Selector has a different coordinate system than V_selector in Selector the origin lies in the entrance plane of the selector e The blades are twisted to the other side i e to the left above the axle in Selector e Speed of rotation is given in rotation per second not in rotations per minute as in V_selector 64 Riso R 1538 rev ed EN Chapter 7 Monochromators In this class of components we are concerned with elastic Bragg scattering from monochro mators Monochromator_flat models a flat thin mosaic crystal with a single scattering vector perpendicular to the surface The component Monochromator_curved is physi cally similar but models a singly or doubly bend monochromator crystal arrangement A much more general model of scattering from a single crystal is found in the component Single_crystal which is presented under Samples chapter 8 7 1 Monochromator_flat An infinitely thin flat mosaic crys tal with a single scattering vector Name Monochromator_flat Author System Input parameters Zmin max Ymin Ymax Mh lv Ro Qo Optional parameters dm Notes In reflecting geometry non polarized This component
97. e channels but it also reduces the transmission because the cylinder removes neutrons in front of the channel entrance or behind the channel exit see figure 6 6 A s rotation axis Figure 6 6 geometry of a staight Fermi chopper Geometry for parabolic channels In this case the Fermi chopper is supposed to be a full cylinder i e the central channels are longer than those on the edges The other features are the same as for the other options see figure 6 7 The algorithm works with a rotating chopper framework Neutrons hitting the channel walls are absorbed The channels are approximated by Neates gates If the trajectory takes a course through all the gates the neutron passes the Fermi chopper There are gates at the entrance and the exit of the channel The other gates are situated close to the centre of the Fermic chopper Precision of the simulation increases with the number of gates but also the computing time needed The use of four channels already gives exact transmission shapes for lower wavelengths A lt 6 A and good approximation for higher ones It is recommended to use larger number of channels only for a check 60 Riso R 1538 rev ed EN Figure 6 7 geometry of a curved Fermi chopper The option zerotime may be used to reset the time at the chopper position The time is set to a value between Tp 2 and Tp 2 with Tp being the maximal pulse length depending on the phase of the chopper at the m
98. e of that row Table_Free amp Table free allocated memory for table Additionally if the block number 3rd argument of Table Read is 0 all blocks will be catenated The Table_Value function assumes that the x axis is the first column index 0 Other functions are used the same way with a few additional parameters e g specifying an offset for reading files or reading binary data This other example for text files shows how to read many data blocks t_Table Table declare a t_Table structure array long n double y Table Table_Read_Array file dat amp n initialize and read the all numerical n Table_Info_Array Table display informations for all blocks also retu y Table_Index Table 0 2 5 read in 1st block the 3rd row 6th column elem ONLY use Table i with i lt n Table_Free_Array Table free allocated memory for Table You may look into for instance the source files for Monochromator_curved or Vir tual_input for other implementation examples B 3 Monitor nD Library This library gathers a few functions used by a set of monitors e g Monitor_nD Res_monitor Virtual_output etc It may monitor any kind of data create the data files and may dis play many geometries for mcdisplay Refer to these components for implementation examples and ask the authors for more details 144 Riso R 1538 rev ed EN B 4 Adaptive importance sampling Library This library is currently only
99. e reader of this document is not supposed to have specific knowledge of neutron scattering but some basic understanding of physics is helpful in understanding the theoretical background for the component functionality For details about setting up and running simulations we refer to the McStas system manual 2 We assume familiarity with the use of the C programming language It is a pleasure to thank Dir Kurt N Clausen PSI for his continuous support to Mc Stas and for having initiated the project Continuous support to McStas has also come from Prof Robert McGreevy ISIS Apart from the authors of this manual also Per Olof Astrand NTNU Trondheim has contributed to the development of the McStas system We have further benefited from discussions with many other people in the neutron scat tering community too numerous to mention here The users who contributed components to this manual are acknowledged as authors of the individual components We encourage other users to contribute components with manual entries for inclusion in future versions of McStas In case of errors questions or suggestions do not hesitate to contact the authors at mcstas risoe dk or consult the McStas home page 3 A special bug request reporting service is available 4 Important developments on the component side in McStas version 1 12 as compared to version 1 4 the last version of the component manual then a section of the system manual include e Validat
100. e right sampling weights neutrons may be emitted with high neutron weights but low probability These low probability neutrons may account for a large fraction of the total intensity in detectors causing large variances in the result To avoid this the component emits early neutrons with a lower weight and later neutrons Ris R 1538 rev ed EN 31 with a higher weight to compensate This way the neutrons that are emitted with the best adaption contribute the most to the result The factor with which the neutron weights are adjusted is given by a logistic curve Yo F j C 0 yo 1 yo e e4 where j is the index of the particular neutron history 1 lt j lt Nhiste The constants yo ro and C are given by 3 10 2 Y 3 11 0 Nex 3 11 1 ol 1 in r lo 3 12 a Nhist Yo 1 C 1 log w Darha 3 13 Nhist The number a is given by the user and specifies as a fraction between zero and one the point at which the adaption is considered good The initial fraction a of neutron histories are emitted with low weight the rest are emitted with high weight N in goah Nsim NpinWi The choice of the constants yo ro and C ensure that Nhist i FG 1 3 15 0 po j F j 3 14 so that the total intensity over the whole simulation will be correct Similarly the adjustment of sampling weights is modified so that the actual formula used is B Yo Wi Ni wili N 1 Je roj B
101. e spin along the defined vector m see Pol monitor as a function of the wavelength A e MeanPolLambda_monitor Measures the average projection of the spin along the defined vector m see Pol_monitor as a function of the wavelength A NB currently the error on the mean is shown a N but it might make more sense to show the spread o A 4 3 Magnetic fields Much inspiration for the components and the tests have been found in 55 e Pol_constBfield A rectangular box with a constant magnetic field in the y direction The x and z components of the spin precess with the Larmor frequency wy It is possible to define the field in terms of a wavelength so that the spin will precess 180 degrees for the given wavelength The component can be rotated to have the field along another axis e Pol_simpleBfield The first attempt at a component for handling general magnetic fields It is a concentric component where you define a start and stop component for each field but this allows other components e g monitors to be put inside the field The component overloads the propagation routines so that numerical spin propagation is done for analytical magnetic fields Riso R 1538 rev ed EN 135 NB At the moment both components does not really check the boundaries of the field on the sides but merely assumes that the field starts at the entrance plane and stops at the exit plane Also some optimization remains for the numerical component
102. eak Bara ead aE es eee 5 3 2 Known problems 0 0 0 000 ee ee 5 4 Guide_gravity A guide with multiple channels and gravitation handling 5 5 Bender a bender model non polarizing lt oe oo 5 6 Curved guides s 2 2 ssf a ale ee eee ee ee ee a eS Moving optical components Choppers and velocity selectors 6 1 DiskChopper The disc chopper 0 00000 ee eee 6 2 FermiChopper The Fermi chopper 0000005 6 2 1 The chopper geometry and parameters 00 4 6 2 2 Propagation in the Fermi chopper 6 3 Vitess ChopperFermi The Fermi Chopper from Vitess 6 4 V_selector A rotating velocity selector 200000 6 4 1 Velocity selector transmission 0 0 00000 eee 6 5 Selector another approach to describe a rotating velocity selector 38 38 38 39 40 41 41 42 42 44 44 44 45 46 46 48 49 49 49 50 50 5l Ris R 1538 rev ed EN 7 Monochromators 65 7 1 Monochromator_flat An infinitely thin flat mosaic crystal with a single Scattering vector s cot ke A aoe ee dae Be Rie ee ee a ea 65 7 1 1 Monochromator physics and algorithm 65 7 2 Monochromator_curved A curved mosaic crystal with a single scattering MECUOL Ae sce gay a ae eh alae ete ve wide wR APIS ey ca cag hay oso St Ne a Oe al as 68 7 3 Single crystal Thick single crystal monochromator plate with multiple Scattenne 222 wi ae eine o a Nn ead EIE B
103. entric shape i e be used for describing sample environment cryostat sample container etc The description of the powder comes from a file in one of the standard output formats LAZY FULLPROF or CRYSTALLOGRAPHICA A usage example of this component can be found in the Neutron site Tutorial templateDIFF instrument from the mcgui 8 3 1 Files formats powder structures Data files of type lau and laz in the McStas distribution data directory are self documented in their header A list of common powder definition files is available in Table 1 2 page 13 They do not need any additional parameters to be used as in the example PowderN lt geometry parameters gt filename Al 1laz Other column based file formats may also be imported e g with parameters such as format Crystallographica format Fullprof format 1 2 3 4 0 0 0 0 In the latter case the indices define order of columns parameters multiplicity lattice spacing F Debye Waller factor and intrinsic line width The column signification may as well explicitely be set in the data file header using any of the lines column_j lt index of the multiplicity j column gt column_d lt index of the d spacing d column gt column_F2 lt index of the squared str factor F 2 column b gt column_F lt index of the structure factor norm F column gt column_DW lt index of the Debye Waller factor DW column gt column_Dd lt index of the relat
104. eport documents the components for McStas version 1 12 released May 2008 The authors are Peter Kj r Willendrup Materials Research Department Riso DTU Roskilde Denmark email peter willendrup risoe dk Erik Knudsen Materials Research Department Riso DTU Roskilde Denmark email erik knudsen risoe dk Kim Lefmann Niels Bohr Institute University of Copenhagen Denmark email lefmann fys ku dk Emmanuel Farhi Institut Laue Langevin Grenoble France email farhi ill fr ISBN 978 87 550 3680 2 ISSN 0106 2840 Information Service Department Riso DTU 2011 Contents Preface and acknowledgements 1 About the component library 1 1 1 2 1 3 1 4 1 5 1 6 Lee 1 8 Authorship e rae fhe a tk Gas See ek nae A ee hg cs RS Symbols for neutron scattering and simulation Component coordinate system sooo a Aboutidata Mlese 4 2 sooo ce see a ke Aye Ce ie eee a ho ee AA Component source code 2 2 ee Documentation 4 26 erie Bk Bee Re ee Pee PE eed Component validation aooaa ee Disclaimer bugs ems iaaa ae a Ge bis he la ee we ae ek Gah an 2 Monte Carlo Techniques and simulation strategy 2 1 2 2 2 3 2 4 2 5 Neutron spectrometer simulations o a s a e a e e ee 2 1 1 Monte Carlo ray tracing simulations The neutron weight aua ans toa dA e p sak ee 2 2 1 Statistical errors of non integer counts sooo Weight factor transformations during a Monte Carlo
105. ers may as well be specified in the data file header with lines e g sigma_abs lt value of Absorption cross section barns gt sigma_inc lt value of Incoherent cross section barns gt Delta_d d lt value of Detla_d d width for all lines gt lattice_a lt value of the a lattice parameter Angs gt lattice_a lt value of the b lattice parameter Angs gt lattice_a lt value of the c lattice parameter Angs gt lattice_aa lt value of the alpha lattice angle deg gt lattice_bb lt value of the beta lattice angle deg gt lattice_cc lt value of the gamma lattice angle deg gt Example data lau files are given in directory MCSTAS data These files contain an extensive self documented header defining most the sample param eters so that only the file name and mosaicity should be given to the component Single_crystal xwidth 0 01 yheight 0 01 zdepth 0 01 mosaic 5 reflections YBaCu0 lau Powder files from ICSD LAZY 7 and Fullprof 46 may also be used see Table 1 2 page 13 We do not recommend to use these as the equivalent vectors are superposed not all Bragg spots will be simulated and the intensity will not be scaled by the multiplicity for each spot Riso R 1538 rev ed EN 89 8 5 Sans spheres A sample of hard spheres for small angle scattering Name Sans_spheres Author System Lise Arleth Veterinary University of Denmark Input parameters R Tw Yh Zt T Fa Ap Raet d
106. es equivalent results 62 Risg R 1538 rev ed EN 6 4 1 Velocity selector transmission By rotating the selector you allow transmittance of neutrons rays with velocities around a nominal value given by Vo wL 6 11 which means that the selector has turned the twist angle during the typical neutron flight time L Vo The actual twist angle is 6 wt wL V Neutrons having a velocity slightly different from Vo will either be transmitted or absorbed depending on the exact position of the rotator blades when the neutron enters the selector Assuming this position to be unknown and integrating over all possible positions assuming zero thickness of blades we arrive at a transmission factor 6 12 Pi 1 N 2m wL V _ if N 2n wL V lt 1 0 otherwise where N is the number of collimator blades A horisontal divergence changes the above formula because of the angular difference be tween the entry and exit points of the neutron The resulting transmittance resembles the one above only with V replaced by V and replaced by Y where y is the angular difference due to the divergence An additional vertical divergence does not change this formula but it may contribute to w We have here ignored the very small non linearity of w along the neutron path in case of both vertical and horisontal divergence Adding the effect of a finite blade thickness t reduces the transmission by the overall factor
107. ese files for Monochromator_curved are HOPG r1lf and HOPG trm As for Monochromator_flat the crystal is assumed to be infinitely thin and the vari ation in lattice spacing Ad d is assumed to be zero Hence this component is not suitable for simulating backscattering instruments or to investigate multiple scattering effects The theory and algorithm for scattering from the individual blades is described under Monochromator_flat 68 Riso R 1538 rev ed EN Monochromator curved y m Figure 7 3 A curved monochromator 7 3 Single crystal Thick single crystal monochromator plate with multiple scattering The Single_crystal component may be used to study more complex monochromators including incoherent scattering thickness and multiple scattering Please refer to section 8 4 7 4 Phase space transformer moving monochromator Eventhough there exist a few attempts to write dedicated phase space transformer com ponents there is an elegant way to put a monochromator into move by mean of the EXTEND keyword If you define a SPEED parameter for the instrument the idea is to change the coordinate system before the monochromator and restore it afterwards as follow in the TRACE section DEFINE INSTRUMENT PST SPEED 200 axed TRACE Caan COMPONENT Mono_PST_on Arm ATS ons EXTEND vx vx SPEED monochromator moves transversaly by SPPED m s Riso R 1538 rev ed EN 69 hy COMPONENT Mono Monochromato
108. geometry radiusi m sphere geometry if radius i 0 thickness m thickness of hollow shape auto_qw boolean Automatically optimise probability tables during sim ulation auto_norm scalar Normalize S q w when 1 use raw data when 0 mul tiply S by given value when positive order integer Limit multiple scattering up to given order 0 means all orders concentric boolean Enables to enter inside concentric hollow geometries Table 8 2 Main Isotropic_Sqw component parameters Risd R 1538 rev ed EN e box dimensions are Zwidth X Yheight X Zdepth e box hollow idem and the side wall thickness is set with thickness e cylinder dimensions are r for the radius and Yheignt for the height e cylinder hollow idem and hollow part is set with thickness e sphere dimension is r for the radius e sphere hollow idem and hollow part is set with thickness The AT position corresponds to the centre of the sample Hollow shapes are particularly useful to model complex sample environments Refer to the dedicated section below for more details on this topic Dynamical structure factor The material behaviour is specified through the total scattering cross sections Ocoh Cinc Cabs and the S q w data files If you are lucky enough to have access to separated coherent and incoherent contributions e g from material simulation simply set Sqw coh and Sqw inc parameter to the files names If on the other hand you h
109. given in units of us The output parameters from TOF_monitor are the three count numbers N I and M for the total counts in the monitor In addition a file filename is produced with a list of the same three data divided in different TOF bins This file can be read and plotted by the mcplot tool see the System Manual 9 2 TOF2E_monitor A time of flight monitor with simple energy analysis Name E_monitor Author System Input parameters Tmin Tmax Ymin Ymax Nchan Emin Emax to Laight filename Optional parameters Notes Not validated The component TOF2E_monitor resembles TOF monitor to a very large extent Only this monitor converts the neutron flight time to energy as would be done in an experi ment The apparent neutron energy Eapp is calculated from the apparent velocity given by Leight Vapp t aie 9 1 where the time offset to defaults to zero Epp is binned in nchan bins between Emin and Emax in meV The output parameters from TOF2E_monitor are the total counts and a file with 1 dimensional data vs Eapp similar to TOF_monitor 110 Riso R 1538 rev ed EN 9 3 E monitor The energy sensitive monitor Name E_monitor Author System Input parameters Tmin Tmax Ymin Ymax Nchan Emin Emax filename Optional parameters Notes The component E_monitor resembles TOF_monitor to a very large extent Only this monitor is sensitive to the neutron
110. h length within the sample after the scattering is denoted by l2 see figure 8 1 We then define the inverse penetration lengths as u 08 V and u o V where Ve is the volume of a unit cell Physically the attenuation along this path follows far l exp l 1 8 3 where the normalization fats 0 1 The probability for a given neutron ray to be scattered from within the interval l1 l1 dl will be P l dl u fate ls dl 8 4 72 Ris R 1538 rev ed EN Figure 8 1 The geometry of a scattering event within a powder sample while the probability for a neutron to be scattered from within this interval into the solid angle 2 and not being scattered further or absorbed on the way out of the sample is P 1y Q dldQ p fare La fart lo y QdNdl 8 5 where 7 Q2 is the directional distribution of the scattered neutrons and l2 is determined by Monte Carlo chocies of l1 Q and from the sample geometry see e g figure 8 1 In our Monte Carlo simulations we may choose the scattering parameters by making a Monte Carlo choice of l and Q from a distribution different from P l Q By doing this we must adjust 7 according to the probability transformation rule 2 9 If we e g choose the scattering depth l from a flat distribution in 0 lay and choose the directional dependence from g Q2 we have a Monte Carlo probability F a 2 g Q lean 8 6 lea is here the path length through the sample
111. hannels nchan each of them being a single linear collimator covering the angular interval min maz angle with respect to the z axis If the divergence parameter is defined the approximation level is used as in Collima tor_linear see section 4 5 On the other hand if you perfer to describe exactly the number of blades nblades assembled to build a single collimator channel then the model is exact and traces the neutron trajectory inside each Soller The computing efficiency is then lowered by a factor 2 The component can be made oscillating with an amplitude of roc times w1 which su presses the channels shadow As an alternative you may use the Exact_radial_coll contributed component For a rect angular shaped collimator instead of cylindrical radial you may use the Guide_channeled and the Guide_gravity components Riso R 1538 rev ed EN 43 Chapter 5 Reflecting optical components mirrors and guides This section describes advanced neutron optical components such as supermirrors and guides as well as various rotating choppers A description of the reflectivity of a super mirror is found in section 5 1 This section describes advanced neutron optical components such as supermirrors and guides A description of the reflectivity of a supermirror is found in section 5 1 5 1 Mirror The single mirror Name Mirror Author System Input parameters l h m Optional parameters Ro Qc W a reflect
112. he input parameters of Slit are the four coordinates min Tmax Ymin Ymax defining the opening of the rectangle or the radius r of a circular opening depending on which parameters are specified The slit component can also be used to discard insignificant i e very low weight neutron rays that in some simulations may be very abundant and therefore time consuming If the optional parameter Peut is set all neutron rays with p lt Peut are ABSORB ed This use is recommended in connection with Virtual_output 4 3 Beamstop A neutron absorbing area Name Beamstop Author System Input parameters mim Linas Uiiine Umax Optional parameters r Notes The component Beamstop can be seen as the reverse of the Slit component It sets up an area at the z 0 plane and propagates the neutrons onto this plane by the kernel call PROP_ZO Neutrons within this area are ABSORB ed while all other neutrons are unaffected By using this component some neutrons contributing to the background in a real exper iment will be neglected These are the ones that scatter off the side of the beamstop or penetrates the absorbing material Further the holder of the beamstop is not simulated Beamstop can be either circular or rectangular The input parameters of Beamstop are the four coordinates Lmin max Ymin Ymax defining the opening of a rectangle or the radius r of a circle depending on which parameters are specified
113. her no polarization effects are yet taken into account in any of the samples 8 1 V_ sample An incoherent scatterer the V sample Name V_sample Author System Input parameters ri To h Tfoc Ttarget Ytarget Ztarget Optional parameters Wr hy tz Wfocus Mfocus Wfoc angle gt hfoc angle Tabs Cinc Vo pack target_index Notes validated A sample with incoherent scattering e g vanadium is frequently used for calibration purposes as this gives an isotropic elastically scattered beam The component V_sample has only absorption and incoherent elastic scattering For the sample geometry we default use a hollow cylinder which has the solid cylinder as a limiting case The sample dimensions are Inner radius rj outer radius ro and height h see figure 8 2 Alternatively the sample geometry can be made rectangular by specifying the width wz the height hy and the thickness tz The incoherent and absorption cross sections for V are default for the component For other choices the parameters Cinc Cabs and the unit cell volume Vo should be specified For a loosely packed sample also the packing factor fpack can be specified default value 74 Riso R 1538 rev ed EN of 1 8 1 1 Physics and algorithm The incoherent scattering gives a uniform angular distribution of the scattered neutrons from each nucleus y Q 1 47 For the focusing we choose to have a uniform distribu tion on a target
114. hopper cylinder and their coordinates are transformed into the rotating frame using T Neutrons outside the slit channel chopper Riso R 1538 rev ed EN 57 Figure 6 5 The different steps in the algorithm left A neutron trajectory in a slit right opening or hitting the top and bottom caps are absorbed yellow dots in Fig 6 3 The side from which the neutron approaches the chopper is known positive or negative z axis of the rotating frame so that the calculation of the time of interaction with the slit package entrance t is performed solving z fength in Eq 6 2 Using the result of the numerical algorithms the neutron propagates to the entrance of the slit package orange circles in Fig 6 3 Neutrons getting aside the slit package entrance are absorbed Additionally the slit package exit time tg is estimated the same way with z length in order to evaluate the whole time of flight in the chopper The index of the slit which was hit is also computed as we know the z coordinate in the rotating frame at the slit entrance Differentiating Eq 6 2 for x coordinate T t v t vg w z vz t cos w t to vz w vz t sin w t to 6 4 we may estimate the tangents to the spiral neutron trajectory in the rotating frame at times t and tg The intersection of these two lines gives an intermediate time t3 If the neutron remains
115. hort explanation of phrases and terms which have a specific meaning within McStas We have tried to keep the list as short as possible with the risk that the reader may occasionally miss an explanation In this case you are more than welcome to contact the McStas core team 146 Arm A generic McStas component which defines a frame of reference for other components Component One unit e g optical element in a neutron spectrometer These are considered as Types of elements to be instantiated in an Instrument description Component Instance A named Component of a given Type inserted in an In strument description Definition parameter An input parameter for a component For example the radius of a sample component or the divergence of a collimator Input parameter For a component either a definition parameter or a setting parameter These parameters are supplied by the user to define the characteristics of the particular instance of the component definition For an instrument a parameter that can be changed at simulation run time Instrument An assembly of McStas components defining a neutron spectrometer Kernel The McStas language definition and the associated compiler McStas Monte Carlo Simulation of Triple Axis Spectrometers the name of this package Pronounciation ranges from mez tas to mac stas and m c stas Output parameter An output parameter for a component For example the counts in a monitor An output parameter may be
116. ices are ignored The file header may optionally contain parameter settings for the material as comments with keywords as in the following example Riso R 1538 rev ed EN 105 V_0O 35 cell volume Angs 3 V_rho 0 07 atom number density at Angs 3 sigma_abs 5 absorption cross section barns sigma_inc 4 8 incoherent cross section barns sigma_coh 1 coherent cross section barns Temperature 10 for detailed balance K density 1 material density g cm 3 weight 18 material molar weight g mol nb_atoms 6 number of atoms per unit cell Some sqw data files are included in the McStas distribution data directory and they contain material parameter settings in their header so that you may use Isotropic_Sqw lt geometry parameters gt Sqw_coh He4_liq_coh sqw T 4 Example files are listed as sqw files in directory MCSTAS data A table of S q w data files for a few liquids are listed in Table 1 3 page 14 File formats S q liquids This file format provides a mean to import directly an S q data set when setting param eters powder_format qSq The Sqw coh or Sqw inc file should contains a single numerical block which column assignment is defaulted as q and S q being the first and second column respectively This may be overridden from the file header with column keywords as in the example column_q 2 column_Sq 1 Such files can only handle elastic scattering File formats powder
117. ide system could be reused for several simulations of the instrument back end speeding up the simulations by typically one or two orders of magnitude The components for doing this trick is Virtual_input and Virtual_output which stores and reads neutron rays respectively Other components perform the simulation of the instrument resolution functions These are Res_sample and TOF_Res_sample which are to be placed at the sample position and Res_monitor that should be localized at the position of the instrument detector Progress_bar is a simulation utility that displays the simulation status but assumes the form of a component Riso R 1538 rev ed EN 121 10 1 Virtual output Saving the first part of a split simula tion Name Virtual_output Author System Input parameters filename Optional parameters _ buffer size type Notes The component Virtual_output stores the neutron ray parameters at the end of the first part of a split simulation The idea is to let the next part of the split simulation be performed by another instrument file which reads the stored neutron ray parameters by the component Virtual_input All neutron ray parameters are saved to the output file which is by default of text type but can also assume the binary formats float or double The storing of neutron rays continues until the specified number of simulations have been performed buffer size may be used to lim
118. in the same slit at this point then there is no intersection with the slit walls direct flight and the neutron may be propagated to the slit output and then to the cylinder output A last check is made for the neutron to pass the chopper aperture in the cylinder If the neutron changes of slit channel at this point we may determine the intersection time of the neutron trajectory within t1 t3 or t3 t2 as seen in Fig 6 5 If walls are not reflecting we just absorb neutrons here The reflections super mirror slits If slit walls are reflecting neutron is first propagated to the slit separating surface Then the velocity in the rotating frame is computed using Eq 6 2 Perpendicular velocity v is reverted for reflection and inverse T transformation is performed Reflected intensity is computed the same way as for the guide component see section 5 1 The remaining time tg to the slit output is estimated and the tangent intersection process is iterated until neutron exits Remember that super mirror m lt 1 parameters behave like m 1 materials see section 5 1 1 Selecting m 0 sets the blabes absorbing 58 Risd R 1538 rev ed EN The propagation is finalized when determining the intersection of the neutron trajectory with the outer surface of the chopper cylinder The neutron must then pass its aperture else it is absorbed Curved slit packages The effect of curvature can significantly improve the flux and energy reso
119. in to zero s 0 0 0 For time of flight sources the choice of the emission time t is being made on basis of detailed analytical expressions For other sources t is set to zero In the case one would like to use a steady state source with time of flight settings the emission time of each neutron ray should be determined using a Monte Carlo choice This may be achieved by the EXTEND keyword in the instrument description source as in the example below TRACE COMPONENT MySource Source_gen AT EXTEND ht t 1le 3 randpm1 set time to 1 ms Ay 3 0 1 Neutron flux The flux of the sources deserves special attention The total neutron intensity is defined as the sum of weights of all emitted neutron rays during one simulation the unit of total neutron weight is thus neutrons per second The flux 7 at an instrument is defined as intensity per area perpendicular to the beam direction The source flux is defined in different units the number of neutrons emitted per second from a 1 cm area on the source surface with direction within a 1 ster solid angle and with wavelength within a 1 A interval The total intensity of real neutrons emitted towards a given diaphragm units n sec is therefore for constant Ltotal PAANAY 3 1 22 Riso R 1538 rev ed EN Sources 0 1 0 05 J L O 0 05 i z m 0 0 05 0 0 050 1 x m Figure 3 1 A circular source component at z 0 emitting ne
120. incoming beam and must as such be almost transparent interacting only with roughly 0 1 1 of the neutrons pass ing by In computer simulations it is of course possible to detect every neutron ray without absorbing it or disturbing any of its parameters Hence the two components have very similar functions in the simulations and we do not distinguish between them For simplicity they are from here on just called monitors Another important difference between computer simulations and real experiments is that one may allow the monitor to be sensitive to any neutron property as e g direction energy and divergence in addition to what is found in real world detectors space and time One may in fact let the monitor record correlations between these properties as seen for example in the divergence position sensitive monitor in section 9 7 When a monitor detects a neutron ray a number counting variable is incremented n m 1 1 In addition the neutron weight p is added to the weight counting variable I 1 pi and the second moment of the weight is updated Mz Mo2j 1 pe As also discussed chapter 2 after a simulation of N rays the detected intensity in units of neutrons sec is Iy while the estimated errorbar is Mz N Many different monitor components have been developed for McStas but we have decided to support only the most important ones One example of the monitors we have omitted is the single monitor Monitor
121. ing neotumns elements No text header should be present in the file e Table Rebin amp 7T able rebins all Table rows with increasing evenly spaced first column index 0 e g before using Table_Value Linear interpolation is performed for all other columns The number of bins for the rebinned table is determined from the smallest first column step e Table_Info Table print information about the table Table e Table Index Table m n reads the Table m n element e Table_Value T able x n looks for the closest x value in the first column index 0 and extracts in this row the n th element starting from 0 The first column is thus the x axis for the data e Table_Free amp TJ able free allocated memory blocks e Table Value2d Table X Y Uses 2D linear interpolation on a Table from X Y coordinates and returns the corresponding value Available functions to read an array of vectors matrices in a text file are e Table Read_Array File amp n read and split file into as many blocks as necessary and return a t_Table array Each block contains a single vector matrix This only works for text files The number of blocks is put into n e Table_Free_Array amp T able free the Table array e Table_Info_Array amp T able display information about all data blocks The format of text files is free Lines starting by characters are considered to be comments and stored in Table header Data blocks are vectors and mat
122. ion of most components against analytical formula and benchmarking in simple cases e Newly added realistic source components ISIS_moderator ISIS source model based on MCNPX D Champion and S Ansell ISIS Virtual_tripoli4_input output Trioli4 similar to MCNP files reading writing G Campioni LLB SNS_source SNS source model based on MCNPX G Granroth SNS Source_gen ILL sources Maxwellian parameters E Farhi N Kernavanois H Bordallo ILL 8 Riso R 1538 rev ed EN ESS_moderator_short Calculated source model for the short pulse target sta tion of the ESS project K Lefmann Ris ESS_moderator_long Calculated source model for the long pulse target station of the ESS project K Lefmann Ris e Newly added optical components Radial_collimator Radial collimator with both approximated and exact op tions E Farhi ILL FermiChopper and Vitess_ChopperFermi Two Fermi Chopper components M Poehlmann G Zsigmond ILL and PSI Guide_tapering A rectangular tapered guide U Filges PSI Guide_curved Non focusing curved neutron guide R Stewart ILL e A suite of sample components Inelastic_Incoherent Inelastic incoherent sample with quasielastic and elas tic contributions K Lefmann Ris Phonon_simple An isotropic acoustic phonon K Lefmann Ris PowderN N lines powder diffraction P K Willendrup Ris Sans_spheres hard spheres in thin solution mono disperse L Arleth th
123. is Mari Polaris Prisma San dals Surf SXD Tosca EO float 0 lt E0 lt E1 meV Only neutrons above this en A ergy are sampled El float E0 lt E1 lt 1el10 meV Only neutrons below this en A ergy are sampled dist float 0 lt dist lt co m Distance of focus window from face of moderator XW float 0 lt rw lt m x width of the focus window yh float 0 lt yh lt m y height of the focus window CAngle float 360 lt CAngle lt 360 E Horizontal angle from the nor mal to the moderator surface modXsize float 0 lt modX size lt oo m Horizontal size of the modera tor defaults to actual size modYsize float 0 lt modY size lt co m Vertical size of the moderator defaults to actual size SAC int 0 1 n a Solid Angle Correction Table 3 3 Brief Description of Variables Ris R 1538 rev ed EN 29 3 7 Source adapt A neutron source with adaptive impor tance sampling Name Source_adapt Author K Nielsen Input parameters Tmin maz Ymins Ymaz LO dE dist cw yh Optional parameters a 8 plenty default values are ok Notes partially validated Source_adapt is a neutron source that uses adaptive importance sampling to improve the efficiency of the simulations It works by changing on the fly the probability distributions from which the initial neutron state is sampled so that samples in regions that contribute much to the accuracy of the overall result are preferred
124. is measured in neutrons second Therefore if all other denominators in the flux are multiplied out then the flux at a point sized focus window should follow an inverse square law This solid angle correction is made if the SAC variable is set equal to 1 it will not be calculated if SAC is set to zero It is advisable to select this variable at all times as it will give the most realistic results 3 6 3 Comparing TS1 and TS2 The Flux data provided in both sets of h face files is for 60 wAmp sources To compare TS1 and TS2 the TS1 data must be multiplied by three current average strength of TS1 source 180 Amps When the 300 Amp upgrade happens this factor should be revised accordingly 3 6 4 Bugs Sometimes if a particularly long wavelength gt 20 A is requested there may be problems with sampling the data In general the data used for long wavelengths should only be taken as a guide and not used for accurate simulations At 9 Athere is a kink in the distribution which is also to do with the MCNPX model changing If this energy is sampled over then the results should be considered carefully 28 Riso R 1538 rev ed EN Variable Type Options Units Description Face char i Hydrogen Groove Nar String which designates the TS2 row Broad ii name of the face E1 E9 W1 W9 Face char i H2 CH4 Merlin Wa String which designates the TS1 ter ii Maps Crisp Gem name of the face EVS HET HRPD Ir
125. it the size of the output file but absolute intentities are then likely to be wrong Exept when using MPI we recommend to use the default value of zero saving all neutron rays The size of the file is then controlled indirectly with the general ncounts parameter 10 2 Virtual_input Starting the second part of a split sim ulation Name Virtual_input Author System Input parameters filename Optional parameters repeat count type Notes The component Virtual_input resumes a split simulation where the first part has been performed by another instrument and the neutron ray parameters have been stored by the component Virtual_output All neutron ray parameters are read from the input file which is by default of text type but can also assume the binary formats float and double The reading of neutron rays continues until the specified number of rays have been simulated or till the file has been exhausted If desirable the input file can be reused a number of times determined by the optional parameter repeat count This is only useful if the present simulation makes use of MC choices otherwise the same outcome will result for each repetition of the simulation see Appendix 2 Care should be taken when dealing with absolute intensities which will be correct only when the input file has been exhausted at least once The simulation ends with either the end of the repeated file counts or with
126. ive line width Delta_d d Dd column gt column_inv2d lt index of the 1 2d sin theta lambda inv2d column gt column_q lt index of the scattering wavevector q column gt Other component parameters may as well be specified in the data file header with lines e g Ris R 1538 rev ed EN 77 V_rho lt value of atom number density at Angs 3 gt Vc lt value of unit cell volume Vc Angs 3 gt sigma_abs lt value of Absorption cross section barns gt sigma_inc lt value of Incoherent cross section barns gt Debye_Waller lt value of Debye Waller factor DW gt Delta_d d lt value of Detla_d d width for all lines gt density lt value of material density g cm73 gt weight lt value of material molar weight g mol gt nb_atoms lt value of number of atoms per unit cell gt Further details on file formats are available in the mcdoc page of the component 8 3 2 Geometry physical properties concentricity The sample has the shape of a solid cylinder radius r and height h or a box shaped sample of size xwidth x yheight x zdepth At the users choice an inner hollow can be specified using the parameter thickness As the Isotropic_Sqw component 8 7 PowderN assumes concentric shape i e can contain other components inside the inner hollow To allow this two almost identical copies of the PowderN components must be set up around the internal component s for example COMPONENT Cryo PowderN reflecti
127. izontal divergence defined by m tan7 v vz The detector window is set by the x and y input coordinates The neutron counts are being histogrammed into Nng X ny pixels The horizontal divergence range accepted is 1hmax Mh max and the horizontal position range is the size of the detector The output from PSD_monitor is the integrated counts n I M2 as well as three two dimensional arrays of counts n x m I x m M2 x m The arrays are written to a file and can be read e g by the tool mcplot see the system manual This component can be used for measuring acceptance diagrams 24 PSD_monitor can easily be changed into being sensitive to y and vertical divergence by a 90 degree rotation around the z axis 112 Risd R 1538 rev ed EN 9 8 Monitor nD A general Monitor for 0D 1D 2D records Name Monitor_nD Author System E Farhi Input parameters Lmin Tmax Ymin Ymax Options Optional parameters file width Yheight Zdepth BINS Min Max Notes The component Monitor_nD is a general Monitor that may output any set of physical parameters regarding the passing neutrons The generated files are either a set of 1D signals Intensity vs Variable or a single 2D signal Intensity vs Variable 1 vs Variable 1 and possibly a simple long list of selected physical parameters for each neutron The input parameters for Monitor_nD are its dimensions min Tmax Ymin Ymax in me ters
128. lding Choosing the q and w transfer from S q w The choice of the q w wavevector energy transfer pair could be done randomly as in the first event of the second order scattering evaluation in DISCUS 48 but it is somewhat inefficient except for materials showing a broad quasi elastic signal As the scattering originates from structural peaks and excitations in the material S q w it is usual 49 to adopt an importance sampling scheme by focusing the q w choice to areas where the intensity of S q w is high In practice this means that the neutron event should scatter preferably on e g Bragg peaks quasielastic contribution and phonons The main idea to implement the scattering from S q w is to cast two consecutive Monte Carlo choices using probability distribution built from the dynamic structure factor We define first the probability P w as the unweighted fraction of modes whose energy lies between w and w dw 0 S q w dq S where S ff S q w dqdw is the norm of S q w in the available dynamical range q E dmin qmar and w E Wmin Wmar The probability P w is normalised to unity J P w dw 1 and is a probability distribution of mode energies in the material We then choose randomly an energy transfer w from this distribution Similarly in order to focus the wavevector transfer choice we define the probability dis tribution of wavevector P q w for the selected energy transfer lying between w and w dw S q
129. le n gt 6 will always hit at least one collimator blade and will thus be ABSORB ed For smaller divergence angles na lt 6 the fate of the neutron depends on its exact entry point Assuming that a typical collimator has many blades the absolute position of each blade perpendicular to the collimator axis is thus mostly unimportant A simple statistical consideration now shows that the transmission probability is T 1 tan n tand Often the approximation T 1 n 6 is used giving a triangular transmission profile 4 5 2 Algorithm The algorithm of Collimator_linear is roughly as follows 1 Check by propagation if the neutron ray clear the entry and exit slits otherwise ABSORB 2 Check if lt 6 otherwise ABSORB 3 Simulate the collimator transmission by a weight transformation mi T 1 tan na tan 4 1 4 6 Collimator radial A radial Soller blade collimator Name Collimator_radial Author System E Farhi ILL Input parameters w1 hi w2 ha len Omin Omaz nchan radius Optional parameters divergence nblades roc and others Notes Validated 42 Risd R 1538 rev ed EN This radial collimator works either using an analytical approximation like Collima tor_linear see section 4 5 or with an exact model The input parameters are the inner radius radius the radial length len the input and output window dimensions w1 h1 w2 h2 the number of Soller c
130. le of the circle as seen from the position of the neutron is returned in dQ This routine was previously called randvec_target_sphere which still works Riso R 1538 rev ed EN 141 e randvec_target_rect_angular amp v amp vy amp v amp dQ aimz aim aim h w Rot does the same as randvec_target_circle but targetting at a rectangle with angu lar dimensions h and w in radians not in degrees as other angles The rota tion matrix Rot is the coordinate system orientation in the absolute frame usually ROT_A_CURRENT_COMP e randvec_target_rect amp v amp vy amp vz KdQ aim z aim aim height width Rot is the same as randvec_target_rect_angular but height and width dimensions are given in meters This function is useful to e g target at a guide entry window or analyzer blade B 2 Reading a data file into a vector matrix Table input read_table lib The read_table 1lib provides functionalities for reading text and binary data files To use this library add a Zinclude read_table lib in your component definition DE CLARE or SHARE section Tables are structures of type t_Table see read_table lib h file for details t_Table structure most important members double data Use Table_Index Table i j to extract i j element long rows number of rows long columns number of columns char header the header with comments char filename file name or title double min_x
131. lection coef ficent for the concave and if necessary for the convex wall only onces together with the number of reflections Nevertheless the exact position the time and the divergence is calculated at the end of the bender so there aren t any approximations The component is shown straight on geometrical views mcdisplay Trace and the next component may be placed directly at distance r Wj l without rotation Results have been compared succesfully with analytical formula in the case of an ideal reflection and cross checked with the program haupt An other implementation of the Bender is available as the contributed component Guide_curved 5 6 Curved guides Real curved guides are usually made of many straight elements about 1 m long separated with small gaps e g 1 mm Sections of about 10 m long are separated with bigger gaps for accessibility and pumping purposes We give here an example description of such a section Let us have a curved guide of total length L made of n elements with a curvature radius R Gaps of size d separate elements from each other The rotation angle of individual straight guide elements is a L d R x 180 7 in degrees In order to build an independent curved guide section we define Arm components at the begining and end of it COMPONENT CG_In Arm AT COMPONENT CG_1 Guide_gravity 1 L n AT 0 0 0 RELATIVE PREVIOUS COMPONENT CG_2 Guide_gravity 1 L n AT 0 0 L n d
132. led review on the Monte Carlo method 2 2 The neutron weight A totally realistic semi classical simulation will require that each neutron is at any time either present or lost In many instruments only a very small fraction of the initial neutrons will ever be detected and simulations of this kind will therefore waste much time in dealing with neutrons that never hit the detector An important way of speeding up calculations is to introduce a neutron weight factor for each simulated neutron ray and to adjust this weight according to the path of the ray If e g the reflectivity of a certain optical component is 10 and only reflected neutrons ray are considered later in the simulations the neutron weight will be multiplied by 0 10 when passing this component but every neutron is allowed to reflect in the component In contrast the totally realistic simulation of the component would require in average ten incoming neutrons for each reflected one Let the initial neutron weight be po and let us denote the weight multiplication factor in the 7 th component by 7 The resulting weight factor for the neutron ray after passage of the whole instrument becomes the product of all contributions n P pr po 7 2 2 j 1 Ris R 1538 rev ed EN 17 Each adjustement factor should be 0 lt m lt 1 except in special circumstances so that total flux can only decrease through the simulation For convenience the value of p is update
133. luable The method presented here for handling neutron interaction with isotropic materials is similar in many respects to the earlier MSC 47 Discus 48 and MSCAT 49 methods but the implementation presented here is part of a more general treatment of a sample in an instrument 8 7 2 Theoretical side Pair correlation function g r and Dynamic structure factor S q w In the following we consider an isotropic medium irradiated with a cold or thermal neutron beam We ignore the possible thermal fission events and assume that the incoming neutron energy does not correspond to a Breit Wigner resonance in the material Furthermore we do not take into account quantum effects in the material nor refraction and primary extinction Following Squires 44 the experimental counterpart of the scattering law S q w is the neutron double differential scattering cross section for both coherent and incoherent pro 96 Riso R 1538 rev ed EN cesses Po oa kg dQdEs 4r ki which describes the amount of neutrons scattered per unit solid angle dQ and per unit final energy dE In this equation N pV is the number of atoms in the scattering volume V with atomic number density p Ey Ei kf ki are the kinetic energy and wavevectors of final and initial states respectively o is the bound atom scattering cross section 2 is the solid angle and q w are the wave vector and energy transfer at the sample In practice the double differential cross section is
134. lution shape As all zx cordinates are transformed into z x the most efficient way to take into account the curvature is to include it in the transformation Eq 6 2 by morphing the curved rotating real space to a straight still frame We use parabolic curvature for slits Then instead of solving x t d Ax 2 where Az 2 Rent 1 1 2 Rsuit 6 5 with A being the gap between the straight tangent line at the slit center and the real slit shape we perform the additional transformation x gt a A z 6 6 The additional transformation counter balances the real curvature so that the rest of the algorithm is written as if slits were straight This applies to all computations in the rotating frame and thus as well to reflections on super mirror coatings 6 3 Vitess ChopperFermi The Fermi Chopper from Vitess Name Vitess_ChopperFermi Author Geza Zsigmond Input parameters GeomOption Nehan f R Wrot l Teurv d O Wwall GeomFile Optional parameters zerotime Ngates Notes validated The component Vitess_ChopperFermi simulates a Fermi chopper with absorbing walls The shape of the channels can be straight curved with circular or curved with ideal i e close to a parabolic shape This is determined by the parameter GeomOption In the option straight Fermi chopper the very fast neutrons are transmitted with only a time modulation and lower speed neutro
135. mple to detector f 1 Packing factor of the powder j 1 Multiplicity of the reflection Vo m Volume of unit cell F Q m Structure factor exp 2W 1 Debye Waller factor LQ m Linear attenuation factor due to scattering from one powder line A powder sample will in general have several allowed reflections Q which will all con tribute to the attenuation These reflections will have different values of F Q and hence of Q jj exp 2W and 6 The total attenuation through the sample due to scattering is given by u uet j 3 where Uic represents the incoherent scattering 80 Riso R 1538 rev ed EN 8 3 4 Algorithm The algorithm of PowderN can be summarized as e Check if the neutron ray intersects the sample otherwise ignore the following e Calculate the attenuation coefficients for scattering and absorption e Perform Monte Carlo choices to determine the scattering position scattering type coherent incoherent and the outgoing direction e Perform the necessary weight factor transformation Riso R 1538 rev ed EN 81 8 4 Single crystal The single crystal component Name Single_crystal Author Kristian Nielsen Input parameters Lwidths Yheights thick b Ad d mosaic reflections Optional parameters Cabs Cine Notes Partially validated centered Further validation undergoing Known BUGS The component is known not to work as a Bragg monochromator likely the problem
136. mponent is a simple source with an energy distribution which is uniform in the range Eo dE alternatively a wavelength distribution in the range o dA This component is not used for detailed time of flight simulations so we put t 0 for all neutron rays The initial neutron ray position is chosen randomly from within a circle of radius r in the z 0 plane This geometry is a fair approximation of a cylindrical cold thermal source with the beam going out along the cylinder axis The initial neutron ray direction is focused onto a rectangular target of width w height h parallel to the xy plane placed at 0 0 Zfoc The initial weight of the created neutron ray po is set to the energy integrated flux Y times the source area tr times a solid angle factor which is basically the solid angle of the focusing rectangle See also the section 3 0 1 on source flux This component replaces the obsolete components Source_flux_lambda Source_flat Source_flat_lambda and Source_flux 3 2 Source_div A continuous source with specified diver gence Name Source_div Author System Input parameters w h n v Eo AE Optional parameters o A gauss Notes Validated t 0 Source_div is a rectangular source w x h which emits a beam of a specified divergence around the direction of the z axis The beam intensity is uniform over the whole of the source and the energy or wavelength distribution of th
137. n orbital angular momentum and simple when the magnet is saturated all spins are parallel or anti parallel to one direction gq 1 It is then given as 1 A Fu K nro X exp ir d 5 9aFa Su oa A 12 d where ro ae 2 818 x 10715m g 2 is the Land splitting factor and Fy is the magnetic form factor which is the Fourier transform of the magnetization density normalized so that F4 0 1 and 4 is the thermal average of the ordered atomic spin In the following the Debye Weller factor exp W4 have been ignored in all cross sections A 2 1 Example Magnetic fields The magnetic moment operator of the neutron is ft Yn8 where Yn 2p 3 826 is the gyromagnetic ratio spin and magnetic moment is anti parallel as for an electron A magnetic field B will exert a torque 0 ds dt 1 n du dt on the neutron magnetic moment n4xB A 13 The magnetic moment u can be related to the polarization as uw 7 P 2 and inserting in Eq A 13 we find 2 mP xB A 14 In the simple case where B 0 0 B we find the solution 54 p 18 Note that if we had used S with values 5 1 to define yn we would get yn 1 913 which is also commonly used Riso R 1538 rev ed EN 129 Px t cos wzt Px 0 sin wzt Py 0 sin wzt Px 0 cos wzt Py 0 A 15 P t Pz 0 Y Il where wr 7 B h is the Larmor frequency The equations above was checked again
138. n reflectivity profile of width similar to but not equal the intrinsic mosaicity In this component and in real life the mosaicity given is that of the reflectivity signal As a further simplification the crystal is assumed to be infinitely thin This means that multiple scattering effects are not simulated It also means that the total reflectivity ro is used as a parameter for the model rather than the atomic scattering cross section implying that the scattering efficiency does not vary with neutron wavelength The variance of the lattice spacing Ad d is assumed to be zero so this component is not suitable for simulating backscattering instruments use the component Single_crystal in section 8 4 for that When a neutron trajectory intersects the crystal the first step in the computation is to determine the probability of scattering This probability is then used in a Monte Carlo choice deciding whether to scatter or transmit the neutron The physical scattering probability is the sum of the probabilities of first second and higher order scattering up to the highest order possible for the given neutron wavelength However in most cases at most one order will have a significant scattering probability and the computation thus considers only the order that best matches the neutron wavelength The scattering of neutrons from a crystal is governed by Bragg s law nQo 2k sin 0 7 1 The scattering order is specified by the integer
139. n represents wavevector energy or wavelength as specified in the options parameter whereas the second column is the transmission weight modifier A usage example as a source would use options wavelength set if the first column in the data is supposted to be A in A Another example using the component as a filter would be options energy multiply if the first column is E in meV The input parameters are the filter window size tmin maz Ymin Ymax the behaviour specification string options and the file to use file Additionally rescaling can be made automatic with the scaling and relative thickness parameters If for instance the trans mission data file corresponds to a 5 cm thick filter and one would like to simulate a 10 cm thick filter then use thickness 2 Some example data files are given with McStas in the MCSTAS data directory as trm files for transmission The filter geometry is a flat plane A geometry with finite thickness can be simulated by surrounding this component with two slits 40 Riso R 1538 rev ed EN 4 5 Collimator linear The simple Soller blade collimator Name Author Input parameters Collimator_linear System Tmin Tmaz Yminy Ymaz L Optional parameters Notes Collimator_linear models a standard linear Soller blade collimator The collimator has two identical rectangular openings defined by the x and y values Neutrons not clearing both openings are ABSORB e
140. n the sample is chosen uniformly along the neutron flight path inside the sample and the scattered direction is chosen in a user specified range either within a sphere of radius ffoc within a rectangular target with measures Xfocus Yfocus Or in the specified angular range This target is positioned at the Ltarget Ytargets Ztarget point in space or using target_index This component stores complete information about the scattering event in the output parameter res_struct see Res_Sample 10 5 Res_monitor The monitor for resolution calculation Name Res_monitor Author System Alan Tennant HMI Input parameters Tmin Tmax Ymin Ymax filename res_sample buffer size Optional parameters w Yh Zt options Notes The component Res_monitor is used for calculating the resolution function of a par ticular instrument with detector of the given shape size and position The shape of Res_monitor is by default rectangular but can be a box a sphere a disk or a cylinder depending on the parameter options The component works like a normal monitor but also records all scattering events and stores them to a file that can later be read by the McStas frontend tool mcresplot For time of flight TOF instruments Res_monitor should be understood as giving the resolution of one time bin of the TOF detector only the bin properties being specified in the preceding TOF_Res_sample 124 Riso R 1538 rev ed
141. nd a box of dimensions dz dy and dz centered at the origin for a neutron with the parameters x y 2 Uz Vy vz The times of intersection are returned in the variables t and t2 with t lt tg In the case of less than two intersections t and possibly t2 are set to zero The function returns true if the neutron intersects the box false otherwise cylinder_intersect amp t amp to Y Z Ur Vy Vz T h Similar to box_intersect but using a cylinder of height h and radius r centered at the origin sphere_intersect amp t amp t2 x Y Z Ur Vy Vz T Similar to box_intersect but using a sphere of radius r B 1 7 Random numbers rand01 Returns a random number distributed uniformly between 0 and 1 randnorm Returns a random number from a normal distribution centered around 0 and with 1 The algorithm used to sample the normal distribution is explained in Ref 56 ch 7 randpm1 Returns a random number distributed uniformly between 1 and 1 randtriangle Returns a random number from a triangular distribution between 1 and 1 randvec_target_circle amp v amp vy Kuz amp dQ aimz aim aim rf Generates a random vector Vz Vy vz of the same length as aim aim aim which is targeted at a disk centered at aimz aim aim with radius rf in meters and perpendicular to the aim vector All directions that intersect the circle are chosen with equal probability The solid ang
142. ng geometry shown in Figure A 1 only applies for the sides of the guide wall and not the top and bottom assuming that the magnetizing field is pointing up or down so there another set of equations should really be used The same physics could also be used for a polarizing powder or single crystal sample if F y amp and Fiyy can be calculated with some other program but one would have to use the general form of Eq A 28 and Eq A 29 without the simplifying geometrical constraints for monochromators and guides A 4 New McStas Components The components written so far can be divided into four groups e Polarizers Components used to make the beam polarized e Monitors Unphysical detectors that can measure the polarization of the neutrons e Magnetic fields Components used to handle magnetic fields e Samples Samples that affects the polarization A 4 1 Polarizers Some of the most common ways of polarizing a beam have been implemented 134 e Set_pol This unphysical component can be used in two ways Either to hard code the polarization to the vector px py pz or when randomOn 0 to set the polar ization vector to a random vector on the unit sphere Monochromator_pol A monochromator that only does the n 1 reflection For each neutron it calculates the wavelength which would give Bragg reflection ABragg and it then calculates based on one mosaicity and one d spread the reflection probability given the neutrons
143. ng the weight factor 2 002 91 8 6 Phonon_simple A simple phonon sample 4 92 8 6 1 The phonon cross section soosoo ee 92 8 6 2 The algorithm sosi eee bare A ao eR a ae a 93 8 6 3 The weight transformation 0 2 000000 ee eee 93 8 7 Isotropic_Sqw A general S q w coherent and incoherent scatterer 95 8 7 1 Neutron interaction with matter overview 96 8 7 2 Theoretical side 2 aaa 96 8 7 3 Theoretical side scattering in the sample 98 8 7 4 The implementation 0 020205022 eee 103 So Validation ne 2 2 ai ad Saf hae Ale te et tei sy Be eis ee 108 Riso R 1538 rev ed EN 5 9 Monitors and detectors 109 9 1 TOF monitor The time of flight monitor 110 9 2 TOF2E monitor A time of flight monitor with simple energy analysis 110 9 3 E_monitor The energy sensitive monitor 204 111 9 4 L monitor The wavelength sensitive monitor 111 9 5 PSD_monitor The PSD monitor 2 04 111 9 6 Divergence_monitor A divergence sensitive monitor 112 9 7 DivPos_monitor A divergence and position sensitive monitor 112 9 8 Monitor_nD A general Monitor for OD 1D 2D records 113 9 8 1 The MonitornD geometry 2 000020 8 113 9 8 2 The neutron parameters that can be monitored 114 9 8 3 Important options 0 0
144. ns are modulated both in time of flight and wavelength If the channels are curved the highest transmission occurs for a wavelength _ 3956 mA s Aopt Weary 6 7 with w 2rf 6 8 The optimal shape is calculated in an exact way and is close to parabolic in this case transmission is as high for the optimal wavelength as in the case of a straight Fermi chopper for the limit A 0 In the more realistic case of circular shapes channels the transmission Ris R 1538 rev ed EN 59 is slightly lower In general neutrons are transmitted through a curved Fermi chopper with a time AND wavelength modulation The rotation axis is vertical y axis i e the path length through the channels is given by the length l along the z axis The inital orientation is given by the phase of the chopper 0 means transmission orientation Geometry for straight and circular channels The geometry of the chopper consists of a rectangular shaped object with a channel system In transmission position there are Neates slits of width wg each along the x axis separated by absorbing walls of thickness Wwall see figure 6 6 The total width wot is given by Wtot NeatesWslit aJ Ngates ag 1 Wwall 6 9 The rectangular channel system is surrounded by a so called shadowing cylinder it is a part of a cylinder with vertical symmetry axis and diameter d gt 4 12 w 6 10 It serves to prevent transmission of neutrons which do not fly through th
145. nt is a variation of Guide_channeled section 5 3 with the ability to handle gravitation effects and functional channeled focusing geometry Channels can be specified in two dimensions producing a 2D array k kn of smaller rectangular guide channels The coating is specified as for the Guide and Mirror components by mean of the parameters Ro m Qc W and a or alternatively from the reflectivity file reflect Waviness effects supposed to be randomly distributed i e non periodic waviness can be specified globally or for each part of the guide section Additionally chamfers may be defined the same way Chamfers originate from the substrate manufacturing so that operators do not harm themselves with cutting edges Usual dimensions are about tens of millimeters They are treated as absorbing edges around guide plates both on the input and output surfaces but also aside each mirror The straight section of length l may be divided into n bits of same length within which chamfers are taken into account The component has also the capability to rotate at a given frequenccy in order to ap proximate a Fermi Chopper including phase shift The approximation resides in the fact that the component is considered fixed during neutron propagation inside slits Beware that this component is then located at its entry window not centered as the other Fermi choppers To activate gravitation support either select the McStas gravitation support merun gra
146. o output the results from a single detector The name of the detector is output together with the simulated intensity and es timated statistical error The output is produced in a format that can be read by McStas front end programs DETECTOR_OUT_1D Used to output the results from a one dimensional detector Integrated intensities error etc is also reported as for DETECTOR_OUT_OD DETECTOR_OUT_2D Used to output the results from a two dimentional detector Integrated intensities error etc is also reported as for DETECTOR_OUT_OD Riso R 1538 rev ed EN DETECTOR OUT 3D Used to output the results from a three dimentional detector Arguments are the same as in DETECTOR_OUT_2D but with an addi tional z axis Resulting data files are treated as 2D data but the 3rd dimension is specified in the type field Integrated intensities error etc is also reported as for DETECTOR_OUT_OD mcinfo_simulation FILE f mcformat char pre char name is used to append the simulation parameters into file f see for instance Res_monitor Internal variable mcformat should be used as specified Please contact the authors for further information B 1 6 Ray geometry intersections inside_rectangle amp z amp y x xw yh Return 1 if rw 2 lt x lt xw 2 AND yh 2 lt y lt yh 2 Else return 0 box_intersect amp t amp t2 x Y Z Ur Vy Uz dz dy dz Calculates the 0 1 or 2 intersections between the neutron path a
147. oment of passing the chopper centre The result is the generation of only 1 pulse instead of several this is useful for TOF instruments on continuous sources This component is about twice slower than the FermiChopper component The component must be placed after a component which sets a non zero flight path to the Fermi Chopper e g not an Arm Riso R 1538 rev ed EN 61 0 1 y m Velocity selector INE ISS QS Figure 6 8 A velocity selector 6 4 V selector A rotating velocity selector Name V_selector Author System Input parameters Lo Li w ro 6 N height width Optional parameters Notes validated position is center of input aperture The component V_selector models a rotating velocity selector constructed from N col limator blades arranged radially on an axis Two identical slits height x width at a 12 o clock position allow neutron passage at the position of the blades The blades are twisted on the axis so that a stationary velocity selector does not transmit neutrons the total twist angle is denoted in degrees Further input parameters for V_selector the distance between apertures Lo the length of the collimator blades L the height from rotation axix to the slit centre ro the rotation speed w in rpm and the blade thickness t The local coordinate system has its Origo at the slit centre The component Selector produc
148. on is fair Riso R 1538 rev ed EN 107 8 7 5 Validation For constant incoherent scattering mode V_sample PowderN Single crystal and Isotropic_Sqw produce equivalent results eventhough the two later are more accurate geometry multiple scattering Execution times are equivalent Compared with the PowderN component the S q method is twice slower in computation time and intensity is usually lower by typically 20 depending on scattering cross sections the difference arising from multiple scattering and secondary extinction not handled in PowderN The PowderN component is intrinsically more accurate in q as each Bragg peak is handled separately as an exact Dirac peak with optional Ag spreading In Isotropic_Sqw an approximated q table is built from the F data and is coarser Still differences in the diffraction pattern are limited The Isotropic_ Sqw component has been benchmarked against real experiment for liquid Rubidium Copley 1974 and liquid Cesium Bodensteiner and Dorner 1989 and the agreement is excellent The Test_Isotropic_Sqw test example instrument exists in the distribution for this com ponent 108 Riso R 1538 rev ed EN Chapter 9 Monitors and detectors In real neutron experiments detectors and monitors play quite different roles One wants the detectors to be as efficient as possible counting all neutrons absorbing them in the process while the monitors measure the intensity of the
149. on rays Warnings will be issued during simulation if sections of the instrument are not reached by any neutron rays or if neutrons are removed This is usually the sign of either overlapping components or a very low intensity 1 4 About data files Some components require external data files e g lattice crystallographic definitions for Laue and powder pattern diffraction S q w tables for inelastic scattering neutron events files for virtual sources transmission and reflectivity files etc Such files distributed with McStas are located in the data sub directory of the MCSTAS library Components that make use of the McStas file system including the read table library see section B 2 may access all McStas data files without making local copies Of course you are welcome to define your own data files and eventually contribute to McStas if you find them useful File extensions are not compulsory but help in identifying relevant files per application We list powder and liquid data files from the McStas library in Tables 1 2 and 1 3 These files contain an extensive header describing physical properties with references and are specially suited for the PowderN see 8 3 and Isotropic_ Sqw components see 8 7 McStas itself generates both simulation and monitor data files which structure is explained in the User Manual see end of chapter Running McStas Riso R 1538 rev ed EN 11 MCSTAS data Description lau Laue pa
150. on will be in terms of Angstroms Variables dist xw and yh are the three component which will determine the directional acceptance window They define a rectangle with centre at 0 0 dist from the moderator Riso R 1538 rev ed EN 27 position and with width zw meters and height yh meters The initial direction of all the neutrons are chosen randomly to originate from a point on the moderator surface and along a vector such that without obstruction and gravitational effects they would pass through the rectangle This should be used as a directional guide All the neutrons start from the surface of the moderator and will be diverted absorbed if they encountered other components The guide system can be turned off by setting dist to zero The CAngle variable is used to rotate the viewed direction of the moderator and reduces the effective solid angle of the moderator face Currently it is only for the horizontal plane This is redundant since there are beamline specific h face files The two variables modYsize and modXsize allow the moderators to be effectively re duced increased If these variables are given negative or zero values then they default to the actual visible surface size of the moderators The last variable SAC will correct for the different solid angle seen by two focussing windows which are at different distances from the moderator surface The normal mea surement of flux is in neutrons second A cm str but in a detector it
151. one monitor at the same place 9 8 2 The neutron parameters that can be monitored There are many different variables that can be monitored at the same time and position Some can have more than one name e g energy or omega kx ky kz k wavevector Angs 1 usually axis are VX vy vz v m s x horz y vert z on axis xyz m Distance Position kxy vxy xy radius m Radial wavevector velocity and position t time s Time of Flight energy omega meV lambda wavelength Angs p intensity flux n s or n cm 2 s ncounts 1 SX SY SZ 1 Spin vdiv ydiv dy deg vertical divergence y hdiv divergence xdiv deg horizontal divergence x angle deg divergence from direction theta longitude deg longitude x z for sphere and cylinder phi lattitude deg lattitude y z for sphere and cylinder as well as two other special variables user user1 will monitor the Mon_Name _Vars UserVariable 1 2 user2 user3 to be assigned in an other component see below To tell the component what you want to monitor just add the variable names in the options parameter The data will be sorted into bins cells default is 20 between some default limits that can also be set by user The auto option will automatically determine what limits should be used to have a good sampling of signals 114 Riso R 1538 rev ed EN 9 8 3 Important options Each monitoring records the flux sum of weights p versus the given variables except if
152. ons Al laz radius 0 01 thickness 0 001 concentric 1 AT 0 0 0 RELATIVE Somewhere COMPONENT Sample some_other_component with geometry FULLY enclosed in the hollow AT 0 0 0 RELATIVE Somewhere COMPONENT Cryo2 COPY Cryo concentric 0 AT 0 0 0 RELATIVE Somewhere As outlined the first instance of PowderN must have concentric 1 and the instance must have concentric 0 Furthermore the component s inside the hollow must have a geometry which can be fully contained inside the hollow In addition to the coherent scattering specified in the reflections file absorption and incoherent cross sections can be given using the input parameters of and o The Bragg scattering from the powder of is calculated from the input file with the parameters Q F Q and j for the scattering vector structure factor and multiplicity respectively The volume of the unit cell is denoted Vc while the sample packing factor is pack Focusing is performed by only scattering into one angular interval d of the Debye Scherrer circle The center of this interval is located at the point where the Debye Scherrer circle intersects the half plane defined by the initial velocity vi and a user specified vector f 78 Ris R 1538 rev ed EN Figure 8 3 The scattering geometry of a powder sample showing part of the Debye Scherrer cone solid lines and the Debye Scherrer circle grey 8 3 3 Powder scatte
153. or is a cylinder with revolution axis along y vertical The radius in xz plane is radius max abs ane Tmax Zwidth 2 9 3 and the height along y is height E Ymax Ymax OlYheight 9 4 Riso R 1538 rev ed EN 113 6 banana The same as the cylinder but without the top bottom caps and on a restricted angular range The angular range is specified using a theta variable limit specification in the options 7 previous The detector has the shape of the previous component This may be a surface or a volume In this case the neutron is detected on previous component and there is not neutron propagation By default the monitor is flat rectangular Of course you can choose the orientation of the Monitor_nD in the instrument description file with the usual ROTATED modifier For the box sphere and cylinder the outgoing neutrons are monitored by default but you can choose to monitor incoming neutron with the incoming option At last the slit or absorb option will ask the component to absorb the neutrons that do not intersect the monitor The exclusive option word removes neutrons which are similarly outside the monitor limits that may be other than geometrical The parallel option keyword is of common use in the case where the Monitor_nD is superposed with other components It ensures that neutrons are detected independently of other geometrical constrains This is generally the case when you need e g to place more than
154. ory Sources optics monochromators samples monitors and other components e The McStas library functions and definitions that aid in the writing of simulations and components in Appendix B e An explanation of the McStas terminology in Appendix C Additionally you may refer to the list of example instruments from the library in the McStas User Manual 1 1 Authorship The component library is maintained by the McStas system group A number of basic components belongs the McStas system and are supported and tested by the McStas team Other components are contributed by specific authors who are listed in the code for each component they contribute as well as in this manual McStas users are encouraged to send their contributions to us for inclusion in future releases Some contributed components have later been taken over for further development by the McStas system group with permission from the original authors The original authors will still appear both in the component code and in the McStas manual 1 2 Symbols for neutron scattering and simulation In the description of the theory behind the component functionality we will use the usual symbols r for the position x y z of the particle unit m and v for the particle velocity Uz Vy Uz unit m s Another essential quantity is the neutron wave vector k myv h where mn is the neutron mass k is usually given in A while neutron energies are given 10 Riso R 1538
155. ource the source will optimize for neutrons that reach that point without being absorbed regardless of neutron position divergence wavelength etc The Adapt_check component takes as single input parameter source_comp the name of the Source_adapt component instance for example COMPONENT mysource Source_adapt COMPONENT mycheck Adapt_check source_comp mysource Only one instance of Adapt_check is allowed in an instrument Riso R 1538 rev ed EN 33 3 9 Source Optimizer A general Optimizer for McStas Name Source_Optimizer Author E Farhi ILL Input parameters options Optional parameters bins step keep Notes partially validated The component Source_Optimizer is not exactly a source but rather a neutron beam modifier It should be positioned after the source anywhere in the instrument description The component optimizes the whole neutron flux in order to achieve better statistics at each Monitor_Optimizer location s see section 3 10 for this latter component It acts on any incoming neutron beam from any source type and more than one optimization criteria location can be placed along the instrument The usage of the optimizer is very simple and usually does not require any configuration parameter Anyway the user can still customize the optimization through various options In contrast to Source_adapt this optimizer does not record correlations between neutron parameters Never
156. ous results often originate from a wrong usage of some part of the package Anyway if you find that either the documentation is not clear or the behavior of the simulation is undoubtedly anomalous you should report this to us at mcstas risoe dk and refer to our special bug request reporting service 4 Riso R 1538 rev ed EN 15 Chapter 2 Monte Carlo Techniques and simulation strategy This chapter explains the simulation strategy and the Monte Carlo techniques used in Mc Stas We first explain the concept of the neutron weight factor and discuss the statistical errors in dealing with sums of neutron weights Secondly we give an expression for how the weight factor transforms under a Monte Carlo choice and specialize this to the con cept of direction focusing Finally we present a way of generating random numbers with arbitrary distributions More details are available in the Appendix concerning random numbers in the User manual 2 1 Neutron spectrometer simulations Neutron scattering instruments are built as a series of neutron optics elements Each of these elements modifies the beam characteristics e g divergence wavelength spread spa tial and time distributions in a way which for simple neutron beam configurations may be modelled with analytical methods This is valid for individual elements such as guides 9 10 choppers 11 12 Fermi choppers 13 14 velocity selectors 15 monochromators 16 19 and detector
157. polarization with the Pol_bender Test_Pol_Set instr Tests Pol_set Test_Pol_Guide_Vmirror instr Illustrates beam polarization with the Pol_guide_vmirror Test_Pol_Mirror instr Illustrates beam polarization with the Pol_mirror Test_Pol_TripleAxis instr An example of a triple axis spectrometer with polarizing monochromators a vanadium sample and a spin flipper Risd R 1538 rev ed EN Appendix B Libraries and conversion constants The McStas Library contains a number of built in functions and conversion constants which are useful when constructing components These are stored in the share directory of the MCSTAS library Within these functions the Run time part is available for all component instrument descriptions The other parts are dynamic that is they are not pre loaded but only imported once when a component requests it using the Zinclude McStas keyword For instance within a component C code block usually SHARE or DECLARE include read_table lib will include the read_table lib h file and the read_table lib c unless the no runtime option is used with mcstas Similarly include read_table lib h will only include the read_table lib h The library embedding is done only once for all components like the SHARE section For an example of implementation see Res_monitor In this Appendix we present a short list of both each of the library contents and the run time features B 1
158. positive t thus found gives the time of the next intersection with the guide or in the case of the guide exit the time when the neutron leaves the guide Propagated the neutron ray to this point Compute the reflection from the side Update the neutron weight factor by the amount 7 R Q Repeat this process until the neutron leaves the guide There are a few optimizations possible here to avoid redundant computations Since the neutron is always inside the guide during the computations we always have O ro n lt 0 Thus t lt 0 if v n gt 0 so in this case there is no need to actually compute t Some redundant computations are also avoided by utilizing symmetry and the fact that many components of n and O are zero 48 Ris R 1538 rev ed EN 5 3 Guide channeled A guide section component with mul tiple channels Name Guide_channeled Author System Input parameters wi hi we he l k Mz My Optional parameters d Ro Qer Qcy W Qr Qy Notes validated no gravitation support The component Guide_channeled is a more complex variation of Guide described in the previous section It allows the specification of different supermirror parameters for the horizontal and vertical mirrors and also implements guides with multiple channels as used in neutron bender devices By setting the m value of the supermirror coatings to zero nonreflecting walls are simulated this may be used for a ver
159. q of Aq a2k sin 6 7 4 The angle y corresponds to a Akp and hence Aq of Aq vk sin 20 7 5 see figure 7 2 Hence we may sample y from a Gaussian with standard deviation 2ksin _ 2ksn a ksin 2ksin cos cos 7 6 to get good statistics What remains is to determine the neutron weight The distribution from which the scat Q cos 0 1 2 2 an p 2 a cos 6 77 fucle V2n a cos0 ee tering event is sampled is a Gaussian in y of width Riso R 1538 rev ed EN 67 In the physical model the probability of the scattering event is proportional to a Gaussian in the angle between the nominal scattering vector Qo and the actual scattering vector q The normalization condition is that the integral over all y should be 1 Thus the probability of the scattering event in the physical model is d y d y I y e 2 e2 dy 7 8 where d Y denotes the angle between the nominal scattering vector and the actual scat tering vector corresponding to y According to equation 2 9 the weight adjustment 7 is then given by Tj II y fuc y 7 9 In the implementation the integral in 7 8 is computed using a 15 order Gaussian quadra ture formula with the integral restricted to an interval of width 50 cos for the same reasons discussed above on the sampling of y 7 2 Monochromator_curved A curved mosaic crystal with a single scattering vector Name Monochromator_curved Author
160. r AT 0 0 0 RELATIVE PREVIOUS COMPONENT Mono_PST_off Arm AT 0 0 0 RELATIVE PREVIOUS EXTEND vz vz SPEED puts back neutron in static coordinate frame hy This solution does not contain acceleration but is far enough for most studies and it is very simple In the latter example the instance Mono_PST_on should itself be rotated to reflect according to a Bragg law 70 Risd R 1538 rev ed EN Chapter 8 Samples This class of components models the sample of the experiment This is by far the most challenging part of a neutron scattering instrument to model However for purpose of sim ulating instrument performance details of the samples are rather unimportant allowing for simple approximations On the contrary for full virtual experiments it is of impor tance to have realistic and detailed sample descriptions McStas contains both simple and detailed samples We first consider incoherent scattering The simple component V sample performs both incoherent scattering and absorption An important component class is elastic Bragg scattering from an ideal powder The component PowderN models a powder scatterer with reflections given in an input file To scatter on a single Bragg peak the Powder1 component may be used The compo nent includes absorption incoherent scattering direct beam transmission and can assume concentric shape i e can be used for modelling sample enviroments Next type is Bragg scattering f
161. r PSDlin_monitor PSD_monitor_4PI PSD_monitor TOF_cylPSD_monitor TOFLambda_monitor TOFlog_mon TOF_monitor options dx bins ndiv limits a 2a 2 lambda bins nlam limits o 1 file file options dx bins nh limits hmar 2hmax 2 dy bins nv limits Umaz 2Umax 2 filename file options dx bins ndiv limits a 2a 2 LMIN L min CTMNAL L max options energy bins nchan limits EminEmaz options energy bins ng limits EminEmaz x bins nx x bins npos LMIN Lmin TMAL L max options dx bins nh hniits Areaa 2inae 2 filename file options lambda bins nh limits Amaz 2Amaz 2 filename file options sphere options unactivate options theta bins nr y bins ny cylinder filename file yheight height xwidth 2 radius options x bins nx xmin Lmin TMAL Lmax yMax Ymax filename file options theta y sphere options x bins nz y bins ny rmin Lmin TMAT Lmax YMIN Ymin YMAT Ymazx fillename file options theta bins ng time bins nt limits to t cylin der filename file yheight height cwidth 2 radius options lambda_ bins n limits Ap Ai time bins nt limits to t1 filename file options log time bins nt limits to t1 options time bins nt limits to t Table 9 1 Using Monitor_nD in place of other components All limits specifications may be advantageously replaced by an auto word preceeding each monitored va
162. r 119 Single crystal diffraction 78 Simulation progress bar 122 Small angle scattering 86 Sources 18 Adaptive importance sampling monitor 29 Adaptive source 26 Continuous source with a Maxwellian spectrum 21 Continuous source with specified diver gence 20 from 1D table input 36 General continuous source 21 ISIS pulsed moderators 22 Optimization location see Sources Optimizer Optimizer 30 Simple continuous source 20 Time of flight pulsed moderator 22 Virtual source from stored neutron events 118 Virtual source recording neutron events 118 Symbols 7 Tools mcdoc 8 mcstas2vitess 141 Point in space Arm Optical bench 34 Tripoli 33 Radial collimator 38 Slit 34 Straight guide 42 Velocity selector 58 59 Optimization 26 29 30 32 Removed neutron events 7 99 134 Sample environments 73 91 103 Samples 67 Coherent and incoherent isotropic scat terer 91 Dilute colloid medium 86 Incoherent inelastic scatterer 72 Incoherent isotropic scatterer Vanadium 70 152 Vitess 33 Risd R 1538 rev ed EN 153 Riso R 1538 rev ed EN Bibliographic Data Sheet Risg R 1538 rev ed EN Title and author s Component Manual to the Neutron Ray Tracing Package McStas Version 1 12 Peter Kj r Willendrup Erik Knudsen Kim Lefmann and Emmanuel Farhi ISBN ISSN ISBN 978 87 550 3680 2 0106 2840 Dept or group Date Materials Research Dep
163. rameters wz hy tz Wfocus Mfocus Wfoc angle Mfoc angle target index Notes only validated qualitatively This component models a simple phonon signal from a single crystal of a pure element in an fcc crystal structure Only one isotropic acoustic phonon branch is modelled and the longitudinal and transverse dispersions are identical with the velocity of sound being c Other physical parameters are the atomic mass M the lattice parameter a the scattering length b the Debye Waller factor DW and the temperature T Incoherent scattering and absorption are taken into account by the cross sections Cabs and Cine The sample can have the form of a cylinder with height h and radius ro or a box with dimensions wz hy tz Phonons are emitted into a specific range of solid angles specified by the location t Yt zt and the focusing radius rg Alternatively the focusing is given by a rectangle wyocus and hAfocus and the focus point is given by the index of a down stream component target_index Multiple scattering is not included in this component A usage example of this component can be found inthe Neutron site tests Test_Phonon instrument from the mcgui 8 6 1 The phonon cross section The inelastic phonon cross section for a Bravais crystal of a pure element is given by Ref 44 ch 3 do akg 27 1 eet f 2 dQdE ki Vo 2M i 2 1 USSD te oa ese T 4 p Wq p i 2 2 where both annihilation
164. ransmission the adjustment is 1 P transmit 1 f transmit m no transmission Absorption is never explicitly simulated so the Monte Carlo probability of coherent or incoherent scattering is f coh f inc 1 The physical probability of coherent or incoherent scattering is P coh P inc Tcoh T Fine Otot so again a weight adjustment m cohljinc H coh inc f coh inc is needed When choosing the reciprocal lattice vector T to scatter from the relative probability for Fis te Cen ey F This is done to get better statistics for weak reflections The Monte Carlo probability for the reciprocal lattice vector 7 is thus f r 2 a Tr whereas the physical probability is P T Ccoh r Ccon A weight adjustment is thus needed of TT P T Fcoh r oe fe FCT Ocoh Tr In most cases however only one reflection is possible whence m 1 8 4 5 Implementation details The equations describing Single crystal are quite complex and consequently the code is fairly sizeable Most of it is just the expansion of the vector and matrix equations in individual coordinates and should thus be straightforward to follow The implementation pre computes a lot of the necessary values in the INITIALIZE section It is thus actually very efficient despite the complexity If the list of reciprocal lattice points is big however the search through the list will be slow The precomputed data is stored in the struct
165. re factor As the present implementation makes no assumption on the simulated instrument part which is behind the sample we can not apply this method Consequently the efficiency of the sample scattering code is certainly lower than previous codes but on the other hand it does not depend on the type of instrument simulation In particular it may be used to model any material in the course of the neutron propa gation along the instrument model filters mechanical parts samples shields radiation protections Once the scattering probability and position the energy and momentum transfers and the neutron momentum after scattering have all been defined the whole process is iterated until the neutron is transmitted and exits the sample volume Extension to powder elastic scattering In principle the component can work in purely elastic mode if only the w 0 column is available in S Anyway in the diffractionists world people do not usually define scattering with S q Eq 8 48 but through the scattering vector 7 multiplicity z r for powders and F structure factors including Debye Waller factors as in Eq 8 18 When doing diffraction and neglecting inelastic contribution as first approximation we may integrate Eq 8 44 keeping k ky se do con NOcoh dQ ca Sco 8 63 cn coh el lal 0 dQdE p f Ar n q 2 yea XC T q Fr from Eq 8 18 8 64 Vo T a with Vo 1 p being the volume of a lattice unit
166. re very low as no big n dimensional array is needed 3 9 2 Using the Source Optimizer To use this component just install the Source_Optimizer after a source but any location is possible afterwards in principle and use the Monitor_Optimizer at a location where you want to reach better statistics where to act on neutron beam COMPONENT optim_s Source_Optimizer options where to have better statistics COMPONENT optim_m Monitor_Optimizer xmin 0 05 xmax 0 05 ymin 0 05 ymax 0 05 optim_comp optim_s using more than one Monitor_Optimizer is possible The input parameter for Source_Optimizer is a single options string that can contain some specific optimizer configuration settings in clear language The formatting of the options parameter is free as long as it contains some specific keywords that can be sometimes followed by values The default configuration equivalent to options is options continuous optimization auto setting keep 0 1 bins 0 1 smooth spikes SetX Y SetDivV SetDivsS Riso R 1538 rev ed EN 35 Parameters keep and step should be between 0 and 1 Additionally you may restrict the optimization to only some of the neutron parameters using the SetXY SetV Sets SetDivV SetDivS keywords The keyword modifiers no or not revert the next option Other options not shown here are verbose displays optimization process debug purpose unactivate
167. red to reach the end of the simulation This spatial correlation may be revealed using the PreMonitor_nD component This latter stores the neutron parameters at a given instrument location to be used at an other Monitor_nD location for monitoring The only parameter of PreMonitor_nD is the name of the associated Monitor_nD in stance which should use the premonitor option as in the following example COMPONENT CorrelationLocation PreMonitor_nD comp CorrelationMonitor AT e g a guide system COMPONENT CorrelationMonitor Monitor_nD options x dx auto all bins 30 premonitor AT which performs the same monitoring as the previous example but with a spatial correlation constrain Indeed it records the position vs the divergence of neutrons at the correlation location but only if they reach the monitoring position All usual Monitor_nD variables may be used except the user variables These latter may be defined as described in section 9 8 7 in an EXTEND block 120 Riso R 1538 rev ed EN Chapter 10 Special purpose components The chapter deals with components that are not easily included in any of the other chapters because of their special nature but which are still part of the McStas system One part of these components deals with splitting simulations into two or more stages For example a guide system is often not changed much and a long simulation of neutron rays surviving through the gu
168. related to the method for selecting the outgoing wave vector direction When the final wave vector has to be computed the quantities ki hw and q q are known We solve the energy conservation law Eq 8 61 and we select randomly ky as one of the two roots The scattering angle 0 from the initial k direction is determined from the momentum conservation law cos k k q 2kikf which defines a scattering cone We then choose randomly a direction on the cone If the selection rules can not be verified namely cos gt 1 a new q w random choice is performed see Section 8 7 3 It might appear inefficient to select the energy and momentum tranfers first and check the selection rules afterwards However in practice the number of iterations to actually scatter on a high probability process and satisfy these Riso R 1538 rev ed EN 101 rules is limited usually below 10 Moreover as these two steps are simple the whole process requires a limited number of computer operations As mentioned in Section 8 7 3 previous multiple scattering estimation codes 47 49 force the outgoing neutron event to come into the detector area and time window thus im proving dramatically the code efficiency This choice sets the measurable energy and momentum transfers for the last scattering event in the sample so that the choice of the scattering excitation actually requires a more complex sampling mechanism for the dynamic structu
169. rev ed EN in meV The neutron wavelength is the reciprocal wave vector A 27 k In general vectors are denoted by boldface symbols Subscripts i and f denotes initial and final respectively and are used in connection with the neutron state before and after an interaction with the component in question The spin of the neutron is given a special treatment Despite the fact that each physical neutron has a well defined spin value the McStas spin vector s can have any length between zero unpolarized beam and unity totally polarized beam Further all three cartesian components of the spin vector are present simultaneously although this is physically not permitted by quantum mechanics For further details about polarization handling you may refer to the Appendix A 1 3 Component coordinate system All mentioning of component geometry refer to the local coordinate system of the individ ual component The axis convention is so that the z axis is along the neutron propagation axis the y axis is vertical up and the x axis points left when looking along the z axis completing a right handed coordinate system Most components position as specified in the instrument description with the AT keyword corresponds to their input side at the nominal beam position However a few components are radial and thus positioned in their centre Components are usually not designed to overlap This may lead to loss of neutr
170. riable Not all file and dimension specifications are indicated e g filename xmin xmax ymin ymax Riso R 1538 rev ed EN 117 Setting directly the user variables simple The first method uses directly the user1 and username1 component parameters to trans fert directly the value and label such as in the following example TRACE Cres COMPONENT UserMonitor Monitor_nD user1 log t usernamel Log time options auto useri The values to assign to user2 and user3 must be global instrument variables or a com ponent output variables as in user1 MC_GETPAR some_comp outpar Similarly the user2 user3 and username2 username3 parameters may be used to control the second and third user variable to produce eventually 2D 3D user variable correlation data and custom event lists Setting indirectly the user variables only for professionals It is possible to control the user variables of a given Monitor_nD instance anywhere in the instrument description This method requires more coding but has the advantage that a variable may be defined to store the result of a computation locally and then transfert it into the UserMonitor all fitting in an EXTEND block This is performed in a 4 steps process 1 Declare that you intend to monitor user variables in a Monitor_nD instance defined in TRACE DECLARE Ws Case include monitor_nd lib MONND_DECLARE UserMonitor will monitor custom things in UserMonitor hy
171. rices Block numbers are counted starting from 1 and changing when a comment is found or the column number changes For instance the file MCSTAS data BeO trm Transmission of a Berylium filter looks like BeO transmission as measured on IN12 Thickness 0 05 m k Angs 1 Transmission 0 1 wavevector multiply 0500 0 74441 0750 0 76727 1000 0 80680 e er HH H Binary files should be of type float i e REAL 32 and double i e REAL 64 and should not contain text header lines These files are platform dependent little or big endian Ris R 1538 rev ed EN 143 The filename is first searched into the current directory and all user additional locations specified using the I option see the Running McStas chapter in the User Manual and if not found in the data sub directory of the MCSTAS library location This way you do not need to have local copies of the McStas Library Data files see table 1 1 A usage example for this library part may be t_Table Table declare a t_Table structure char file BeO trm a file name double x y Table_Read amp Table file 1 initialize and read the first numerical block Table_Info Table display table informations x Table_Index Table 2 5 read the 3rd row 6th column element of the table Indexes start at zero in C y Table_Value Table 1 45 1 look for value 1 45 in 1st column x axis and extract 2nd column valu
172. ring An ideal powder sample consists of many small crystallites although each crystallite is sufficiently large not to cause measurable size broadening The orientation of the crystal lites is evenly distributed and there is thus always a large number of crystallites oriented to fulfill the Bragg condition nr 2dsin 8 8 10 where n is the order of the scattering an integer A is the neutron wavelength d is the lattice spacing of the sample and 20 is the scattering angle see figure 8 3 As all crystal orientations are realised in a powder sample the neutrons are scattered within a Debye Scherrer cone of opening angle 46 43 Equation 8 10 may be cast into the form IQ 2 k sind 8 11 where Q is a vector of the reciprocal lattice and k is the wave vector of the neutron It is seen that only reciprocal vectors fulfilling Q lt 2 k contribute to the scattering For a complete treatment of the powder sample one needs to take into account all these Q values since each of them contribute to the attenuation The strength of the Bragg reflections is given by their structure factors 2 gt bj exp R Q 8 12 J where the sum runs over all atoms in one unit cell This structure factor is non zero only when Q equals a reciprocal lattice vector Ris R 1538 rev ed EN 79 The textbook expression for the scattering cross section corresponding to one Debye Scherrer cone reads 44 ch 3 6 with V NVo being the to
173. rmi Chopper 6 2 2 Propagation in the Fermi chopper As can be seen in figure 6 3 neutrons first propagate onto the cylinder surface of the chopper yellow curve Then the program checks the interaction with the entrance of the slit package orange line and calculates which slit is hit If the slit coating is reflecting m gt 0 multiple reflections are calculated green blue and maroon circles otherwise the neutrons are absorbed as soon as they interact with the blades Finally the remaining neutrons propagate to the exit of the chopper red curve The rotation of the chopper is characterized by the angle 6 between the rotating z and the static z axis 6 t is defined by 6 t 2 2 w t to w t do where t is the absolute time to is the chopper delay and o is the chopper phase The chopper should better be time focussing slow neutrons should pass before the fast ones so that they finally hit the detectors at the same time Therefore the signs of w and are very important For t gt t is positive and points anti clockwise Since the rotation is applied along the y axis we can simplify the problem to two dimensions The orthogonal transformation matrix T from the static zx to the rotating 56 Ris R 1538 rev ed EN Z Component X Component Z m Time t X m Figure 6 4 The x and z component as a function of time in the rotating frame left
174. rom single crystals The simplest single crystals are in fact the monochromator components like Monochromator flat presented in section 7 1 The monochromators are models of a thin mosaic crystal with a single scattering vector perpendicular to the surface Much more advanced the component Single_crystal is a general single crystal sample with multiple scattering that allows the input of an arbitrary unit cell and a list of structure factors read from a LAZY Crystallographica file This component also allows anisotropic mosaicity and Ad d lattice space variation Isotropic small angle scattering is simulated in Sans_Spheres which models scattering from a collection of hard spheres dilute colloids Inelastic scattering from a dispersion is exemplified by the component Phonon_simple which models scattering from a single acoustic phonon branch For a more general sample model the Isotropic_Sqw component is able to simulate all kinds of isotropic materials Liquids glasses polymers powders etc with S q w table specified by an input file Physical processes include coherent incoherent scattering both elastic and inelastic with absorption and multiple scattering Moreover this component may be used concentrically to model a sample environment Thus it may handle most samples except single crystals Riso R 1538 rev ed EN 71 Sample Coherent Incoherent Process Elastic Inelastic Elastic Inelastic Absorption Multi Sc
175. s 20 22 In the case of a limited number of optical elements the so called acceptance diagram theory 10 23 24 may be used within which the neutron beam distributions are considered to be homogeneous triangular or Gaussian However real neutron instruments are constituted of a large number of optical elements and this brings additional complexity by introducing strong correlations between neutron beam parame ters like divergence and position which is the basis of the acceptance diagram method but also wavelength and time The usual analytical methods such as phase space theory then reach their limit of validity in the description of the resulting effects In order to cope with this difficulty Monte Carlo MC methods for a general review see Ref 25 may be applied to the simulation of neutron instruments The use of probability is common place in the description of microscopic physical processes Integrating these events absorption scattering reflection over the neutron trajectories results in an estimation of measurable quantities characterizing the neutron instrument Moreover using variance reduction importance sampling where possible reduces the computation time and gives better accuracy 16 Riso R 1538 rev ed EN Early implementations of the MC method for neutron instruments used home made com puter programs see 26 27 but more recently general packages have been designed pro viding models for most op
176. s area be as large as possible starting from 0 for both ranges If we use Wmin gt 0 dmin 2 0 Wmax gt 4E and dmax gt 2k we completely describe all scattering processes for incoming neutrons with wavevector k 47 This means that in order to correctly estimate the total intensity and multiple scattering the knowledge of S q w must be wider at least twice in q as stated previously than the measurable range in the corresponding experiment As a side effect a self consistent iterative method for finding the true scattering law from the measurement itself is not theorically feasible except for providing crude approximations However that measured dynamic structure factor may be used to estimate the multiple scattering for a further measurement using longer wavelength neutrons In that case extrapolating the scattering law beyond the accessible measurement ranges might improve substantially the accuracy of the method but this discussion is beyond the scope of this paper Consequently limiting the q integration in Eq 8 54 to the maximum momentum transfer for elastic processes 2k we write the total scattering cross section as N 2k 2k Jo os Ei qoS q dq 8 55 Using Eq 8 45 it is possible to define similar expressions for the coherent and incoherent terms O on F and Cinel Ei respectively These integrated cross sections are usually quite different from the tabulated values 8 since the latter are bound scattering cross se
177. s given by 2 9 N in ay Pi 1 Nbin 2 jal Wj fc P t Npinwi 3 8 TI where P is understood by the natural uniform sampling In order to set the criteria for adaption the Adapt check component is used see sec tion 3 8 The source attemps to sample only from bins from which neutrons are not ab sorbed prior to the position in the instrument at which Adapt check is placed Among those bins the algorithm attemps to minimize the variance of the neutron weights at the Adapt check position Thus bins that would give high weights at the Adapt check position are sampled more often lowering the weights while those with low weights are sampled less often Let 7 Pac po denote the ratio between the neutron weight p at the Adapt_check position and the initial weight po just after the source For each bin the component keeps track of the sum of m s as well as of the total number of neutrons n from that bin The average weight at the Adapt_source position of bin i is thus n We now distribute a total sampling weight of 6 uniformly among all the bins and a total weight of 1 8 among bins in proportion to their average weight X n at the Adapt_source position p 8 yy M4 Noin ee Ey n 3 9 Wi After each neutron event originating from bin 7 the sampling weight w is updated This basic idea can be improved with a small modification The problem is that until the source has had the time to learn th
178. s in the chopper right 6 2 FermiChopper The Fermi chopper Name FermiChopper Author M Poehlmann C Carbogno H Schober E Farhi Input parameters R YminYmaz V w length Nslit phase Optional parameters m Qc Ro a W curvature zero_time Notes validated 6 2 1 The chopper geometry and parameters The Fermi chopper is a rotating vertical cylinder containing a set of collimating slits slit package Main geometry parameters are the radius R minimum and maximum height Ymin and Ymax see Fig 6 3 In this implementation the slits are by default straight but may be coated with super mirror and curved Main parameters for the slits are the number of slits Nslit the length length and width w of each slit the width of the separating Cd blades is neglected The slit walls reflectivity is modelled just like in guide components by the m value m gt 1 for super mirrors the critical scattering vector Qe the slope of reflectivity a the low angle reflectivity Ro and the width of supermirror cut off W For m 0 the blades are completly absorbing The AT position of the component is its center The angular speed of the chopper is w 27v where v is the rotation frequency The angle phase for which the chopper is in the open state for most of the neutrons coming in z axis of the rotating frame parallel to the z axis of the static frame is also an input parameter The time window may optionally be shif
179. s known as importance sampling If e g a sample scatters isotropically over the whole 47 solid angle and all interesting directions are known to be contained within a certain solid angle interval AQ only these solid angles are used for the Monte Carlo choice of scattering direction According to Eq 2 9 the weight factor will then have to be changed by the amount 7 AQ 47 One thus ensures that the mean simulated intensity is unchanged during a correct direction focusing while a too narrow focusing will result in a lower i e wrong intensity since we cut neutrons rays that should have reached the final detector Riso R 1538 rev ed EN 19 Figure 2 1 Illustration of the effect of direction focusing in McStas Weights of neutrons emitted into a certain solid angle are scaled down by the full unit sphere area 2 4 Adaptive and Stratified sampling Another strategy to improve sampling in simulations is adaptive importance sampling also called variance reduction technique where McStas during the simulations will de termine the most interesting directions and gradually change the focusing according to that Implementation of this idea is found in the Source_adapt and Source_Optimizer components An other class of efficiency improvement technique is the so called stratified sampling It consists in partitioning the event distributions in representative sub spaces which are then all sampled individualy The advant
180. s should be used with caution Ris R 1538 rev ed EN 25 Source Name Ti l To Ip T3 Is factor PSI cold source 150 4 3 67e11 38 74 3 64e11 14 84 0 95e11 Irarget mA ILL VCS H1 216 8 1 24e13 33 9 1 02e13 16 7 3 042e12 ILL HCS H5 413 5 10 22e12 145 8 3 44e13 40 1 2 78e13 ILL Thermal H2 683 7 5 874e12 257 7 2 51e13 16 7 1 034e12 2 25 ILL Hot source 1695 1 74e13 708 3 9e12 Table 3 1 Flux parameters for present sources used in components Source_gen and Source_Maxwell_3 For some cases a correction factor to the intensity should be used to reach measured data for the PSI cold source this correction factor is the beam cur rent Itarget which is currently of the order 1 2 mA 3 5 Moderator A time of flight source pulsed Name Moderator Author System Mark Hagen SNS Input parameters rs Eo E1 zf w h To Ec Y Optional parameters Notes The simple time of flight source component Moderator resembles the source component Source_simple described in 3 1 Moderator is circular with radius r and focuses on a rectangular target of area w x h in a distance zf The initial velocity is chosen with a linear distribution within an interval defined by the minimum and maximum energies Eo and E1 respectively The initial time of the neutron is determined on basis of a simple heuristical model for the time dependence of the neutron intensity from a time of flight source For all
181. see the description of the Res_monitor component in section 10 5 Riso R 1538 rev ed EN 123 10 4 TOF Res sample A sample like component for TOF resolution calculation Name TOF_Res_sample Author System Input parameters Ti Tos h Tfocus Ltarget Ytarget target t0 At Optional parameters Zw Yh Zt Lfocus Yfocus Av focus Ah focus target index Notes The component TOF_Res_sample scatters neutron rays isotropically in position within a specified angular range As for Res_sample this component is meant for computation of the resolution function but in this case for one time bin in a time of flight TOF instrument The component selects uniformly the neutron energy so that neutron arrival time at the TOF detector lies within one time bin specified by to and At For actual calculations of the resolution function TOF_Res_sample should be used together with Res_monitor described in section 10 5 The shape of TOF_Res_sample is either a hollow cylinder or a rectangular box The hollow cylinder shape is specified with the inner and outer radius r and ro respectively and the height h If these parameters are unspecified the shape is instead a box of dimensions ty Yh and zz The component only propagates neutron rays that are scattered other rays are absorbed As for Res_sample the scattering probability is proportional to the neutron flight path length inside the sample The point of scattering i
182. simulates an infinitely thin single crystal with a single scattering vector Qo 27 dm perpendicular to the surface A typical use for this component is to simulate a simple monochromator or analyzer The monochromator dimensions are given by the length zw and the height yp As the parameter names indicate the monochromator is placed in the z y plane of the local coordinate system This definition is made to ensure that the physical monochromator angle often denoted A1 will equal the McStas rotation angle of the Monochromator component around the y axis Rg is the maximal reflectivity and 7 and ny are the horizontal and vertical mosaicities respectively see explanation below 7 1 1 Monochromator physics and algorithm The physical model used in Monochromator_flat is a rectangular piece of material composed of a large number of small micro crystals The orientation of the micro crystals deviates from the nominal crystal orientation so that the probability of a given micro crystal orientation is proportional to a Gaussian in the angle between the given and the nominal orientation The width of the Gaussian is given by the mosaic spread 7 of the Riso R 1538 rev ed EN 65 Figure 7 1 Selection of the Bragg order 2 in this case crystal given in units of arc minutes 7 is assumed to be large compared to the inherent Bragg width of the scattering vector often a few arc seconds The mosaicity gives rise to a Gaussia
183. son J Sci Instrum 43 1 1966 A K Freund Nucl Instr Meth 213 495 1983 V F Sears Acta Cryst A53 35 1997 G Shirane S M Shapiro and J M Tranquada Neutron Scattering with a Triple Azxis Spectrometer Cambridge University Press 2002 L Alianelli J Appl Cryst 37 732 2004 V Radeka IEEE Trans Nucl Sci NS 21 51 1974 Risd R 1538 rev ed EN 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 V Peskov G Charpak W Dominik and F Sauli Nucl Instr and Meth A277 547 1989 G Manzin B Guerard F A F Fraga and L M S Margato Nucl Instr Meth A535 102 2004 J R D Copley J Neut Research 1 21 1993 L D Cussen J Appl Cryst 36 1204 2003 F James Rep Prog Phys 43 1145 1980 J R D Copley P Verkerk A A van Well and H Fredrikze Comput Phys Commun 40 337 1986 D F R Mildner C A Pellizari and J M Carpenter Acta Cryst A 33 954 1977 P A Seeger L L Daemen T G Thelliez and R P Hjelm Physica B 283 433 2000 J Saroun and J Kulda Physica B 234 1102 1997 See website http omega ujf cas cz restrax D Wechsler G Zsigmond F Streffer and F Mezei Neutron News 25 11 2000 W T Lee and X L Wang Neutron News 13 30 2002 See website http www sns gov ideas E Farhi T Hansen A Wildes R Ghosh and K Lefmann Appl Phys A 74
184. st the equations in the polarimetrie neutronique notes by Francis Tasset and found to be consistent There can be sign differences between different publications depending on whether they use a right handed like e g McStas or a left handed like e g NISP coordinate system A 3 Polarized Neutron Scattering First we will give a short introduction to how calculations are done and then quote some results which are important for implementing the first McStas components Al the potentials nuclear magnetic and electric we will be interested in can be written on the form f A 16 The first term does not affect the spin while the second term can change the spin Let us just remind here that rXt X FyXt X FeXt Xt A 17 sX X SyXL TIX FX TX So that the interaction proportional to y and y results in spin flips while the interactions with conserves the spin It turns out to be smart to define a density matrix operator A T a ab a nee where x is the neutron wave function Eq A 5 and Z is the unit matrix Using the density matrix the elastic cross section can be written as 53 Eq 10 31 do ga TAS PATEA AVTA ATEA Ex A 19 A A where V is the interaction potential and it is understood that the trace is to be taken with respect only to the neutron spin coordinates The outgoing polarization is given as d ror f X 7 R Pp Tr t NO PATAVII EN I KJA E By A
185. structures LAZY Fullprof Crystallographica Data files as used by the component PowderN may also be read Data files of type lau and laz in the McStas distribution data directory are self documented in their header They do not need any additional parameters to be used as in the example Isotropic_Sqw lt geometry parameters gt Sqw_coh Al laz Other column based file formats may also be imported e g with parameters such as powder_format Crystallographica powder_format Fullprof powder_Dd 0 powder_DW 1 The last two parameters may as well be specified in the data file header with lines 106 Riso R 1538 rev ed EN Debye_Waller 1 Delta_d d 1e 3 The powder description is then translated into S q by using Eq 8 65 In this case the density p n Vo is the number of atoms in the inverse volume of the unit cell As the component builds an S q from the powder structure description the accuracy of the Isotropic_ Sqw component is limited by the binning during that conversion This is usually enough to describe sample environments including powders aluminium cop per but it is recommended to rather use PowderN for faster and accurate powder diffraction eventthough this latter does not implement multiple scattering Such files can only handle elastic scattering A list of common powder definition files is available in Table 1 2 page 13 Concentric geometries sample environment The component has been designed
186. t parameters Ti To h Tfoc Ttarget Ytarget target Optional parameters We hy tz Wfocus hfocus Wfoc angle hfoc angle Tabs Cinc Vo fpack far ftun T Etun targetindex Notes not validated The component Tunneling sample displays incoherent inelastic scattering as found in a number of systems e g containing mobile hydrogen For the sample geometry we default use a hollow cylinder which has the solid cylinder as a limiting case The sample dimensions are Inner radius ri outer radius ro and height h This geometry is the same as the default for V sample see figure 8 2 As for V_sample the sample geometry can be made rectangular by specifying the width Wg the height hy and the thickness tz Also the focusing properties are the same as for V_sample For the focusing is performed as a uniform distribution on a target sphere of radius rfoc at the position target Ytarget Ztarget in the local coordinate system The focusing can alternatively be performed on a rectangle with dimensions Wfocus Afocus or Uniformly in angular space in a small angle approxima tion using wWfoc angle Mfoc angle The focusing location can be picked to be a downstream component by specifying target_index The incoherent and absorption cross sections for V are default for the component For other choices the parameters inc Cabs and the unit cell volume Vo should be specified For a loosely packed sample also the packing
187. t the input of the component index To ignore a component effect use RESTORE_NEUTRON INDEX _CURRENT_COMP L Y Z VX vy VZ t S SY SZ p at the end of its TRACE section or in its EXTEND section These neutron states are in the local component coordinate systems e SCATTERED is a variable set to 0 when entering a component which is incre mented each time a SCATTER event occurs This may be used in the EXTEND sections to determine whether the component interacted with the current neutron ray e extend_list n amp arr amp len elemsize Given an array arr with len elements each of size elemsize make sure that the array is big enough to hold at least n elements by extending arr and len if necessary Typically used when reading a list of numbers from a data file when the length of the file is not known in advance e mcset_ncount n Sets the number of neutron histories to simulate to n e mcget_ncount Returns the number of neutron histories to simulate usually set by option n e mcget_run_num Returns the number of neutron histories that have been simu lated until now B 1 3 Coordinate transformations e coords_set x y z returns a Coord structure like POS_A CURRENT_COMP with x y and z members Riso R 1538 rev ed EN 139 coords _get P amp x amp y amp z copies the x y and z members of the Coord structure P into x y z variables coords_add a b coords_sub a b coords_neg a enable to operate
188. tal sample volume 3 Ocone ian Ol 8 13 Q For our purpose this expression should be changed slightly Firstly the sum over structure factors for a particular Q is replaced by the sum over essentially different reflections multiplied by their multiplicity j Then a finite packing factor f is defined for the powder and finally the Debye Waller factor is multiplied on the elastic cross section to take lattice vibrations into account no inelastic background is simulated however We then reach isi oo eo Or 8 14 cone Q JQ p V2 4sin0 G N 47 jol F Q fexp my 3 at 8 15 in the thin sample approximation For samples of finite thickness the beam is being attenuated by the attenuation coefficient HQ Feone Q V 8 16 For calibration it may be useful to consider the total intensity scattered into a detector of effective height h covering only one reflection 44 ch 3 6 A cut though the Debye Scherrer cone perpendicular to its axis is a circle At the distance r from the sample the radius of this circle is r sin 20 Thus the detector in a small angle approximation counts a fraction h 2rr sin 20 of the scattered neutrons giving a resulting count intensity fe Vocne aay 8 17 where W is the flux at the sample position For clarity we repeat the meaning and unit of the symbols w s m Incoming intensity of neutrons I s7 Detected intensity of neutrons h m Height of detector r m Distance from sa
189. ted to zero when setting the zero_time 1 option A phase guess value may be set automatically using the zero_time 2 option The curvature of the slit channels is specified with the curvature parameter Positive sign indicates that the deviation bump due to curvature is in the x positive side and the Risg R 1538 rev ed EN 55 Parameter unit meaning radius m chopper cylinder radius ymin m lower y bound of cylinder ymax m upper y bound of cylinder Nslit 1 number of chopper slits length m channel length of the Fermi chopper w m width of one chopper slit May also be specified as width w Nslit for total width of slit package nu Hz chopper frequency phase deg chopper phase at t 0 zero_time 1 shit time window around 0 if true curvature m71 Curvature of slits 1 radius of curvature m 1 alpha A Qc Z1 slit coating parameters See section 5 1 1 W ATI RO 1 Table 6 1 FermiChopper component parameters center of curvature is in the x negative side The optimal radius of curvature R is related to frequency v and neutron velocity v with v 4r Rv The component was validated extensivelly by K Lieutenant As an alternative one may use the Vitess_ChopperFermi component eventhough slower and without super mirror support or the FermiChopper_ILL contributed component The Guide_gravity com ponent has also a rotating mode using an approximation of a Fe
190. tering from any isotropic material such as liquids glasses amorphous systems poly mers and powders currently mono crystals cannot be handled The component treats coherent and incoherent neutron scattering and may be used to model most materials including sample environments with concentric geometries The structure and dynamics of isotropic samples can be characterised by the dynamic structure factor S q w which determines the interaction between neutrons and the sample and therefore can be used as a probability distribution of w energy and g momentum transfers It handles coherent and incoherent processes both for elastic and inelastic interactions The main input for Riso R 1538 rev ed EN 95 the component is S q w tables or powder structure files Usage examples of this component can be found in the Neutron site tests Test_Isotropic_Sqw the Neutron site ILL ILL_H15_IN6 and the ILL_TOF_Env instruments from the mcgui 8 7 1 Neutron interaction with matter overview When a neutron enters a material according to usual models it sees atoms as disks with a surface equal to the total cross section of the material ctot The latter includes absorption coherent and incoherent contributions which all depend on the incoming neutron energy The transmission probability follows an exponential decay law accounting for the total cross section For the neutron which is not transmitted we select a scattering position along the p
191. the normal end with ncount McStas simulation events We recommand to control the simulation on repeat count by using a very larger ncount value 122 Risd R 1538 rev ed EN 10 3 Res sample A sample like component for resolution calculation Name Res_sample Author System Alan Tennant HMI Input parameters T T h Tfocus target Ytarget Ztarget Fo AE Optional parameters w Yn 2d Lfocus Yfocuss Qv focus Qh focus target index Notes The component Res_sample scatters neutron rays isotropically in direction and uniformly in energy Regardless of the state of the incoming neutron ray all directions and energies for the scattered ray have the same probability within specified intervals The component is meant for computation of the resolution function but may also be used for test and debugging purposes For actual calculations of the resolution function Res_sample should be used together with Res_monitor described in section 10 5 The shape of Res_sample is either a hollow cylinder or a rectangular box The hollow cylinder shape is specified with the outer radius r and thickness respectively and the height h If these parameters are unspecified the shape is instead a box of dimensions w yn and zg The component only propagates neutron rays that are scattered other rays are absorbed The scattering probability is proportional to the neutron flight path length inside the sample to make a
192. the vector S sz Sy Sz which is propagated through the different components so it has the correct relative orientation in each component The probability for the spin to be parallel a given direction n is then P t n na A 10 This equation from 55 is easy to understand The average spin along n is n S and the probability then follows from Eq A 4 For an unpolarized beam S 0 and all directions are equally probable 50 Note that in our approach we do not decide if the neutron is up or down after a given component but instead keep track of as much information for as long as possible In the following we will use P to denote the polarization vector The most important variables used are 128 Riso R 1538 rev ed EN K Scattering vector P Polarization before a component ingoing PL Polarization perpendicular to scattering vector Pj A x P x amp P Polarization after a component outgoing 7 Unit vector in direction of atomic spin B 1 for a ferromagnet Fy Unit cell nuclear structure factor Fy Unit cell magnetic structure factor The unit cell nuclear structure factor is defined as Fy X exp ir d ba A 11 d where the d is the position of the d th atom within the unit cell and bg is the average of ba In the simple case of a single atom Bravais crystal one finds Fy K b The unit cell magnetic structure factor is useful when the atoms in the crystal only have spi
193. theless it is rather efficient enabling the user to increase the number of events at optimization criteria locations by typically a factor of 20 Hence the signal error bars will decrease by a factor 4 5 since the overall flux remains unchanged 3 9 1 The optimization algorithm When a neutron reaches the Monitor_Optimizer location s the component records its previous position x y and speed vz vy Vz when it passed in the Source_Optimizer Some distribution tables of good neutrons characteristics are then built When a bad neutron comes to the Source_Optimizer it would then have few chances to reach Monitor Optimizer it is changed into a better one That means that its position and velocity coordinates are translated to better values according to the good neutrons distribution tables The neutron energy v2 v7 v is kept as far as possible The Source_Optimizer works as follow 1 First of all the Source_Optimizer determines some limits min and maz for vari ables x Y Ur Vy Vz 2 Then the component records the non optimized flux distributions in arrays with bins cells default is 10 cells This constitutes the Reference source 3 The Monitor_Optimizer records the good neutrons that reach it and communi cate an Optimized beam requirement to the Source_Optimizer However retains keep percent of the original Reference source is sent unmodified default is 10 The Optimized source is thus Optimized
194. tical components of neutron spectrometers The most widely used packages are NISP 28 ResTrax 29 McStas 1 3 Vitess 30 and IDEAS 31 which allow a wide range of neutron scattering instruments to be simulated The neutron ray tracing Monte Carlo method has been used widely for guide studies 23 32 33 instrument optimisation and design 34 35 Most of the time the conclu sions and general behaviour of such studies may be obtained using the classical analytical approaches but accurate estimates for the flux resolution and generally the optimum parameter set benefit considerably from MC methods 2 1 1 Monte Carlo ray tracing simulations Mathematically the Monte Carlo method is an application of the law of large numbers 25 36 Let f u be a finite continuous integrable function of parameter u for which an integral estimate is desirable The discrete statistical mean value of f computed as a series in the uniformly sampled interval a lt u lt b converges to the mathematical mean value of f over the same interval b E E Faia 2 1 i 1 a lt u lt b a In the case were the u values are regularly sampled we come to the well known midpoint integration rule In the case were the u values are randomly but uniformly sampled this is the Monte Carlo integration technique As random generators are not perfect we rather talk about quasi Monte Carlo technique We encourage the reader to refer to James 25 for a detai
195. to unactivate the Optimizer file name Filename where to save optimized source distributions The file option will save the source distributions at the end of the optimization If no name is given the component name will be used and a src extension will be added By default no file is generated The file format is in a McStas 2D record style As an alternative you may use the Source_adapt component see section 3 7 which per forms a 3D phase space optimization 3 10 Monitor Optimizer Optimization locations for the Source_Optimizer Name Source_Optimizer Author E Farhi ILL Input parameters optim_comp Optional parameters Zmin Cmax YminsYmaxr Notes partially validated The Monitor_Optimizer component works with the Source_Optimizer component See section 3 9 for usage The input parameters for Monitor_Optimizer are the rectangular shaped opening coor dinates tmin Tmax Ymin Ymax and the name of the associated instance of Source_Optimizer used in the instrument description file one word without quotes As many Monitor_Optimizer instances as required may be used in an instrument for possibly more than one optimization location Multiple instances may all have an effect on the total intensity 36 Riso R 1538 rev ed EN 3 11 Other sources components contributed pulsed sources virtual sources event files There are many other source definitions in McStas Detailed pulsed source
196. true volume weighting of the sample The reason for this is that the resolution function of an instrument is independent of any sample properties such as scattering and absorbtion cross sections but will in general depend on sample size and shape The point of scattering inside the sample is chosen uniformly along the neutron flight path inside the sample and the scattered neutron ray is given a random energy and direction This energy is selected in the interval Eo AE Eo AE which hence must be chosen large enough to cover all interesting neutron energies Similarly the scattered direction is chosen in a user specified range either within a sphere of radius rfocus within a rectangular target with measures focus Yfocus Or in the specified angular range This target is positioned at the target Ytargets Ztarget point in space or using the target_index for which e g 1 is the further component 1 is the previous etc A special feature used when computing resolution functions is that the component stores complete information about the scattering event in the output parameter res_struct The information includes initial and final wave vectors the coordinates of the scattering point and the neutron weight after the scattering event From this information the scattering parameters Q w can be recorded for every scattering event and used to compute the resolution function For an example of using the information in the output parameter
197. ttern file as issued from Crystallographica For use with Single crystal PowderN and Isotropic Sqw Data h k 1 Mult d space 2Theta F squared Jaz Powder pattern file as obtained from Lazy ICSD For use with PowderN Isotropic_Sqw and possibly Single_crystal trm transmission file typically for monochromator crystals and fil ters Data k Angs 1 Transmission 0 1 rfl reflectivity file typically for mirrors and monochromator crys tals Data k Angs 1 Reflectivity 0 1 sqw S q w files for Isotropic SSqw component Data q w S q w Table 1 1 Data files of the McStas library 1 5 Component source code Source code for all components may be found in the MCSTAS library subdirectory of the McStas installation the default is usr local lib mcstas on Unix like systems and C mcstas lib on Windows systems but it may be changed using the MCSTAS environ ment variable In case users only require to add new features preserving the existing features of a com ponent using the EXTEND keyword in the instrument description file is recommended For larger modification of a component it is advised to make a copy of the component file into the working directory A component file in the local directory will in McStas take precedence over a library component of the same name 1 6 Documentation As a complement to this Component Manual we encourage users to use the mcdoc front end which enables
198. ures hkl_info and in an array of hkl_data structures one for each reciprocal lattice point in the list In addition for every neutron event an array of tau_data is computed with one element for each reciprocal lattice point close to the Ewald sphere Except for the search for possible 7 vectors all computations are done in local coordinates using the matrix U to do the necessary transformations 88 Riso R 1538 rev ed EN The list of reciprocal lattice points is specified in an ASCII data file Each line contains seven numbers separated by white space The first three numbers are the h k l indices of the reciprocal lattice point and the last number is the value of the structure factor F in barns The middle three numbers are not used and may be omitted they are nevertheless recommended since this makes the file format compatible with the output from the Crystallographica program 45 Any line beginning with any character of is considered to be a comment and lines which can not be read as vectors matrices are ignored The column signification may also explicitely be set in the data file header using any of the lines column_h lt index of the Bragg Qh column gt column_k lt index of the Bragg Qk column gt column_1 lt index of the Bragg Ql column gt column_F2 lt index of the squared str factor F 2 column b gt column_F lt index of the structure factor norm F column gt Other component paramet
199. utron events randomly either from a model or from a data file where A is the source area AQ is the solid angle of the diaphragm as seen from the source surface and AA is the width of the wavelength interval in which neutrons are emitted assuming a uniform wavelength spectrum The simulations are performed so that detector intensities are independent of the number of neutron histories simulated although more neutron histories will give better statistics If Ngim denotes the number of neutron histories to simulate the initial neutron weight po must be set to NMtotal EN P A Nsim Nsim where the source flux is now given a A dependence As a start we recommend new McStas users to use the Source_simple component Slightly more realistic sources are Source_Maxwell_3 for continuous sources or Moder ator for time of flight sources Optimizers can dramatically improve the statistics but may occasionally give wrong re sults due to misleaded optimization You should always check such simulations with shorter non optimized ones Other ways to speed up simulations are to read events from a file See section 3 11 for details po AQAX 3 2 Riso R 1538 rev ed EN 23 3 1 Source simple A simple continuous source with a flat energy wavelength spectrum Name Source_simple Author System Input parameters Ts Zoc W h Eo AE Y Optional parameters Ao d Notes Validated t 0 This co
200. vax vy vz is modified ALLOW_BACKPROP Indicates that the next propagation routine will not re move the neutron ray even if negative propagation times are found Further propa gations are not affected SCATTER This macro is used to denote a scattering event inside a component It should be used e g to indicate that a component has interacted with the neutron ray e g scattered or detected This does not affect the simulation see however Beamstop and it is mainly used by the MCDISPLAY section and the GROUP modifier See also the SCATTERED variable below B 1 2 Coordinate and component variable retrieval 138 MC_GETPAR comp outpar This may be used in e g the FINALLY section of an instrument definition to reference the output parameters of a component NAME CURRENT COMP gives the name of the current component as a string POS_A_CURRENT_COMIP gives the absolute position of the current compo nent A component of the vector is referred to as POS_A CURRENT_COMP i where tiS Y OT Z ROT _A CURRENT _ COMP and ROT _R CURRENT _ COMP give the ori entation of the current component as rotation matrices absolute orientation and the orientation relative to the previous component respectively A component of a rotation matrix is referred to as ROT_A_ CURRENT_COMP m n where m and n are 0 1 or 2 standing for x y and z coordinates respectively POS _A COMP comp gives the absolute position of the component with the nam
201. vents into a single value e g flux or onto an histogram grid The theory 25 shows that the accuracy of these estimates is a function of the space dimension d and the number of events N For large numbers N the central limit theorem provides an estimate of the relative error as 1 V N However the exact expression depends on the random distributions McStas uses a space with d 10 parameters to describe neutrons position velocity spin time We show in Table 2 1 a rough estimate of the accurarcy on integrals as a function of the number of records reaching the integration point This stands both for integrated flux as well as for histogram bins for which the number of events per bin should be used for N Riso R 1538 rev ed EN 21 Chapter 3 Source components McStas contains a number of different source components and any simulation will usually contain exactly one of these sources The main function of a source is to determine a set of initial parameters r v for each neutron ray This is done by Monte Carlo choices from suitable distributions For example in most present sources the initial position is found from a uniform distribution over the source surface which can be chosen to be either circular or rectangular The initial neutron velocity is selected within an interval of either the corresponding energy or the corresponding wavelength Polarization is not relevant for sources and we initialize the neutron average sp
202. vitation or from the Run dialog of mcgui or set the gravitation field strength G e g 9 81 on Earth This component is about 50 slower than the Guide component but has much more capabilities A contributed version Guide_honeycomb of this component exists with a honeycomb ge ometry 5 5 Bender a bender model non polarizing Name Bender Author Philipp Bernhardt Input parameters r Win l w h Optional parameters k d Rofa i s gt Qa i s gt Mja i s Qca is Wia i s Notes partly validated no gravitation support The Bender component is simulating an ideal curved neutron guide bender It is bent to the negative X axis and behaves like a parallel guide in the Y axis Opposite curvature may be achieved by a 0 0 180 rotation along Z axis 50 Ris R 1538 rev ed EN Bender radius r entrance width w and height h are required parameters To define the length you may either enter the deviation angle Win or the length l Three different reflectivity profiles Ro Qe W m a can be given see section 5 1 for outer walls index a for inner walls index 7 and for the top and bottom walls index s To get a better transmission coefficient it is possible to split the bender into k channels which are separated by partitions with the thickness of d The partitioning walls have the same coating as the exterior walls Because the angle of reflection doesn t change the routine calculates the ref
203. wald sphere with a plane 8 4 4 Computing the total coherent cross section To determine the total coherent scattering cross section the differential cross section must be integrated over the Ewald sphere do Ocoh EFE dQ 55 coh el For small mosaic we may approximate the sphere with the tangential plane and we thus get from 8 22 and 8 25 2 3 Ocoh r i G r k F dQ 8 29 0 1 27 1 ee f t to M t to ae F 0 dt 8 30 k Vo vV2r A pe Eau 1 27 e det L N i 2 Vo 10203 F saa aaa 8 31 3 2 a 2 det L NO 3 Vo 010203 F 8 32 det L 2r 5 2 e7 2 N FE 8 33 p2 Ve es 8 33 i Ocoh Y Oude 8 34 T As before we let g L71 t to so that dt det L dg Ris R 1538 rev ed EN 87 Neutron weight factor adjustment We now calculate the correct neutron weight adjustment for the Monte Carlo choices made In three cases is a Monte Carlo choice made with a probability different from the probability of the corresponding physical event When deciding whether to transmit the neutron or not when simulating absorption and when selecting the reciprocal lattice vector 7 to scatter from If the user has choosen a fixed transmission probability f transmit Ptransmit the neutron weight must be adjusted by P transmit m transmit TEA where P transmit exp 4 is the physical transmission probability Likewise for non t
204. y detailed simulation of a Soller collimator see section 4 5 The input parameters are w1 h1 we he and l to set the guide dimensions as for Guide entry window exit window and length k to set the number of channels d to set the thickness of the channel walls and Ro W Qez Qey Ar Ay Mg and my to set the supermirror parameters as described under Guide the names with x denote the vertical mirrors and those with y denote the horizontal ones 5 3 1 Algorithm The implementation is based on that of Guide 1 Calculate the channel which the neutron will enter 2 Shift the x coordinate so that the channel can be simulated as a single instance of the Guide component 3 do the same as in Guide 4 Restore the coordinates when the neutron exits the guide or is absorbed 5 3 2 Known problems e This component may produce wrong results with gravitation support Use Guide_gravity section 5 4 in this case e The focusing channeled geometry for k gt 1 and different values of w and w2 is buggy wall slopes are not computed correctly and the component leaks neutrons Riso R 1538 rev ed EN 49 5 4 Guide gravity A guide with multiple channels and grav itation handling Name Guide_gravity Author System Input parameters w1 hi w2 ha L k m Optional parameters d Ro Qc W a wavy chamfers kp n G Notes validated with gravitation support rotating mode This compone
205. y the time t to a random time at which it is possible to pass Of course there should be only one first chopper in any simulation To simulate frame overlap from a first chopper one can specify the number of frames to study by the parameter Npulse For more advanced chopper geometries than those mentioned above it is possible to set up a GROUP of choppers COMPONENT Chop1i DiskChopper omega 2500 R 0 3 h 0 2 theta_0 20 n 1 AT 0 O 1 1 RELATIVE Source GROUP Choppers COMPONENT Chop2 DiskChopper omega 2500 R 0 3 h 0 2 theta_0 20 n 1 phi_0 40 AT 0 O 1 1 RELATIVE Source Riso R 1538 rev ed EN 53 GROUP Choppers The result of such a DiskChopper GROUPing can be seen in figure 6 2 DiskChopper GROUP arrangement 0 2 PSD1 PSD1 sim ot X0 6 90216 dX 7 63337 YO 0 91963 dY 5 61107 1 0 077593 Err 0 900278955 N 7759 T 0 x 01 5 p a 02 5o 2 z Q a ie 0 3 w s x amp 0 4 g a L 1 1 20 10 0 10 20 0 3 0 2 0 1 0 0 1 0 2 X position em 29 Mar 2006 10 30 Figure 6 2 mcdisplay rendering and monitor output from a DiskChopper GROUP 54 Riso R 1538 rev ed EN zr Al Cd slit package length Z m Absorbing Chopper walls S 1 L N Fa 0 04 0 02 0 0 02 0 04 Figure 6 3 Geometry of the Fermi chopper left and Neutron
206. y times before exiting the sample A bilinear interpolation for the g w determination is used to improve the accuracy on the scattered intensity but it may be unactivated when setting parameter interpolate 0 This will often result in a discrete q w sampling As indicated in the previous section the Isotropic_ Sqw component is not as efficient as PowderN for powder single scattering but handles scattering processes in a more accurate way secondary extinction multiple scattering 8 7 4 The implementation Geometry The geometry for the component may be box cylinder and sphere shaped either filled or hollow Relevant parameters for this purpose are as follow Riso R 1538 rev ed EN 103 104 Parameter type meaning Sqw_coh string Coherent scattering data file name Use 0 NULL or to disable Sqw_inc string Incoherent scattering data file name Use 0 NULL or to scatter isotropically Vanadium like sigma_coh barns Coherent scattering cross section 1 to disable sigma_inc barns Incoherent scattering cross section 1 to disable sigma_abs barns Absorption cross section 1 to disable V_rho A 3 atomic number density May also be specified with molar weight weight in g mol and material density in g cm T K Temperature 0 disables detailed balance xwidth m yheight m dimensions of a box shaped geometry zdepth m radius_o m dimensions of a cylinder shaped
Download Pdf Manuals
Related Search
Related Contents
BLU Dash JR 0.5GB Black Dealer Manual - Amazon Web Services M. M. BOIARDO User Manual - Tele System 安全上のご注意 取扱説明書 INSTRUCTION MANUAL Manuel Instruction Thermopompes HCW SYSTÈMES High-Speed M Series Multifunction DAQ for USB MBW EcoStar 100 Bloody Mary Copyright © All rights reserved.
Failed to retrieve file