Skip to content

Feature/energy changes tracker#38

Open
cgevans wants to merge 9 commits intomainfrom
feature/energy-changes-tracker
Open

Feature/energy changes tracker#38
cgevans wants to merge 9 commits intomainfrom
feature/energy-changes-tracker

Conversation

@cgevans
Copy link
Copy Markdown
Owner

@cgevans cgevans commented Mar 22, 2026

No description provided.

cgevans and others added 2 commits March 22, 2026 14:28
Add a new StateTracker that builds a histogram of energy changes per
event, binned to a configurable precision (default 1e-6). This is useful
for analyzing the distribution of energy changes in simulations.

Replace the simple TrackingType enum with a richer TrackingConfig enum
that carries per-variant configuration (e.g., bin_width for
EnergyChanges). This avoids polluting TileSet with per-tracker fields.
TrackingConfig supports custom serde (string or map) and FromPyObject
(str or dict) for backward-compatible Python usage:

  tracking="movie"
  tracking={"type": "energychanges", "bin_width": 0.01}

Also adds energy_histogram() method on State for lightweight access
to the histogram data without requiring polars, and adds polars to
test dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test that the EnergyChangesTracker correctly captures the distribution
of energy changes during simulation. For each test, extract per-bond-
count attach/detach events and verify:

- Growth: net two-bond attachments account for most tile gain
- Melt: net two-bond detachments account for most tile loss
- Equilibrium: two-bond and one-bond attach/detach are roughly equal
- All cases: three/four-bond events are rare vs two-bond

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 28.52459% with 218 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.51%. Comparing base (5ef7bcd) to head (3b99221).

Files with missing lines Patch % Lines
rgrow-rust/src/tileset.rs 26.26% 73 Missing ⚠️
rgrow-rust/src/python.rs 5.88% 48 Missing ⚠️
rgrow-rust/src/system/types.rs 0.00% 20 Missing ⚠️
rgrow-rust/src/state.rs 72.85% 19 Missing ⚠️
rgrow-rust/src/system/analysis.rs 0.00% 18 Missing ⚠️
rgrow-rust/src/rbffs.rs 15.00% 17 Missing ⚠️
rgrow-rust/src/ffs.rs 16.66% 15 Missing ⚠️
rgrow-rust/src/system/dispatch.rs 0.00% 6 Missing ⚠️
rgrow-rust/src/models/sdc1d.rs 0.00% 1 Missing ⚠️
rgrow-rust/src/system/core.rs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (5ef7bcd) and HEAD (3b99221). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5ef7bcd) HEAD (3b99221)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #38       +/-   ##
===========================================
- Coverage   60.57%   42.51%   -18.06%     
===========================================
  Files          35       31        -4     
  Lines       15574    13785     -1789     
===========================================
- Hits         9434     5861     -3573     
- Misses       6140     7924     +1784     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cgevans and others added 7 commits March 22, 2026 20:01
The testing dependency group in pyproject.toml includes polars (needed
by the new energy tracking tests), but CI was hardcoding a subset of
test deps. Use `uv pip install --group testing` instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow passing CriticalStateConfig fields as keyword arguments directly
to find_first/last_critical_state. Export CriticalStateConfig and
CriticalStateResult from rgrow package. Fix type stubs to use concrete
class names instead of Self.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Rust implementation is commented out, so these stub entries were
misleading. Remove them from all model classes (ATAM, SDC, KTAM,
OldKTAM, KBlock).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arch

Add `parallel: bool` to CriticalStateConfig and calc_committor_threshold_test,
defaulting to true. When false, runs committor trials sequentially with a
single state. Also change evolve_states and related methods from &mut self
to &self since evolve only requires &self.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These methods only call &self methods on the system (evolve, evolve_states,
calc_dimers, etc.) and never mutate it. Changed to &self/&S in:
- analysis.rs: calc_committor, calc_forward_probability
- dispatch.rs: DynSystem trait and impl for run_ffs, run_rbffs,
  calc_committor, calc_forward_probability
- ffs.rs: FFSRun::create, FFSLevel::next_level, nmers_from_dimers,
  FFSRunResult::run_from_system
- rbffs.rs: RBFFSResult::run_from_system, run_rbffs
- python.rs: get_param, calc_mismatch_locations, py_calc_committor,
  py_calc_forward_probability, py_run_ffs, py_calc_committor_threshold_test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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