FFT indexer: histogram padded to the next 2-3-5-7-smooth length
The histogram length is ceil(2 pi * 2 * max_cell / d_high): 3142 = 2 x 1571 for rugnux's defaults (500 A, 2 A), 1571 (prime) for the broker's (250 A, 2 A), and almost never smooth otherwise - 217 of 222 lengths over the cell bounds 100-1200 A at 2 and 3.5 A. pocketfft does such a length by Bluestein. It is padded on to the next length whose factors are 2, 3, 5 and 7 (3142 -> 3150); the bin spacing is unchanged, only the zero padding grows by 0.25%. The indexer's transform (16384 directions, one thread), on a loaded box (load 11): 3142 0.75 s, 3150 0.07 s - per FFT-indexed image. Rotation sets, --no-refine, CPU -N 16: 47.2 vs 47.2 s and 39.9 vs 39.3 s (few images are indexed); GPU 9.6 vs 9.3 s and 14.1 vs 14.7 s. Results: one lysozyme set bit-identical on CPU and GPU, the other the same merge to rounding (same SG, cell, I/sigma, R_meas, CC1/2, ISa; the pre-pass lattice moves by 0.2 A). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
1 parent
cfe15f2343
commit
6f6e57b364
1 file changed
+11
@@ -35,7 +35,18 @@ FFTIndexer::FFTIndexer(const IndexingSettings &settings)
|
||||
const float one_over_d_max = 1.0f / settings.GetFFT_HighResolution_A();
|
||||
|
||||
histogram_spacing = 1.0f / (2.0f * max_length_A);
|
||||
// Then zero-padded a little further, to the next length whose prime factors are all 2, 3, 5 or 7:
|
||||
// the default (500 A, 2 A) is 3142 = 2 x 1571, which both FFT libraries can only do the slow way.
|
||||
histogram_size = std::ceil(oversampling * one_over_d_max / histogram_spacing);
|
||||
for (bool smooth = false; !smooth; ) {
|
||||
int64_t v = histogram_size;
|
||||
for (int p : {2, 3, 5, 7})
|
||||
while (v % p == 0)
|
||||
v /= p;
|
||||
smooth = (v == 1);
|
||||
if (!smooth)
|
||||
++histogram_size;
|
||||
}
|
||||
|
||||
input_size = histogram_size * nDirections;
|
||||
output_size = (histogram_size / 2 + 1) * nDirections;
|
||||
|
||||
Reference in new issue
Block a user