1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! GNXAS amplitude helper `gnxas(r0, sigma, beta)`.
//!
//! A path-expression helper (registered like `sigma2_eins`/`sigma2_debye`) that
//! returns the GNXAS amplitude for an asymmetric pair distribution `g(r)`
//! parametrised by `(r0, sigma, beta)`, evaluated at the path's `reff`. Port of
//! larch's `gnxas` (`larch/xafs/sigma2_models.py`):
//!
//! ```text
//! q = 4 / beta^2
//! alpha = q * (1 + (reff - r0) * beta / (2*sigma)) (= q + 2*(reff-r0)/(beta*sigma))
//! out = max(0, 2 * exp(-alpha) * alpha^(q-1) / (sigma * |beta| * Γ(q)))
//! ```
//!
//! Verified against larch's **module-level** `gnxas(r0, sigma, beta, path)`,
//! which is the documented, working implementation. NOTE: larch's
//! asteval-injected copy (the form a feffit path expression would actually call)
//! is broken in current larch — its debug `print('> ', reff, ...)` references an
//! undefined name and raises, so a `gnxas(...)` path expression evaluates to
//! `None`. The two implementations are otherwise numerically identical (verified
//! bit-for-bit), so this port reproduces the documented-correct behaviour and
//! there is no stock-larch end-to-end feffit reference to match.
use crategamma;
/// GNXAS amplitude for `(r0, sigma, beta)` at a path of radius `reff`.