Repository navigation
cvc::pocket_tunnel: PocketTunnel on the shared cocone core, with its legacy A/B (TexMol T5 part 1) - #1439
Merged
Conversation
…legacy A/B (TexMol T5 part 1) PocketTunnel (Goswami and Bajaj, UT 2008; transfix/volrover src/PocketTunnel, UT LGPL-2.1): the pockets, tunnels and voids of a surface, as the stable manifolds of the distance function's maxima outside it. - The cocone core P1 ported (init, util, tcocone, rcocone, datastruct, stepping) moves from src/cvc/geometry/skeleton to src/cvc/geometry/cocone, shared by both ports. The skeleton's own stages keep their files and get skeleton_stages.h. PocketTunnel's init.cpp and tcocone.cpp were this code; its util.cpp adds only cell_volume, now in the core. - cvc::pocket_tunnel (inc/cvc/geometry/pocket_tunnel.h): S_max (grow_maximum, merging the touching outside clusters, volumes and their sort), the mouths (detect_handle) and the output (convert_pocket_tunnel_to_rawc_geometry) as one coroutine, a resumable pocket_tunnel_stepper and its result_job, with a param_table (pocket_tunnel_params.h). The result lists every cluster with its kind, mouths, volume, cells and maxima, which the legacy library only printed; the coloured surface keeps the legacy colours. No statics, no files, no stderr; bad input throws pocket_tunnel_error with a reason. The quadratic legacy pieces (the linked-list merges, the volume table, the selection sort, a facet scan per shown feature) are a union-find, a table, a stable merge sort and one scan. - pocket_tunnel_test: the four chambered-ball inputs (a pocket, a tunnel, three chambers, a cavity), the output's invariants (closed, consistently oriented boundaries whose enclosed volume is the cluster's), bad and degenerate input, point order (which moves only a few surface cells: Tight Cocone walks in tet_complex's insertion order), independent calls, two apps at once on their own schedulers and state trees, T7 resumability and cancel, the parameter keys on the state tree; natively and in the wasm-mt ports lane. - The legacy A/B (tools/volrover-goldens): pockettunnel_driver.cpp runs the legacy entry once a process, through a read-only hook patched into pocket_tunnel.cpp, and records its clusters, geometry and Tight Cocone marking; make_goldens.py --check compares by content. Given the legacy marking, the port's own stages match the legacy library exactly on all four cases (clusters, triangles, colours). End to end they match exactly on three; Tight Cocone's greedy peeling walks in the cells' order, which in the legacy code is their addresses, and on the tunnel case that marks a few surface cells differently (the legacy library itself gives the other result in one run of five within a process). - CI: pocket_tunnel_test joins SAN_CXX_TESTS; the cgal-ab path filter watches the cocone core's new directory; the volrover goldens job checks PocketTunnel too.
…l::blur is on master - tools/volrover-goldens/inputs/pockettunnel/1grl.pts: 1GRL's heavy atoms blurred by cvc::mol::blur (blobbiness -0.2, a 3 A grid) and cvc::iso at 10, 2,609 points as floats; its golden from the legacy library. make_inputs.py leaves it alone (it needs libcvc). - OnAProtein (native, where libcvc has its mesher): makes the surface at the skeleton lab's 2 A (10,881 points; the largest feature a two-mouth tunnel of about 2,600 A^3) and at 3 A, checks the committed points against the latter, and writes them again with CVC_POCKETTUNNEL_WRITE_1GRL. - The A/B covers 1grl: after Tight Cocone, the port is the legacy library exactly (19 clusters, 490 triangles, 251 coloured points). End to end the large pocket is the legacy's cell for cell, the tunnel has 317 cells to its 309 (1,195 A^3 to 1,181), and the legacy run finds 17 one-cell pockets to the port's 3; large clusters are compared to 5%.
…il JX2 numpy-cp312 2.4.6+cvc.7 was published for wasm and wasm-mt on 2026-11-21 (23:43Z), built with -fwasm-exceptions for JX2 (#1409). libcvc still links ariglx with Emscripten's JS exceptions, so every ariglx-web job that has installed it since fails to link bin/ariglx.js: wasm-ld: error: .../numpy/_core/_multiarray_umath.cpython-312-wasm32-emscripten.so: undefined symbol: __cpp_exception (also __wasm_lpad_context, _Unwind_CallPersonality) pin-wasm-pre-jx1.sh now puts cvc.6 back, as it does for the JX1 bundles. cvc.6 is the bundle #1417's ariglx-web jobs linked on both columns. Checked locally on wasm and wasm-mt: with cvc.7 installed, 2 of numpy's 19 extensions import __cpp_exception; after the script, the lockfile says cvc.6 and none do. JX2 deletes the script and its calls.
… check makes them The first Linux run of the volrover goldens check (run 44987475380) remade three of the five PocketTunnel goldens differently from the Windows ones. The legacy result follows the cells' heap order, so glibc's and MSVC's heaps mark different cells outside on tunnel (33 more on Linux), three_chambers (41 fewer) and 1grl (67 fewer). As with Skeletonization's goldens, the committed set is now CI's (ubuntu-24.04, GCC, cvcpkg's CGAL), from that run's artifact. - MatchesTheLegacyLibraryAfterTightCocone: unchanged and exact on all five; given either platform's marking, the port's stages make that platform's result. - MatchesTheLegacyLibrary: tunnel is now exact end to end (a tunnel of 3,085 cells and five pockets of one or two, as the port finds); three_chambers moves to the 5% group (each cluster 3 to 6 cells more than the legacy's); 1grl's tunnel is 317 cells to 307. - README: the table, the end-to-end numbers and the platform note.
The asan-ubsan job stopped pocket_tunnel_test's OnAProtein at 1GRL's 3 A surface: octree.cpp:2656, "shift exponent -1 is negative". An edge on the volume's far boundary is stored in a cell outside the grid; xyz2octcell gives -1 there, so is_eflag_on() and eflag_on() computed idx -3 to -1 and shifted by idx%8. Both now treat such an edge as having no flag. The mesh does not change. Every caller makes a quad only through is_min_edge(), which returns 0 for these edges before it touches the frame, because is_refined() is 1 outside the grid. eflag_on() already changed nothing for them, since the shifted bit fell outside the char. pocket_tunnel 15, lbie_mesher 69, algorithm 10, geometry 122 and skeleton 11 pass natively, and the 3 A surface still matches the committed 1grl.pts.
…rch64 recipe / macos-latest / Debug ran OnAProtein for the first time on this PR (every earlier macOS run was cancelled), and its 3 A surface had 2,606 points to the committed 1grl.pts's 2,609. x86 Linux and Windows make the same 2,609. On aarch64 the compilers' default fuses the mesher's multiply-adds; the mesher is not built with -ffp-contract=off, as blur.cpp is, and the 2 A surface still has the same 10,881 points. So the committed-copy check stays exact where __FP_FAST_FMA is not defined (x86, and MSVC everywhere), and on a target with fused multiply-add it checks the point count to 1%. The README says so. pocket_tunnel_test passes 15/15 natively (Windows, exact path).
transfix
added a commit
that referenced
this pull request
Nov 22, 2026
…-secondary #1439 moved the cocone core to src/cvc/geometry/cocone and the skeleton's U1/U2 declarations to skeleton/skeleton_stages.h, so secondary.h now includes that. The eight conflicts are adjacent additions, and both sides are kept: the build lists, the goldens tool (CMakeLists, make_goldens.py, make_inputs.py, README) and the TexMol roadmap. The shared cvcgeom.h shim is #1439's plus line_t and lines(). With that shim, the legacy SecondaryStructures makes the same bytes as before.
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.
TexMol roadmap T5, first part: PocketTunnel (Goswami and Bajaj, UT 2008; transfix/volrover
src/PocketTunnel, UT LGPL-2.1) as a headlesscvc::core. It finds the pockets, tunnels and voids of a surface as the stable manifolds of the distance function's maxima outside it. SecondaryStructures stays out (its licence waits on UT). The CLI, pycvc, DSL intrinsics, amesh_labrequest and a molecule demo are later PRs.One cocone core
P1's cocone port moves from
src/cvc/geometry/skeleton/tosrc/cvc/geometry/cocone/:cocone.h,datastruct.*,stepping.h,init,util,tcoconeandrcocone, as git renames. The skeleton keeps its own stages inskeleton/and gets askeleton_stages.h; the tiler'sstepping.hinclude follows the move. PocketTunnel's legacyinit.cppandtcocone.cppare this same code, and itsutil.cppadds onlycell_volume, which now lives in the core. No other copy is vendored. The skeleton, tiler and tet_complex tests pass unchanged.cvc::pocket_tunnelinc/cvc/geometry/pocket_tunnel.handsrc/cvc/geometry/pocket_tunnel/pocket_tunnel.cppport smax.cpp (grow_maximum, merging the touching outside clusters, the volumes and their sort), handle.cpp (the mouths) and op.cpp (the output) as one coroutine on the core.pocket_tunnel_stepperis resumable, with phases from "checking" through "output".pocket_tunnel_jobwraps it as aresult_job. The parameters are aparam_table(pocket_tunnel_params.h).pocket_tunnel_errorwith a reason: empty input, too few points, all in one plane or on one line, the same point repeated, a coordinate that is not finite, or bad parameters.Legacy A/B (
tools/volrover-goldens, at the pinned volrover sha)pockettunnel_driver.cpprunspocket_tunnel_fromsurf()once per process. A read-only hook patched into the legacypocket_tunnel.cpprecords its clusters, the geometry it returns, and Tight Cocone's marking.make_goldens.py --checkcompares a remade golden by content. There are five committed inputs. Four are synthetic: a ball with a chamber and one neck (a pocket), with two necks (a tunnel), three chambers, and an enclosed cavity. The fifth is PDB 1GRL's surface (2,609 points): its heavy atoms blurred bycvc::mol::blurat blobbiness -0.2 on a 3 Å grid, thencvc::isoat 10. That became possible once #1428 landed; master is merged in.The legacy result is not a function of its input. CGAL's facet iterator reports a facet from the cell at the lower address, and Tight Cocone's peeling is greedy in that order. In one process, 1 of 5 triangulations of the tunnel input marked 33 more cells outside, which made five extra 1–2 cell pockets. The port walks in tet_complex's order instead. So
pocket_tunnel_testcompares at two levels:pocket_tunnel_marked.h), the port's own stages give every cluster with the same kind, mouths, cells and maxima, volumes to 1e-12, every shown triangle with its cluster and class, and every point's colour. This holds on all five cases, 1GRL included (19 clusters, 490 triangles, 251 coloured points).The goldens are Linux's (f60500f). CI's first Linux check of the Windows-made goldens remade three of them differently, because glibc's and MSVC's heaps order the cells differently. On Windows, the tunnel's marking has 33 fewer outside cells and a single tunnel of 3,083 cells. The three chambers' has 41 more, and the port matches it to the cell. 1GRL's has 67 more, a tunnel of 309 cells and 17 one-cell pockets. As with Skeletonization's goldens, the committed set is CI's (ubuntu-24.04, GCC, cvcpkg's CGAL), taken from run 44987475380's artifact. Given either platform's marking, the port's stages make that platform's result exactly.
Tests (
pocket_tunnel_test, natively and in the wasm-mt ports lane)cvc::apps run jobs at once, each from its own state-tree parameters on its own scheduler.Local runs:
--checkreproduces the Linux goldens on Linux only. A Windows build makes its own goldens the same way in each new process, and they differ on three cases (above).CI
pocket_tunnel_testjoinsSAN_CXX_TESTS.src/cvc/geometry/cocone.ci.ymlstays CRLF (+4 / -2 lines).OnAProteinat 1GRL's 3 Å surface:octree.cpp:2656, "shift exponent -1 is negative". An edge on the volume's far boundary is stored in a cell outside the grid, sois_eflag_on()andeflag_on()shifted by a negative count. Both now treat that edge as having no flag. The mesh does not change:is_min_edge()never makes a quad for such an edge, and the oldeflag_on()changed nothing for it. lbie_mesher, algorithm, geometry, skeleton and pocket_tunnel pass natively, and the 3 Å surface still matches the committed1grl.pts.recipe / macos-latest / DebugranOnAProteinfor the first time on 01ebf3b (every earlier macOS run was cancelled). Its 3 Å surface had 2,606 points to the committed 2,609, the arm64 FMA effect that blur.cpp, the tiler, nav and others already build around with-ffp-contract=off. The mesher isn't built that way. Changing that would move every macOS mesh, so the test's exact comparison is limited to targets without__FP_FAST_FMAinstead.ariglx-web (wasm)check was red on cvc.7. JX2 (wasm: wasm exceptions and JSPI for libcvc's web hosts (JX2, first part) #1409) has since landed, and it deletes the pin script, so the merge of master (9f1b585) takes that deletion. The PR no longer changes anything under.github/scripts.