Skip to content

WIP basic intensity calculations#5

Draft
ajjackson wants to merge 17 commits intomainfrom
intensity
Draft

WIP basic intensity calculations#5
ajjackson wants to merge 17 commits intomainfrom
intensity

Conversation

@ajjackson
Copy link
Member

Start with the simplest possible incoherent-approximation calculation: fundamental transitions in the fully-isotropic approximation.

  • Use Euphonic DebyeWaller data structure
  • We need to calculate this ourselves to recover the intermediate mode-by-mode tensors.
  • At this point we are not thinking too hard about q-points handling: require the user to pass an array of nominal Q2 values. (This could become a function over modes data.)
- Use euphonic DebyeWaller data structure - However, we need to calculate this ourselves to recover the intermediate mode-by-mode tensors. - At this point we are not thinking tooooo hard about q-points handling: require the user to pass an array of nominal Q2 values.
No CI / pre-commit linting yet, just starting to configure for now.
The kinematic constraints calculation is checked against data from Mantid's QECoverage interface, and agrees pretty exactly! So far the intensities agree to ~0.5% after normalisation for the GaSb case. That seems quite encouraging; the next step could be to figure out what is happening with overall scaling/normalisation.
- We should be using 2n+1 for DW and n+1 for Q^2 term - First check the results don't change when factoring out...
Clearly this should really happen somewhere outside of the test code But anyway, at this point it makes no difference to the results Probably because the temperature is so low anyway at 10K. (We should add some test data at higher temperature to capture this properly.)
We will eventually improve workflow for efficient manipulation of Bose occupations; in the meantime, use docstrings to clarify what manipulation is needed.
The scale factor between this implementation and AbINS is about 4. This could plausibly be an meV-cm conversion factor and a factor 2. Or that could be a coincidence. Investigate further!
Let's stick with Euphonic scaling of DW, which is half Mantid-Abins A But go via Abins-like scaling of B, so it has to be divided by 2 when forming A. This keeps the intensity expression more Abins-like?
- include /2 A scale in einsum for efficiency - factor out isotropic DW factor for cleaner testing - test against data from Abins: looks fine!
"test" and "lint" dependencies are really for development rather than as optional library features. With this new-ish syntax one can pip install --group test --group lint or uv sync --group test --group lint to install appropriate dev tools to environment.
- Extracted intensity values from Abins before DW weighting, compare with abinslib values by dividing out DW factor - Compare mode displacements B with data dumped to .npz reference
- Added some options to disable DW, cross-sections for ease of comparison - In the end we don't want to have too many of these options: provide at high-level and generally make these things steps in the workflow.
- There is a bin-width scale factor to watch out for. This _should_ be accounted for at some other level Mantid-Abins but I haven't confirmed where yet. - Note that some quantization error is introduced and affects intensity. This is due to the calculation of intensity Q^2n dependence after spectrum has been binned. This applies to isotropic fundamentals and to orders 2+. - Usual anisotropic fundamentals might not be affected. - Also if orders 3+ are enabled Mantid-Abins works on finer bins before downsampling at the end. So the error is likely lower in most practical calculations.
@ajjackson
Copy link
Member Author

I've run into an interesting quantization error, resulting from a Mantid-Abins performance optimization.

Rather than calculate each fundamental mode intensity as Q² U² before binning to energy, we calculate the U² part for each mode, bin those, then apply Q² scaling to the binned spectra. (For higher-order modes this is Q^2n.) The terms can be separated linearly like this because of the isotropic approximation.

However, this means the Q used for intensity calculation can differ from the exact E-Q line of the component modes; it is the intersection of the E-Q constraint with the midpoint of the energy bin.

This is pretty tolerable in practice and can be reduced by using fine bins (which Mantid-Abins automatically does when orders 3-10 are enabled.) But it does lead to a small discrepancy between simple reference calculations and data dumped from Mantid-Abins; accordingly we will need a generous rtol in some of the test cases.

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

Labels

None yet

1 participant