Skip to content

Commit fe651ff

Browse files
authored
Merge pull request #2290 from willend/main
Add 'full' template in McXtrace and align with McStas version
2 parents c91fb5d + 3a2f3a0 commit fe651ff

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

mcstas-comps/examples/Templates/template/template.instr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
* McStas instrument definition URL=http://www.mcstas.org
33
*
4-
* Instrument: test (rename also the example and DEFINE lines below)
4+
* Instrument: template (rename also the example and DEFINE lines below)
55
*
66
* %Identification
77
* Written by: Your name (email)
@@ -14,7 +14,7 @@
1414
* %Description
1515
* Instrument longer description (type, elements, usage...)
1616
*
17-
* Example: mcrun test.instr <parameters=values>
17+
* Example: mcrun template.instr <parameters=values>
1818
*
1919
* once your instrument is written and functional:
2020
* - replace INSTRUMENT_SITE entry above with your Institution name as a single word
@@ -24,6 +24,7 @@
2424
* sensible parameter set.
2525
*
2626
* %Parameters
27+
* Par: [unit] A parameter description
2728
*
2829
* %Link
2930
* A reference/HTML link for more information
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*******************************************************************************
2+
* McXtrace instrument definition URL=http://www.mcxtrace.org
3+
*
4+
* Instrument: template (rename also the example and DEFINE lines below)
5+
*
6+
* %Identification
7+
* Written by: Your name (email)
8+
* Date: Current Date
9+
* Origin: Your institution
10+
* %INSTRUMENT_SITE: Templates
11+
*
12+
* !!Please write a short instrument (1 line) here!!
13+
*
14+
* %Description
15+
* Instrument longer description (type, elements, usage...)
16+
*
17+
* Example: mcrun template.instr <parameters=values>
18+
*
19+
* once your instrument is written and functional:
20+
* - replace INSTRUMENT_SITE entry above with your Institution name as a single word
21+
* - rename the instrument name after DEFINE INSTRUMENT below
22+
* - update the parameter help in the following Parameters section
23+
* - update the instrument description, and better add a usage example with a
24+
* sensible parameter set.
25+
*
26+
* %Parameters
27+
* Par: [unit] A parameter description
28+
*
29+
* %Link
30+
* A reference/HTML link for more information
31+
*
32+
* %End
33+
*******************************************************************************/
34+
DEFINE INSTRUMENT template(Par1=1)
35+
36+
/* The DECLARE section allows us to declare variables or small */
37+
/* functions in C syntax. These may be used in the whole instrument. */
38+
DECLARE
39+
%{
40+
%}
41+
42+
/* The INITIALIZE section is executed when the simulation starts */
43+
/* (C code). You may use them as component parameter values. */
44+
INITIALIZE
45+
%{
46+
%}
47+
48+
/* Here comes the TRACE section, where the actual */
49+
/* instrument is defined as a sequence of components. */
50+
TRACE
51+
52+
/* The Arm() class component defines reference points and orientations */
53+
/* in 3D space. Every component instance must have a unique name. Here, */
54+
/* Origin is used. This Arm() component is set to define the origin of */
55+
/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used */
56+
/* for further RELATIVE reference, Other useful keywords are : ROTATED */
57+
/* EXTEND GROUP PREVIOUS. Also think about adding a neutron source ! */
58+
/* Progress_bar is an Arm displaying simulation progress. */
59+
COMPONENT Origin = Progress_bar()
60+
AT (0,0,0) ABSOLUTE
61+
62+
/* This section is executed when the simulation ends (C code). Other */
63+
/* optional sections are : SAVE */
64+
FINALLY
65+
%{
66+
%}
67+
/* The END token marks the instrument definition end */
68+
END
69+

0 commit comments

Comments
 (0)