BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SSCAHelper Class Reference
Collaboration diagram for SSCAHelper:

Public Member Functions

 SSCAHelper (double kappa)
 
void init (const std::vector< FormFactorCoherentSum > &ff_wrappers)
 
complex_t getCharacteristicSizeCoupling (double qp, const std::vector< FormFactorCoherentSum > &ff_wrappers) const
 
complex_t getCharacteristicDistribution (double qp, const IInterferenceFunction *p_iff) const
 
complex_t calculatePositionOffsetPhase (double qp, double radial_extension) const
 
complex_t getMeanFormfactorNorm (double qp, const std::vector< complex_t > &precomputed_ff, const std::vector< FormFactorCoherentSum > &ff_wrappers) const
 
void getMeanFormfactors (double qp, Eigen::Matrix2cd &ff_orig, Eigen::Matrix2cd &ff_conj, const InterferenceFunctionUtils::matrixFFVector_t &precomputed_ff, const std::vector< FormFactorCoherentSum > &ff_wrappers) const
 

Private Attributes

double m_kappa
 
double m_mean_radius
 

Detailed Description

Helper class for SSCApproximationStrategy, offering some methods, shared between the scalar and polarized scattering calculations.

Definition at line 29 of file SSCAHelper.h.

Constructor & Destructor Documentation

◆ SSCAHelper()

SSCAHelper::SSCAHelper ( double  kappa)

Definition at line 20 of file SSCAHelper.cpp.

20 : m_kappa(kappa), m_mean_radius{} {}
double m_mean_radius
Definition: SSCAHelper.h:49
double m_kappa
Definition: SSCAHelper.h:48

Member Function Documentation

◆ init()

void SSCAHelper::init ( const std::vector< FormFactorCoherentSum > &  ff_wrappers)

Definition at line 22 of file SSCAHelper.cpp.

23 {
24  m_mean_radius = 0.0;
25  for (auto& ffw : ff_wrappers)
26  m_mean_radius += ffw.relativeAbundance() * ffw.radialExtension();
27 }

References m_mean_radius.

Referenced by SSCApproximationStrategy::strategy_specific_post_init().

◆ getCharacteristicSizeCoupling()

complex_t SSCAHelper::getCharacteristicSizeCoupling ( double  qp,
const std::vector< FormFactorCoherentSum > &  ff_wrappers 
) const

Definition at line 29 of file SSCAHelper.cpp.

31 {
32  complex_t result{};
33  for (auto& ffw : ff_wrappers) {
34  double radial_extension = ffw.radialExtension();
35  result +=
36  ffw.relativeAbundance() * calculatePositionOffsetPhase(2.0 * qp, radial_extension);
37  }
38  return result;
39 }
std::complex< double > complex_t
Definition: Complex.h:20
complex_t calculatePositionOffsetPhase(double qp, double radial_extension) const
Definition: SSCAHelper.cpp:51

References calculatePositionOffsetPhase().

Referenced by SSCApproximationStrategy::polarizedCalculation(), and SSCApproximationStrategy::scalarCalculation().

Here is the call graph for this function:

◆ getCharacteristicDistribution()

complex_t SSCAHelper::getCharacteristicDistribution ( double  qp,
const IInterferenceFunction p_iff 
) const

Definition at line 41 of file SSCAHelper.cpp.

43 {
44  const InterferenceFunctionRadialParaCrystal* p_iff_radial =
45  dynamic_cast<const InterferenceFunctionRadialParaCrystal*>(p_iff);
46  if (!p_iff_radial)
47  throw Exceptions::ClassInitializationException("Wrong interference function for SSCA");
48  return p_iff_radial->FTPDF(qp);
49 }
Interference function of radial paracrystal.

References InterferenceFunctionRadialParaCrystal::FTPDF().

Referenced by SSCApproximationStrategy::polarizedCalculation(), and SSCApproximationStrategy::scalarCalculation().

Here is the call graph for this function:

◆ calculatePositionOffsetPhase()

complex_t SSCAHelper::calculatePositionOffsetPhase ( double  qp,
double  radial_extension 
) const

Definition at line 51 of file SSCAHelper.cpp.

52 {
53  return exp_I(m_kappa * qp * (radial_extension - m_mean_radius));
54 }
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Definition: Complex.h:30

References exp_I(), m_kappa, and m_mean_radius.

Referenced by getCharacteristicSizeCoupling(), getMeanFormfactorNorm(), and getMeanFormfactors().

Here is the call graph for this function:

◆ getMeanFormfactorNorm()

complex_t SSCAHelper::getMeanFormfactorNorm ( double  qp,
const std::vector< complex_t > &  precomputed_ff,
const std::vector< FormFactorCoherentSum > &  ff_wrappers 
) const

Definition at line 57 of file SSCAHelper.cpp.

59 {
60  complex_t ff_orig = 0., ff_conj = 0.; // original and conjugated mean formfactor
61  for (size_t i = 0; i < ff_wrappers.size(); ++i) {
62  double radial_extension = ff_wrappers[i].radialExtension();
63  complex_t prefac =
64  ff_wrappers[i].relativeAbundance() * calculatePositionOffsetPhase(qp, radial_extension);
65  ff_orig += prefac * precomputed_ff[i];
66  ff_conj += prefac * std::conj(precomputed_ff[i]);
67  }
68  return ff_orig * ff_conj;
69 }

References calculatePositionOffsetPhase().

Referenced by SSCApproximationStrategy::scalarCalculation().

Here is the call graph for this function:

◆ getMeanFormfactors()

void SSCAHelper::getMeanFormfactors ( double  qp,
Eigen::Matrix2cd &  ff_orig,
Eigen::Matrix2cd &  ff_conj,
const InterferenceFunctionUtils::matrixFFVector_t precomputed_ff,
const std::vector< FormFactorCoherentSum > &  ff_wrappers 
) const

Definition at line 71 of file SSCAHelper.cpp.

75 {
76  ff_orig = Eigen::Matrix2cd::Zero();
77  ff_conj = Eigen::Matrix2cd::Zero();
78  for (size_t i = 0; i < ff_wrappers.size(); ++i) {
79  double radial_extension = ff_wrappers[i].radialExtension();
80  complex_t prefac =
81  ff_wrappers[i].relativeAbundance() * calculatePositionOffsetPhase(qp, radial_extension);
82  ff_orig += prefac * precomputed_ff[i];
83  ff_conj += prefac * precomputed_ff[i].adjoint();
84  }
85 }

References calculatePositionOffsetPhase().

Referenced by SSCApproximationStrategy::polarizedCalculation().

Here is the call graph for this function:

Member Data Documentation

◆ m_kappa

double SSCAHelper::m_kappa
private

Definition at line 48 of file SSCAHelper.h.

Referenced by calculatePositionOffsetPhase().

◆ m_mean_radius

double SSCAHelper::m_mean_radius
private

Definition at line 49 of file SSCAHelper.h.

Referenced by calculatePositionOffsetPhase(), and init().


The documentation for this class was generated from the following files: