diff --git a/Resample/Interparticle/DecouplingApproximationStrategy.cpp b/Resample/Interparticle/DecouplingApproximationStrategy.cpp index 2039518c18444675d216b1baa32dc916e51eb267..bb06120604bf6229f1a8ffe9322dced52aa0a489 100644 --- a/Resample/Interparticle/DecouplingApproximationStrategy.cpp +++ b/Resample/Interparticle/DecouplingApproximationStrategy.cpp @@ -33,7 +33,7 @@ DecouplingApproximationStrategy::DecouplingApproximationStrategy( double DecouplingApproximationStrategy::scalarCalculation(const DiffuseElement& ele) const { double intensity = 0.0; - complex_t amplitude = complex_t(0.0, 0.0); + complex_t amplitude = 0; for (const auto& ffw : m_weighted_formfactors) { const complex_t ff = ffw->summedFF(ele); if (std::isnan(ff.real())) @@ -43,9 +43,7 @@ double DecouplingApproximationStrategy::scalarCalculation(const DiffuseElement& amplitude += fraction * ff; intensity += fraction * std::norm(ff); } - const double amplitude_norm = std::norm(amplitude); // squared magnitude - const double coherence_factor = m_iff->structureFactor(ele.meanQ()); - return intensity + amplitude_norm * (coherence_factor - 1.0); + return intensity + (m_iff->structureFactor(ele.meanQ()) - 1) * std::norm(amplitude); } //! This is the polarized version @@ -70,6 +68,5 @@ double DecouplingApproximationStrategy::polarizedCalculation(const DiffuseElemen const SpinMatrix intensity_matrix = polarization_handler.analyzerMatrix() * mean_intensity; const double amplitude_trace = std::abs(amplitude_matrix.trace()); const double intensity_trace = std::abs(intensity_matrix.trace()); - const double coherence_factor = m_iff->structureFactor(ele.meanQ()); - return intensity_trace + amplitude_trace * (coherence_factor - 1.0); + return intensity_trace + (m_iff->structureFactor(ele.meanQ()) - 1) * amplitude_trace; }