Skip to content

Comments

Add atom-specific scattering form factors#478

Open
mlund wants to merge 1 commit intomasterfrom
feature/atom-specific-scattering-form-factors
Open

Add atom-specific scattering form factors#478
mlund wants to merge 1 commit intomasterfrom
feature/atom-specific-scattering-form-factors

Conversation

@mlund
Copy link
Owner

@mlund mlund commented Jan 30, 2026

Summary

  • Add scattering_f0 property to AtomData for atom-specific scattering form factors (defaults to 1.0)
  • All scattering schemes now support form factors:
    • Debye: uses FormFactorAtomicConstant
    • EXPLICIT_PBC: uses FormFactorAtomicConstant
    • EXPLICIT_IPBC: uses FormFactorAtomicConstant
  • Normalize scattering intensity by Σfᵢ² (sum of squared form factors) instead of N
  • Backwards compatible: when all scattering_f0 = 1.0, normalization is identical to before

Usage

atomlist:
  - C: { sigma: 3.4, scattering_f0: 6.0 }
  - N: { sigma: 3.2, scattering_f0: 7.0 }

Test plan

  • Unit tests for FormFactorAtomicConstant
  • Unit tests for scattering_f0 JSON serialization
  • Verify backwards compatibility (default f0=1 gives same results)
  • All scattering schemes use form factors

- Add scattering_f0 property to AtomData (defaults to 1.0)
- Create FormFactorAtomicConstant class using atom-specific form factors
- Normalize scattering intensity by sum of squared form factors (Σfᵢ²)
- Update ScatteringFunction to use Scatterer struct with position and atom id
- Add tests for new form factor functionality
- Update documentation in analysis.md and topology.md

Backwards compatible: when scattering_f0=1.0 (default), normalization
by Σfᵢ² equals normalization by N, giving identical results.
@mlund mlund force-pushed the feature/atom-specific-scattering-form-factors branch from 85a21ef to cfda4ed Compare January 30, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant