BraggPrediction: Add partiality calculation
Some checks failed
Build Packages / build:rpm (rocky8) (push) Failing after 11m17s
Build Packages / build:rpm (rocky9) (push) Failing after 11m50s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 12m2s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / build:rpm (rocky8_sls9) (push) Failing after 12m14s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 12m28s
Build Packages / build:rpm (ubuntu2204) (push) Failing after 12m22s
Build Packages / Build documentation (push) Successful in 31s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m44s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m29s
Build Packages / Unit tests (push) Failing after 3m28s
Build Packages / build:rpm (ubuntu2404) (push) Failing after 5m34s

This commit is contained in:
2026-02-03 14:31:29 +01:00
parent 88701b31db
commit 7edad6b7c1
5 changed files with 81 additions and 37 deletions

View File

@@ -45,7 +45,10 @@ int BraggPredictionRot::Calc(const DiffractionExperiment &experiment, const Crys
const float m3_S0 = m3 * S0;
int i = 0;
const float max_angle_rad = settings.max_angle_deg * static_cast<float>(M_PI) / 180.f;
const float mos_angle_rad = settings.mosaicity_deg * static_cast<float>(M_PI) / 180.f;
const float wedge_angle_rad = settings.wedge_deg * static_cast<float>(M_PI) / 180.f;
const float max_angle_rad = wedge_angle_rad / 2 + mos_angle_rad;
for (int h = -settings.max_hkl; h <= settings.max_hkl; h++) {
// Precompute A* h contribution
@@ -93,11 +96,18 @@ int BraggPredictionRot::Calc(const DiffractionExperiment &experiment, const Crys
float phi = -1.0f * std::atan2(sinphi, cosphi);
if (phi > max_angle_rad || phi < -max_angle_rad)
if (phi > wedge_angle_rad || phi < -max_angle_rad)
continue;
const float lorentz_reciprocal = std::fabs(m2 * (S % S0))/(S*S0);
const Coord e1 = (S % S0).Normalize();
const float zeta_abs = std::fabs(m2 * e1);
const float lorentz_reciprocal = std::fabs(m2 * (S % S0))/(S*S0);
const float c1 = std::sqrt(2.0f) * mos_angle_rad / zeta_abs;
const float partiality = (std::erf(zeta_abs * (phi + wedge_angle_rad / 2.0f) * c1)
- std::erf(zeta_abs * (phi - wedge_angle_rad / 2.0f) * c1)) / 2.0f;
// Inlined RecipToDector with rot1 and rot2 (rot3 = 0)
// Apply rotation matrix transpose
float S_rot_x = rot[0] * S.x + rot[1] * S.y + rot[2] * S.z;
@@ -127,7 +137,8 @@ int BraggPredictionRot::Calc(const DiffractionExperiment &experiment, const Crys
.rlp = lorentz_reciprocal,
.S_x = S.x,
.S_y = S.y,
.S_z = S.z
.S_z = S.z,
.partiality = partiality
};
i++;
}