Routines for optimizing neutron scattering instruments with McStas.
We present software routines for simulating the transport of thermal neutrons through materials relevant for neutron instrumentation. The elastic interactions in different types of textured polycrystals are modelled and implemented in the routines. Three limit cases of textures are explicitly considered: powder texture, with uniform distribution of grain orientations, mosaic single crystal texture, with a distribution of orientations sharply peaked about one direction, and ideal fibre textures. Sharp textures can be modelled as combinations of these three limit textures. For polycrystals with mild textures, a different method is used. The inelastic scattering is treated in the incoherent approximation, including multi-phonon terms of arbitrary large order. The routines have been implemented in the McStas software package.