Instrument Simulations and Virtual Experiments

The NexMaP simulation effort revolves around two world class software packages; McStas (neutron scattering) McStas homepage and McXtrace (X-rays) McXtrace homepage. The packages are designed to simulate any and all neutron and X-ray scattering instruments and experiments.

McStas and McXtrace are:

  • Open Source (GPL)
  • Multiplatform
  • Fast and Scalable
  • Extendable

Ray Tracing

McStas and McXtrace both use the principle of Ray-Tracing.

  • Each ray is independent: The code becomes inherently parallel and suitable for cluster computations.
  • Each ray represents any number of of real particles: Efficient calculations and decouples simulation run time from the source.


McStas is used at all major neutron facilities around the word; Research reactors and Spallation sources alike.

McXtrace is used at many X-ray scattering facilities around the word. Much of the current usage is focused around synchrotrons, FELs and the like. Recently it has found use in X-ray telescope design.

Workshops past and future

The simulation group makes it a priority to hold and attend workshops/tutorials and conferences - in an effort to help our users reach their goals and gain valuable insights in new instrument developments. Recent and upcoming events include:

  • McStas school at ISIS, Oxfordshire, UK, April 23rd-25th, 2017
  • McXtrace demo at SPIE Optics+Photonics, San Diego, CA, Aug. 6th-10th, 2017


McStas is a proven tool which has been used in neutron scattering for >10 years. Benchmarking efforts are vital - against experiments where viable - if not then against other neutron optic computer codes.


We are actively working with groups within DTU and around the world for new developments and validation/benchmarking efforts:

McXtrace is a younger sibling, nonetheless it is being validated and benchmarked in the same manner. We are currently pursuing efforts together with groups at:

McXtrace: Current projects and main themes

Student Projects

Projects can be tailored to almost any level, harnessing the modular nature of McStas/McXtrace, either as combinations with experiments or purely theoretical exercises. Current Examples: - Mirror deformations and their effect on telescope performance - Module displacement (during launch) and focusing properties of telescopes. Simulation details: A bit of detailed information on the workings of McStas and McXtrace. Please refer to the homepages for in depth information McStas homepage and McXtrace (X-rays) McXtrace homepage.

Instrument Build-up, How?
The main piece of a McStas/McXtrace simulation is the instrument file. In it simplest form this is a description of the devices (components) present in a beamline simulation. There is close to a 1-to-1 correspondence between devices at a real scattering beamline and modules in a simulation.

Modular Design
The McStas working procedure is as follows: 1. Each optical device in a scattering experiment is modelled by its own independent piece of code. 2. The collection of modules is assembled into an auto-generated C-program 3. The generated code is compiled for the target module including optimisations for the target system The independent modules themselves are C-modules.


Erik Bergbäck Knudsen
Research Engineer
DTU Physics
+45 21 32 66 55


Peter Kjær Willendrup
Senior Research Engineer, Special Consultant
DTU Physics
+45 21 25 46 12