hkl_key: Dedicated header

This commit is contained in:
2026-01-30 14:02:08 +01:00
parent 6f653866e3
commit 8c7bf61fa7
6 changed files with 83 additions and 10 deletions
+2 -1
View File
@@ -8,6 +8,7 @@
#include <stdexcept>
#include "../common/ResolutionShells.h"
#include "../common/hkl_key.h"
IntegrateMap ParseXdsIntegrateHkl(const std::string& filename) {
std::ifstream in(filename);
@@ -47,7 +48,7 @@ IntegrateMap ParseXdsIntegrateHkl(const std::string& filename) {
entry.tail.push_back(v);
}
result[hkl_key_16(-h, k, l)].push_back(std::move(entry));
result[hkl_key(-h, k, l)].push_back(std::move(entry));
}
return result;
-9
View File
@@ -12,21 +12,12 @@
#include "../common/CrystalLattice.h"
struct CcHalfByResolutionResult {
std::vector<double> cc;
std::vector<int32_t> pairs;
std::vector<float> shell_mean_one_over_d2;
};
inline uint64_t hkl_key_16(int64_t h, int64_t k, int64_t l) {
const uint16_t bias = 512; // maps -512..512 -> 0..1024
uint64_t uh = static_cast<uint16_t>(std::clamp(h + bias, int64_t(0), int64_t(1024)));
uint64_t uk = static_cast<uint16_t>(std::clamp(k + bias, int64_t(0), int64_t(1024)));
uint64_t ul = static_cast<uint16_t>(std::clamp(l + bias, int64_t(0), int64_t(1024)));
return uh | (uk << 16) | (ul << 32);
}
struct HKLData {
int64_t h ,k,l;
double I = 0.0;