-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1764 from McStasMcXtrace/single_crystal_order_fix
Fix of order system in Single_crystal
- Loading branch information
Showing
2 changed files
with
130 additions
and
45 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
mcstas-comps/examples/Tests_samples/Test_Powders/Test_Powders.instr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/******************************************************************************* | ||
* McStas instrument definition URL=http://www.mcstas.org | ||
* | ||
* Instrument: Test PowderN output | ||
* | ||
* %Identification | ||
* Written by: M. Bertelsen | ||
* Date: November 19 2024 | ||
* Origin: ESS DMSC | ||
* %INSTRUMENT_SITE: Tests_samples | ||
* | ||
* Test output of PowderN and Single_crystal on a spherical monitor / PSD. | ||
* | ||
* %Description | ||
* A test instrument for Powder output from different sample components. | ||
* Currently does not validate, but Single_crystal should be able to | ||
* replicate PowderN results. | ||
* | ||
* %Example: lambda=2.5 directbeam=0 comp=1 SPLITS=1 Detector: Sph_mon_I=5.67059e+08 | ||
* %Example: lambda=2.5 directbeam=0 comp=1 SPLITS=1 Detector: psd_mon_I=1.46997e+06 | ||
* %Example: lambda=2.5 directbeam=0 comp=2 SPLITS=1 Detector: Sph_mon_I=5.67059e+08 | ||
* %Example: lambda=2.5 directbeam=0 comp=2 SPLITS=1 Detector: psd_mon_I=1.46997e+06 | ||
* | ||
* %Parameters | ||
* lambda: [Angs] Wavelength emitted from source, 1% wl-interval around. | ||
* L1: [m] Source-sample distance | ||
* directbeam: [1] Suppress direct beam or not | ||
* reflections_powderN: [str] List of powder reflections for powderN | ||
* reflections_Single_crystal: [str] List of powder reflections for Single_crystal | ||
* SPLITS: [1] Number of SPLIT's before sample | ||
* frac_t: [1] Fraction of stats assigned to unscattered, "direct beam" | ||
* | ||
* %End | ||
*******************************************************************************/ | ||
DEFINE INSTRUMENT Test_PowderN(int comp=1, lambda=2.5, L1=10, int directbeam=0, string reflections_powderN="Ge.laz", string reflections_Single_crystal="Ge.lau", int SPLITS=1, frac_t=0.1) | ||
|
||
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 | ||
|
||
REMOVABLE COMPONENT Origin = Progress_bar() | ||
AT (0,0,0) ABSOLUTE | ||
|
||
/* source with constant flux */ | ||
REMOVABLE COMPONENT Source = Source_gen( | ||
radius = 0.11, dist = L1, focus_xw = 0.01, focus_yh = 0.1, | ||
lambda0 = lambda, dlambda = lambda*0.01, | ||
T1=229.6,I1=5.32e13,T2=1102, I2=4.37e12, T3=437.1,I3=3.84e13) | ||
AT (0, 0, 0) RELATIVE Origin | ||
|
||
/* TIP: monochromator cradle */ | ||
SPLIT SPLITS COMPONENT sample_cradle = Arm() | ||
AT (0, 0, L1) RELATIVE PREVIOUS | ||
|
||
COMPONENT Pow_PowderN = PowderN( | ||
radius=0.005, yheight=0.1, reflections=reflections_powderN, p_transmit=frac_t) | ||
WHEN (comp==1) | ||
AT (0, 0, 0) RELATIVE sample_cradle | ||
EXTEND %{ | ||
if(INSTRUMENT_GETPAR(directbeam) == 0) { | ||
if (!SCATTERED) { | ||
ABSORB; | ||
} | ||
} | ||
%} | ||
|
||
SPLIT SPLITS COMPONENT Pow_Single_crystal = Single_crystal( | ||
radius=0.005, yheight=0.1, reflections=reflections_Single_crystal, p_transmit=frac_t, | ||
powder=1, mosaic=5, order=1, barns=0) | ||
WHEN (comp==2) | ||
AT (0, 0, 0) RELATIVE sample_cradle | ||
EXTEND %{ | ||
if(INSTRUMENT_GETPAR(directbeam) == 0) { | ||
if (!SCATTERED) { | ||
ABSORB; | ||
} | ||
} | ||
%} | ||
|
||
COMPONENT Sph_mon = PSD_monitor_4PI(nx=360,ny=180, radius=1, restore_neutron=1, filename="Sphere") | ||
AT (0, 0, 0) RELATIVE PREVIOUS | ||
|
||
COMPONENT peak_dir = Arm() | ||
AT (0,0,0) RELATIVE sample_cradle | ||
ROTATED (0, 100, 0) RELATIVE sample_cradle | ||
|
||
COMPONENT psd_mon = PSD_monitor(xwidth=0.08, yheight=0.05, nx=100, ny=100, restore_neutron=1, filename="PSD") | ||
AT (0,0,1) RELATIVE peak_dir | ||
|
||
/* The END token marks the instrument definition end */ | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters