From 57f1cfb2d6eae004a8d5d39f258fe82f2995acc1 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Mon, 2 Sep 2024 14:24:53 +0200
Subject: [PATCH] calc rms

---
 Sample/Interface/AutocorrelationModels.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Sample/Interface/AutocorrelationModels.cpp b/Sample/Interface/AutocorrelationModels.cpp
index 1fdcf2de8c3..aa62772a1a8 100644
--- a/Sample/Interface/AutocorrelationModels.cpp
+++ b/Sample/Interface/AutocorrelationModels.cpp
@@ -108,5 +108,7 @@ double K_CorrelationModel::spectralFunction(const R3& q) const
 double K_CorrelationModel::rms() const
 {
     // integration of spectral function: rms^2 = Integrate[PSD(f) * 2*pi*f, {f, 0, max_frequency}]
-    return 0;
+    const double H = m_hurst_parameter;
+    const double val = 2 * pi * m_lateral_corr_length * m_max_spatial_frequency;
+    return m_sigma * std::sqrt(1. - std::pow(1 + val * val, -H));
 }
-- 
GitLab