What makes scientists happy? Probably collect good quality data, pushing the instruments to their limits, and fit that data to physical models. Among available measurement techniques, neutron scattering provides a large variety of spectrometers to probe structure and dynamics of all kinds of materials.
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, spatial and time distributions) in a way which, for simple neutron beam configurations, may be modeled with analytic methods. This is valid for individual elements such as guides [MLS63; Mil90], choppers [Low60; Cop03], Fermi choppers [FMM47; Pet05], velocity selectors [Cla+66], monochromators [Fre83; Sea97; SST02; Ali04], and detectors [Rad74; Pes+89; Man+04]. In the case of a limited number of optical elements, the so-called acceptance diagram theory [Mil90; Cop93; Cus03] 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 parameters like divergence and position - which is the basis of the acceptance diagram method - but also wavelength and time. The usual analytic 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. [Jam80]) 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.
Early implementations of the MC method for neutron instruments used home-made computer programs (see [Cop+86; MPC77]) but, more recently, general packages have been designed, providing models for most optical components of neutron spectrometers. The most widely-used packages are NISP [See+00], ResTrax [SK97], McStas [Wil+14; LN99; Mcs], Vitess [Wec+00], and IDEAS [LW02], 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 [Cop93; Far+02; Sch+04], instrument optimization and design [ZLa04; Lie05]. Most of the time, the conclusions and general behavior of such studies may be obtained using the classical analytic approaches, but accurate estimates for the flux, resolution and generally the optimum parameter set, benefit considerably from MC methods, see Chapter 2.
Neutron instrument resolution (in \(q\) and \(E\)) and flux are often limitations in the experiments. This then motivates instrument responsibles to improve the resolution, flux and overall efficiency at the spectrometer positions, and even to design new machines. Using both analytic and numerical methods, optimal configurations may be found.
But achieving a satisfactory experiment on the best neutron spectrometer is not all. Once collected, the data analysis process raises some questions concerning the signal: what is the background signal? What proportion of coherent and incoherent scattering has been measured? Is possible to identify clearly the purely elastic (structure) contribution from the quasi-elastic and inelastic one (dynamics)? What are the contributions from the sample geometry, the container, the sample environment, and generally the instrument itself? And last but not least, how does multiple scattering affect the signal? Most of the time, the physicist will elude these questions using rough approximations, or applying analytic corrections [Cop+86]. Monte-Carlo techniques also provide means to evaluate some of these quantities.
Technicalities of Monte-Carlo simulation techniques are explained in detail in Chapter 2.
Initially, the McStas project had four main objectives that determined its design.
Correctness. It is essential to minimize the potential for bugs in computer simulations. If a word processing program contains bugs, it will produce bad-looking output or may even crash. This is a nuisance, but at least you know that something is wrong. However, if a simulation contains bugs it produces wrong results, and unless the results are far off, you may not know about it! Complex simulations involve hundreds or even thousands of lines of formulae, making debugging a major issue. Thus the system should be designed from the start to help minimize the potential for bugs to be introduced in the first place, and provide good tools for testing to maximize the chances of finding existing bugs.
Flexibility. When you commit yourself to using a tool for an important project, you need to know if the tool will satisfy not only your present, but also your future requirements. The tool must not have fundamental limitations that restrict its potential usage. Thus the McStas systems needs to be flexible enough to simulate different kinds of instruments as well as many different kind of optical components, and it must also be extensible so that future, as yet unforeseen, needs can be satisfied.
Power. “Simple things should be simple; complex things should be possible”. New ideas should be easy to try out, and the time from thought to action should be as short as possible. If you are faced with the prospect of programming for two weeks before getting any results on a new idea, you will most likely drop it. Ideally, if you have a good idea at lunch time, the simulation should be running in the afternoon.
Efficiency. Monte Carlo simulations are computationally intensive, hardware capacities are finite (albeit impressive), and humans are impatient. Thus the system must assist in producing simulations that run as fast as possible, without placing unreasonable burdens on the user in order to achieve this.