Monte Carlo ray-tracing packages for neutrons
In the early 1990'ies, simulation of the optics in a neutron instrument was performed mostly by monolithic Monte Carlo codes. Although being marvelous pieces of work, these codes were mostly written as one-person projects with limited manpower resources. Hence, the codes were designed to solve only one particular problem. They were thus subject to lack of generality, possible programming mistakes, low documentation level, and limited user-friendliness. (One notable exception from this is the package NISP.)
Today, a fair number of well-tested and documented general freeware packages exists for neutron ray-tracing simulations. Each package has the aim of enabling neutron scientists (and students) to quickly set up simulations. The development projects of the package co-exist in an atmosphere of collaboration and friendly competition for users. The collaboration between the three European packages were 2004-2012 supported by a European Union research project, MCNSI[6]. The 5 currently maintained packages are listed in Table xx--CrossReference--tab:MCpackages--xx.
The main author of these notes is also a co-author of the McStas package. However, we have kept the text part of these notes free from reference to any particular package, to the extent possible. The hands-on problems om simulations found on the McStas simulation projects page are related directly to the McStas package, but could with little effort be "translated" into covering any other simulation package.
Describing the neutron optical components
In the simulation packages, the individual optical components (or modules), like source, guide, sample, and detector, are parametrized and pre-programmed. Each package contains a library of well-tested components that cover the most often used optical ones, as well as some model samples. It is, however, possible for the user to program additional components when needed. Some of these components may later find their way into the corresponding library, which is thus strengthened by user contributions.
Some of the components contain full quantum mechanical treatment of the neutron as a wave on the microscopic length scales to compute the correct physics of the component, e.g. diffraction from a crystal. However, it should be emphasized that quantum mechanics is only present in the simulations at this level of description. The transport of rays between components is performed by classical kinematics, possibly including gravity.
Describing and visualizing the neutron instrument
It is the task of the user (the simulator) to assemble the components into a full working instrument. The Monte Carlo simulation itself is then performed by the simulation package on the basis of the instrument description.
All packages have features to visualize the instrument geometry, the simulated rays, and the monitor/detector data.
Varying and optimizing the instrument parameters
The packages give the opportunity to perform a series of simulations, where one or more instrument parameters are systematically varied. In this way, it is possible to perform a scan of one or more instrument parameters and plot some key data, e.g. the neutron counts in a monitor, as a function of the scanned parameter(s). The packages can automatically produce such plots.
In addition, some packages are able to vary a number of instrument parameters to perform optimization of the instrument settings. Many numerical optimization methods exist, and we will not here go into details. General about the optimizations is, however, that the user should define a certain Figure of Merit (FoM) for the optimizer to maximize. This could be the number of neutrons at the sample, the reciprocal of the beam spot size (if a narrow beam is wanted), the reciprocal width of the neutron energy distribution (if a monochromatic beam is desired), or any combination of these. The optimal parameter settings of course depend upon the choice of the FoM, and hence a careful selection is necessary.
Virtual experiments
Using a detailed instrument description with a realistic sample model, it is possible to produce a computer model of a complete neutron experiment. This virtual instrument can then be controlled with software that resembles the actual instrument control program, and the simulation data can be analyzed with the same tools as used for real experimental data. This is known as a virtual experiment. It is foreseen by many scientists in the field that virtual experiments can be used to support and complement experimental activities in a number of ways[7]:
- In the design phase of an instrument it can be investigated how the instrument will perform certain key experiments. This can in turn be used to optimize the instrument design[8].
- When applying for beam time at a facility, the experimentalists can estimate whether the experiment will be feasible at a given instrument and how much beam time is needed.
- Experiments (and experimentalists) can be prepared prior to performing the actual experiment by analyzing the optimal instrument configuration[9].
- Running experiments can be diagnosed "on the fly" to faster react on various mistakes and unexpected results.
- Analysis of the data can be conducted in more detail by including instrument-related features in the data analysis[10].
- New data analysis programs can be benchmarked against virtual data from known samples[11].
- Students and new users can be trained before their first actual experiment. This is, in fact, the general idea behind the simulation problems in these notes.
Performing the ray-tracing simulations
Since the (neutron) rays in the simulations are non-interacting and in principle statistically independent, the simulations can without methodological problems be carried out in parallel on several computers. Many packages are equipped to parallize the simulations automatically, and the performance has been seen to scale linearly with the number of processors up to at least 1000.
Hence, the technique of neutron ray-tracing simulations can take full advantage of the large parallel supercomputers emerging in many research facilities and universities.
- ↑ See the NISP home page http://www.paseeger.com
- ↑ See the IDEAS home page http://www.ornl.gov/~xwl/publications/NeutronNews-2002.pdf
- ↑ See the McStas home page http://www.mcstas.org
- ↑ See the VITESS home page http://www.hmi.de/projects/ess/vitess
- ↑ See the RESTRAX home page http://omega.ujf.cas.cz/restrax
- ↑ See the home page of the MCNSI part of NMI3 http://www.mcnsi.risoe.dk
- ↑ K. Lefmann et al. J. Neutr. Res. (in press) (2009).
- ↑ A. Vickery et al, J. Jap. Phys. Soc., in print (2013)
- ↑ P.K. Willendrup et al., Physica B, vol. 385-386, p. 1032-1034 (2006)
- ↑ L. Udby et al., Nucl. Instr. Meth. A, vol. 634, p. S138 (2011)
- ↑ P.L.W. Trigenna-Piggott, J. Neutr. Res., vol. 16, p. 13 (2008)