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

 Linux Install (deb/rpm)
 Mac OS X Install
 Unix Install (src code)
 Windows Install
 Other Downloads (share)

Mailing list

Search web/mailinglist

 McStas manual
 Known problems
 C Compilers




Report bugs


McStas Ubuntu live-dvd

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

May 19th, 2017: Three minor bugs/annoyances with 2.4

Three minor bugs/annoyances with 2.4 have been found, and now have fixes / workarounds:
  1. If you experience that your Python mcgui File->Preferences dialogue crashes (Issue 470), please:
    • Linux deb: sudo apt-get install --reinstall mcstas-tools-python-mccodelib-2.4
    • Linux rpm: sudo yum reinstall mcstas-tools-python-mccodelib-2.4
    • MacOS / Windows: Manually replace the file as described in the issue link
  2. The MCPL_output component was shipped with a silly off-by-one error that may prevent you from merging the output. (Issue 475)
  3. On older Ubuntu's (14.04 tested), the dependency python3-pyqtgraph is not available (Issue 471)

We envisage that new issues can occur over the next weeks, and aim to fix these by a minor update release.

Please report any bug found to our GitHub issue system

Best and happy simulating! :-)

May 18th, 2017: Minor bug with McStas 2.4

A minor bug with McStas 2.4 has been found, which prevents the user from starting the File->Configuration dialogue in mcgui. If you encounter an error message like
/usr/share/mcstas/2.4/tools/Python/mcgui/../mccodelib/ SyntaxWarning: name 'configuration' is used prior to global declaration
  global configuration
user config does not exist: /home/farhi/.mcstas/2.4/mccode_config.json
Traceback (most recent call last):
  File "/usr/share/mcstas/2.4/bin/../tools/Python/mcgui/", line 615, in handleConfiguration
  File "/usr/share/mcstas/2.4/tools/Python/mcgui/", line 171, in showConfigDialog
    dlg = McConfigDialog()
  File "/usr/share/mcstas/2.4/tools/Python/mcgui/", line 1007, in __init__
    prefix = mccode_config.get_mccode_prefix()
AttributeError: 'module' object has no attribute 'get_mccode_prefix'
You should:
  • Deb/RPM Linux: install the package mcstas-tools-python-mccodelib-2.4 again
  • macOS: Place this configuration file in your /Applications// folder (hint: run 'open $MCSTAS' from the terminal and you should get a finder window in /Applications//
  • Windows: Place this configuration file in your C:\mcstas-2.4\lib\tools\Python\mccodelib folder (hint: run 'start %MCSTAS%' from the terminal and you should get an explorer window in C:\mcstas-2.4\lib)
Sorry for any inconvenience caused!

May 18th, 2017: Updated install instructions.

Dear all,

The content of the installation pages have been updated, please consult

May 17th, 2017: McStas 2.4 release!

Dear all,

McStas 2.4 has been released and is ready for download via

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

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

Peter Willendrup

Changes in McStas v.2.4, May 17th, 2017

McStas 2.4 is the fifth release in the 2.x series and fixes various issues with McStas 2.3, plus provides important new developments.

Note that we only provide 64 bit packages now, with the exception of Debian systems and the Windows platform! (32bit packages for a given platform can be made available on request)

  • Tools:
    • From 2.4 we will default to use our new set of Python tools, developed by Jakob Garde, DTU.
    • A mcgui editor with rich syntax highlighting
    • A mcrun utility script, with a few new features wrt. the legacy perl solution.
    • A newly developed mcplot-pyqtgraph, optically similar to the legacy mcplot solution, but with new features.
    • A newly developed mcdisplay-webgl
      • Fully 3D and interactive, uses your HTML5-capable browser with javascript controls
      • Pause or resume visualisation of the neutron rays in the instrument
      • Allows to keep already rendered rays to illustrate the full beam
      • Visualises rays with color, scaled with particle velocity (ideal for illustrating e.g. monochromatisation)
    • A newly developed mcdisplay-pyqtgraph, modeled after the legacy mcdisplay tool, but with various improvements
    • The cif2hkl software from iFit ( is provided with McStas for easy generation of reflection lists for the Single_crystal and PowderN components
  • Components and instruments:
    • A new set of components referred to as "Union"components, contribution by Mads Bertelsen Uni Copenhagen.
      • Allows very rich simulation of samples and sample environment
      • Several instrument files included to illustrate the capabilities and use
      • See his video presentation
    • Component and Instrument documentation headers have been uniformised in preparation for a Python mcdoc.
    • MCPL library updated to v. 1.1
    • ESS_butterfly.comp provides a time-focusing mode ala what was available in ESS_moderator_long.
    • ESS_butterfly_MCPL.instr implements the use of MCPL files in the ESS butterfly geometry
    • PowderN can "flip" the d_phi focusing to "zoom" on a range of angles.
    • New PSD_monitor_TOF that outputs a TOF signal pr. PSD pixel (single files). Used in templateNMX_TOF.instr
    • A version of Isotropic_Sqw from the McStas 2.0 release has been imported under the name of Isotropic_Sqw_legacy, since some users reported that release being in better agreement with experiments.
    • By the help of a Japanse user, we have identified issues with the performance of the supermirror coating option in FermiChopper.comp. We will investigate further and adress the issue over the course of 2017. Note that the component works as expected when not implementing supermirror slits.
    • Various bugfixes and improvements across the example instruments and component library
  • Platforms:
    • Our macOS application bundle provides a 'miniconda' Python, including gcc, openmpi etc.
    • Our Linux packages for RPM systems provide a 'miniconda' Python for all Python tool dependencies.
    • Our Windows installer provides a 'miniconda' Python, including gcc.

March 17th, 2017: Video presentation about using iFit with McStas by Emmanuel Farhi (ILL)

Dear all,

Emmanuel Farhi (McStas team & ILL Spectroscopy Group) visited the ESS DMSC in Copenhagen today and gave a nice talk about using iFit and McStas together. The presentation was recorded and is now available for viewing online here. Further information below:

Using iFit to control McStas simulations, and more.

The iFit tool will be presented. It is a generic data analysis and fitting infrastructure. A special focus will be put on the ability to launch McStas simulations, and retrieve the monitor data. The fitting capability of iFit allows to optimise a defined figure of merit (e.g. monitor or so) by changing the instrument parameters. This type feature is for instance used in the guide-bot from Mads Bertelsen, but it is applicable to any instrument model. Other features will be presented, such as the 4D convolution of a McStas TAS-type instrument with an 4D S(q,w) dispersion volume, which could be used for e.g. Bifrost. More on

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

Last Modified: Monday, 22-May-2017 16:59:02 CEST
Search website mailinglist archive GitHub repos