18 FormFactorWeighted::FormFactorWeighted()
20 setName(
"FormFactorWeighted");
23 FormFactorWeighted::~FormFactorWeighted()
25 for (
size_t index = 0; index < m_form_factors.size(); ++index)
26 delete m_form_factors[index];
32 for (
size_t index = 0; index < m_form_factors.size(); ++index)
33 result->addFormFactor(*m_form_factors[index], m_weights[index]);
40 for (
size_t index = 0; index < m_form_factors.size(); ++index)
47 if (m_form_factors.empty())
48 throw std::runtime_error(
"FormFactorWeighted::bottomZ() -> Error: "
49 "'this' contains no form factors.");
51 [&rotation](
IFormFactor* ff) { return ff->bottomZ(rotation); });
56 if (m_form_factors.empty())
57 throw std::runtime_error(
"FormFactorWeighted::topZ() -> Error: "
58 "'this' contains no form factors.");
60 [&rotation](
IFormFactor* ff) { return ff->topZ(rotation); });
63 void FormFactorWeighted::addFormFactor(
const IFormFactor& form_factor,
double weight)
65 m_form_factors.push_back(form_factor.
clone());
66 m_weights.push_back(weight);
71 for (
size_t index = 0; index < m_form_factors.size(); ++index)
77 complex_t result(0.0, 0.0);
78 for (
size_t index = 0; index < m_form_factors.size(); ++index)
79 result += m_weights[index] * m_form_factors[index]->
evaluate(wavevectors);
85 Eigen::Matrix2cd result = Eigen::Matrix2cd::Zero();
86 for (
size_t index = 0; index < m_form_factors.size(); ++index)
87 result += m_weights[index] * m_form_factors[index]->
evaluatePol(wavevectors);
Defines and implements namespace algo with some algorithms.
Pure virtual interface for rotations.
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
A wrapper for underlying material implementation.
Holds all wavevector information relevant for calculating form factors.
double max_value(const Iterator &begin, const Iterator &end, const Evaluator &evaluate)
Returns the maximum value of function evaluate as applied to the elements of an iterator range.
double min_value(const Iterator &begin, const Iterator &end, const Evaluator &evaluate)
Returns the minimum value of function evaluate as applied to the elements of an iterator range.