Skip to content

Use adaptive integration for tetrapod model #739

Description

@pkienzle

Target accuracy for the models is 5 digits of precision for SANS (R=20 nm at q=1/Å) and USANS (R=20 μm at q=0.002/Å). For USANS slit smearing, which pushes q out to 0.1/Å, the target accuracy 0.2. With regard to performance, I'm trying to limit it to 2 s to evaluate 200 q points on my mac M2 chip.

I recently revised all the models to use a simple adaptive integration scheme (#658) based on qr max for the shape along the c-axis and in the a-b plane. For the outer loop I use the max of these two, but only the a-b cross section for the inner loop. I'm limiting the (θ,φ) grid to 100 000 evaluation points, with no more than 76 points in the outer loop.

Here's an example from triaxial ellipsoid:

    const double qr_max_inner = fmax(q*radius_equat_minor, q*radius_equat_major);
    const double qr_max = fmax(qr_max_inner, q*radius_polar);
    constant double *z_outer, *w_outer;
    constant double *z_inner, *w_inner;
    int n_outer = gauss_weights(qr_max, ADAPTIVE_MAX_OUTER, &w_outer, &z_outer);
    int n_inner = gauss_weights(qr_max_inner, n_outer, &w_inner, &z_inner);

For the tetrapod, qr_max = q*sqrt(length**2 + (outer radius)**2) is probably all you need. Whether outer radius is radius or core radius + thickness depends on your parameterization.

Code in explore/check_adaptive.py compares the adaptive grid to a 5000x5000 grid on a few points and reports those that are out of tolerance.

This is not needed for this PR, but please convert this comment into a new ticket if you choose to do it later.

Originally posted by @pkienzle in #705 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions