Skip to content
Snippets Groups Projects
Commit 2b783488 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

comments

parent 25451fde
No related branches found
No related tags found
1 merge request!1658explain Parratt implementation
...@@ -84,8 +84,7 @@ std::vector<Spinor> computeTR(const SliceStack& slices, const std::vector<comple ...@@ -84,8 +84,7 @@ std::vector<Spinor> computeTR(const SliceStack& slices, const std::vector<comple
return TR; return TR;
} }
// Calculate transmission/refraction coefficients t_r for each layer, from bottom to top. // Parratt algorithm, step 1: compute r/t ratios from bottom to top.
// Starting from TR[X[N - 1]] = {1.0, 0.0} as set above.
std::vector<complex_t> tfactor(N - 1); std::vector<complex_t> tfactor(N - 1);
for (size_t i = N - 1; i > 0; i--) { for (size_t i = N - 1; i > 0; i--) {
const size_t jthis = X[i - 1]; const size_t jthis = X[i - 1];
...@@ -101,8 +100,7 @@ std::vector<Spinor> computeTR(const SliceStack& slices, const std::vector<comple ...@@ -101,8 +100,7 @@ std::vector<Spinor> computeTR(const SliceStack& slices, const std::vector<comple
TR[jthis].v = delta * (slm + slp * TR[jlast].v) * f; TR[jthis].v = delta * (slm + slp * TR[jlast].v) * f;
} }
// Now correct all amplitudes by dividing by the remaining tfactor in forward direction. // Parrat algorithm, step 2: compute r and t from top to bottom.
// At some point this divison underflows; from there on all further amplitudes are set to zero.
complex_t t = 1; complex_t t = 1;
for (size_t i = 1; i < N; ++i) { for (size_t i = 1; i < N; ++i) {
t = t * tfactor[i - 1]; t = t * tfactor[i - 1];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment