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

McStas

About McStas
 Conditions of use
 Authors/Contacts
 Project funding

Download
 Components
 Other Downloads (share)

Mailing list

Search web/mailinglist

Documentation
 Wiki (GitHub)
 McStas manual
 Publications

Links

Report bugs (GitHub)

Code-repository (GitHub)


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


Migrating from McStas 2.x to 3.x? - Use the wiki-based guides

June 17th, 2025: McStas and McXtrace 3.5.32 released


McStas and McXtrace release 3.5.32 is now available.
McStas installation instructions are found
on GitHub .

What's Changed

Common changes to McStas and McXtrace

  • Deployment, platforms and CI
    • [Bugfixes] to Windows conda script and related README by @willend in#1976#1978, #1984, #1985, #1986
    • [CI] Let "autobuild" CI scripts create arm64 debs for mccode.org by @willend in #1981
  • Tools:
    • [Feature] mcgui/mxgui: show current instrument name in dialogues by @farhi in #1989
    • [Feature] VSCode McStas/McXtrace grammar extension
      • Update vs code extension by @Lomholy in #1975
      • Small updates to editor, as well as updated installation information by @Lomholy in #1977
    • [Feature] LaTeX math (formulae etc) for mcdoc %Description headers by @willend in #2054
  • Code generator/Grammar:
    • [Feature] Unified McStas/McXtrace, c and .py code generators defined from common set of files in mccode/src
      • Unify grammar take2 by @willend in #2008
      • Unify instr y c py: unify our code generators for C and Python by @farhi in #2009
    • [Feature] NEW INHERIT keyword in the component grammar: Allows to mix and match component sections from multiple components to achieve new functionality.
      For an example use see
    • [Feature] Add ADR (Architectural Design Record) for grammar changes
      • Add doc folder for proposed, accepted, rejected, deprecated, superseded changes of McCode GRAMMAR by @willend in #2064
      • Put in place folder for grammar documentation by @willend in #2070
    • [Feature] The McStas/McXtrace code generators have a new commandline switch --version-num to print the version number only.
    • [Feature] New CLI default for mcstas / mcxtrace: --trace is on (This allows any compiled instrument to run with --trace=0 by @willend in #2010 and #2023)
  • Libs and runtime (various minor changes)
    • Add Open_File in header (used from e.g. PowderN) by @willend in #2014
    • Wrap cabs in OpenACC settings by @willend in #2016
    • Swap default trace behaviour to 'enabled' by @willend in #2023
    • cif2hkl: update to solve F^2 for Xrays using latest CrysFML by @farhi in #2021
    • Openacc minor rectifications by @willend in #2027
  • MCPL Components
    • [Feature] Update MCPL components for MCPL 2.2.0 features (including stat:sum). by @tkittel in #2046
    • [Feature] Sync MCPL components McStas <-> McXtrace for MCPL 2.2.0 support by @willend in #2019
    • [Feature] Please consult the GitHub discussion on MCPL > 2.0 support in McStas / McXtrace

McStas specific:

  • [Bugfix] Source_custom
    • Fixed minor typo in docs by @pablogila in #1980
    • Fixed pulse normalisation for all values of n by @pablogila in #2024
    • Simplified redundant code for the peak integral calculation by @pablogila in #2025
  • [Bugfix and feature] Resolution sample/monitor
    • Reso: Updates by @tweber-ill in #1992
    • Add infrastructure to save calculated resolution/covariance matrices by @willend in #1993
    • Sync Res_monitor <-> TOFRes_monitor by @willend in #1995
  • [Bugfix] Add mcresplot to debian metapackage by @willend in #2022
  • [Bugfix] Monitor_nD pixel id and buffer fix by @mads-bertelsen in #2002
  • [Bugfix] Add exit attenuation to Incoherent.comp for finite order scattering by @Lomholy in #2042
  • [Bugfix] Updates to Monochromator_bent from @Lomholy by @willend in #2059 and #2058

McXtrace specific:

  • [Features and bugfixes] McXtrace fluorescence:
    • McXtrace: fix header doc in fluo sample (powder and SX) by @farhi in #1974
    • McXtrace fluo fix pow 0 by @farhi in #1979
    • McXtrace fluo fix 2 by @farhi in #1988
    • McXtrace fluo fix : fix in powder select - use gaussian line shape by @farhi in #1994
    • McXtrace: samples: fluo: add M-lines via XrayLib Kissel CSb calls by @farhi in #2004
    • McXtrace: samples: fluo: fix again the Fluo share by @farhi in #2005
    • McXtrace add fluo mcdisplay by @farhi in #2015
    • McXtrace fluo add detector 0 by @farhi in #2029
  • [Bugfix] Fix compilation of McXtrace Test_PowderN instr by @willend in #2000
  • [Bugfixes] McXtrace various example instrument updates by @farhi in
  • [Bugfix] cif2hkl: update to solve F^2 for Xrays using latest CrysFML by @farhi in #2021
  • [Feature]McXtrace: add SWING BL at SOLEIL by @farhi in #2036

Full Changelog: https://github.com/mccode-dev/McCode/compare/v3.5.27...v3.5.32


April 29th, 2025: McStas and McXtrace 3.5.27 released

Dear all,
McStas and McXtrace release 3.5.27 is now available.
McStas installation instructions are found on GitHub .

What's Changed - common McStas/McXtrace highlights:

  • [Feature] McStas and McXtrace are now fully on conda-forge also for Windows, since MCPL 2.0 arrived.
    This means that we now recommend to install via this mechanism on Windows. See the instructions for details.
  • [Feature] mcrun/mxrun have a new -y switch which runs a given instrument using its default parameters.
  • [BUGFIX] mcplot/mxplot should now deal better with negative / very small numbers in 'log' mode plotting.
  • [Feature] mcgui/mxgui improved tooltips on the run dialogue.
  • [Feature] rootmccode works with newer versions of ROOT
  • [BUGFIX] The KISS random number generator was earlier running with systematically different random numbers (and a shorter period) on Windows.
    Identical instruments now run with identical random numbers across platforms, when using identical seed.
  • [CI, packaging, platform support] Lots of work behind the scenes for portability, packaging, and improved CI of the code on GitHub.
    Better standard solutions and easier possibility of spotting when/if we make errors!

What's Changed - McStas specific highlights:

  • [BUGFIX] As reported on mcstas-users, reflective/transmissive polarisers/analysers could sometimes lead to |P|>1.
    This is now fixed by ellimination of "non-up-down" polarisation components when measuring an "up-down" polarisation.
  • [Feature] Contributed component Source_custom by @pablogila, useful features for simulatiung e.g. CANS and other pulsed sources.
    Comes with corresponding new test instrument.

What's Changed - McXtrace specific highlights:

  • [Feature] New components for Fluorescence + Single_crystal and Fluoresence + Powder.
    Come with corresponding new test instruments.
For a full list of changes, please consult the CHANGES or GitHub release notes

April 6th, 2025: Component doc pages back online

We are now in the air with new server hardware.

Among other things this means that component mcdoc pages are back online - by popular demand!


April 5th, 2025: Ongoing webserver upgrade

We are in the process of upgrading the webserver for McStas, McXtrace and other sites. Please bear with us if you experience service interruptions. :-)


February 19th, 2025: McStas and McXtrace 3.5.24 released

Dear all,
McStas and McXtrace release 3.5.24 is now available - McStas installation instructons on GitHub .

What's Changed

Important note

  • McStas and McXtrace will soon change organisation-name on GitHub - from McStasMcXtrace -> mccode-dev

User interfaces and tools

Components and instruments

Core simulation toolkit

Interfaces and interoperability with other codes

NCrystal

mccode-antlr

  • Thanks to @g5t for ping-pong on this :)
  • [Feature] mccode-antlr is an alternative code-generator for McStas and McXtrace - a new development by @g5t and based on ANTLR instead of lex/yacc. The new tool is mainly written in python and thus has a lower barrier for changes in language syntax and code generation. The tool implementations mcstas-antlr and mcxtrace-antlr are thus a candidate implementations to potentially replace the classic mcstas and mcxtrace code generators in the future. Current status is that
    • McStas: mcstas-antlr is fully feature complete wrt. mcstas for CPU simulations and close to complete for GPU simulations
    • McXtrace: Not all instruments will compile using mcxtrace-antlr but basic functionality is in place
    • To try:
      1. Install mccode-antlr from conda-forge or via pip
      2. Adapt your configuration to use e.g. mcstas-antlr by
        • Setting the new --cogen=mcstas-antlr option in mcrun
        • Enable or edit the MCCOGEN field of mccode_config.json using the new Save/Edit configuration in mcgui
        • (The antlr tools default to download comps etc. to an internal cache: Add e.g. -I${MCSTAS} to prefer ingredients fromyour local library)
      3. Use the mcrun-antlr/mxrun-antlr tools provided directly by mccode-antlr

Platform support

  • Debian/Ubuntu
  • Windows
    • [Feature] NCrystal is now available with McStas on Windows
    • [Info] Windows via cross-compiled .exeinstaller from mccode.org: Please place the MCPL-related .bat files from the extras folder in e.g. c:\mcstas-3.5.24\bin to enable MCPL (May require giving your user 'full access' permissions to the bin folder)
    • [Info] Windows via conda-forge: MCPL is not yet available but expected during the spring

Full Changelog: https://github.com/mccode-dev/McCode/compare/v3.5.16...v3.5.24


January 8th, 2025: Monte Carlo Satellite to ICNS2025

Dear all,

The ICNS2025 conference is taking place in Copenhagen and Lund this summer, and the abstract submission is closing January 15th - in one week.

Of special interest to McStas users:
A satellite event is being planned for July 11th, arranged by Mads Bertelsen, ESS and Peter Willendrup DTU/ESS. We envision a one-day event with contributed talks on instrument simulation and its use, abstract submission will open soon:

Advanced computer simulations methods for neutron scattering instruments

Abstract:
Neutron scattering relies heavily on computer simulations of neutron scattering instrumentation to optimize their performance. These simulation tools are also evolving to be more relevant for a running facility, aiding in both preparation and analysis for individual experiments. It is even becoming possible to make better decisions during experiments by running simulations in parallel.

All the best and hope to see you this summer in Copenhagen,
Peter Willendrup


Previous news items: 2024, 2023, 2022, 2021,2020,2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998.


Last Modified: Tuesday, 17-Jun-2025 20:11:02 CEST
Search website mailinglist archive GitHub repos