McXtrace logo

McXtrace - An X-ray ray-trace simulation package

ESRF; SAXSLAB Niels Bohr Institute DTU Physics


Project Status
 Project Partners
 Project People

 Mac OSX Installation
 Windows Installation

Mailing List



Minutes of Meetings

McXtrace Art

About McXtrace




McXtrace - Monte Carlo Xray Tracing, is a joint venture by

DTU_logo.gif B_NAT_cmyk.png ERSF_logo.png SAXSLab ApS.

Funding from NABIIT, DSF and the above parties.

Our code is based on technology from mcstas_logo_thumb.png.

Code repository (shared with 'McStas') is located at

For information on our progress, please subscribe to our user mailinglist..

McXtrace News

The latest McXtrace news.

McXtrace 1.4: known bugs

  • Lens_parab & Lens_parab_Cyl: A missing 'I' in the header (line 11) trips the insrtion algorithm. Fixed in the devlopment tree
  • mxplot-pyqtgraph on windows: An error in a post-install script causes the file c:\mcxtrace-1.4\bin\mxplot-pyqtgraph to have a typo where it says instead of as it should. The mxplot-pyqtgraph script is generated install time - the install procedure has been altered to fix this. For existing system the simple workaround is to either edit that file in place or to replace it with one from this link
  • .
  • On windows, if you want to use the Undulator component, you must also install The GNU scientific Library (GSL). It is available from This also implies that you probably need to edit the mcxtrace compiler flags. Go to File->Configure and add something along the lines "-Lc:\mcxtrace\Program Files (x86)\GnuWin32\lib -Ic:\mcxtrace\Program Files (x86)\GnuWin32\include" to the C flags box for mcxxtrace to be find the libraries compile time.

McXtrace 1.4 is released!

The McXtrace team is prod to annoucen that McXtrace 1.4 has finally been released. In the first step packages are made available for debian systems, while the testing trolls do their work on the rpms and windows file to make sure the installation procedure runs as smooth as possible. Fortunately testing trolls do not celebrate Swedish midsummers' eve. New features of 1.4 (pasted from the CHANGES file):
  1. Source_pt, Source_flat, Source_gaussian, and Source_div now behave in the same manner wrt. phase. The relevant parameters are randomphase and phase. If randomphase is !=0 the phase is completely random, if ==0 the value of phase is used.
  2. EPSD_monitor: Has a parameter nE which denotes a number of energy bins. if >1 the monitor will output a number of files. each corresponding to an energy bin.
  3. Lens_parab, Lens_parab_Cyl The functionality of the _rough versions of these components have been merged into the main components and the _rough versions themselves retired.
  4. Support for binary file dump of photons in the mcpl-format is added.
  5. On debian class systems, McXtrace now installs to /usr/share to be more standards compliant.
  6. New Components:
    • sources/Undulator.comp: Undulator model based on Kim, 1989, "Characteristics of synchrotron radiation"
    • samples/Incoherent.comp: Model sample of an incoherent scatterer
    • samples/Polycrystal.comp: Polycrystal sample based on Single_crystal formalism
    • samples/SasView_model.comp: All samples included in the SasModels module of SasView. Currently does not take in absorption into account
    • misc/Air.comp: A "box" full of Air that may scatter.
    • misc/Focus.comp: Adds resampling to any component. I.e. causes the preceding object to become a secondary source.
    • misc/MCPL_input.comp: Interface components to read/write MCPL-format files.
    • misc/MCPL_output.comp
    • monitors/DivE_monitor.comp
    • monitors/DivPos_monitor.comp
    • monitors/Divergence_monitor.comp
    • optics/Bragg_crystal.comp: Superseeds Perfect_Crystal
    • optics/Bragg_crystal_bent.comp: Bent crystal model
    • optics/Capillary.comp: Capillary tube with reflecting walls.
    • optics/Collimator_linear.comp: Ideal collimator models
    • optics/Collimator_radial.comp
    • optics/Mirror.comp: Simple flat mirror component
    • optics/Mirror_toroid.comp: Toroidal mirror
    • contrib/Detector_pn.comp: Detector model with quantum efficiency.
    • contrib/SAXS/SAXSCurve.comp: A set of SAXS-sample models
    • contrib/SAXS/SAXSCylinders.comp
    • contrib/SAXS/SAXSEllipticCylinders.comp
    • contrib/SAXS/SAXSLiposomes.comp
    • contrib/SAXS/SAXSNanodiscsFast.comp
    • contrib/SAXS/SAXSNanodiscsWithTagsFast.comp
    • contrib/SAXS/SAXSNanodiscsWithTags.comp
    • contrib/SAXS/SAXSNanodiscs.comp
    • contrib/SAXS/SAXSPDBFast.comp
    • contrib/SAXS/SAXSPDB.comp
    • contrib/SAXS/SAXSQMonitor.comp
    • contrib/SAXS/SAXSShells.comp
    • contrib/SAXS/SAXSSpheres.comp
  7. Example Instrument simulations:
    • Full model of proposed DanMAX beamline.
    • Pump_probe_solvent: Example of disordered scattering in solution.
    • SAXS_saxlab: Laboratory SAXS setup with Montel optic.
    • template_1Slit_Diff & template_2Slit_Diff: examples of raytracing with coherent interference effects.
    • ESRF_ID01: Microdiffraction beamline with polycrystal sample
    • templateSasView: Example of using the (experimental) SasView interface.
    • ... and various Unit test/Example instruments
  8. New python/Qt based GUI/plotting tool
  9. PowderN: incoherent scattering (computed from tables)
  10. Curved Bragg monochromator crystal, Major improvements to the flat Bragg monochromator crystal
  11. Output in the NeXus-format.
  12. Data files (such as photoelectric absorption spectra) can be read once and reused by other components without further disk IO overhead.

Bug in PowderN.comp

A bug has been found in PowderN. It results in underestimating absorption substantially. A patch has been commited to the devlopment tree which may be downloaded from PowderN.comp. Thanks to the groups at University College London and Cranfield University for reporting this.
Older News

McXtrace Manual

A manual is "under construction". A rough draft version is available here. From now on, we will upload nightly builds of the manuals here: nightlies.

A printed, bound version is planned using a Print-On-Demand scheme.

This is work in progress and may contain significant omissions and inaccuracies but for the interested it may be downloaded here:

The User manual documents the use of the McXtrace system whereas the Component manual details the inner workings of the models employed in the components, in other words the interaction physics between devices and beam.

McXtrace Code Development

The code development page has more info on code details

Art Gallery

We've established a gallery of plots which are beautiful/funnny or otherwise interesting at McXtraceArt. Please take a look and be inspired!

Steering Committee Meeting Minutes

You may now access the minutes of the steering committee meetings

Last Modified: Wednesday, 16-Aug-2017 02:25:17 CEST
Search website mailinglist archive SVN repos McCode Trac