Where the molecular transform's FFT runs on the CPU - a CPU-only build, --no-gpu, a card too small for it -
it was one single-threaded FFTW 3D r2c: 12.5 s of 13 s of the transform on 4nwv's 768^3 box, one core busy
while fifteen waited. Now MapToFPhiInParallel does it as two passes over the threads: the r2c along w of
every (u, v) column, then the 2D transform of each plane l the search keeps (l <= reach), cropping as
CropHalfL does. Each column and each plane is done by one plan, so the result does not depend on the thread
count; it agrees with FFTW's 3D plan to float rounding, not bit for bit. The GPU path is unchanged.
CPU-only (--no-gpu), timing benchmark: 4nwv's transform 13.1 -> 2.4 s (provisional, load average 13-25).
What the rounding moved: 4nwv and myob came out byte-identical; on cytc (three copies, tNCS) the null's
replicates, placed by the translation function, read the fit at +22.8 sd instead of +18.7 (MR_HAND_FIT_SIGMA),
and the placement - same R-work, R-free and every MR candidate line - came out at an origin-equivalent
position 43 A from the previous one, so its model file and maps differ while the answer (ENANTIOMORPH,
P 32 2 1, placement CC 0.744) does not. GPU runs byte-identical on all three. [MolecularReplacement] passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the CPU every orientation's translation function scattered its terms into a complex<double> grid,
converted that to an FPhiGrid, which MapFromFPhi copied into FFTW's input, transformed, and copied out
again into a map the statistics then read: 24 bytes a grid point, 1.6 GB an orientation on 4nwv's cell,
with the 2 x 32 orientations of the groups' functions in flight at once.
Now, once per setup and for all its orientations (a new TranslationFunction over a list of rotations, which
the search calls), each half-grid point's entries are listed in the order the terms and pairs come, cross
terms after; an orientation sums each point over its own list - the same additions in the same order as
the scatter - writes it conjugated into FFTW's input as MapFromFPhi would (MapFromFPhiExecute, the same
plan) and reads the statistics off FFTW's output scaled as MapFromFPhi scales it: 8 bytes a point.
CPU-only (--no-gpu), timing benchmark on 4nwv: the translation stage 61.5 -> 17.7 s, provisional (load
average 24-31 during both runs, and every other stage moved by as much again with no change). Reports,
MR candidate lines, reflection files, maps and placed models byte-identical on myob, cytc and 4nwv,
CPU-only and on the GPU. [MolecularReplacement] passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The molecular transform's FFT went to the GPU only where its buffers took at most a quarter of the card
(MapToFPhiGPUFits), the last quarter rule left in molecular replacement. On a large cell that is never:
4nwv's 768^3 box needs 5.45 GB, so on a 16 GB card it ran on the CPU in FFTW, single-threaded - 12.5 s
of the search's 31 s.
Now it is judged, as every other part of the search, against the search's budget (80% of the card less
what is resident; the search holds nothing else yet when it runs), and the device writes only the
cropped transform the search keeps (CropHalfL, moved to ModelFFT), so it needs 4.46 GB instead of 5.45.
cuFFT and FFTW agree to float rounding, not bit for bit, so wherever the transform moves to the GPU the
search's functions can differ in their last bits: on 4nwv on 16 GB and 8.55 GB cards it moves (it now
does on any card above about 5.6 GB, before above 21.8 GB); the small boxes were on the GPU before and
give the same values (the same kernel, cropped).
Measured on the RTX 5080, timing benchmark: 4nwv's transform 14.1 -> 2.2 s, MR 31.6 -> 20.1 s, run
93.0 -> 89.2 s; MR's peak device memory unchanged at 8.7 GB (the FFT's own 5.2 GB comes before anything
else is held). On this card the reflection files, maps, placed models, reports and the MR candidate lines
of myob, cytc and 4nwv still came out byte-identical to rc175-metal-merge. [MolecularReplacement] passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pure move. ModelValidation, RigidBodyRefine, RigidBodyGPU, ModelFFT, ModelGrid,
ModelScaling, ModelMaskGPU, ModelScaleGPU and SigmaA - everything that works on an
atomic model - become the JFJochStructureRefinement library, linked by
JFJochImageAnalysis. WriteModel (the placed-model mmCIF/PDB writer) goes to writer/
as its own small JFJochModelWriter target, so JFJochWriter, which a writer-only build
compiles, does not gain a gemmi dependency. Only include paths and CMake lists change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi