<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Jörg,
<div class=""><br class="">
</div>
<div class="">Yes, this sort of thing is entirely possible. :-) </div>
<div class=""><br class="">
</div>
<div class="">The EXTEND block is simply glued on “at the end” of the other stuff the component does within TRACE.</div>
<div class=""><br class="">
</div>
<div class="">Relevant building blocks are these:</div>
<div class=""><br class="">
</div>
<div class="">1) The neutron state,</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>x,y,z,vx,vy,vz,sx,sy,sz,t,p</div>
<div class=""><br class="">
</div>
<div class="">2) Conversion factors from mcstas-r.h:</div>
<div class="">
<div class="">#define AA2MS 629.622368 /* Convert k[1/AA] to v[m/s] */</div>
<div class="">#define MS2AA 1.58825361e-3 /* Convert v[m/s] to k[1/AA] */</div>
<div class="">#define K2V AA2MS</div>
<div class="">#define V2K MS2AA</div>
<div class="">#define Q2V AA2MS</div>
<div class="">#define V2Q MS2AA</div>
<div class="">#define SE2V 437.393377 /* Convert sqrt(E)[meV] to v[m/s] */</div>
<div class="">#define VS2E 5.22703725e-6 /* Convert (v[m/s])**2 to E[meV] */</div>
</div>
<div class=""><br class="">
</div>
<div class="">3) Our RNG functions like these</div>
<div class="">rand01()</div>
<div class="">rand0max()</div>
<div class="">randpm1()</div>
<div class="">randnorm()</div>
<div class="">randtriangle()</div>
<div class="">randminmax()</div>
<div class="">randvec_target… functions like they are e.g. used in sources and samples</div>
<div class=""><br class="">
</div>
<div class="">Best</div>
<div class="">Peter<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 11 Mar 2021, at 11.09, Voigt, Jörg <<a href="mailto:j.voigt@fz-juelich.de" class="">j.voigt@fz-juelich.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Thierry,
<div class=""><br class="">
</div>
<div class="">can one realize this by a source that selects the transverse momentum k_x and k_y by a Monte Carlo choice?</div>
<div class="">Simply “Extending” the source component?</div>
<div class=""><br class="">
</div>
<div class="">Regards</div>
<div class=""><br class="">
</div>
<div class="">Jörg</div>
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 11. Mar 2021, at 10:20, Andrew Wildes <<a href="mailto:wildes@ill.fr" class="">wildes@ill.fr</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Thierry,
<div class=""><br class="">
</div>
<div class="">I’m a big fan of making relative comparisons using the simplest possible source. I first simulate a “reference” instrument before playing with parameters. So long as the source characteristics stay the same, any changes in performance can be
expressed by dividing the monitor counts for the modified instrument by the monitor counts for the reference instrument.</div>
<div class=""><br class="">
</div>
<div class="">Consequently, I’d solve your problem by using the Source_div component and have the focus as a variable defined in the INITIALIZE section, e.g.:</div>
<div class=""><br class="">
</div>
<div class="">DEFINE INSTRUMENT Thierry(lambda=6, dlambda=0.1,m=1)</div>
<div class=""><br class="">
</div>
<div class="">DECLARE</div>
<div class="">%{</div>
<div class=""> double DivSource_m;</div>
<div class="">
<div class=""> double SourceWid = 0.1;</div>
</div>
<div class="">
<div class=""> double SourceHi = 0.1;</div>
</div>
<div class=""><br class="">
</div>
<div class="">%}</div>
<div class=""><br class="">
</div>
<div class="">INITIALIZE</div>
<div class="">%{</div>
<div class=""> DivSource_m=m*0.1*lambda;</div>
<div class="">%}</div>
<div class=""><br class="">
</div>
<div class="">TRACE</div>
<div class="">COMPONENT Centre = Progress_bar()<br class="">
AT (0, 0, 0) ABSOLUTE<br class="">
<br class="">
/*******************************************************/<br class="">
/******************* Source ****************************/<br class="">
/*******************************************************/<br class="">
COMPONENT source = Source_div(<br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>xwidth = SourceWid, <br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>yheight = SourceHi, <br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>focus_aw = DivSource_m, <br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>focus_ah = DivSource_m,<br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>lambda0 = lambda,<br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>dlambda = dlambda,<br class="">
<span class="Apple-tab-span" style="white-space:pre"></span>gauss = 0)<br class="">
AT (0,0,0) ABSOLUTE</div>
<div class=""><br class="">
</div>
<div class="">END</div>
<div class=""><br class="">
</div>
<div class="">(Please forgive any direct programming errors).</div>
<div class=""><br class="">
</div>
<div class="">I suspect that there might be a problem with my relative comparisons if you change the source divergence between instruments as the flux at your target might change. Someone might be able to advise on that.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class=""><br class="">
</div>
<div class="">Andrew<br class="">
<br class="">
</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 10 Mar 2021, at 16:46, Thierry Bigault <<a href="mailto:bigault@ill.fr" class="">bigault@ill.fr</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class=""><font size="-1" class=""><font face="Verdana" class="">Dear McStas,<br class="">
<br class="">
Here is my problem: <br class="">
I would like to simulate the exit of a cold neutron guide with a source. The aim is to concentrate on the instrument optics, without having to calculate all the guide from the reactor.<br class="">
A simplified and quite general description of a guide exit is a beam with a fixed "m-value" divergence: for a given wavelength, the width of the angular divergence (either box-type, Gaussian or whatever) is essentially proportional to the m-value of the guide
coating and to the wavelength.<br class="">
If the guide has different supermirror coatings on horizontal and on vertical faces, this leads to different angular widths.<br class="">
I assume the beam characteristics does not depend on the position at the guide exit in this approach.<br class="">
My question is : what is the simplest way to simulate such a secondary (or virtual) source in McStas ? I only found components where the angular width is geometrically fixed (in degrees), therefore wavelength-independent.<br class="">
Ideally I would also like to include a non-flat wavelength intensity distribution, but this can probably be done by adding a Filter_gen after the source.<br class="">
I am thinking of making several calculations at different wavelengths, but if anyone knows a all-in-one solution I am interested.<br class="">
<br class="">
Thierry<br class="">
</font></font></div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
mcstas-users mailing list<br class="">
<a href="mailto:mcstas-users@mcstas.org" class="">mcstas-users@mcstas.org</a><br class="">
<a href="https://mailman2.mcstas.org/mailman/listinfo/mcstas-users" class="">https://mailman2.mcstas.org/mailman/listinfo/mcstas-users</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
mcstas-users mailing list<br class="">
<a href="mailto:mcstas-users@mcstas.org" class="">mcstas-users@mcstas.org</a><br class="">
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users<br class="">
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;">
<br class="">
Peter Kjær Willendrup<br class="">
Forskningsingeniør, Specialkonsulent<br class="">
Næstformand for DTU Fysik LSU<br class="">
<br class="">
DTU Physics<br class="">
<br class="">
</div>
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="Apple-interchange-newline">
<span><img apple-inline="yes" id="2EB2E6BF-AE3E-4255-B836-AFC69F026824" src="cid:b6339554-7f28-441d-9f31-5944f811397c@win.dtu.dk" class=""></span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Technical
University of Denmark</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><span><img apple-inline="yes" id="02D7917A-F898-433D-B70D-70D1C39069A0" src="cid:e108e480-fcab-46e2-9531-b38165079572@win.dtu.dk" class=""></span><br class="Apple-interchange-newline">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Department
of Physics</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Fysikvej</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Building
307</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">DK-2800
Kongens Lyngby</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Direct
+45 2125 4612</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Mobil
+45 2125 4612</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class="">Fax
+45 4593 2399</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline !important; float: none;" class=""><a href="mailto:pkwi@fysik.dtu.dk" class="">pkwi@fysik.dtu.dk</a></span>
</span></span></div>
<br class="">
</div>
</body>
</html>