-
Notifications
You must be signed in to change notification settings - Fork 64
Component development
Peter Willendrup edited this page Jan 14, 2026
·
24 revisions
- Instrument/comp/particle parameter/variable scope, access and their use,
see table Variables and Scopes - Tips for Writing Components
(includes an exercise and a walkthrough of Slit.comp)
- Please consult and adhere to our McStas or McXtrace standard naming and units of SI and neutron / X-ray standards.
- Writing a parsable mcdoc component header
- Write an example instrument
- The mctest tool can be used to test a set of McStas/McXtrace instruments
- Keep it simple - complexity means a harder time debugging.
- Choose algorithmic simplicity / readability over performance.
- Document (in language that your colleague also understands) what your code is meant to do. You will even not fully remember yourself in a matter of months!
- Please always be mindful and act on / minimise the number warnings from your c-compiler!
- Run the mccode linter
- If you experience weird crashes it is time for Debugging the c-code
- We recommend to use the option to Build your own McStas or McXtrace via conda‐forge directly from your personal fork of McCode.