From 3a2f3a0fe51a9029eeaa6cc99a50e6e4c090b93a Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 14 Jan 2026 12:01:25 +0100 Subject: [PATCH] Add 'full' template in McXtrace and align with McStas version --- .../Templates/template/template.instr | 5 +- .../Templates/template/template.instr | 69 +++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 mcxtrace-comps/examples/Templates/template/template.instr diff --git a/mcstas-comps/examples/Templates/template/template.instr b/mcstas-comps/examples/Templates/template/template.instr index e6b81e199a..fad2161875 100644 --- a/mcstas-comps/examples/Templates/template/template.instr +++ b/mcstas-comps/examples/Templates/template/template.instr @@ -1,7 +1,7 @@ /******************************************************************************* * McStas instrument definition URL=http://www.mcstas.org * -* Instrument: test (rename also the example and DEFINE lines below) +* Instrument: template (rename also the example and DEFINE lines below) * * %Identification * Written by: Your name (email) @@ -14,7 +14,7 @@ * %Description * Instrument longer description (type, elements, usage...) * -* Example: mcrun test.instr +* Example: mcrun template.instr * * once your instrument is written and functional: * - replace INSTRUMENT_SITE entry above with your Institution name as a single word @@ -24,6 +24,7 @@ * sensible parameter set. * * %Parameters +* Par: [unit] A parameter description * * %Link * A reference/HTML link for more information diff --git a/mcxtrace-comps/examples/Templates/template/template.instr b/mcxtrace-comps/examples/Templates/template/template.instr new file mode 100644 index 0000000000..0ac26dc16b --- /dev/null +++ b/mcxtrace-comps/examples/Templates/template/template.instr @@ -0,0 +1,69 @@ +/******************************************************************************* +* McXtrace instrument definition URL=http://www.mcxtrace.org +* +* Instrument: template (rename also the example and DEFINE lines below) +* +* %Identification +* Written by: Your name (email) +* Date: Current Date +* Origin: Your institution +* %INSTRUMENT_SITE: Templates +* +* !!Please write a short instrument (1 line) here!! +* +* %Description +* Instrument longer description (type, elements, usage...) +* +* Example: mcrun template.instr +* +* once your instrument is written and functional: +* - replace INSTRUMENT_SITE entry above with your Institution name as a single word +* - rename the instrument name after DEFINE INSTRUMENT below +* - update the parameter help in the following Parameters section +* - update the instrument description, and better add a usage example with a +* sensible parameter set. +* +* %Parameters +* Par: [unit] A parameter description +* +* %Link +* A reference/HTML link for more information +* +* %End +*******************************************************************************/ +DEFINE INSTRUMENT template(Par1=1) + +/* The DECLARE section allows us to declare variables or small */ +/* functions in C syntax. These may be used in the whole instrument. */ +DECLARE +%{ +%} + +/* The INITIALIZE section is executed when the simulation starts */ +/* (C code). You may use them as component parameter values. */ +INITIALIZE +%{ +%} + +/* Here comes the TRACE section, where the actual */ +/* instrument is defined as a sequence of components. */ +TRACE + +/* The Arm() class component defines reference points and orientations */ +/* in 3D space. Every component instance must have a unique name. Here, */ +/* Origin is used. This Arm() component is set to define the origin of */ +/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used */ +/* for further RELATIVE reference, Other useful keywords are : ROTATED */ +/* EXTEND GROUP PREVIOUS. Also think about adding a neutron source ! */ +/* Progress_bar is an Arm displaying simulation progress. */ +COMPONENT Origin = Progress_bar() + AT (0,0,0) ABSOLUTE + +/* This section is executed when the simulation ends (C code). Other */ +/* optional sections are : SAVE */ +FINALLY +%{ +%} +/* The END token marks the instrument definition end */ +END +