feat(icp): point-to-plane refinement on top-N final poses (Phase 4 task 4)#29
Merged
Merged
Conversation
…sk 4) New f2dock::refine_pose_point_to_plane(...) wraps f3dock::icp::IcpAligner::alignPointToPlane and composes the returned ICP delta on the left of the candidate pose (R_new = R_d * R; t_new = R_d * t + t_d). Driven by four new PARAMS_IN fields parsed in F2Dock.cpp (icpRefine, icpRefineTopN, icpRefineInlierDist, icpRefineNumNeighbors). Default icpRefine=false keeps the docking path bit-for-bit unchanged. printIntermediateStats refines only the first icpRefineTopN ranked poses, mutates the in-memory transformation matrix before the .out line is written, and emits an 'ICP refine rank=...' line to stdout per refined pose. .out schema unchanged. Tests: 5 GoogleTest cases in tests/unit/test_f2dock_icp_refine.cpp (identity stability, small-translation recovery, too-few-points, ICP-delta composition with existing rotated pose, null-pointer rejection).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 4 task 4 of the F3Dock migration matrix: wire
IcpAligner::alignPointToPlaneinto a refinement pass that runs on the top-N final poses, gated behind a default-off input-file flag so existing runs are bit-for-bit unchanged.Changes
inc/f2dock/IcpRefine.h+src/f2dock/IcpRefine.cpp:f2dock::refine_pose_point_to_plane(...)builds a receptormodelcloud fromxkAOrig/ykAOrig/zkAOrig, applies the candidate pose's current rotation/translation to the ligandxkBOrig/ykBOrig/zkBOrigto form themovingcloud, callsf3dock::icp::IcpAligner::alignPointToPlane(...)(neighbor count clamped to[3, model.size()]and thekMinPoints >= 5guard), and composes the returned ICP delta on the left of the existing pose (R_new = R_d * R; t_new = R_d * t + t_d).PARAMS_INcarries four new fields:icpRefineEnabled,icpRefineTopN(default 10),icpRefineInlierDist(default 5.0),icpRefineNumNeighbors(default 10).setParamFromFileinF2Dock.cppparses four new keys (icpRefine,icpRefineTopN,icpRefineInlierDist,icpRefineNumNeighbors).printIntermediateStatsinsrc/f2dock/Docking.cpprefines only the firsticpRefineTopNranked poses (usingpr->pri->icpRefine*), mutates the in-memorytransformationmatrix before the line is written to the .out file, and emits a singleICP refine rank=... rmsd_before=... rmsd_after=...line to stdout per refined pose. The.outschema is unchanged so existing parsers keep working.Tests
5 new GoogleTest cases in
tests/unit/test_f2dock_icp_refine.cpp:IdentityPoseIsAlreadyAligned— refining an identity pose does not worsen alignment.RecoversSmallTranslationPerturbation— small known z-translation gets pulled back toward the receptor plane.RejectsTooFewPoints— <kMinPointscloud size is rejected (refined=false).ComposesIcpDeltaWithExistingPose— initial non-identity pose composes with the ICP delta anddet(R) ≈ 1is preserved.NullPointersReturnFalse— null receptor/ligand pointers are rejected without crashing.All tests +
test_f3dock_icppass locally under Ubuntu-24.04 / gcc-13.F2Dockexe still builds and links cleanly.Migration matrix
Task 4 entry in
doc/F3DOCK_MIGRATION_MATRIX.mdupdated to Landed. Task 5 (hinge-joined two-domain integration test) remains.Stacks on top of #28 (already merged into
master).