From marcus.mendenhall at nist.gov Mon Oct 5 14:00:29 2015 From: marcus.mendenhall at nist.gov (Mendenhall, Marcus) Date: Mon, 5 Oct 2015 12:00:29 +0000 Subject: [mcxtrace-users] improved perfect crystal model Message-ID: My group at NIST does extensive work with high-quality single-crystal optics to make xray spectrometers. Using the "PerfectCrystal.comp" component turned up numerous computational errors and shortcomings in the model. I have taken the code from it, and both fixed the errors in it, and extended it to be more useful in a practical context. This code should still look quite familiar to someone who has read the original PerfectCrystal.comp model. The issues fixed are: 1) rays with non-zero kx were reflected incorrectly 2) complex arithmetic in DarwinReflectivity had errors 3) atomic motion not handled at all, so rocking curve width was not right. The extensions are: 1) now fully handles polarization. If ray comes in with Ex and Ey correctly defined, the outgoing polarization is a correctly computed from these. If Ex and Ey are zero on entrance, a new, random, polarization is generated, and then properly reflected. If multiple bounces are used, the polarization propagates correctly. 2) added a crystal_type field which allows one to select diamond, bcc, or fcc cubic structures, or to explicitly provide the phase factors from which to compute form factors 3) added a field for the Debye-Waller temperature factor, and scaling of structure factors for the atomic motion. Rocking curves now agree in high detail both with XOP and with our own experimental data. I have spent considerable effort validating the entire result. I think this is a good representation of a flat, perfect crystal under realistic conditions. Anyone who has been using the PerfectCrystal.comp object, I would appreciate it if you would take a hard look at this and let me know if you see issues. This should eventually probably turn up in the official McXtrace distribution. For the future: I will extend this to handle bent crystals, to that Johansson monochromators can be modeled. Marcus Mendenhall Materials Measurement Science Division National Institute of Standards and Technology 100 Bureau Dr. stop 8370 (217/B115) Gaithersburg MD 20899 USA phone: +1(301) 975-8631 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: NIST_Perfect_Crystal.comp Type: application/octet-stream Size: 17991 bytes Desc: NIST_Perfect_Crystal.comp URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From erkn at fysik.dtu.dk Mon Oct 5 20:38:40 2015 From: erkn at fysik.dtu.dk (Erik B Knudsen) Date: Mon, 5 Oct 2015 20:38:40 +0200 Subject: [mcxtrace-users] improved perfect crystal model In-Reply-To: References: Message-ID: <5612C3B0.70606@fysik.dtu.dk> Dear Marcus, Great news! We (as in the McXtrace team) would be happy study this improved crystal model, and to include this greatly improved crystal model in the official distribution, if that is your wish. If you want, we'll be happy to assist you with your plans for a bent crystal model. on behalf of the McXtrace team Erik B Knudsen On 05/10/15 14:00, Mendenhall, Marcus wrote: > My group at NIST does extensive work with high-quality single-crystal > optics to make xray spectrometers. Using the "PerfectCrystal.comp" > component turned up numerous computational errors and shortcomings in > the model. > > I have taken the code from it, and both fixed the errors in it, and > extended it to be more useful in a practical context. This code should > still look quite familiar to someone who has read the original > PerfectCrystal.comp model. > > The issues fixed are: > > 1) rays with non-zero kx were reflected incorrectly > 2) complex arithmetic in DarwinReflectivity had errors > 3) atomic motion not handled at all, so rocking curve width was not right. > > The extensions are: > 1) now fully handles polarization. If ray comes in with Ex and Ey > correctly defined, the outgoing polarization is a correctly computed > from these. If Ex and Ey are zero on entrance, a new, random, > polarization is generated, and then properly reflected. If multiple > bounces are used, the polarization propagates correctly. > 2) added a crystal_type field which allows one to select diamond, bcc, > or fcc cubic structures, or to explicitly provide the phase factors from > which to compute form factors > 3) added a field for the Debye-Waller temperature factor, and scaling of > structure factors for the atomic motion. Rocking curves now agree in > high detail both with XOP and with our own experimental data. > > I have spent considerable effort validating the entire result. I think > this is a good representation of a flat, perfect crystal under realistic > conditions. > > > Anyone who has been using the PerfectCrystal.comp object, I would > appreciate it if you would take a hard look at this and let me know if > you see issues. This should eventually probably turn up in the official > McXtrace distribution. > > For the future: I will extend this to handle bent crystals, to that > Johansson monochromators can be modeled. > > Marcus Mendenhall > > Materials Measurement Science Division > National Institute of Standards and Technology > 100 Bureau Dr. stop 8370 (217/B115) > Gaithersburg MD 20899 USA > phone: +1(301) 975-8631 > > > > _______________________________________________ > mcxtrace-users mailing list > mcxtrace-users at mcxtrace.org > http://mailman.mcxtrace.org/cgi-bin/mailman/listinfo/mcxtrace-users > -- Erik Bergb?ck Knudsen, Research Engineer | DTU | morituri NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te phone: (+45) 2132 6655 |<>-<>| salutant From marcus.mendenhall at nist.gov Thu Oct 15 14:38:17 2015 From: marcus.mendenhall at nist.gov (Mendenhall, Marcus) Date: Thu, 15 Oct 2015 12:38:17 +0000 Subject: [mcxtrace-users] improved perfect crystal model In-Reply-To: <5612C3B0.70606@fysik.dtu.dk> References: <5612C3B0.70606@fysik.dtu.dk> Message-ID: <597ED54B-766A-4159-BE3B-FD612A75120C@nist.gov> Erik: I now have a working doubly-bent crystal model, too, capable of creating a Johannson optic. I also have updated the Source_lab.comp into Source_lab_lorentzian.comp. The original Source_lab, although documented to produce Lorentzian lines, actually produces Gaussians, if one looks at the code. The Source_Lab_Lorentzian produces reasonable facsimilies of the spectra of some commonly-used anode materials. I have slightly updated the NIST_Perfect_crystal I provided before, so that I think it handles non-zero alpha angles (angle between crystal surface and lattice planes). I would like to start writing documentation for these. What format do you want text for your manual? (LaTeX would be my preferred format). I am attaching an updated NIST_Perfect_crystal.comp, Source_Lab_Lorentzian.comp, and the new NIST_bent_crystal.comp, along with an instrument which uses these. The comments and math in the sample instrument show how to compute the correct curvatures for an asymmetric (different source and focal distance) Johannson optic for a given material and center wavelength. I am also attaching a PDF of the geometries of the two crystal types, just as a start on documentation. Finally, I am attaching a modified version of PSD_Monitor.comp. The monitor, as provided in the distribution, results in invalid output if you make it a 1-dimensional monitor. This is because in the function which finalizes the output from a general n-dimensional detector in mcdetector_import() in mccode_r.c, the downconversion of the rank of the detector preserves the variables as X & Y (correct for a 2 detector), instead of converting them to X and (I, Ierr) which is correct for the 1D case. This probably should ultimately be fixed at this level, but for now the new PSD_Monitor checks to see if it is really 1D, and directly calls the appropriate output function. All of these should, of course, be considered very beta code for now, although I have tried to validate both crystals fairly thoroughly. Marcus Mendenhall Materials Measurement Science Division National Institute of Standards and Technology 100 Bureau Dr. stop 8370 (217/B115) Gaithersburg MD 20899 USA phone: +1(301) 975-8631 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: DBD_IBM_Si_analyzer.instr Type: application/octet-stream Size: 7269 bytes Desc: DBD_IBM_Si_analyzer.instr URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: NIST_Perfect_Crystal.comp Type: application/octet-stream Size: 18506 bytes Desc: NIST_Perfect_Crystal.comp URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: NIST_bent_crystal.comp Type: application/octet-stream Size: 23239 bytes Desc: NIST_bent_crystal.comp URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Source_lab_lorentzian.comp Type: application/octet-stream Size: 14265 bytes Desc: Source_lab_lorentzian.comp URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: PSD_monitor.comp Type: application/octet-stream Size: 5364 bytes Desc: PSD_monitor.comp URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: NIST_mcx_crystals.pdf Type: application/pdf Size: 57848 bytes Desc: NIST_mcx_crystals.pdf URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcus.mendenhall at nist.gov Thu Oct 15 14:47:27 2015 From: marcus.mendenhall at nist.gov (Mendenhall, Marcus) Date: Thu, 15 Oct 2015 12:47:27 +0000 Subject: [mcxtrace-users] improved perfect crystal model In-Reply-To: <5612C3B0.70606@fysik.dtu.dk> References: <5612C3B0.70606@fysik.dtu.dk> Message-ID: Erik and the list: Note that in the files I attached to the previous message, the DBD_IBM_Si_analyzer.instr has comments encoded in UTF-8 to insert nice Greek letters in the comments. It will download correctly and be readable if you set your browser or editor to recognize the UTF-8. No harm is done if you do not; the comments will just look scrambled. Marcus Mendenhall Materials Measurement Science Division National Institute of Standards and Technology 100 Bureau Dr. stop 8370 (217/B115) Gaithersburg MD 20899 USA phone: +1(301) 975-8631 -------------- next part -------------- An HTML attachment was scrubbed... URL: From erkn at fysik.dtu.dk Thu Oct 15 18:39:22 2015 From: erkn at fysik.dtu.dk (Erik B Knudsen) Date: Thu, 15 Oct 2015 18:39:22 +0200 Subject: [mcxtrace-users] improved perfect crystal model In-Reply-To: <597ED54B-766A-4159-BE3B-FD612A75120C@nist.gov> References: <5612C3B0.70606@fysik.dtu.dk> <597ED54B-766A-4159-BE3B-FD612A75120C@nist.gov> Message-ID: <561FD6BA.2090504@fysik.dtu.dk> Dear Marcus, Again excellent news! I look forward to testing your components thoroughly. On 15/10/15 14:38, Mendenhall, Marcus wrote: > Erik: > > I now have a working doubly-bent crystal model, too, capable of creating > a Johannson optic. I also have updated the Source_lab.comp into > Source_lab_lorentzian.comp. The original Source_lab, although > documented to produce Lorentzian lines, actually produces Gaussians, if > one looks at the code. The Source_Lab_Lorentzian produces reasonable > facsimilies of the spectra of some commonly-used anode materials. Acknowledged, the lines were indeed coded to be Gaussian, which was not quite what they should be. > > I have slightly updated the NIST_Perfect_crystal I provided before, so > that I think it handles non-zero alpha angles (angle between crystal > surface and lattice planes). Good! > > I would like to start writing documentation for these. What format do > you want text for your manual? (LaTeX would be my preferred format). LateX for sure. We may be moving to XeTeX or XeLaTeX sometime soon, but we can easily deal with whatever (minor) modifications are necessary with respect to that. > > I am attaching an updated NIST_Perfect_crystal.comp, > Source_Lab_Lorentzian.comp, and the new NIST_bent_crystal.comp, along > with an instrument which uses these. The comments and math in the > sample instrument show how to compute the correct curvatures for an > asymmetric (different source and focal distance) Johannson optic for a > given material and center wavelength. I am also attaching a PDF of the > geometries of the two crystal types, just as a start on documentation Excellent - thank you very much. > > Finally, I am attaching a modified version of PSD_Monitor.comp. The > monitor, as provided in the distribution, results in invalid output if > you make it a 1-dimensional monitor. This is because in the function > which finalizes the output from a general n-dimensional detector in > mcdetector_import() in mccode_r.c, the downconversion of the rank of the > detector preserves the variables as X & Y (correct for a 2 detector), > instead of converting them to X and (I, Ierr) which is correct for the > 1D case. This probably should ultimately be fixed at this level, but > for now the new PSD_Monitor checks to see if it is really 1D, and > directly calls the appropriate output function. > > All of these should, of course, be considered very beta code for now, > although I have tried to validate both crystals fairly thoroughly. Beta or not - Let's berge ahead with some testing, and we might make it into the next release perhaps. This is really cool! > > Marcus Mendenhall > > Materials Measurement Science Division > National Institute of Standards and Technology > 100 Bureau Dr. stop 8370 (217/B115) > Gaithersburg MD 20899 USA > phone: +1(301) 975-8631 Happy simulating! Erik -- Erik Bergb?ck Knudsen, Research Engineer | DTU | morituri NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te phone: (+45) 2132 6655 |<>-<>| salutant From erkn at fysik.dtu.dk Fri Nov 27 09:12:20 2015 From: erkn at fysik.dtu.dk (Erik B Knudsen) Date: Fri, 27 Nov 2015 09:12:20 +0100 Subject: [mcxtrace-users] Apologies for spam coming through Message-ID: <56581064.80807@fysik.dtu.dk> Dear all, On behlaf of the team, I would like to apologize for the spam that currently gets through the filters to the mailing list. We are working on getting rid of it - in the meantime, we'll just have to ask you for patience. cheers Erik B Knudsen -- Erik Bergb?ck Knudsen, Research Engineer | DTU | morituri NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te phone: (+45) 2132 6655 |<>-<>| salutant