From 401f24991ff28febdab72c63e6a7cc19fa15a7fc Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Tue, 28 Oct 2025 13:45:27 +0100 Subject: [PATCH 1/5] Unentangle Incoherent DISPLAY section from Shape and suppres nx,ny,nz from Incoherent --- mcstas-comps/misc/Shape.comp | 18 ++++++++++++++++-- mcstas-comps/samples/Incoherent.comp | 9 ++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mcstas-comps/misc/Shape.comp b/mcstas-comps/misc/Shape.comp index 051a9ccac3..dc30bcd628 100644 --- a/mcstas-comps/misc/Shape.comp +++ b/mcstas-comps/misc/Shape.comp @@ -92,6 +92,20 @@ TRACE %{ /* component Shape does nothing */ %} -MCDISPLAY INHERIT Incoherent - +MCDISPLAY +%{ + if (geometry && strlen(geometry) && strcmp(geometry, "NULL") && strcmp(geometry, "0")) { /* OFF file */ + off_display(offdata); + } + else + if (radius > 0 && yheight) { /* cylinder along y*/ + cylinder(0,0,0,radius,yheight,thickness, nx, ny, nz); + } + else if (xwidth && yheight) { /* box/rectangle */ + box(0,0,0,xwidth,yheight,zdepth,thickness, nx, ny, nz); + } + else if (radius > 0 && !yheight) { /* sphere */ + sphere(0,0,0,radius); + } +%} END diff --git a/mcstas-comps/samples/Incoherent.comp b/mcstas-comps/samples/Incoherent.comp index d9a8fab926..c87c3f8215 100644 --- a/mcstas-comps/samples/Incoherent.comp +++ b/mcstas-comps/samples/Incoherent.comp @@ -116,8 +116,7 @@ DEFINE COMPONENT Incoherent SETTING PARAMETERS (string geometry=0, radius=0, xwidth=0, yheight=0, zdepth=0, -thickness=0, nx=0, ny=1, nz=0, -target_x = 0, target_y = 0, target_z = 0, focus_r = 0, +thickness=0, target_x = 0, target_y = 0, target_z = 0, focus_r = 0, focus_xw=0, focus_yh=0, focus_aw=0, focus_ah=0, int target_index=0, pack = 1, p_interact=1, f_QE=0, gamma=0, Etrans=0,deltaE=0, sigma_abs=5.08, sigma_inc=5.08, Vc=13.827, concentric=0, order=0) @@ -478,11 +477,11 @@ MCDISPLAY off_display(offdata); } else - if (radius > 0 && yheight) { /* cylinder */ - cylinder(0,0,0,radius,yheight,thickness, nx, ny, nz); + if (radius > 0 && yheight) { /* cylinder along y*/ + cylinder(0,0,0,radius,yheight,thickness, 0, 1, 0); } else if (xwidth && yheight) { /* box/rectangle */ - box(0,0,0,xwidth,yheight,zdepth,thickness, nx, ny, nz); + box(0,0,0,xwidth,yheight,zdepth,thickness, 0, 1, 0); } else if (radius > 0 && !yheight) { /* sphere */ sphere(0,0,0,radius); From 2f39281fafe6bc2a38073764bce09409dddb88fc Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Tue, 28 Oct 2025 13:48:16 +0100 Subject: [PATCH 2/5] Header fix --- mcstas-comps/samples/Powder1.comp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcstas-comps/samples/Powder1.comp b/mcstas-comps/samples/Powder1.comp index 856ecd5635..80964e1868 100644 --- a/mcstas-comps/samples/Powder1.comp +++ b/mcstas-comps/samples/Powder1.comp @@ -34,10 +34,10 @@ * radius: [m] Radius of sample in (x,z) plane * yheight: [m] Height of sample y direction * pack: [1] Packing factor -* Vc: [AA^3] Volume of unit cell +* Vc: [AA^3] Volume of unit cell * sigma_abs: [barns] Absorption cross section per unit cell at 2200 m/s * -* q: Scattering vector of reflection [AA^-1] +* q: [AA^-1] Scattering vector of reflection * d: [AA] d-spacing for sample, overrides 'q' * j: [1] Multiplicity of reflection * F2: [barns] Structure factor of reflection From 2e79ab1f9a3831103928ebca7ef6d16a7fe50203 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Tue, 28 Oct 2025 13:48:55 +0100 Subject: [PATCH 3/5] Header fix --- mcstas-comps/samples/PowderN.comp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcstas-comps/samples/PowderN.comp b/mcstas-comps/samples/PowderN.comp index a969657d8d..893dae362b 100644 --- a/mcstas-comps/samples/PowderN.comp +++ b/mcstas-comps/samples/PowderN.comp @@ -141,7 +141,7 @@ * xwidth: [m] Horiz. dimension of sample, as a width * yheight: [m] Height of sample y direction * zdepth: [m] Depth of box sample -* thickness: [] Thickness of hollow sample. Negative value extends the hollow volume outside of the box/cylinder. +* thickness: [m] Thickness of hollow sample. Negative value extends the hollow volume outside of the box/cylinder. * reflections: [string] Input file for reflections (LAZ LAU CIF, FullProf, ShelX). Use only incoherent scattering if NULL or "" * d_phi: [deg] Angle corresponding to the vertical angular range to focus to, e.g. detector height. 0 for no focusing. * d_omega: [deg] Horizontal focus range (only for incoherent scattering), 0 for no focusing. From 2a17426e49baab1a78f9c8ed1fb9e264d90fd3a0 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Tue, 28 Oct 2025 14:19:16 +0100 Subject: [PATCH 4/5] Header fixes --- mcstas-comps/samples/Tunneling_sample.comp | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/mcstas-comps/samples/Tunneling_sample.comp b/mcstas-comps/samples/Tunneling_sample.comp index fa19bf3d76..951ca682db 100644 --- a/mcstas-comps/samples/Tunneling_sample.comp +++ b/mcstas-comps/samples/Tunneling_sample.comp @@ -40,33 +40,33 @@ * * %P * INPUT PARAMETERS: -* radius: [m] Outer radius of sample in (x,z) plane -* yheight: [m] vert. dimension of sample, as a height -* thickness: [m] Thickness of cylindrical sample in (x,z) plane -* focus_r: [m] Radius of disk containing target. Use 0 for full space -* target_index: [1] relative index of component to focus at, e.g. next is +1 -* xwidth: horiz. dimension of sample, as a width [m] -* zdepth: depth of sample [m] -* focus_xw: horiz. dimension of a rectangular area [m] -* focus_yh: vert. dimension of a rectangular area [m] -* focus_aw: horiz. angular dimension of a rectangular area [deg] -* focus_ah: vert. angular dimension of a rectangular area [deg] -* sigma_abs:Absorbtion cross section pr. unit cell [barns] -* sigma_inc:Total incoherent scattering cross section pr. unit cell [barns] -* Vc: Unit cell volume [AA^3] -* p_interact: MC Probability for scattering the ray; otherwise transmit [1] -* f_QE: Fraction of quasielastic scattering [1] -* f_tun: Fraction of tunneling scattering (f_QE+f_tun < 1) [1] -* gamma: Lorentzian width of quasielastic broadening (HWHM) [meV] -* E_tun: Tunneling energy [meV] -* target_x: X-position of target to focus at [m] -* target_y: Y-position of target to focus at [m] -* target_z: Z-position of target to focus at [m] +* radius: [m] Outer radius of sample in (x,z) plane +* yheight: [m] vert. dimension of sample, as a height +* thickness: [m] Thickness of cylindrical sample in (x,z) plane +* focus_r: [m] Radius of disk containing target. Use 0 for full space +* target_index: [1] relative index of component to focus at, e.g. next is +1 +* xwidth: [m] horiz. dimension of sample, as a width +* zdepth: [m] depth of sample +* focus_xw: [m] horiz. dimension of a rectangular area +* focus_yh: [m] vert. dimension of a rectangular area +* focus_aw: [deg] horiz. angular dimension of a rectangular area +* focus_ah: [deg] vert. angular dimension of a rectangular area +* sigma_abs: [barns] Absorbtion cross section pr. unit cell +* sigma_inc: [barns] Total incoherent scattering cross section pr. unit cell +* Vc: [AA^3] Unit cell volume +* p_interact: [1] MC Probability for scattering the ray; otherwise transmit +* f_QE: [1] Fraction of quasielastic scattering +* f_tun: [1] Fraction of tunneling scattering (f_QE+f_tun < 1) +* gamma: [meV] Lorentzian width of quasielastic broadening (HWHM) +* E_tun: [meV] Tunneling energy +* target_x: [m] X-position of target to focus at +* target_y: [m] Y-position of target to focus at +* target_z: [m] Z-position of target to focus at * * Variables calculated in the component * -* V_my_s: Attenuation factor due to scattering [m^-1] -* V_my_a: Attenuation factor due to absorbtion [m^-1] +* V_my_s: [m^-1] Attenuation factor due to scattering +* V_my_a: [m^-1] Attenuation factor due to absorbtion * * %L * Test From 7234e190fe475461102e737998a5cb866e4d3e8e Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Tue, 28 Oct 2025 14:28:19 +0100 Subject: [PATCH 5/5] Header fixes --- .../samples/Single_magnetic_crystal.comp | 74 +++++++++---------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/mcstas-comps/samples/Single_magnetic_crystal.comp b/mcstas-comps/samples/Single_magnetic_crystal.comp index 4be3fed8c0..98f309d90a 100644 --- a/mcstas-comps/samples/Single_magnetic_crystal.comp +++ b/mcstas-comps/samples/Single_magnetic_crystal.comp @@ -51,50 +51,42 @@ * * %P * INPUT PARAMETERS: -* radius: Outer radius of sample in (x,z) plane [m] -* xwidth: Width of crystal [m] -* yheight: Height of crystal [m] -* zdepth: Depth of crystal (no extinction simulated) [m] -* geometry: Name of an Object File Format (OFF) file for complex geometry. -* The OFF file may be generated from XYZ coordinates using qhull/powercrust [str] -* delta_d_d: Lattice spacing variance, gaussian RMS [1] -* mosaic: Crystal mosaic (isotropic), gaussian RMS [arc minutes] -* mosaic_h: Horizontal (rotation around Y) mosaic (anisotropic), -* gaussian RMS [arc minutes] -* mosaic_v: Vertical (rotation around Z) mosaic (anisotropic), -* gaussian RMS [arc minutes] -* mosaic_n: Out-of-plane (Rotation around X) mosaic (anisotropic), -* gaussian RMS [arc minutes] -* recip_cell: Choice of direct/reciprocal (0/1) unit cell definition [1] -* ax: -* ay: Coordinates of first (direct/recip) unit cell vector [AA or AA^-1] -* az: -* bx: -* by: Coordinates of second (direct/recip) unit cell vector [AA or AA^-1] -* bz: -* cx: -* cy: Coordinates of third (direct/recip) unit cell vector [AA or AA^-1] -* cz: -* mx: -* my: Coordinates of vector defining the SF/NSF direction [1] -* mz: -* na: -* nb: Unit cell multipliers. The specified unit cell vectors are scaled by these factors. Note that the mulitpliers are applied directly to the raw input data. I.e. if recip. cell vectors are given, multipliers should be <1 (= 1/n). F.i. used to specify a magnetic unit cell which is larger than the chemical unit cell. -* nc: -* atom_sites: File name containing the atoms present in the unit cell. Use -* empty ("") or NULL for sigma_inc scattering only [string] -* order: limit multiple scattering up to given order -* (0: all, 1: first, 2: second, ...) [1] -* q_min: [AA^-1] lower boundary of momentum transfer range to generate hkls in -* q_max: [AA^-1] upper boundary of momentum transfer range to generate hkls in +* radius: [m] Outer radius of sample in (x,z) plane +* xwidth: [m] Width of crystal +* yheight: [m] Height of crystal +* zdepth: [m] Depth of crystal (no extinction simulated) +* geometry: [str] Name of an Object File Format (OFF) file for complex geometry. The OFF file may be generated from XYZ coordinates using qhull/powercrust +* delta_d_d: [1] Lattice spacing variance, gaussian RMS +* mosaic: [arcmin] Crystal mosaic (isotropic), gaussian RMS +* mosaic_h: [arcmin] Horizontal (rotation around Y) mosaic (anisotropic), gaussian RMS +* mosaic_v: [arcmin] Vertical (rotation around Z) mosaic (anisotropic), gaussian RMS +* mosaic_n: [arcmin] Out-of-plane (Rotation around X) mosaic (anisotropic), gaussian RMS +* recip_cell: [1] Choice of direct/reciprocal (0/1) unit cell definition +* ax: [AA or AA^-1] +* ay: [AA or AA^-1] Coordinates of first (direct/recip) unit cell vector +* az: [AA or AA^-1] +* bx: [AA or AA^-1] +* by: [AA or AA^-1] Coordinates of second (direct/recip) unit cell vector +* bz: [AA or AA^-1] +* cx: [AA or AA^-1] +* cy: [AA or AA^-1] Coordinates of third (direct/recip) unit cell vector +* cz: [AA or AA^-1] +* mx: [1] +* my: [1] Coordinates of vector defining the SF/NSF direction +* mz: [1] +* na: [1] +* nb: [1] Unit cell multipliers. The specified unit cell vectors are scaled by these factors. Note that the mulitpliers are applied directly to the raw input data. I.e. if recip. cell vectors are given, multipliers should be <1 (= 1/n). F.i. used to specify a magnetic unit cell which is larger than the chemical unit cell. +* nc: [1] +* atom_sites: [str] File name containing the atoms present in the unit cell. Use empty ("") or NULL for sigma_inc scattering only +* order: [1] limit multiple scattering up to given order (0: all, 1: first, 2: second, ...) +* q_min: [AA^-1] lower boundary of momentum transfer range to generate hkls in +* q_max: [AA^-1] upper boundary of momentum transfer range to generate hkls in * * Optional input parameters: * -* p_transmit: Monte Carlo probability for neutrons to be transmitted -* without any scattering. Used to improve statistics from -* weak reflections [1] -* sigma_abs: absorption cross-section per unit cell at 2200 m/s [barns] -* sigma_inc: incoherent scattering cross-section per unit cell [barns] +* p_transmit: [1] Monte Carlo probability for neutrons to be transmitted without any scattering. Used to improve statistics from weak reflections +* sigma_abs: [barns] absorption cross-section per unit cell at 2200 m/s +* sigma_inc: [barns] incoherent scattering cross-section per unit cell * * CALCULATED PARAMETERS: *