.. _hollow-rectangular-prism:

hollow_rectangular_prism
=======================================================

Hollow rectangular parallelepiped with uniform scattering length density.

=========== ============================================== ============ =============
Parameter   Description                                    Units        Default value
=========== ============================================== ============ =============
scale       Scale factor or Volume fraction                None                     1
background  Source background                              |cm^-1|              0.001
sld         Parallelepiped scattering length density       |1e-6Ang^-2|           6.3
sld_solvent Solvent scattering length density              |1e-6Ang^-2|             1
length_a    Shortest, external, size of the parallelepiped |Ang|                   35
b2a_ratio   Ratio sides b/a                                |Ang|                    1
c2a_ratio   Ratio sides c/a                                |Ang|                    1
thickness   Thickness of parallelepiped                    |Ang|                    1
theta       c axis to beam angle                           degree                   0
phi         rotation about beam                            degree                   0
psi         rotation about c axis                          degree                   0
=========== ============================================== ============ =============

The returned value is scaled to units of |cm^-1| |sr^-1|, absolute scale.


**Definition**

This model provides the form factor, $P(q)$, for a hollow rectangular
parallelepiped with a wall of thickness $\Delta$. The 1D scattering intensity
for this model is calculated by forming the difference of the amplitudes of two
massive parallelepipeds differing in their outermost dimensions in each
direction by the same length increment $2\Delta$ (\ [#Nayuk2012]_ Nayuk, 2012).

As in the case of the massive parallelepiped model (:ref:`rectangular-prism`),
the scattering amplitude is computed for a particular orientation of the
parallelepiped with respect to the scattering vector and then averaged over all
possible orientations, giving

.. math::
  P(q) =  \frac{1}{V^2} \frac{2}{\pi} \times \, \int_0^{\frac{\pi}{2}} \,
  \int_0^{\frac{\pi}{2}} A_{P\Delta}^2(q) \, \sin\theta \, d\theta \, d\phi

where $\theta$ is the angle between the $z$ axis and the $C$ axis
of the parallelepiped, $\phi$ is the angle between the scattering vector
(lying in the $xy$ plane) and the $y$ axis, and

.. math::
  :nowrap:

  \begin{align*}
  A_{P\Delta}(q) & =  A B C
    \left[\frac{\sin \bigl( q \frac{C}{2} \cos\theta \bigr)}
    {\left( q \frac{C}{2} \cos\theta \right)} \right]
    \left[\frac{\sin \bigl( q \frac{A}{2} \sin\theta \sin\phi \bigr)}
    {\left( q \frac{A}{2} \sin\theta \sin\phi \right)}\right]
    \left[\frac{\sin \bigl( q \frac{B}{2} \sin\theta \cos\phi \bigr)}
    {\left( q \frac{B}{2} \sin\theta \cos\phi \right)}\right] \\
    & {} - A' B' C'
    \left[ \frac{\sin \bigl[ q \frac{C'}{2} \cos\theta \bigr]}
    {q \frac{C'}{2} \cos\theta} \right]
    \left[ \frac{\sin \bigl[ q \frac{A'}{2} \sin\theta \sin\phi \bigr]}
    {q \frac{A'}{2} \sin\theta \sin\phi} \right]
    \left[ \frac{\sin \bigl[ q \frac{B'}{2} \sin\theta \cos\phi \bigr]}
    {q \frac{B'}{2} \sin\theta \cos\phi} \right]
  \end{align*}

$A'$, $B'$, $C'$ are the inner dimensions and $A = A' + 2\Delta$,
$B = B' + 2\Delta$, $C = C' + 2\Delta$ are the outer dimensions of the
parallelepiped shell, giving a shell volume of $V = ABC - A'B'C'$.

The 1D scattering intensity is then calculated as

.. math::
  I(q) = \text{scale} \times V \times (\rho_\text{p} -
  \rho_\text{solvent})^2 \times P(q) + \text{background}

where $\rho_\text{p}$ is the scattering length density of the parallelepiped,
$\rho_\text{solvent}$ is the scattering length density of the solvent,
and (if the data are in absolute units) *scale* represents the volume fraction
(which is unitless) of the rectangular shell of material (i.e. not including
the volume of the solvent filled core).

For 2d data the orientation of the particle is required, described using
angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further details
of the calculation and angular dispersions see :ref:`orientation`.
The angle $\Psi$ is the rotational angle around the long *C* axis. For example,
$\Psi = 0$ when the *B* axis is parallel to the *x*-axis of the detector.

For 2d, constraints must be applied during fitting to ensure that the inequality
$A < B < C$ is not violated, and hence the correct definition of angles is
preserved. The calculation will not report an error if the inequality is *not*
preserved, but the results may be not correct.

.. figure:: img/parallelepiped_angle_definition.png

    Definition of the angles for oriented hollow rectangular prism. Note that
    rotation $\theta$, initially in the $xz$ plane, is carried out first,
    then rotation $\phi$ about the $z$ axis, finally rotation $\Psi$ is now
    around the axis of the prism. The neutron or X-ray beam is along the $z$
    axis.

.. figure:: img/parallelepiped_angle_projection.png

    Examples of the angles for oriented hollow rectangular prisms against the
    detector plane.


**Validation**

Validation of the code was conducted by qualitatively comparing the output
of the 1D model to the curves shown in (Nayuk, 2012).



.. figure:: img/hollow_rectangular_prism_autogenfig.png

    1D and 2D plots corresponding to the default parameters of the model.


**Source**

:download:`hollow_rectangular_prism.py <src/hollow_rectangular_prism.py>`
$\ \star\ $ :download:`hollow_rectangular_prism.c <src/hollow_rectangular_prism.c>`
$\ \star\ $ :download:`adaptive.c <src/adaptive.c>`

**References**

See also Onsager [#Onsager1949]_.

.. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854
.. [#Onsager1949] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659

**Authorship and Verification**

* **Author:** Miguel Gonzales **Date:** February 26, 2016
* **Last Modified by:** Paul Kienzle **Date:** December 14, 2017
* **Last Reviewed by:** Paul Butler **Date:** September 06, 2018

