computer programs\(\def\hfill{\hskip 5em}\def\hfil{\hskip 3em}\def\eqno#1{\hfil {#1}}\)

Journal logoJOURNAL OF
APPLIED
CRYSTALLOGRAPHY
ISSN: 1600-5767

GRASP Integrated 3D Plotter: GRIP

crossmark logo

aMassachusetts Institute of Technology, USA, and bPaul Scherrer Institut, Switzerland
*Correspondence e-mail: pmneves@mit.edu

Edited by J. Ilavsky, Argonne National Laboratory, USA (Received 16 September 2024; accepted 24 October 2024; online 26 November 2024)

In research on mesoscale structure and correlations, small-angle neutron scattering (SANS) is increasingly being employed to map fully three-dimensional distributions of scattered intensity at low momentum transfer. While traditionally SANS experiments and data analysis methods are designed to prioritize the determination of salient information in only one or two dimensions, the trend towards volumetric intensity mapping experiments calls for new software tools to assist with analyzing the resulting datasets. In this paper, we describe the development of a new software module, the GRASP Integrated 3D Plotter (GRIP). GRIP adds numerous features to GRASP, a widely used SANS analysis program that was written in MATLAB and developed at the Institut Laue–Langevin, France. The GRIP module provides multiple methods of three-dimensional SANS data visualization and new abilities to perform 1D and 2D cuts in various momentum-space coordinate systems, including reciprocal lattice units relevant for single-crystal studies. GRIP also includes the ability to fit diffraction peaks to a fully three-dimensional ellipsoidal Gaussian function to extract peak parameters including peak intensity, location and width, as well as a built-in calculator for estimating the resolution-deconvolved 3D coherence lengths in a sample. GRIP thus represents a significant addition to GRASP which extends the utility and application of SANS. Valuable advantages are provided, in particular, for `small-angle neutron diffraction' studies of mesoscale correlations in single crystals, such as those due to incommensurate magnetic spin textures like spirals and topological skyrmion lattices.

1. Introduction

Small-angle neutron scattering (SANS) is a well established and versatile technique (Jeffries et al., 2021[Jeffries, C. M., Ilavsky, J., Martel, A., Hinrichs, S., Meyer, A., Pedersen, J. S., Sokolova, A. V. & Svergun, D. I. (2021). Nat. Rev. Methods Primers, 1, 70.]) providing pivotal insights in the research fields of biological systems, polymers, engineering, nanoparticles and micromagnetism (Mühlbauer et al., 2019[Mühlbauer, S., Honecker, D., Périgo, A., Bergner, F., Disch, S., Heinemann, A., Erokhin, S., Berkov, D., Leighton, C., Eskildsen, M. R. & Michels, A. (2019). Rev. Mod. Phys. 91, 015004.]; Jacques & Trewhella, 2010[Jacques, D. A. & Trewhella, J. (2010). Protein Sci. 19, 642-657.]; Koch et al., 2003[Koch, M. H. J., Vachette, P. & Svergun, D. I. (2003). Q. Rev. Biophys. 36, 147-227.]; Schmidt, 1991[Schmidt, P. W. (1991). J. Appl. Cryst. 24, 414-435.]; Chen, 1986[Chen, S.-H. (1986). Annu. Rev. Phys. Chem. 37, 351-399.]; Gabel et al., 2002[Gabel, F., Bicout, D., Lehnert, U., Tehei, M., Weik, M. & Zaccai, G. (2002). Q. Rev. Biophys. 35, 327-367.]; Schmatz et al., 1974[Schmatz, W., Springer, T., Schelten, J. & Ibel, K. (1974). J. Appl. Cryst. 7, 96-116.]; Bunjes & Unruh, 2007[Bunjes, H. & Unruh, T. (2007). Adv. Drug Deliv. Rev. 59, 379-402.]; Blazek & Gilbert, 2011[Blazek, J. & Gilbert, E. P. (2011). Carbohydr. Polym. 85, 281-293.]; Marshall & Lowde, 1968[Marshall, W. & Lowde, R. D. (1968). Rep. Prog. Phys. 31, 705-775.]; Gebel & Diat, 2005[Gebel, G. & Diat, O. (2005). Fuel Cells, 5, 261-276.]; Honecker et al., 2022[Honecker, D., Bersweiler, M., Erokhin, S., Berkov, D., Chesnel, K., Venero, D. A., Qdemat, A., Disch, S., Jochum, J. K., Michels, A. & Bender, P. (2022). Nanoscale Adv. 4, 1026-1059.]), to name a few. The technique is optimized for the study of structure and correlations characterized by real-space length scales in the ∼1–400 nm range. In recent years in particular, SANS has proved invaluable in the investigation of a growing number of magnetic materials found to host complex magnetism such as magnetic incommensurately modulating spiral and skyrmion phases (Mühlbauer et al., 2009[Mühlbauer, S., Binz, B., Jonietz, F., Pfleiderer, C., Rosch, A., Neubauer, A., Georgii, R. & Böni, P. (2009). Science, 323, 915-919.]; Mühlbauer et al., 2019[Mühlbauer, S., Honecker, D., Périgo, A., Bergner, F., Disch, S., Heinemann, A., Erokhin, S., Berkov, D., Leighton, C., Eskildsen, M. R. & Michels, A. (2019). Rev. Mod. Phys. 91, 015004.]; Tokura & Kanazawa, 2021[Tokura, Y. & Kanazawa, N. (2021). Chem. Rev. 121, 2857-2897.]). Skyrmions themselves are nanoscale magnetic whirl-like structures with topological properties and real-space length scales that vary from a few to a few hundred nanometres. As they typically form a two-dimensional hexagonal lattice inside a host crystal, the distribution of the associated diffraction signals in momentum space from these skyrmion lattices makes them ripe for exploration and characterization by SANS. The first discovery by SANS of skyrmions was in the chiral cubic helimagnet MnSi in 2009 (Mühlbauer et al., 2009[Mühlbauer, S., Binz, B., Jonietz, F., Pfleiderer, C., Rosch, A., Neubauer, A., Georgii, R. & Böni, P. (2009). Science, 323, 915-919.]; Neubauer et al., 2009[Neubauer, A., Pfleiderer, C., Binz, B., Rosch, A., Ritz, R., Niklowitz, P. G. & Böni, P. (2009). Phys. Rev. Lett. 102, 186602.]; Yu et al., 2010[Yu, X. Z., Onose, Y., Kanazawa, N., Park, J. H., Han, J. H., Matsui, Y., Nagaosa, N. & Tokura, Y. (2010). Nature, 465, 901-904.]); skyrmions and their lattice structures have most recently been discovered in frustrated magnets with strong Ruderman–Kittel–Kasuya–Yosida (RKKY) interactions (Kurumaji et al., 2019[Kurumaji, T., Nakajima, T., Hirschberger, M., Kikkawa, A., Yamasaki, Y., Sagayama, H., Nakao, H., Taguchi, Y., Arima, T. & Tokura, Y. (2019). Science, 365, 914-918.]; Hirschberger et al., 2019[Hirschberger, M., Nakajima, T., Gao, S., Peng, L., Kikkawa, A., Kurumaji, T., Kriener, M., Yamasaki, Y., Sagayama, H., Nakao, H., Ohishi, K., Kakurai, K., Taguchi, Y., Yu, X., Arima, T. H. & Tokura, Y. (2019). Nat. Commun. 10, 5831.]), with SANS studies again making notable contributions (Takagi et al., 2022[Takagi, R., Matsuyama, N., Ukleev, V., Yu, L., White, J. S., Francoual, S., Mardegan, J. R. L., Hayami, S., Saito, H., Kaneko, K., Ohishi, K., Ōnuki, Y., Arima, T., Tokura, Y., Nakajima, T. & Seki, S. (2022). Nat. Commun. 13, 1472.]; Singh et al., 2023[Singh, D., Fujishiro, Y., Hayami, S., Moody, S. H., Nomoto, T., Baral, P. R., Ukleev, V., Cubitt, R., Steinke, N.-J., Gawryluk, D. J., Pomjakushina, E., Ōnuki, Y., Arita, R., Tokura, Y., Kanazawa, N. & White, J. S. (2023). Nat. Commun. 14, 8050.]). Beyond two-dimensional skyrmion lattices, three-dimensional magnetic textures such as hedgehog lattices (Tanigaki et al., 2015[Tanigaki, T., Shibata, K., Kanazawa, N., Yu, X., Onose, Y., Park, H. S., Shindo, D. & Tokura, Y. (2015). Nano Lett. 15, 5438-5442.]; Fujishiro et al., 2019[Fujishiro, Y., Kanazawa, N., Nakajima, T., Yu, X. Z., Ohishi, K., Kawamura, Y., Kakurai, K., Arima, T., Mitamura, H., Miyake, A., Akiba, K., Tokunaga, M., Matsuo, A., Kindo, K., Koretsune, T., Arita, R. & Tokura, Y. (2019). Nat. Commun. 10, 1059.]; Ishiwata et al., 2020[Ishiwata, S., Nakajima, T., Kim, J.-H., Inosov, D. S., Kanazawa, N., White, J. S., Gavilano, J. L., Georgii, R., Seemann, K. M., Brandl, G., Manuel, P., Khalyavin, D. D., Seki, S., Tokunaga, Y., Kinoshita, M., Long, Y. W., Kaneko, Y., Taguchi, Y., Arima, T., Keimer, B. & Tokura, Y. (2020). Phys. Rev. B, 101, 134406.]; Kanazawa et al., 2020[Kanazawa, N., Kitaori, A., White, J. S., Ukleev, V., Rønnow, H. M., Tsukazaki, A., Ichikawa, M., Kawasaki, M. & Tokura, Y. (2020). Phys. Rev. Lett. 125, 137202.]) have also been revealed using SANS, extending the scope of magnetic textures found in nature that may be potentially exploited for industrial use (Fert et al., 2017[Fert, A., Reyren, N. & Cros, V. (2017). Nat. Rev. Mater. 2, 17031.]).

The developing interest in applying SANS instruments for studying diverse types of incommensurate magnetic order marks the evolution towards a need for comprehensive analysis of three-dimensional datasets. Traditionally SANS data analysis software allows the user to perform an analysis over either one or two dimensions within the qx-qy plane of the two-dimensional detector (Pedersen, 1997[Pedersen, J. S. (1997). Adv. Colloid Interface Sci. 70, 171-210.]). The qz dimension (parallel to the incident neutron beam) is otherwise neglected or integrated over, and in many studies, for instance on biological and soft matter systems, only |q| is considered. However, in systems with sharply peaked structure factors or single-crystalline materials, important information is con­tained in the qz dimension: namely the three-dimensionality of propagation vectors q of incommensurate magnetic structures, information about mosaicity of single-crystal samples and three-dimensional correlation lengths. The emergence of numerous single-crystalline materials hosting magnetic textures spanning a wide distribution in momentum space strongly motivates the need for SANS software tools which allow visualization, analysis and interpretation of fully three-dimensional diffraction data, thus consolidating a branch of the technique we term small-angle neutron diffraction (SAND).

To date, SANS software tools have provided only limited support for the detailed analysis of the full three-dimensional scattering that can be collected in standard SAND measurements (i.e. `rocking curve’ measurements), where multi-detector intensity data are collected over a range of discrete sample rotation angles with respect to the incoming neutron beam. Notably, the SANS data reduction and analysis software GRASP, written in MATLAB (The MathWorks Inc., Natick, MA, USA) and developed at the Institut Laue–Langevin (ILL), Grenoble, France (Dewhurst, 2023[Dewhurst, C. D. (2023). J. Appl. Cryst. 56, 1595-1609.]), provides a platform for analysis of SAND data obtained over a range of rocking angles, as well as the ability to analyze data both within the qx-qy detector plane and as a function of rocking angle. However, the standard analysis tools offered by GRASP neither calculate qz nor transform the data from the laboratory frame into the sample's momentum space, and rely on integration over one or more directions of a three-dimensional array of the accumulated two-dimensional SANS detector data. Additionally, there are no tools that allow the user to either visualize or analyze the entire three-dimensional dataset as a single entity of volumetric data in the sample reference frame.

Here, we describe the development of a user module for GRASP that provides the capability for the operator to both visualize and analyze an entire three-dimensional SAND dataset. This user module, called GRASP Integrated 3D Plotter or GRIP, harnesses much of the flexibility of GRASP, making it immediately compatible with data collected at numerous SANS instruments around the world, as well as including support for modern multi-panel SANS detectors and polarization analysis. GRIP introduces several methods of plotting three-dimensional SAND datasets, the ability to make user-defined one- and two-dimensional cuts in a variety of coordinate systems, and a SAND calculator to aid in the planning of experiments. Beyond this, GRIP elevates the capability of GRASP to a full 3D analysis of SAND data through (i) plotting the three-dimensional SAND dataset in reciprocal lattice units, (ii) three-dimensional fitting of diffraction peaks to extract 3D q-vector lengths and orientations, diffraction intensities, and correlation lengths, and (iii) a built-in resolution calculator. Additionally, the processed datasets produced by GRIP are made available to users using the MATLAB-code version as a global data structure in the MATLAB workspace. The current version of GRIP was developed in MATLAB version R2023b with GRASP version 10.27f. GRIP is included as part of GRASP, either as source MATLAB code or as a standalone executable, and is distributed freely by the ILL at https://www.ill.fr/grasp.

2. Formalism

2.1. Coordinate systems

In order to develop the full three-dimensional treatment of SAND data, it is important to first describe the coordinate systems and their relationships. The geometry of a standard SANS experiment is depicted in Fig. 1[link]. A collimated monochromatic neutron beam is transmitted through a sample, and then the scattered beam is detected on a 2D detector a distance d behind the sample. We define a dimensionless laboratory coordinate system with an origin in the plane of the detector where [{{\hat{\bf y}_{\rm L}}}] is vertical, [{{\hat{\bf z}_{\rm L}}}] is anti-parallel to the incident neutron beam and [{{\hat{\bf x}_{\rm L}}}] completes the right-handed coordinate system. The incident neutron wavevector [{{\bf k}}_{0} = -{ k}_{0}{{\hat{\bf z}_{\rm L}}}], where the magnitude k0 is related to the neutron wavelength λ by k0 = 2π/λ. Since we consider only standard elastic scattering processes [neither inelastic SANS nor scattering processes that lead to noticeable changes in neutron kinetic energy (e.g. Kealey et al., 2001[Kealey, P. G., Charalambous, D., Forgan, E. M., Lee, S. L., Johnson, S. T., Schleger, P., Cubitt, R., Paul, D. M., Aegerter, C. M., Tajima, S. & Rykov, A. (2001). Phys. Rev. B, 64, 174501.]; Rastovski et al., 2013[Rastovski, C., Dewhurst, C. D., Gannon, W. J., Peets, D. C., Takatsu, H., Maeno, Y., Ichioka, M., Machida, K. & Eskildsen, M. R. (2013). Phys. Rev. Lett. 111, 087003.]) are considered or implemented in GRIP], the outgoing neutron wavevector [{{\bf k_{\rm f}}}] of magnitude k0 forms an angle 2θ with [{{\bf k}}_{0}] and an azimuthal angle ψ in the x-y plane. If a neutron is detected at a position (x, y, 0) on the detector, and the transmitted beam is centered at (xBC, yBC, 0), then

[\eqalignno{{{\bf k_{\rm f}}}& = k_{0}{{(x-x_{\rm BC}){{\hat{\bf x}_{\rm L}}}+(y-y_{\rm BC}){{\hat{\bf y}_{\rm L}}}-d{ {\hat{\bf z}_{\rm L}}}} \over {\left[ {(x-x_{\rm BC})^{2}+(y-y_{\rm BC})^{2}+d^{2}} \right]^{1/2}}}\cr & = k_{0}(\sin 2\theta\sin\psi\ {{\hat{\bf x}_{\rm L}}}+\sin 2 \theta\cos\psi \ {{\hat{\bf y}_{\rm L}}}-\cos 2\theta\ {{\hat{\bf z}_{\rm L}}}). & (1)}]

The scattering wavevector in the laboratory coordinate system [{{\bf q_{\rm L}}}] is then defined as

[\eqalignno{{\bf q_{\rm L}}& = {{\bf k_{\rm f}} }-{{\bf k}}_{0}\cr & = k_{0}[\sin 2\theta\sin\psi\ {{\hat{\bf x}_{\rm L}}}+\sin 2 \theta\cos\psi\ {{\hat{\bf y}_{\rm L}}}+(1-\cos 2\theta){{\hat{\bf z}_{\rm L }}}].& (2)}]

[Figure 1]
Figure 1
Diagram of a typical SANS experiment geometry at a continuous source, and angle/axis coordinates used by GRIP. An incident collimated and monochromated neutron beam comes from the left with wavevector k0. The sample is indicated by a gray hexagonal prism with local sample coordinates [{\hat{\bf x}_{\rm S}}], [{\hat{\bf y}_{\rm S}}], [{\hat{\bf z}_{\rm S}}] in red. The sense of rotation of the goniometer angles GRIP_dom, GRIP_san and GRIP_phi is indicated about the axes shown as dashed lines. Outgoing scattered neutrons at wavevector kf impinge upon a detector a distance d (several metres, not to scale) away. The laboratory coordinate system [{\hat{\bf x}_{\rm L}}], [{\hat{\bf y}_{\rm L}}], [{\hat{\bf z}_{\rm L}}] is indicated on the detector, along with the Bragg angle 2θ and the azimuthal angle ψ.

Prior to GRIP, this equation represented the extent to which GRASP handled both geometric angles and the momentum-space coordinate system, with the relevant values generated by the built-in GRASP function build_q_matrix.m. Combining these values with an understanding of the geometry of the rotation axes, the GRIP module maps these data to a three-dimensional reciprocal space in the reference frame of the sample. In a standard experiment, the sample and cryostat may be rocked together, first by a rotation about the vertical direction, which we refer to as san, and then on that goniometer by a rotation about a horizontal axis parallel to [{{\hat{\bf x}_{\rm L}}}] when san = 0, referred to as ϕ. Then inside the cryostat the sample stick can be rotated about an axis that is parallel to [{{\hat{\bf y}_{\rm L}}}] when ϕ is zero, a rotation that we refer to as dom. (The names of angles san, ϕ and dom, respectively, correspond to those commonly called ω, χ and ϕ on four-circle diffractometers.) The combined effect of these independent rotational degrees of freedom can be represented by the application of three consecutive rotation matrices:

[\eqalign{{{\bi R}^{-1}_{san}}& = \pmatrix{\cos san &0&-\sin san\cr 0&1&0\cr \sin san&0&\cos san},\cr {{\bi R}^{-1}_{\phi}}& = \pmatrix{1&0&0\cr 0&\cos\phi&-\sin\phi\cr 0&\sin\phi&\cos\phi},\cr{{\bi R}^{-1}_{dom}}& = \pmatrix{\cos dom&0&-\sin dom \cr 0&1&0\cr \sin dom&0&\cos dom}.} \eqno (3)]

These create a master rotation matrix [{\bi R}^{-1}],

[{\bi R}^{-1} = {{\bi R}^{-1}_{san}{\bi R}^{-1}_{\phi}{\bi R}^{-1}_{dom}},\eqno (4)]

that transforms the scattering vector in the laboratory coordinate system [{{\bf q_{\rm L}}}] into the (not yet aligned) sample coordinate system [{{{\bf q}_{\rm S}^{\prime}}}] as

[{{{\bf q}_{\rm S}^{\prime}}} = {{\bi R}^{-1}}{{\bf q_{\rm L}}}\eqno (5)]

when [{{{\bf q}_{\rm S}^{\prime}}}] and [{{\bf q_{\rm L}}}] are represented as row vectors. A standard SAND experiment consists of rocking over one or several angles and taking exposures on the 2D detector at many discrete, consecutive angles. In this way, a three-dimensional volume of reciprocal space is mapped out. To make any of the GRASP-supported SANS instruments compatible with GRIP, one need only add a mapping of the instrument goniometer angles to the GRIP_dom, GRIP_san and/or GRIP_phi variables within the instrument's specific pre-existing GRASP configuration file.

GRIP provides further support for correcting any mis­align­ment of the sample with respect to the zeroed goniometer positions. Here three additional rotation matrices [{{\bi U}_{y}^{-1}}], [{{\bi U}_{x}^{-1}}] and [{{\bi U}_{z}^{-1}}] correct for misalignment of the sample rotation in dom, tilt in ϕ and azimuthal alignment, respectively. These are written as

[\eqalign{{{\bi U}_{y}^{-1}}&= \pmatrix{\cos \theta_{y}&0&-\sin\theta_{y}\cr 0&1&0\cr \sin\theta_{y}&0&\cos\theta_{y}},\cr {{\bi U}_{x}^{-1}}&\displaystyle = \pmatrix{1&0&0\cr 0&\cos\theta_{x}&-\sin\theta_{x}\cr 0&\sin\theta_{x}&\cos\theta_{x}},\cr \displaystyle{{\bi U}_{z}^{-1}}&\displaystyle = \pmatrix{\cos\theta_{z}&-\sin \theta_{z}&0\cr \sin\theta_{z}&\cos\theta_{z}&0\cr 0&0&1}} \eqno (6)]

for angular sample misalignments θy, θx and θz. The complete transformation matrix from the laboratory [{{\bf q_{\rm L}}}] to an aligned sample reciprocal space [{{\bf q_{\rm S}}}] is thus [{{\bf q_{\rm S}}} = {{\bi U}_{\rm a}^{-1}}{{\bi R}^{-1}}{{\bf q_{\rm L}}}] with [{{\bi U}_{\rm a}^{-1}}{\bi R}^{-1} = {\bi U}_{y}^{-1}{\bi U}_{x}^{-1}{\bi U}_{z}^{-1}{\bi R}^{-1}_{san}{\bi R}^{-1 }_{\phi}{\bi R}^{-1}_{dom}].

GRIP also supports several other coordinate systems which can aid in various common types of data cuts, visualizations and analysis that the users may want to perform. A cylindrical coordinate system is provided by

[\eqalign{ q_{r}& = \left( {q_{x}^{2}+q_{y}^{2}} \right)^{1/2},\cr \displaystyle\psi&\displaystyle = {\rm atan2}(q_{x},q_{y}),\cr \displaystyle q_{z}&\displaystyle = q_{z},} \eqno(7)]

where atan2 is the four-quadrant arctangent function returning in units of degrees such that 0° ≤ atan2(y, x) ≤ 360°. This coordinate system is particularly useful, for example, when analyzing hexagonal/square lattice structures, or other cases where a magnetic field creates a planar or cylindrically symmetric structure, or where a user observes an azimuthal distribution of intensity as a function of qz or qr. Additionally, a spherical coordinate system is provided by

[\eqalign{ q_{\rho}&\displaystyle = \left( {q_{x}^{2}+q_{y}^{2}+q_ {z}^{2}} \right)^{1/2},\cr \displaystyle\psi&\displaystyle = {\rm atan2}(q_{x},q_{y}),\cr \displaystyle\omega&\displaystyle = {\rm acos}(q_{z}/q_{\rho}).} \eqno (8)]

This coordinate system is particularly convenient for obtaining the true magnitude of [|{{\bf q}}|] that includes all three dimensions, and for resolution function calculations, since the principal axes of the instrument resolution function lie along qρ, ψ and ω when the rocking axis is perpendicular to [{{\bf q}}]. The relationship between the Cartesian, cylindrical and spherical coordinate systems is depicted in Fig. 2[link].

[Figure 2]
Figure 2
Relationship between Cartesian (qx, qy, qz), cylindrical (qr, ψ, qz) and spherical (qρ, ψ, ω) coordinate systems used by GRIP.

Also of key importance for interpreting SAND data from single-crystalline samples is the ability to transform the data into the reciprocal lattice unit (RLU) coordinate system of the sample. This transformation can be accomplished by

[{{\bf q_{\rm RLU}}} = {\bi B}^{-1}{\bi U}_{\rm b}^{-1}{{\bf q_{\rm S}}}, \eqno (9)]

where [{\bi B}^{-1}{\bi U}_{\rm b}^{-1}] is a matrix which transforms coordinates in momentum space into reciprocal lattice units (Busing & Levy, 1967[Busing, W. R. & Levy, H. A. (1967). Acta Cryst. 22, 457-464.]; Arnold et al., 2014[Arnold, O., Bilheux, J.-C., Borreguero, J. M., Buts, A., Campbell, S. I., Chapon, L., Doucet, M., Draper, N., Ferraz Leal, R., Gigg, M. A., Lynch, V. E., Markvardsen, A., Mikkelson, D. J., Mikkelson, R. L., Miller, R., Palmen, K., Parker, P., Passos, G., Perring, T. G., Peterson, P. F., Ren, S., Reuter, M. A., Savici, A. T., Taylor, J. W., Taylor, R. J., Tolchenov, R., Zhou, W. & Zikovsky, J. (2014). Nucl. Instrum. Methods Phys. Res. A, 764, 156-166.]). In SANS, it is often not possible to directly access nuclear Bragg peaks, so alignment must be done either ex situ or with (in)commensurate superlattice peaks of known propagation direction. For this reason, we separate the sample misalignment correction matrix [{\bi U}_{\rm a}^{-1}] from the overall [{\bi B}^{-1}{\bi U}_{\rm b}^{-1}] matrix for convenience. [{{\bi B}^{-1}{\bi U}_{\rm b}^{-1}}] can be generated from a set of three points with known coordinates in both [{{\bf q_{\rm S}}}] and [{{\bf q_{\rm RLU}}}] as

[{\bi B}^{-1}{\bi U}_{\rm b}^{-1} = {\bi Q}_{\rm RLU}{\bi Q}_{\rm S}^{-1},\eqno (10)]

where [{{\bi Q}_{\rm RLU}}] and [{{\bi Q}_{\rm S}}] are 3 × 3 matrices made of three columns of three vectors of [{{\bf q_{\rm S}}}] and [{{\bf q_{\rm RLU}}}], respectively. The [{\bi B}^{-1}{\bi U}_{\rm b}^{-1}] matrix can also be generated from two known crystallographic directions if the lattice constants are known (Busing & Levy, 1967[Busing, W. R. & Levy, H. A. (1967). Acta Cryst. 22, 457-464.]; Arnold et al., 2014[Arnold, O., Bilheux, J.-C., Borreguero, J. M., Buts, A., Campbell, S. I., Chapon, L., Doucet, M., Draper, N., Ferraz Leal, R., Gigg, M. A., Lynch, V. E., Markvardsen, A., Mikkelson, D. J., Mikkelson, R. L., Miller, R., Palmen, K., Parker, P., Passos, G., Perring, T. G., Peterson, P. F., Ren, S., Reuter, M. A., Savici, A. T., Taylor, J. W., Taylor, R. J., Tolchenov, R., Zhou, W. & Zikovsky, J. (2014). Nucl. Instrum. Methods Phys. Res. A, 764, 156-166.]). Both methods have been implemented in GRIP.

To aid in the planning and interpretation of SAND experiments where a strongly three-dimensional distribution of scattering intensity is expected, GRIP also includes a calculator. This tool can convert between neutron wavelength in ångströms, energy in meV and momentum in inverse ångströms. This calculator can also calculate reciprocal lattice vectors given lattice parameters (only necessary for conversions using RLU), and convert a Cartesian [{{\bf q}}] vector into RLU coordinates or the rotation angles at which a diffraction peak may appear. Note that for the conversion to angles one angle of {san, 2θ, ϕ, ψ} must be specified; otherwise the nonlinear function solver will be underconstrained. If given RLU coordinates, the calculator can convert those to Cartesian [{{\bf q}}] coordinates. Given a set of instrument angles, a corresponding [{{\bf q}}] vector can also be calculated.

2.2. Binning

In a standard SAND experiment on samples with diffraction peaks, the sample is rocked along one or more angles while collecting data on a 2D area detector, sweeping out a 3D volume of reciprocal space. The pixels are not distributed evenly or uniformly in three dimensions, and therefore it is necessary to rebin the pixelated data into a regular coordinate system in order to plot the data for 1D, 2D or 3D cuts. In the following, we describe the protocol for binning in Cartesian coordinates. The procedure is similar for other coordinate systems, though care must be taken to handle the branch cut in the azimuthal angle in cylindrical and spherical coordinates if the desired limits exceed the range [0°, 360°]. In this case, the ψ coordinates should first be shifted as ψ → mod(ψψmin, 360°) + ψmin to ensure that the desired range is covered, where ψmin is the minimum of the binned ψ range. To bin the data, first the user selects 0, 1 or 2 axes to integrate over for 3D, 2D and 1D plots, respectively. Then the range and number of bins of [{{\bf q}}]-space to include is specified with minima and maxima in qx, qy and qz. If the user leaves an intensity limit as NaN (`not a number’), the largest/smallest value on that axis within the dataset is used automatically. The specified number of bins are evenly distributed between the minimum and the maximum. For each detector pixel at each sample angle, the pixel [{{\bf q}}] is calculated and is added to the appropriate bin for which it falls within the binning limits. Axes that are integrated over include all counts with the specified limits (this can be thought of as creating one bin for that axis). If normalization is selected, the counts in each bin are divided by the number of detector pixels that fell within that bin. This compensates for the nonuniform sampling of each bin (e.g. the Lorentz factor and moiré patterns between detector pixels and bins). Even with normalization, some choices of binning still lead to obvious binning artifacts, and care must be taken when aiming to evaluate peak intensities on an absolute scale from binned data.

The user can also choose to symmetrize the data with respect to [{{\bf q}}\rightarrow-{{\bf q}}]. This is often valid because of Friedel’s law, which states that the intensity of scattering should be inversion symmetric because it is proportional to the magnitude squared of the structure factor. However, we note that data symmetrization may not always be appropriate due to absorption, an asymmetric background, detector inefficiency, the chiral term in polarized data etc. Whether or not to symmetrize should be judged carefully by the user on the basis of the details of their experiment and reported in publications. Symmetrization is useful to improve the statistics in data visualization and to accommodate for regions that were not reached in [{{\bf q}}]-space. The symmetrization is performed by splitting each pixel of intensity I at position [{\bf q}] into two pixels of intensity I/2 at [{{\bf q}}] and [-{{\bf q}}]. A comparison between a single qxqy cut with different choices of normalization and symmetrization is provided in Fig. 3[link]. Symmetrization matches the intensity of opposing peaks and improves signal to noise. Normalization can even out the peak intensities somewhat, correcting for e.g. the Lorentz factor, which in this case leads to an intensity equalization so that the top and bottom peaks appear more intense. In practice, normalization may not always help with Lorentz factor corrections, depending on the angular extent over which the measurements are performed.

[Figure 3]
Figure 3
Comparison between options for data symmetrization and normalization within GRIP. The same data are plotted in all plots integrating over qz with different symmetrization/normalization options. The two top plots (a, b) do not normalize the number of pixels per bin, while the two bottom plots (c, d) do. The two left plots (a, c) do not symmetrize the data [{{\bf q}}\rightarrow-{{\bf q}}], while the two right plots (b, d) do. The data are from the superconducting vortex lattice of elemental niobium measured on the SANS-I instrument, Paul Scherrer Institute, Switzerland.

3. Plotting

A number of plotting options have been integrated into GRIP to aid in interpretation, investigation and analysis of SAND data. The data plotted and analyzed by GRIP come from the dataset that is currently in the GRASP dataloaders and can be perused angle by angle on the main display. Therefore, any background subtractions, renormalizations, polarization analysis etc. done by GRASP can be easily transported into GRIP for further analysis. Multi-detector support is implemented, and as mentioned above, any GRASP-supported instrument can be made compatible with GRIP through the implementation of GRIP_san, GRIP_dom and GRIP_phi angles (as defined in Fig. 2[link]) in the instrument configuration file. This must be done individually for each instrument to accommodate differences in naming and sign conventions for each instrument's goniometer(s).

3.1. 3D plotting

3.1.1. Isosurface and volumetric plots

For full visualization of three-dimensional SAND datasets, GRIP includes a variety of 3D plotting options. Volumetric and isosurface plots in Cartesian and RLU coordinates can be made in the same GUI. First, the user selects the desired binning and symmetry/normalization settings. For the isosurface plotter, which plots three-dimensional isosurfaces of intensity, the user must specify the isovalue level below which the intensity is cut off. An isovalue guidance button is provided which gives the percentiles of binned pixel intensities. Often an isovalue near 99% is optimal to display the diffraction peaks, but some experimentation may be necessary to optimize the plot. For the isosurface plot, the user can also add translucent planes for qx = 0, qy = 0 and qz = 0, as well as colored lines and surface coloring, as is shown in Fig. 4[link] for data of an incommensurate magnetic material measured on the SANS-I instrument, Paul Scherrer Institute, Switzerland (Kurumaji et al., 2024[Kurumaji, T., Paul, N., Fang, S., Neves, P. M., Kang, M., White, J. S., Nakajima, T., Graf, D., Ye, L., Chan, M. K., Suzuki, T., Denlinger, J., Jozwiak, C., Bostwick, A., Rotenberg, E., Zhao, Y., Lynn, J. W., Kaxiras, E., Comin, R., Fu, L. & Checkelsky, J. G. (2024). Submitted.]).

[Figure 4]
Figure 4
Example screenshot of main GRASP interface with data loaded from SANS-I (left), GRIP 3D plotting interface (lower right) and GRIP isosurface plot (upper right) for example data of an incommensurate magnetic material measured on the SANS-I instrument, Paul Scherrer Institute, Switzerland (Kurumaji et al., 2024[Kurumaji, T., Paul, N., Fang, S., Neves, P. M., Kang, M., White, J. S., Nakajima, T., Graf, D., Ye, L., Chan, M. K., Suzuki, T., Denlinger, J., Jozwiak, C., Bostwick, A., Rotenberg, E., Zhao, Y., Lynn, J. W., Kaxiras, E., Comin, R., Fu, L. & Checkelsky, J. G. (2024). Submitted.]).

Volumetric plots where the opacity and color of a cuboid are modified by the scattering intensity can also be produced within MATLAB's Volume Viewer interface. Again, first binning and symmetrization/normalization is specified. Volumetric plots can also be specified to be displayed with a logarithmic or linear intensity scale. When the `Make Vol.' button is pressed, a new Volume Viewer window is created, and the user can choose a colorscale and manipulate the opacity scaling. The upper window shown in Fig. 5[link] includes a zoom-in of a linear scaled dataset, while the lower portion of Fig. 5[link] provides a logarithmic volumetric plot of the same dataset, but zoomed out to also show the volume mapped out by additional side-detector panels of the instrument. Both scales can be useful to highlight different aspects of the data. Additionally, in our experience the volumetric plotter is often the easiest way to discover subtle, inherently 3D features in the data, such as subtle three-dimensional peak shapes, mosaicity and harmonic peaks. The eye can detect these patterns across multiple voxels in three dimensions when using the volumetric plotter, which is not possible when the data are projected into two or one dimension. Note that this plotting option requires the MATLAB Image Processing Toolbox to be installed.

[Figure 5]
Figure 5
Example volumetric plots. (a) A linear-scaled plot of the main detector and (b) the same data with a logarithmic scale.

Both the volumetric and isosurface plotters include an anisotropic 3D Gaussian smoothing option and an aspect ratio option to adjust the relative scale of each axis. In particular, enlarging the scale of qz is helpful when examining data from SAND experiments where the intensity is largely located near the qx-qy plane.

3.1.2. Pixel plotter

Though the isosurface and volumetric plotters plot the binned data only, it may sometimes be useful to directly visualize the intensity distribution of the actually measured detector pixels (i.e. with no binning) in three-dimensional space. The 3D pixel plotter option enables this. Every exposure of each detector panel is plotted, curved into Cartesian momentum space. This is helpful to understand the region of momentum space sampled by a given rocking curve. The pixels can be given a uniform transparency value, or the transparency of each pixel can be scaled by its intensity. An example pixel plot is shown in Fig. 6[link].

[Figure 6]
Figure 6
Example 3D pixel plot. Every pixel of each detector is plotted individually in the sample's 3D reciprocal space for each angle in a rocking curve. The opacity and color of each pixel is scaled by its intensity.

3.2. 1D/2D plotting

In addition to 3D plotting, 1D and 2D plots can be produced in GRIP. These are often useful for a subsequent, more detailed quantitative analysis. The user can choose either to make a single 1D or 2D plot or to make a multiplot which includes six 2D and 1D cuts of the same dataset, as is shown in Fig. 7[link] and in Appendix A[link] in Figs. 10, 11 and 12. These plots can be produced in Cartesian, cylindrical, spherical and RLU coordinates. The user must specify the coordinate system, the binning and which axes to integrate over, the symmetrization/normalization options, whether to plot in a logarithmic scale, and the colorscale. When using the multiplotter, the axes of all six plots can be linked together, allowing the user to zoom in to specific features. Then the limits can be transferred back to the 1D/2D plotting GUI or peak fitting GUI (discussed below) to easily plot only a specific volume of reciprocal space.

[Figure 7]
Figure 7
Screenshot of GRIP Cartesian 1D/2D multiplot viewer. Multiplot viewers of additional coordinate systems are provided in Appendix A[link]. (a) qxqy 2D colorplot with dataset integrated over qz. (b) qyqz 2D colorplot with dataset integrated over qx. (c) qxqz 2D colorplot with dataset integrated over qy. (d) qx 1D lineplot with dataset integrated over qy and qz. (e) qy 1D lineplot with dataset integrated over qx and qz. (f) qz 1D lineplot with dataset integrated over qx and qy.

4. 3D peak fitting and resolution function

To more accurately obtain peak positions, heights and widths for quantitative analysis, GRIP includes functionality to fit a diffraction peak to a 3D Gaussian ellipsoid with a linear background function:

[\eqalignno{ I({{\bf q}}) = & \ {{I_{0}} \over {\left[ {(2\pi)^{3}|\boldSigma|} \right]^{1/2}}}\exp\left[-{{1} \over { 2}}({{\bf q}}-{{\bf q_{\rm c}}})^{\rm T}\boldSigma^{-1}({{\bf q}}-{ {\bf q_{\rm c}}})\right] \cr & +{{\bf l}}\cdot{{\bf q}}+C.&(11)}]

Here [{{\bf q_{\rm c}}}] is the peak center, [{{\bf l}}] is a vector of linear background coefficients, C is a uniform background offset and Σ is a covariance matrix:

[\boldSigma = \pmatrix{\sigma_{\rm 11,T}^{2}&\sigma_{\rm 12,T}^{2}&\sigma_{\rm 13,T}^{2}\cr \sigma_{\rm 12,T}^{2}&\sigma_{\rm 22,T}^{2}&\sigma_{\rm 23,T}^{2}\cr \sigma_{\rm 13,T}^{2}&\sigma_{\rm 23,T}^{2}&\sigma_{\rm 33,T}^{2}}.\eqno(12)]

The fitting can be done in any coordinate system, so {1, 2, 3} correspond to the first, second and third dimensions in the coordinate system of choice. The covariance [\sigma_{ij,{\rm T}}^{2}] quantifies how correlated the peak shape is along axes i and j, with σii,T being the variance (square of the standard deviation) along axis i. First, the user should select a volume of momentum space which only contains one peak. This can be done quickly by linking the axes of the multiplotter, zooming in to the desired region and pressing `Get Lims’ in the fitting GUI. Then the user can choose to symmetrize the data and apply any angular misalignment offset. The peak fitter automatically guesses the initial fit parameters and performs a nonlinear least squares fit of equation (11[link]) directly to all detector pixels within the selected limits, not the binned data. The number of bins selected does not affect the fitting result and is only used in the fitting result visualization as shown in Fig. 8[link]. This is why some fit results may not look like smooth Gaussians when binned.

[Figure 8]
Figure 8
Screenshot of 3D peak fitter. (ac) Data binned into 2D colorplots on the indicated axes, with one axis integrated in each. (df) Fit binned in the same way into 2D colorplots. (gi) Residuals of data minus fit. The red ovals indicate the one standard deviation contour of the Gaussian ellipsoid fitting function.(jl) 1D lineplots with the data binned to qρ, ψ and ω respectively, each integrated over the other two axes. The data are shown with blue circles, the residuals with red circles, the fit with a black line and the linear background with a blue line. The error bars shown are statistical. The fit parameters are output to the terminal.

One of the key advantages of SAND measurements is that they can be used to obtain information about sample correlation lengths in all three dimensions from the widths of diffraction peaks (Pedersen et al., 1990[Pedersen, J. S., Posselt, D. & Mortensen, K. (1990). J. Appl. Cryst. 23, 321-333.]; Harris et al., 1995[Harris, P., Lebech, B. & Pedersen, J. S. (1995). J. Appl. Cryst. 28, 209-222.]). If a peak has total width (standard deviation) σii,T along axis i, this is due to a convolution of the instrument resolution in that direction, σii,I, with the intrinsic width of the peak from the sample, σii,S, such that [\sigma_{ii,{\rm T}} = \left( {\sigma_{ii,{\rm I}}^{2}+\sigma_{ii,{\rm S}}^{2}} \right)^{1/2}]. If σii,S is provided in units of Å−1 or nm−1, then the sample correlation length in that direction is given by λi = 1/σii,S in units of Å or nm. The standard deviations σ can be converted to a full width at half-maximum (FWHM) by multiplying by 2(2ln2)1/2 ≈ 2.355, and similarly the FWHM correlation length is obtained by dividing λi by 2(2ln2)1/2. The principal axes of the SAND resolution function lie approximately along the red axes depicted in Fig. 9[link]: one along [{{\bf q}}], one perpendicular to the surface of the Ewald sphere (we note that the lineshape in this direction is often of more Lorentzian or Voigt character) and a third orthogonal to those. GRIP implements several methods of estimation of the instrument resolution, which are discussed in detail in Appendix B[link]. The results of the calculations by these methods can be compared with one another by the user and provide a sense of the uncertainty in estimations of the instrument resolution.

[Figure 9]
Figure 9
Coordinate system used in defining the principal axes of the SANS resolution function.

Once the instrument configuration is input into the instrument resolution estimator, the results can be combined with the 3D peak fitter to obtain an estimate of the correlation length of a sample in all three directions. This is most easily performed with a peak fit in spherical coordinates, as a standard SANS instrument will possess an instrument resolution ellipsoid whose principal axes are along qρ, ψ and ω which are locally parallel to the red axes in Fig. 9[link].

5. General guidance for a SAND experiment

Generally, little needs to be changed in a SAND experiment from a conventional SANS experiment on three-dimensional structures. Similar collimation and sample-to-detector selection choices apply. The greatest potential differences lie in the choice of rocking angle step size, range and axes. For the best results, the rocking axes and range should be selected to completely rock through each feature of interest at least once. At the extreme, a full 180° rocking curve (or 360° if the detector is offset from the beam center) covers the full volume of reciprocal space. Then the step size should be chosen to take multiple steps to pass through each peak, and ideally should be less than or equal to the instrument resolution in ω at the wavevectors of interest. Neglecting considerations of overhead for motors to change etc., sampling with denser rocking curve steps for less time each is strictly better for GRIP, because these data can always be rebinned to a courser grid. If the step size is too large, some binned voxels will contain no detector pixels and will be blank in the cuts unless a very course binning is chosen. Exploitation of the GRIP resolution estimator allows the operator to estimate reasonable rocking curve step sizes when planning SANS intensity mapping measurements.

6. Conclusion

Here, we have described the implementation of a 3D SANS plotting and analysis package called GRASP Integrated 3D Plotter (GRIP), which is integrated into the GRASP program (Dewhurst, 2023[Dewhurst, C. D. (2023). J. Appl. Cryst. 56, 1595-1609.]). The GRIP module enables SANS users to easily observe three-dimensional scattering information in near real time during a beamline experiment and plot and analyze the data in detail after the experiment. The GRIP module significantly extends the capabilities of GRASP, enabling a more comprehensive analysis of 3D intensity distributions collected using SANS instruments. We envisage the module as being a routinely used tool for analyzing data from intrinsically three-dimensional volume datasets, such as incommensurate spin textures, SANS tomographic measurements (Henderson et al., 2023[Henderson, M. E., Heacock, B., Bleuel, M., Cory, D. G., Heikes, C., Huber, M. G., Krzywon, J., Nahman-Levesqué, O., Luke, G. M., Pula, M., Sarenac, D., Zhernenkov, K. & Pushin, D. A. (2023). Nat. Phys. 19, 1617-1623.]) etc.

The presently described GRIP module is developed for handling data obtained in monochromatic SAND experiments, as well as for Gaussian fitting of volumetric data. Our approach is not limited to these cases however, and extensions to the GRIP module can be easily implemented to include new features. For example, routes for further development include more peak fitting options catering for non-Gaussian functions, 1D and 2D fitting, dealing with overlapping/multiple peaks, numerical approaches to resolution function calculations (e.g. with Monte Carlo methods), compatibility with scripting, more flexible goniometer setups, additional ways to cut the data, implementation of a generalized Bayesian analysis approach (Holmes, 2014[Holmes, A. T. (2014). Phys. Rev. B, 90, 024514.]) to 3D volumetric data, and handling data obtained in time-of-flight modes. New instruments or detector upgrades can be easily accommodated, as GRIP is built within GRASP, which is built to flexibly handle a variety of instruments.

APPENDIX A

Multiplots in additional coordinate systems

The data plotted in Fig. 7[link] can also be plotted in other coordinate systems as defined in Fig. 2[link]. Figs. 10[link], 11[link] and 12[link] provide screenshots of the same data plotted in cylindrical, spherical and RLU coordinates, respectively.

[Figure 10]
Figure 10
Screenshot of GRIP cylindrical 1D/2D multiplot viewer. (a) ψqr 2D colorplot with dataset integrated over qz. (b) ψqz 2D colorplot with dataset integrated over qr. (c) qrqz 2D colorplot with dataset integrated over ψ. (d) qr 1D lineplot with dataset integrated over ψ and qz. (e) ψ 1D lineplot with dataset integrated over qr and qz. (f) qz 1D lineplot with dataset integrated over qr and ψ.
[Figure 11]
Figure 11
Screenshot of GRIP spherical 1D/2D multiplot viewer. (a) ψqρ 2D colorplot with dataset integrated over ω. (b) ψω 2D colorplot with dataset integrated over qρ. (c) qρω 2D colorplot with dataset integrated over ψ. (d) qρ 1D lineplot with dataset integrated over ψ and ω. (e) ψ 1D lineplot with dataset integrated over qρ and ω. (f) ω 1D lineplot with dataset integrated over qρ and ψ.
[Figure 12]
Figure 12
Screenshot of GRIP RLU 1D/2D multiplot viewer. (a) HK 2D colorplot with dataset integrated over L. (b) KL 2D colorplot with dataset integrated over H. (c) HL 2D colorplot with dataset integrated over K. (d) H 1D lineplot with dataset integrated over K and L. (e) K 1D lineplot with dataset integrated over H and L. (f) L 1D lineplot with dataset integrated over H and K.

APPENDIX B

Approaches to calculating the instrument resolution

Several methods of resolution estimation are implemented in GRIP. In the following, a quantity with angled brackets 〈…〉 indicates the nominal value, while a quantity without signifies the true value. Quantities with Δ indicate a FWHM while quantities with σ indicate a standard deviation. Consider an instrument with FWHM wavelength spread Δλ/〈λ〉 (typically ∼0.1), a first aperture width and height wx1 and wy1, respectively, a collimation length (distance from first aperture to sample) l1, a second aperture or sample size, whichever is smaller, width and height wx2 and wy2, respectively, a sample-to-detector distance l2, and pixel size wx3 by wy3. The following equations assume circular collimating apertures; if rectangular apertures are used, then wx1, wy1, wx2 and/or wy2 should be multiplied by 2(31/2)/3. We consider the resolution in [q_{\tilde{x}}], [q_{\tilde{y}}] and [q_{\tilde{z}}] along the red axes in Fig. 9[link] for nominal scattering vector magnitude 〈q〉.

B1. Method 1: Taylor expansion

One can consider the reported wavevector 〈[{{\bf q}}]〉 and the actual wavevector [{{\bf q}}] as a function of the expected and true values, respectively, of the neutron flight path through the SANS instrument. First, the neutron has a wavelength λ. Then, the vertical and horizontal position where the neutron entered the first collimating aperture is (x1, y1). Similarly we have (x2, y2) for the second aperture, and the position on the detector (x3, y3). Each of these parameters has a nominal value 〈x1〉 = 〈x2〉 = 〈y1〉 = 〈y2〉 = 0, 〈x3〉, 〈y3〉 and 〈λ〉, as well as an uncertainty σxi = wxi / 4, σyi = wyi / 4 and [\sigma_{\lambda}] = [ \Delta\lambda/][\left[\lambda 2(2\ln 2)^{1/2}\right]]. If the aperture is circular instead of rectangular, the 4 should be replaced with 121/2. [{{\bf q}}] can be written in the laboratory Cartesian coordinate system as a function of these parameters as

[\eqalign{{{\bf k_{\rm i}}}&\displaystyle = {{2\pi} \over { \lambda}}{{\left(x_{2}-x_{1},y_{2}-y_{1},-l_{1}\right)} \over {\left[ {(x_{2}-x_{1}) ^{2}+(y_{2}-y_{1})^{2}+l_{1}^{2}} \right]^{1/2}}},\cr \displaystyle{{\bf k_{\rm f}}}&\displaystyle = {{2\pi} \over {\lambda}}{{\left (x_{3}-x_{2},y_{3}-y_{2},-l_{2}\right)} \over {\left[ {(x_{3}-x_{2})^{2}+(y_{3}-y_{2})^ {2}+l_{2}^{2}} \right]^{1/2}}},\cr \displaystyle{{\bf q}}&\displaystyle = {\bf k}_{\rm f}-{\bf k}_{\rm i}.}\eqno(13)]

Inserting the nominal values of these parameters, we obtain

[\left\langle{{\bf q}}\right\rangle = k_{0}\left({{\langle x_{3}\rangle} \over {l}},{{ \langle y_{3}\rangle} \over {l}},1-{{l_{2}} \over {l}}\right) \eqno(14)]

with k0 = 2π/〈λ〉 and [l = \left( {\langle x_{3}\rangle ^{2}+\langle y_{3}\rangle ^{2}+l_{2}^{2}} \right)^{1/2}], which is equivalent to equation (1[link]). We can then transform into the spherical/principal resolution function coordinate system and propagate the uncertainty in [{{\bf q}}] as

[\sigma_{{{\bf q}}} = \left( {\left.{{{\partial^{2}{{\bf q}}} \over { \partial x_{1}^{2}}}}\right|_{\langle{{\bf q}}\rangle}\left(x_{1}-\langle x_ {1}\rangle \right)^{2}+\cdots+\left.{{{\partial^{2}{{\bf q}}} \over { \partial\lambda^{2}}}}\right|_{\langle {{\bf q}}\rangle}\left(\lambda-\langle\lambda\rangle\right)^{2}} \right)^{1/2}, \eqno (15)]

where [\left.\right|_{\langle{{\bf q}}\rangle}] is a shorthand meaning to evaluate with the nominal values of all parameters. This propagation is not concise but can easily be performed exactly with symbolic computations in MATLAB. This is a first-order estimate of the uncertainty in [{{\bf q}}], assuming each parameter is independent.

B2. Method 2: Monte Carlo

We can use a simple Monte Carlo approach to simulate the instrument resolution function. In addition to all above values, we include the range and step size of rocking of GRIP_san. For each neutron, a wavelength is chosen randomly, distributed as a Gaussian/triangle distribution about 〈λ〉 with the correct FWHM. Next, a random position on each of the first and second apertures is chosen under the assumption that both apertures are uniformly illuminated. For the momentum vector [\langle{{\bf q}}\rangle] under consideration, it is determined which value, if any, of GRIP_san satisfies the Bragg condition for this incident neutron. Then, the outgoing neutron direction is calculated and used to obtain the location where this neutron will hit the detector. The four possible solutions for GRIP_san are

[{\tt GRIP\_san} = \pm\cos^{-1}\left[(a\pm b)/c\right] \eqno(16)]

with

[\eqalign{ a = & -k_{ix}q_{x}^{3}+2k_{ix}k_{iy}q_{x} q_{y}+k_{iz}q_{x}^{2}q_{z}+2k_{iy}k_{iz}q_{y}q_{z}\cr &+k_{ix}q_{x}q_{z}^{2}+k_{iz}q_{z}^{3}+(k_{ix}q_{x}+k_{iz}q_{z})q _{y}^{2},\cr \displaystyle b = & \ \big\{(k_{iz}q_{x}-k_{ix}q_{z})^{2}[4k_{iz}^{ 2}q_{x}^{2}-q_{x}^{4}-4k_{iy}q_{x}^{2}q_{y}\cr &\displaystyle -4k_{iy}^{2}q_{y}^{2}+4k_{iz}^{2}q_{z}^{2}-2q_{x}^{2}q_{z}^{2}-4 k_{iy}q_{y}q_{z}^{2}-q_{z}^{4}\cr &\displaystyle+4k_{ix}^{2}(q_{x}^{2}+q_{z}^{2})-2(q_{x}^{2}+2k_{iy}q_{y}+q_{z} ^{2})q_{y}^{2}-q_{y}^{4}]\bigr\}{}^{1/2},\cr \displaystyle c = & \ 2(k_{ix}^{2}+k_{iz}^{2})(q_{x}^{2}+q_{z}^{2}),}\eqno(17)]

where the valid solutions can be identified by confirming that [|{{\bf k_{\rm i}}}| = |{{\bf k_{\rm f}}}|]. The location where the neutron hits the detector and the value of GRIP_san are both binned into the specified binning mesh. The standard deviation along each direction is then calculated. This approach allows one to simulate how the data would look for a given rocking curve and even permits the data to be exported back to GRASP for further analysis and comparison.

B3. Method 3: estimation

The SANS instrument resolution function can be estimated (Pedersen et al., 1990[Pedersen, J. S., Posselt, D. & Mortensen, K. (1990). J. Appl. Cryst. 23, 321-333.]; Harris et al., 1995[Harris, P., Lebech, B. & Pedersen, J. S. (1995). J. Appl. Cryst. 28, 209-222.]) as originating from three sources: the wavelength spread, the angular collimation from the collimating apertures and the detector resolution. The following assume that [{{\bf q}}] lies in the horizontal scattering plane; for scattering out of the plane, wxi and wyi must be appropriately mixed.

The wavelength spread only affects the resolution along [q_{\tilde{x}}]. This contribution is

[\sigma_{\tilde{x}\tilde{x},\lambda} = {{\Delta\lambda} \over {\langle\lambda\rangle }}{{\langle q\rangle} \over {2(2\ln 2)^{1/2}}}. \eqno (18)]

The collimation affects all three components as

[\eqalign{\sigma_{\tilde{x}\tilde{x},{\rm coll}}&\displaystyle = k_{0} {{\cos\langle\theta\rangle\Delta\beta_{1}} \over {2(2\ln 2)^{1/2}}},\cr \displaystyle\sigma_{\tilde{y}\tilde{y},{\rm coll}}&\displaystyle = k_{0}{{\Delta \beta_{2}} \over {2(2\ln 2)^{1/2}}},\cr \displaystyle\sigma_{\tilde{z}\tilde{z},{\rm coll}}&\displaystyle = \min\left\lbrace{{w _{x2}} \over {l_{2}}},{{w_{x1}} \over {(l_{2}+l_{1})}}\right\rbrace\langle q\rangle/12^{1/2}} \eqno (19)]

with k0 = 2π/〈λ〉 and θ = arcsin(〈q〉/2k0). Δβ1 and Δβ2 are given by

[\Delta\beta_{1} = \cases{ \displaystyle {{w_{x1}}\over{l_{1}}}-{{1} \over {4}}{{w_{x2}^{2}} \over {w_{x1}}} {{\cos^{4}\langle 2\theta\rangle} \over {l_{2}^{2}l_{1}}}&\cr \quad\times(l_{1}+l_{2}/\cos^{2}\langle 2\theta\rangle)^{2},&$ {\rm for }\ a_{1} \geq a_{2},$ \cr \displaystyle w_{x2}\left({{1} \over {l_{1}}}+{{\cos^{2}\langle 2\theta\rangle} \over {l_{2}}}\right)- {{1} \over {4}}{{w_{x1}^{2}} \over {w_{x2}}}{{l_{2}} \over {l_{1}}}&\cr \displaystyle \quad\times{{1} \over {\cos^{2}\langle 2\theta\rangle(l_{1}+l_{2}/\cos^{2}\langle 2 \theta\rangle )}},&$ {\rm for }\ a_{1}\ \lt \ a_{2}$} \eqno (20)]

and

[\Delta\beta_{2} = \cases{ \displaystyle {{w_{y1}}\over {l_{1}}}-{{1} \over {4}}{{w_{y2}^{2}} \over {w_{y1}}} {{\cos^{2}\langle 2\theta\rangle} \over {l_{2}^{2}l_{1}}}&\cr \quad\times(l_{1}+l_{2}/\cos^{2}\langle 2\theta\rangle )^{2},&${\rm for } \ a_{1} \geq a_{2},$ \cr \displaystyle w_{y2}\left({{1} \over {l_{1}}}+{{\cos\langle 2\theta\rangle} \over {l_{2}}}\right)- {{1} \over {4}}{{w_{y1}^{2}} \over {w_{y2}}}{{l_{2}} \over {l_{1}}}&\cr \displaystyle\quad\times{{1} \over {\cos\langle 2\theta\rangle (l_{1}+l_{2}/\cos\langle 2\theta \rangle)}},&${\rm for }\ a_{1}\ \lt \ a_{2},$} \eqno(21)]

where a1 = wx1/[2(l1 + l2)] and a2 = wx2/(2l2). Finally, the detector resolution is

[\eqalign{ \sigma_{\tilde{x}\tilde{x},{\rm D}}&\displaystyle = {{ \pi w_{x3}} \over {3^{1/2}l_{2}\langle\lambda\rangle}}\cos\langle \theta\rangle,\cr \displaystyle\sigma_{\tilde{y}\tilde{y},{\rm D}}&\displaystyle = {{\pi w_{y3}} \over {3 ^{1/2}l_{2}\langle\lambda\rangle}},\cr \displaystyle\sigma_{\tilde{z}\tilde{z},{\rm D}}&\displaystyle = {{\pi w_{x3}} \over {3 ^{1/2}l_{2}\langle\lambda\rangle}}\sin\langle\theta\rangle.}\eqno(22)]

These are all added in quadrature to obtain the complete instrument resolution along all three axes as

[\eqalign{ \sigma_{\tilde{x}\tilde{x},{\rm I}}&\displaystyle = \left( { \sigma_{\tilde{x}\tilde{x},\lambda}^{2}+\sigma_{\tilde{x}\tilde{x},{\rm coll}}^{2}+ \sigma_{\tilde{x}\tilde{x},{\rm D}}^{2}} \right)^{1/2},\cr \displaystyle\sigma_{\tilde{y}\tilde{y},{\rm I}}&\displaystyle = \left( {\sigma_{\tilde{ y}\tilde{y},{\rm coll}}^{2}+\sigma_{\tilde{y}\tilde{y},{\rm D}}^{2}} \right)^{1/2},\cr \displaystyle\sigma_{\tilde{z}\tilde{z},{\rm I}}&\displaystyle = \left( {\sigma_{\tilde{ z}\tilde{z},{\rm coll}}^{2}+\sigma_{\tilde{z}\tilde{z},{\rm D}}^{2}} \right)^{1/2}.} \eqno(23)]

B4. Method 4: semi-empirical

The angular collimation of the beam and detector resolution can be directly measured by measuring the size of the (attenuated) direct beam on the detector. This has the advantage of including all effects of divergence without any assumptions of perfect optics alignment etc. The following analysis is valid for small angles ([\cos\theta\approx 1]). If the direct beam is measured to have an FWHM size wD on the detector, then the beam has an effective angular spread of

[\sigma_{\beta} = {{1} \over {2(2\ln 2)^{1/2}}}{{w_{\rm D}} \over {l_{2}}}. \eqno(24)]

The resolution along qx is then approximately

[\sigma_{\tilde{x}\tilde{x},{\rm I}} = \left( {\sigma_{\beta}^{2}k_{0}^{2}+\sigma_{\tilde {x}\tilde{x},\lambda}^{2}} \right)^{1/2}, \eqno(25)]

the qy component is

[\sigma_{\tilde{y}\tilde{y},{\rm I}} = \sigma_{\beta}k_{0} \eqno(26)]

and the qz component is

[\sigma_{\tilde{z}\tilde{z},{\rm I}} = \langle q\rangle\sigma_{\beta}.\eqno(27)]

Acknowledgements

We thank Joseph G. Checkelsky, Takashi Kurumaji, Charles D. Dewhurst, Lisa Debeer-Schmitt, Robert Cubitt, Joshua P. Wakefield, Caolan John and Daniel Mayer for stimulating discussions and support. This work is based partly on experiments performed at the Swiss spallation neutron source SINQ, Paul Scherrer Institute, Villigen, Switzerland.

Funding information

This work was funded, in part, by the Air Force Office of Scientific Research (AFOSR) under award FA9550-22–1-0432 (code development). JSW acknowledges support from the Swiss National Science Foundation (SNSF) project grant 200021_188707.

References

First citationArnold, O., Bilheux, J.-C., Borreguero, J. M., Buts, A., Campbell, S. I., Chapon, L., Doucet, M., Draper, N., Ferraz Leal, R., Gigg, M. A., Lynch, V. E., Markvardsen, A., Mikkelson, D. J., Mikkelson, R. L., Miller, R., Palmen, K., Parker, P., Passos, G., Perring, T. G., Peterson, P. F., Ren, S., Reuter, M. A., Savici, A. T., Taylor, J. W., Taylor, R. J., Tolchenov, R., Zhou, W. & Zikovsky, J. (2014). Nucl. Instrum. Methods Phys. Res. A, 764, 156–166.  Web of Science CrossRef CAS Google Scholar
First citationBlazek, J. & Gilbert, E. P. (2011). Carbohydr. Polym. 85, 281–293.  Web of Science CrossRef CAS Google Scholar
First citationBunjes, H. & Unruh, T. (2007). Adv. Drug Deliv. Rev. 59, 379–402.  Web of Science CrossRef PubMed CAS Google Scholar
First citationBusing, W. R. & Levy, H. A. (1967). Acta Cryst. 22, 457–464.  CrossRef IUCr Journals Web of Science Google Scholar
First citationChen, S.-H. (1986). Annu. Rev. Phys. Chem. 37, 351–399.  CrossRef CAS Web of Science Google Scholar
First citationDewhurst, C. D. (2023). J. Appl. Cryst. 56, 1595–1609.  Web of Science CrossRef CAS IUCr Journals Google Scholar
First citationFert, A., Reyren, N. & Cros, V. (2017). Nat. Rev. Mater. 2, 17031.  Web of Science CrossRef Google Scholar
First citationFujishiro, Y., Kanazawa, N., Nakajima, T., Yu, X. Z., Ohishi, K., Kawamura, Y., Kakurai, K., Arima, T., Mitamura, H., Miyake, A., Akiba, K., Tokunaga, M., Matsuo, A., Kindo, K., Koretsune, T., Arita, R. & Tokura, Y. (2019). Nat. Commun. 10, 1059.  CrossRef PubMed Google Scholar
First citationGabel, F., Bicout, D., Lehnert, U., Tehei, M., Weik, M. & Zaccai, G. (2002). Q. Rev. Biophys. 35, 327–367.  Web of Science CrossRef PubMed CAS Google Scholar
First citationGebel, G. & Diat, O. (2005). Fuel Cells, 5, 261–276.  Web of Science CrossRef CAS Google Scholar
First citationHarris, P., Lebech, B. & Pedersen, J. S. (1995). J. Appl. Cryst. 28, 209–222.  CrossRef CAS Web of Science IUCr Journals Google Scholar
First citationHenderson, M. E., Heacock, B., Bleuel, M., Cory, D. G., Heikes, C., Huber, M. G., Krzywon, J., Nahman-Levesqué, O., Luke, G. M., Pula, M., Sarenac, D., Zhernenkov, K. & Pushin, D. A. (2023). Nat. Phys. 19, 1617–1623.  CrossRef CAS Google Scholar
First citationHirschberger, M., Nakajima, T., Gao, S., Peng, L., Kikkawa, A., Kurumaji, T., Kriener, M., Yamasaki, Y., Sagayama, H., Nakao, H., Ohishi, K., Kakurai, K., Taguchi, Y., Yu, X., Arima, T. H. & Tokura, Y. (2019). Nat. Commun. 10, 5831.  CrossRef PubMed Google Scholar
First citationHolmes, A. T. (2014). Phys. Rev. B, 90, 024514.  Web of Science CrossRef Google Scholar
First citationHonecker, D., Bersweiler, M., Erokhin, S., Berkov, D., Chesnel, K., Venero, D. A., Qdemat, A., Disch, S., Jochum, J. K., Michels, A. & Bender, P. (2022). Nanoscale Adv. 4, 1026–1059.  Web of Science CrossRef CAS PubMed Google Scholar
First citationIshiwata, S., Nakajima, T., Kim, J.-H., Inosov, D. S., Kanazawa, N., White, J. S., Gavilano, J. L., Georgii, R., Seemann, K. M., Brandl, G., Manuel, P., Khalyavin, D. D., Seki, S., Tokunaga, Y., Kinoshita, M., Long, Y. W., Kaneko, Y., Taguchi, Y., Arima, T., Keimer, B. & Tokura, Y. (2020). Phys. Rev. B, 101, 134406.  CrossRef Google Scholar
First citationJacques, D. A. & Trewhella, J. (2010). Protein Sci. 19, 642–657.  Web of Science CrossRef CAS PubMed Google Scholar
First citationJeffries, C. M., Ilavsky, J., Martel, A., Hinrichs, S., Meyer, A., Pedersen, J. S., Sokolova, A. V. & Svergun, D. I. (2021). Nat. Rev. Methods Primers, 1, 70.  Web of Science CrossRef Google Scholar
First citationKanazawa, N., Kitaori, A., White, J. S., Ukleev, V., Rønnow, H. M., Tsukazaki, A., Ichikawa, M., Kawasaki, M. & Tokura, Y. (2020). Phys. Rev. Lett. 125, 137202.  CrossRef PubMed Google Scholar
First citationKealey, P. G., Charalambous, D., Forgan, E. M., Lee, S. L., Johnson, S. T., Schleger, P., Cubitt, R., Paul, D. M., Aegerter, C. M., Tajima, S. & Rykov, A. (2001). Phys. Rev. B, 64, 174501.  CrossRef Google Scholar
First citationKoch, M. H. J., Vachette, P. & Svergun, D. I. (2003). Q. Rev. Biophys. 36, 147–227.  Web of Science CrossRef PubMed CAS Google Scholar
First citationKurumaji, T., Nakajima, T., Hirschberger, M., Kikkawa, A., Yamasaki, Y., Sagayama, H., Nakao, H., Taguchi, Y., Arima, T. & Tokura, Y. (2019). Science, 365, 914–918.  CrossRef CAS PubMed Google Scholar
First citationKurumaji, T., Paul, N., Fang, S., Neves, P. M., Kang, M., White, J. S., Nakajima, T., Graf, D., Ye, L., Chan, M. K., Suzuki, T., Denlinger, J., Jozwiak, C., Bostwick, A., Rotenberg, E., Zhao, Y., Lynn, J. W., Kaxiras, E., Comin, R., Fu, L. & Checkelsky, J. G. (2024). Submitted.  Google Scholar
First citationMarshall, W. & Lowde, R. D. (1968). Rep. Prog. Phys. 31, 705–775.  CrossRef CAS Web of Science Google Scholar
First citationMühlbauer, S., Binz, B., Jonietz, F., Pfleiderer, C., Rosch, A., Neubauer, A., Georgii, R. & Böni, P. (2009). Science, 323, 915–919.  Web of Science PubMed Google Scholar
First citationMühlbauer, S., Honecker, D., Périgo, A., Bergner, F., Disch, S., Heinemann, A., Erokhin, S., Berkov, D., Leighton, C., Eskildsen, M. R. & Michels, A. (2019). Rev. Mod. Phys. 91, 015004.  Google Scholar
First citationNeubauer, A., Pfleiderer, C., Binz, B., Rosch, A., Ritz, R., Niklowitz, P. G. & Böni, P. (2009). Phys. Rev. Lett. 102, 186602.  Web of Science CrossRef PubMed Google Scholar
First citationPedersen, J. S. (1997). Adv. Colloid Interface Sci. 70, 171–210.  CrossRef CAS Web of Science Google Scholar
First citationPedersen, J. S., Posselt, D. & Mortensen, K. (1990). J. Appl. Cryst. 23, 321–333.  CrossRef Web of Science IUCr Journals Google Scholar
First citationRastovski, C., Dewhurst, C. D., Gannon, W. J., Peets, D. C., Takatsu, H., Maeno, Y., Ichioka, M., Machida, K. & Eskildsen, M. R. (2013). Phys. Rev. Lett. 111, 087003.  Web of Science CrossRef PubMed Google Scholar
First citationSchmatz, W., Springer, T., Schelten, J. & Ibel, K. (1974). J. Appl. Cryst. 7, 96–116.  CrossRef CAS IUCr Journals Web of Science Google Scholar
First citationSchmidt, P. W. (1991). J. Appl. Cryst. 24, 414–435.  CrossRef CAS Web of Science IUCr Journals Google Scholar
First citationSingh, D., Fujishiro, Y., Hayami, S., Moody, S. H., Nomoto, T., Baral, P. R., Ukleev, V., Cubitt, R., Steinke, N.-J., Gawryluk, D. J., Pomjakushina, E., Ōnuki, Y., Arita, R., Tokura, Y., Kanazawa, N. & White, J. S. (2023). Nat. Commun. 14, 8050.  CrossRef PubMed Google Scholar
First citationTakagi, R., Matsuyama, N., Ukleev, V., Yu, L., White, J. S., Francoual, S., Mardegan, J. R. L., Hayami, S., Saito, H., Kaneko, K., Ohishi, K., Ōnuki, Y., Arima, T., Tokura, Y., Nakajima, T. & Seki, S. (2022). Nat. Commun. 13, 1472.  CrossRef PubMed Google Scholar
First citationTanigaki, T., Shibata, K., Kanazawa, N., Yu, X., Onose, Y., Park, H. S., Shindo, D. & Tokura, Y. (2015). Nano Lett. 15, 5438–5442.  CrossRef CAS PubMed Google Scholar
First citationTokura, Y. & Kanazawa, N. (2021). Chem. Rev. 121, 2857–2897.  Web of Science CrossRef CAS PubMed Google Scholar
First citationYu, X. Z., Onose, Y., Kanazawa, N., Park, J. H., Han, J. H., Matsui, Y., Nagaosa, N. & Tokura, Y. (2010). Nature, 465, 901–904.  Web of Science CrossRef CAS PubMed Google Scholar

This is an open-access article distributed under the terms of the Creative Commons Attribution (CC-BY) Licence, which permits unrestricted use, distribution, and reproduction in any medium, provided the original authors and source are cited.

Journal logoJOURNAL OF
APPLIED
CRYSTALLOGRAPHY
ISSN: 1600-5767
Follow J. Appl. Cryst.
Sign up for e-alerts
Follow J. Appl. Cryst. on Twitter
Follow us on facebook
Sign up for RSS feeds