Skip to content

Fully-featured Primitive resolution shift operations - #75

Draft
timbernat wants to merge 2 commits into
prim-refactorfrom
res-shift
Draft

Fully-featured Primitive resolution shift operations#75
timbernat wants to merge 2 commits into
prim-refactorfrom
res-shift

Conversation

@timbernat

@timbernat timbernat commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Description

System preparation at arbitrary resolution scales and and CG backmap operations would greatly benefit from mature capability for expanding, retracting, and truncating intermediate scale Primitive within a hierarchy tree. Further, the implementation of expansion provided there is poorly-scalable, taking significant time even for systems on the order of 10k atoms, due to reliance on atomic operations on individual primitives, rather than caching information and making use of larger organizational units within the representation (i.e. avoiding the "deregister -> reregister/relabel -> reconnect to neighbors" path taken now). This was a deliberate choice to facilitate reasoning about the correctness of the program and simplify implementation, but would benefit from more targeted optimization now that it has been tested in example workflows.

Todos

Notable points that this PR has either accomplished or will accomplish.

  • Implement resolution-shifting operation on mutable Composite Primitives, namely:
    • Implement Primitive.retract(): injects an intermediate level into a hierarchy between a parent Primitive and its children, encoding a partition of those children
      • Add support for MultiGraphs when collection topologies to ensure partitions w/ interlinked parts are supported, as well as allowing polymers with intrinsically multi-bonded repeat units, such as PIMs and polycyclophanes, to be represented
    • Implement Primitive.truncate(): add the ability to remove all levels below a given Composite and replace it with an analogous Simple
  • Accelerate the implementation of (already-extant) Primitive.expand()
    • Implement native API for reassigning (still unique!) handles to children without de- and then re-registering them
    • Replace calls to Primitive.flatten() in exporters with topolgoy collection logic (TB: likely an entirely separate PR)
  • Implement total hierarchy-wide label uniquification in tree rendering (not directly relevant, but would be enabled by the same kind of tree-wde handle uniquification required for the above)

Questions

  • placeholder

Status

  • Passed tests
  • Passed co-dev review
    • Passed Copilot review to catch dumb spelling errors etc.
  • Ready to go

@timbernat timbernat self-assigned this May 26, 2026
@timbernat timbernat changed the title Soft commit to differentiate res-shift branch Fully-featured Primitive resolution shift operations May 26, 2026
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