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
f69bf4c7
Commit
f69bf4c7
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Decoupling Approximation: more compact notation for scalarCalculation
parent
e5cf34a4
No related branches found
No related tags found
1 merge request
!1017
consequential use of OwningVector
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Resample/Interparticle/DecouplingApproximationStrategy.cpp
+3
-6
3 additions, 6 deletions
Resample/Interparticle/DecouplingApproximationStrategy.cpp
with
3 additions
and
6 deletions
Resample/Interparticle/DecouplingApproximationStrategy.cpp
+
3
−
6
View file @
f69bf4c7
...
@@ -33,7 +33,7 @@ DecouplingApproximationStrategy::DecouplingApproximationStrategy(
...
@@ -33,7 +33,7 @@ DecouplingApproximationStrategy::DecouplingApproximationStrategy(
double
DecouplingApproximationStrategy
::
scalarCalculation
(
const
DiffuseElement
&
ele
)
const
double
DecouplingApproximationStrategy
::
scalarCalculation
(
const
DiffuseElement
&
ele
)
const
{
{
double
intensity
=
0.0
;
double
intensity
=
0.0
;
complex_t
amplitude
=
complex_t
(
0.0
,
0.0
)
;
complex_t
amplitude
=
0
;
for
(
const
auto
&
ffw
:
m_weighted_formfactors
)
{
for
(
const
auto
&
ffw
:
m_weighted_formfactors
)
{
const
complex_t
ff
=
ffw
->
summedFF
(
ele
);
const
complex_t
ff
=
ffw
->
summedFF
(
ele
);
if
(
std
::
isnan
(
ff
.
real
()))
if
(
std
::
isnan
(
ff
.
real
()))
...
@@ -43,9 +43,7 @@ double DecouplingApproximationStrategy::scalarCalculation(const DiffuseElement&
...
@@ -43,9 +43,7 @@ double DecouplingApproximationStrategy::scalarCalculation(const DiffuseElement&
amplitude
+=
fraction
*
ff
;
amplitude
+=
fraction
*
ff
;
intensity
+=
fraction
*
std
::
norm
(
ff
);
intensity
+=
fraction
*
std
::
norm
(
ff
);
}
}
const
double
amplitude_norm
=
std
::
norm
(
amplitude
);
// squared magnitude
return
intensity
+
(
m_iff
->
structureFactor
(
ele
.
meanQ
())
-
1
)
*
std
::
norm
(
amplitude
);
const
double
coherence_factor
=
m_iff
->
structureFactor
(
ele
.
meanQ
());
return
intensity
+
amplitude_norm
*
(
coherence_factor
-
1.0
);
}
}
//! This is the polarized version
//! This is the polarized version
...
@@ -70,6 +68,5 @@ double DecouplingApproximationStrategy::polarizedCalculation(const DiffuseElemen
...
@@ -70,6 +68,5 @@ double DecouplingApproximationStrategy::polarizedCalculation(const DiffuseElemen
const
SpinMatrix
intensity_matrix
=
polarization_handler
.
analyzerMatrix
()
*
mean_intensity
;
const
SpinMatrix
intensity_matrix
=
polarization_handler
.
analyzerMatrix
()
*
mean_intensity
;
const
double
amplitude_trace
=
std
::
abs
(
amplitude_matrix
.
trace
());
const
double
amplitude_trace
=
std
::
abs
(
amplitude_matrix
.
trace
());
const
double
intensity_trace
=
std
::
abs
(
intensity_matrix
.
trace
());
const
double
intensity_trace
=
std
::
abs
(
intensity_matrix
.
trace
());
const
double
coherence_factor
=
m_iff
->
structureFactor
(
ele
.
meanQ
());
return
intensity_trace
+
(
m_iff
->
structureFactor
(
ele
.
meanQ
())
-
1
)
*
amplitude_trace
;
return
intensity_trace
+
amplitude_trace
*
(
coherence_factor
-
1.0
);
}
}
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