From f4e1c9edb3bd1046d8370a42c575ca59ae761909 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 2 Jun 2015 11:56:06 +0200
Subject: [PATCH] but special treatment needed for top layer

---
 Core/Algorithms/src/SpecularMatrix.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Core/Algorithms/src/SpecularMatrix.cpp b/Core/Algorithms/src/SpecularMatrix.cpp
index 421ebef671f..09cff1507e9 100644
--- a/Core/Algorithms/src/SpecularMatrix.cpp
+++ b/Core/Algorithms/src/SpecularMatrix.cpp
@@ -77,9 +77,14 @@ void SpecularMatrix::execute(const MultiLayer& sample, const kvector_t& k,
 
         complex_t lambda = coeff[i].lambda;
         if (lambda == 0.0) {
-            // standing wave in layer with k_perp=0
-            coeff[i].t_r(0) = +1;
-            coeff[i].t_r(1) = -1;
+            if (i==0) {
+                // standing vertical wave in layer with k_perp=0
+                coeff[i].t_r(0) = +1;
+                coeff[i].t_r(1) = -1;
+            }
+            else {
+                coeff[i].t_r.setZero();
+            }
             // no intensity in layers below
             for (size_t ii=i+1; ii<N; ++ii) {
                 coeff[ii].t_r.setZero();
-- 
GitLab