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:






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:

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

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.