McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics NEXMAP


About McStas
 Conditions of use
 Project funding

 Other Downloads (share)

Mailing list

Search web/mailinglist

 McStas manual
 Known problems
 C Compilers



Links <- UPDATED!

Report bugs


McStas - A neutron ray-trace simulation package

McStas is a general tool for simulating neutron scattering instruments and experiments. It is actively supported by DTU Physics, NBI KU, ESS, PSI and ILL

Simulated scattering from a hollow-cylinder vanadium sample.

The plot shows the intensity of scattered neutrons (red is highest intensity). The sample is at the center of the sphere with the neutron beam coming from the left. Clearly seen is the shadowing effect of the sample causing a lower intensity opposite the beam. Also seen is the effect of the non-symmetric geometry of the sample, causing lower intensity directly above and to the side of the sample.

Recent news

December 12th, 2018: McStas 2.5 release!

Dear all,

Our 20-year anniversary release McStas 2.5 has been built and is ready for download! Download and installation instructions are available via our GitHub download pages

Selected highligts from the release are listed below. The full list of changes is also available at

Greetings and merry X-mas from the McStas team - hope you will enjoy this new release! :-)

Peter Willendrup

Changes in McStas v.2.5, December 12th, 2018

McStas 2.5 is the seventh release in the 2.x series and fixes various issues with McStas 2.4.1, plus many new developments. McStas 2.5 is also the 20th anniversary release of McStas - 1.0 was released in October 1998!

Thanks to all contributors of components, instruments etc.! This is what Open Source and McStas is all about!

Our install docs are now available on the McCode GitHub page at

Fixes of issues from last release:
A number of issues from 2.4.1 were corrected, see the relevant GitHub issues for details:

Plus lots of work in general:


  • As for the earlier few releases the default set of tools are Python-based and developed by Jakob Garde, DTU.
  • BUT: Please use the Python tools and provide feedback rather than sticking with the Perl! :-)
  • Feature developments:
    • mcgui: For a quick visualisation of your instrument, simply useSimulation -> Display-2D and Display-3D (will use the default instrument parameters)
    • mcgui: The run-dialogue now gives quick access to all mcdisplay and mcplot utilities as comboboxes
    • mcdoc: We now provide a mcdoc utility based on Python


  • Our Windows release is finally 64bit. Also further prepackages GSL for use e.g. with Multilayer_sample.comp from R. Dalgliesh (ISIS)
  • If you want to use NeXus and / or MPI on Windows, please ensure to install Strawberry perl!


  • NCrystal library from T. Kittelmann (ESS) and X.X. Cai (DTU Nutech/ESS) is distributed with McStas on Unix platforms. To use it, carry out the below steps:
    • !!! To enable ncrystal with McStas on Linux systems please:
      • install the mcstas-ncrystal-2.5 package
      • (re-)install the mcstas-tools-python-mcrun-2.5 package
    • mcstas:~/NCryst$ mcstas-2.5-environment
    • mcstas:~/NCryst$ source $MCSTAS/ncrystal/
    • mcstas:~/NCryst$ ncrystal_preparemcstasdir
    • mcstas:~/NCryst$ cp $MCSTAS/examples/NCrystal_example_mcstas.instr .
    • mcstas:~/NCryst$ mcrun -c NCrystal_example_mcstas.instr
  • MCPL library from the same authors now included at v. 1.2.3


  • Single_crystal_inelastic.comp is a development from Duc Le (ISIS) and presents our attempt at a general, inelastic single crystal component. iFit can be used to generate its input, see
  • E_4PI.comp is a monitor also from Duc Le, used to illustrate the output of his inelastic component in the instrument Test_Single_crystal_inelastic.instr
  • Magnon_bcc.comp is new inelastic component from K. Lefmann (KU), used in Test_Magnon_bcc_TAS.instr and Test_Magnon_bcc_2D.instr
  • Isotropic_Sqw.comp from E. Farhi has recieved a number of important edits, including correctiono of a bug found by S. Bellissmia (CNR) relating to detailed balance
  • PowderN received a bugfix from M. Bertelsen (KU) and a set of focusing patches from J. Saroun (NPI)
  • NPI_tof_dhkl_detector.comp and NPI_tof_theta_monitor.comp are new monitor components from J. Saroun (NPI), used in his model of the ESS BEER instrument, see below
  • Guide_multichannel.comp is a new component from J. Saroun (NPI), based on Guide_channeled.comp. It allows to simulate bi-spectral extraction optics.
  • Sqq_w_monitor.comp is a development from P. Willendrup (DTU) and is a "scattering plane" monitor that outputs a set of energy-slices over a (qh,qk) reciprocal space plane, used in Test_Magnon_bcc_2D.instr
  • Pol_guide_mirror.comp is a development from E. Knudsen (DTU) which among other use cases allows to simulate a so-called "frame overlap mirror" as envisioned for multiple ESS instruments
  • Pol_Bfield.comp from E. Knudsen (DTU) has been updated to allow more flexible geometry and "rotatable" tabulated field descriptions. It replaces Pol_simpleBfield which is now in obsolete.
  • Absorber.comp received a bugfix thanks to Artur Glavic (PSI)
  • FermiChopper.comp had a long-standing issue when using supermirror coatings in the slit-package which is now fixed, thanks to Ryoichi Kajimoto (J-PARC)
  • All monitors can now suppress file-output when their standard input parameter "nowritefile" is true. The idea is to be able to suppress (some) output at runtime, e.g. in simulations with lots of monitors.


  • ESS_Testbeamline_HZB_V20.instr from Alaa Al-Falahat and Robin Woracek (ESS/HZB) is a model of the ESS test- beamline in Berlin
  • ESS_BEER_MCPL.instr from J. Saroun (NPI) is a model of the ESS BEER secondary spectrometer. It uses MCPL input calculated via SIMRES
  • BTsimple.instr from P. Willendrup (DTU) shows a simple method to calculate brillance transfer through a guide system
  • ILL_H142_D11.instr and ILL_H142_D33.instr from E. Farhi (ILL) are models of the optics in the two well-known ILL SANS instruments
  • ILL_H5_new.instr from E. Farhi (ILL) is a model of the ILL IN5 spectrometer after the guide upgrade in 2011
  • ILL_IN5_Spots.instr modified byP. Willendrup (DTU) is a model of the ILL IN5 spectrometer with multiple resolution-calculation options
  • ISIS_IMAT.instr from G. Burca (ISIS) is a model of the ISIS IMAT engineering-beamline
  • ISIS_SANS2d_Mantid.instr from T. R. Nielsen (ESS) is a model of the ISIS SANS2d instrument with sample and a Mantid output possibility
  • ISIS_TOSCA_preupgrade.instr and ISIS_TOSCA_preupgrade_Mantid.instr from P. Willendrup and S. Mukhopadhyay, based on an earlier model by M.Zanetti are models of the TOSCA spectrometer at ISIS
  • NCrystal_example_mcstas.instr by X.X. Cai (DTU/ESS) is used to illustrate the use of the NCrystal library in McStas
  • Test_DiskChoppers.instr by P. Willendrup (DTU) compares the use of 2 DiskChoppers with one MultiDiskChopper
  • Test_Magnon_bcc_TAS.instr from K. Lefmann (KU) and Test_Magnon_bcc_2D.instr P. Willendrup (DTU) illustrate the use of the new Magnon_bcc.comp
  • Test_Single_crystal_inelastic.instr from Duc Le (ISIS) is a test instrument for Single_crystal_inelastic.comp
  • Test_Pol_Guide_mirror.instr from E. Knudsen (DTU) is a test instrument for Pol_guide_mirror.comp
  • Test_focus.instr from T. Weber (ILL) compares focusing by Single_crystal and Monochromator_curved

We hope you will enjoy this 20th anniversary release!!!

November 6th, 2018: McStas user survey 2018

Dear all,

To assess the current use of McStas, we have put together the below survey for users of our neutron Monte Carlo ray-tracing package.

Using the survey results, we hope to gain insight and statistics on the McStas user community, where it is currently based, which operating systems and computing infrastructures are used, and to what satisfaction the package, support infrastructure and documentation is used. The survey should also give us a clear picture where to focus our future efforts.

We hope you will help us by investing a few minutes in the survey:

On behalf of the McStas team,
Peter Willendrup

September 29th, 2018: Release 2.4.1 works OK on macOS 10.14 Mojave

Dear all,

I can confirm that the latest McStas works fine on the newest macOS release, even though the distributed "Check-PL-dependencies" script will report both 10.13 and 10.14 as an unsupported macOS releases.

If you need to install our Perl-based tool chain on 10.13 High Sierra or 10.14 Mojave, the easiest way is to download an updated version of the above script, get it from our GitHub (I will also put a copy alongside the existing .tgz for download)

If, after an upgrade to Mojave you get compilation issues with the error message

mccode-r.h:39:18: fatal error: math.h: No such file or
then please run the following commands in a terminal:
  • xcode-select --install
    - to initiate installation of updated Xcode commandline tools
  • sudo open
    - to install the development headerfiles in the usual /usr/include location

May 18th, 2018: MDANSE 2018

Does the combination of DFT or classical MD with McStas for modeling experimental data sound interesting?

If so, please consider participating in the MDANSE 2018 event in Tenerife this fall. Registration closes on May 31st 2018.

(You can also read more in this a post to mcstas-users)

April 30th, 2018: Release 2.4.1 works OK on Ubuntu 18.04 + a workaround

Dear all,

I have tested McStas 2.4.1 with the recent Ubuntu 18.04 LTS "bionic beaver", and the usual installation recipe works.

The only found issue so far relates to the behaviour of the Perl+PGPLOT plotter which out of the box fails with the error message: "%giza - ERROR - giza_open_device: Unknown device, device not opened" (see below graphics also).

(In fact the problem was known already for Debian testing, see our related GitHub issue)

The following solutions/workarounds exist:

  1. Recommended:
    Use the Python-based pyqtgraph plotter instead, i.e. mcplot (or mcplot-pyqtgraph). This would give you graphics like this:
  2. Configure pgplot/giza for "XWIN" driver:
    Either edit your /usr/share/mcstas/2.4.1/tools/Perl/perl/mccode_config.perl replacing XSERV with XWIN or set the related environment variable in the shell, i.e.
    export PGPLOT_DEV=/XWIN
    The solution will give you this appearance:
  3. Force-configure to use the legacy PGPLOT:
    Use these commands in a shell and get your "normal" PGPLOT window back
    • cd /usr/lib/x86_64-linux-gnu
    • sudo ln -sf ../
    • sudo ln -sf ../
    The solution will give you this appearance (as usual):

March 2018: McStas-McXtrace team participates in GPU Hackathon

As some of you may have already seen via our facebook page or on twitter, a joint McStas-McXtrace team visited the 2018 GPU Hackathon in Dresden in March.

We can not a such claim that the software fully runs on NVIDIA GPU's, but we certainly gained knowledge and will investigate further. :-)

The team pariticpating in Dresden were

  • DTU: Peter Willendrup, Jakob Garde, DTU Physics and Giovanni Fevola, DTU Energy
  • ILL: Emmannuel Farhi, ILL Spectroscopy Group / Computing for Science
  • UCPH: Mads Bertelsen, Niels Bohr Institute

Here is a few photos from the event - and also a PDF from the final presentation, put together by Mads Bertelsen, University of Copenhagen

Previous news items: 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003,2002, 2001, 2000, 1999, 1998.

Last Modified: Thursday, 13-Dec-2018 12:29:02 CET
Search website mailinglist archive GitHub repos