Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
a3a4bb59
Commit
a3a4bb59
authored
4 years ago
by
Beerwerth, Randolf
Browse files
Options
Downloads
Patches
Plain Diff
Correctly implement k = 0 corner case
parent
0269f6df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Multilayer/SpecularMagneticNewStrategy.cpp
+14
-8
14 additions, 8 deletions
Core/Multilayer/SpecularMagneticNewStrategy.cpp
Core/RT/MatrixRTCoefficients_v3.cpp
+4
-3
4 additions, 3 deletions
Core/RT/MatrixRTCoefficients_v3.cpp
with
18 additions
and
11 deletions
Core/Multilayer/SpecularMagneticNewStrategy.cpp
+
14
−
8
View file @
a3a4bb59
...
...
@@ -56,6 +56,8 @@ std::vector<MatrixRTCoefficients_v3>
SpecularMagneticNewStrategy
::
computeTR
(
const
std
::
vector
<
Slice
>&
slices
,
const
std
::
vector
<
complex_t
>&
kzs
)
const
{
const
size_t
N
=
slices
.
size
();
if
(
slices
.
size
()
!=
kzs
.
size
())
throw
std
::
runtime_error
(
"Error in SpecularMagnetic_::execute: kz vector and slices size shall coinside."
);
...
...
@@ -63,9 +65,9 @@ SpecularMagneticNewStrategy::computeTR(const std::vector<Slice>& slices,
return
{};
std
::
vector
<
MatrixRTCoefficients_v3
>
result
;
result
.
reserve
(
slices
.
size
()
);
result
.
reserve
(
N
);
const
double
kz_sign
=
kzs
.
front
().
real
()
>
0.0
?
1.0
:
-
1.0
;
// save sign to restore it later
const
double
kz_sign
=
kzs
.
front
().
real
()
>
=
0.0
?
1.0
:
-
1.0
;
// save sign to restore it later
auto
B_0
=
slices
.
front
().
bField
();
result
.
emplace_back
(
kz_sign
,
eigenvalues
(
kzs
.
front
(),
0.0
),
kvector_t
{
0.0
,
0.0
,
0.0
},
0.0
);
...
...
@@ -76,12 +78,16 @@ SpecularMagneticNewStrategy::computeTR(const std::vector<Slice>& slices,
B
.
mag
()
>
eps
?
B
/
B
.
mag
()
:
kvector_t
{
0.0
,
0.0
,
0.0
},
magnetic_SLD
);
}
if
(
std
::
abs
(
kzs
[
0
])
<
std
::
sqrt
(
eps
))
{
for
(
size_t
i
=
0
,
size
=
slices
.
size
();
i
<
size
;
++
i
)
{
if
(
std
::
abs
(
kzs
[
i
])
>=
std
::
sqrt
(
eps
))
{
result
[
i
].
m_T
<<
0
,
0
,
0
,
0
;
result
[
i
].
m_R
<<
0
,
0
,
0
,
0
;
}
if
(
N
==
1
){
result
[
0
].
m_T
=
Eigen
::
Matrix2cd
::
Identity
();
result
[
0
].
m_R
=
Eigen
::
Matrix2cd
::
Zero
();
return
result
;
}
else
if
(
kzs
[
0
]
==
0.0
){
result
[
0
].
m_T
=
Eigen
::
Matrix2cd
::
Identity
();
result
[
0
].
m_R
=
-
Eigen
::
Matrix2cd
::
Identity
();
for
(
size_t
i
=
1
;
i
<
N
;
++
i
)
{
result
[
i
].
m_T
.
setZero
();
result
[
i
].
m_R
.
setZero
();
}
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Core/RT/MatrixRTCoefficients_v3.cpp
+
4
−
3
View file @
a3a4bb59
...
...
@@ -54,9 +54,9 @@ Eigen::Matrix2cd MatrixRTCoefficients_v3::TransformationMatrix(complex_t eigenva
}
else
if
(
m_b
.
mag
()
<
eps
&&
eigenvalue
!=
0.
)
return
exp2
;
// result = Eigen::Matrix2cd(Eigen::DiagonalMatrix<complex_t, 2>({0.5, 0.5}));
else
if
(
m_b
.
mag
()
<
eps
&&
eigenvalue
==
0.
)
return
Eigen
::
Matrix2cd
(
Eigen
::
DiagonalMatrix
<
complex_t
,
2
>
({
0.5
,
0.5
}))
;
return
exp2
;
throw
std
::
runtime_error
(
"Broken magnetic field vector"
);
}
...
...
@@ -145,7 +145,8 @@ Eigen::Matrix2cd MatrixRTCoefficients_v3::computeInverseP() const
const
complex_t
beta
=
m_lambda
(
1
)
-
m_lambda
(
0
);
if
(
std
::
abs
(
alpha
*
alpha
-
beta
*
beta
)
<
eps
)
throw
std
::
runtime_error
(
"Singular p_m"
);
// throw std::runtime_error("Singular p_m");
return
Eigen
::
Matrix2cd
::
Zero
();
Eigen
::
Matrix2cd
result
=
pMatrixHelper
(
-
1.
);
result
*=
2.
/
(
alpha
*
alpha
-
beta
*
beta
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment