faunus
Classes | Enumerations | Functions
Faunus::Scatter Namespace Reference

Routines related to scattering. More...

Classes

class  DebyeFormula
 Calculate scattering intensity, I(q), on a mesh using the Debye formula. More...
 
struct  FormFactorAtomicConstant
 Atom-specific constant form factor (q independent). More...
 
class  FormFactorSphere
 Form factor, F(q), for a hard sphere of radius R. More...
 
struct  FormFactorUnity
 Unity form factor (q independent). More...
 
class  SamplingPolicy
 A policy for collecting samples. More...
 
struct  Scatterer
 Lightweight scatterer holding position and atom type id. More...
 
class  StructureFactorIPBC
 Calculate scattering intensity using explicit q averaging in isotropic periodic boundary conditions (IPBC). More...
 
class  StructureFactorPBC
 Calculate scattering intensity using explicit q averaging. More...
 

Enumerations

enum  Algorithm { SIMD, EIGEN, GENERIC }
 

Functions

 TEST_CASE_TEMPLATE ("[Faunus] StructureFactorPBC", T, StructureFactorPBC< FormFactorUnity< float >, float, SIMD >, StructureFactorPBC< FormFactorUnity< float >, float, EIGEN >, StructureFactorPBC< FormFactorUnity< float >, float, GENERIC >)
 
 TEST_CASE ("[Faunus] StructureFactorIPBC")
 
 TEST_CASE ("[Faunus] FormFactorAtomicConstant")
 
template<typename T >
constexpr const auto & getPosition (const T &scatterer)
 Helper to extract position from a scatterer or point. More...
 
template<std::floating_point T>
std::map< T, TaverageByMagnitude (const std::vector< std::pair< T, T >> &pairs, T precision=T{10000})
 Average values with equivalent keys (same rounded magnitude). More...
 

Detailed Description

Routines related to scattering.

Function Documentation

◆ averageByMagnitude()

template<std::floating_point T>
std::map<T, T> Faunus::Scatter::averageByMagnitude ( const std::vector< std::pair< T, T >> &  pairs,
T  precision = T{10000} 
)

Average values with equivalent keys (same rounded magnitude).

Groups (key, value) pairs by rounded key and computes the mean value for each group. Used to average intensities from equivalent q-vectors with the same |q| magnitude.

See also
Equivalent to Rust's average_duplicates in pripps/src/explicit.rs

◆ getPosition()

template<typename T >
constexpr const auto& Faunus::Scatter::getPosition ( const T scatterer)

Helper to extract position from a scatterer or point.

For Scatterer types, returns the .pos member. For Point types (Eigen vectors), returns the point directly.