Skip to content

feat(icp): point-to-plane refinement on top-N final poses (Phase 4 task 4)#29

Merged
transfix merged 1 commit into
masterfrom
feature/f3dock-phase4-icp-refine
May 19, 2026
Merged

feat(icp): point-to-plane refinement on top-N final poses (Phase 4 task 4)#29
transfix merged 1 commit into
masterfrom
feature/f3dock-phase4-icp-refine

Conversation

@transfix

Copy link
Copy Markdown
Owner

Summary

Phase 4 task 4 of the F3Dock migration matrix: wire IcpAligner::alignPointToPlane into 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

  • New inc/f2dock/IcpRefine.h + src/f2dock/IcpRefine.cpp: f2dock::refine_pose_point_to_plane(...) builds a receptor model cloud from xkAOrig/ykAOrig/zkAOrig, applies the candidate pose's current rotation/translation to the ligand xkBOrig/ykBOrig/zkBOrig to form the moving cloud, calls f3dock::icp::IcpAligner::alignPointToPlane(...) (neighbor count clamped to [3, model.size()] and the kMinPoints >= 5 guard), 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_IN carries four new fields: icpRefineEnabled, icpRefineTopN (default 10), icpRefineInlierDist (default 5.0), icpRefineNumNeighbors (default 10). setParamFromFile in F2Dock.cpp parses four new keys (icpRefine, icpRefineTopN, icpRefineInlierDist, icpRefineNumNeighbors).
  • printIntermediateStats in src/f2dock/Docking.cpp refines only the first icpRefineTopN ranked poses (using pr->pri->icpRefine*), mutates the in-memory transformation matrix before the line is written to the .out file, and emits a single ICP refine rank=... rmsd_before=... rmsd_after=... line to stdout per refined pose. The .out schema 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 — < kMinPoints cloud size is rejected (refined=false).
  • ComposesIcpDeltaWithExistingPose — initial non-identity pose composes with the ICP delta and det(R) ≈ 1 is preserved.
  • NullPointersReturnFalse — null receptor/ligand pointers are rejected without crashing.

All tests + test_f3dock_icp pass locally under Ubuntu-24.04 / gcc-13. F2Dock exe still builds and links cleanly.

Migration matrix

Task 4 entry in doc/F3DOCK_MIGRATION_MATRIX.md updated to Landed. Task 5 (hinge-joined two-domain integration test) remains.

Stacks on top of #28 (already merged into master).

…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).
@transfix transfix merged commit 7850d32 into master May 19, 2026
10 checks passed
@transfix transfix deleted the feature/f3dock-phase4-icp-refine branch May 19, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant