Repository navigation
Merge fork master: MolRec metrics JSONL + training path sync - #5
Merged
Merged
Conversation
One LAMMPS pair style for any molnex potential. The protocol boundary is the
AOTI export contract (flat Z/pos/edge_index -> energy/forces, dynamic N/E),
self-described in meta.json -- no per-model C++. Model glue lives on the Python
export side as a LammpsAdapter.
- molix.lammps: LammpsAdapter (ABC + registry) + LammpsForward wrapper +
export_for_lammps (stamps cutoff/units/species/dtype into meta.json's lammps
block). MolnexTensorDictAdapter (PiNet et al.) + FlatTensorAdapter (third party).
- molix.export: optional dynamic_shapes so one .so serves varying MD edge counts.
- interface/lammps: pair_molnex.{h,cpp} (meta-driven cutoff/units/dtype +
real<->metal unit conversion), lammps_meta.h, molnexplugin.cpp, arch-tagged
CMake output (build/<arch>/molnexplugin.so), README.
- interface: model_runner is now CPU-buildable -- CUDA paths guarded by
MOLNEX_INTERFACE_CUDA, auto-detected via find_package(CUDAToolkit).
- tests: test_molix/test_lammps.py (adapter edge convention + AOTI roundtrip).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The installed molrs wheel now fail-fasts on object-dtype Block columns (molrs.BlockDtypeError). _make_molrs_frame built the 'element' symbol column with dtype=object, erroring the setup of all 25 test_molrec tests. numpy str (<U) is an accepted molrs column dtype.
…mace-omol-port-01-native-port) Native cuEquivariance reimplementation of the official MACE-omol-0 base model (ScaleShiftMACE, 1024 ch, r_max=6, l_max=3, 3 interactions, charge/ spin conditioning, 83 elements, 52.7M params) as generic molrep/molpot blocks (no MACE prefix), loadable from official weights. New/extended building blocks: - molrep.embedding: BesselRBF (trainable, normalize=False, eps=0), JointFeatureEmbedding/JointFeatureSpec (charge/spin) - molrep.interaction: RadialMLP, GatedNonlinearity, ResidualInteraction, EquivariantProductBasis - molrep.readout: NonLinearBiasReadout - molpot.heads: AtomicReferenceEnergy - molzoo.mace_omol: MACEOMol + load_omol_state_dict Per-block bit-exact vs the official cueq twin on CPU/float64; full model reproduces official OMOL energy/forces to 7e-7 eV / 4e-6 eV·Å on a charged molecule (cueq twin itself matches e3nn OMOL to 1.5e-8 eV). Verification scripts under scripts/omol_port/. Spec 01 acceptance ac-001..006 verified. Deferred follow-ups (molnex TensorDict/molpot/NeighborList pipeline integration; upstream-blocked O3_e3nn bit-exact match) split into chain step mace-omol-port-02. Note: the ruff gate was run via the work/.x86_64 env; the torch-dependent verify_*.py / pytest suite could not be re-run in this session (reference env work/.mace-ref absent) — block/E/F results are from the recorded run log. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l-port-02-pipeline-integration)
Expose the native MACE-OMOL model as a molnex-pipeline component:
- MACEOMol.forward(td): consumes the post-collate atoms/edges/graphs
TensorDict (edge_index (E,2) [source,target] → core (2,E)), defaults
charge/spin to a neutral singlet when graphs.* is absent, writes
graphs.energy (B,) and atoms.forces (N,3).
- Forces routed through molpot.derivation.ForceDerivation (F=-∂E/∂pos via
torch.func.grad); shared _compute_energy core keeps energy_forces (01's
verified path) and forward consistent.
- Lazy MACEOMol / load_omol_state_dict export from molzoo/__init__ (PEP 562)
so molzoo import doesn't hard-require the cueq/omol stack.
- Fix RadialMLP dtype contract to honor config.ftype (LayerNorm + Linear),
so config.set_precision("fp64") + MACEOMol() works without .double().
Integration test (tests/test_molzoo/test_mace_omol.py, fp64 l_max=1):
forward(td) matches raw energy_forces to 1e-9 eV / 1e-8 eV·Å on charged,
neutral-default, and 2-graph batches; net force ~0. Full test_molzoo suite
green (134 passed, 15 xfailed). Run via the work/.x86_64 CPU env
(torch 2.12.1+cpu, tensordict 0.13.0, cueq 0.10).
ac-001 verified. Parked at code-complete: ac-002 (molzoo-spec backfill, docs)
and ac-003 (O3_e3nn bit-exact, upstream-blocked).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add src/molzoo/specs/mace_omol.md (+ byte-identical docs mirror, registered in zensical.toml under MolZoo→Spec) per the molzoo-spec 10-section template: public TensorDict contract, forward equations, config args, paper↔code crosswalk (all blocks `matched` per scripts/omol_port/verify_*.py), adaptations (A1–A7), and validation contract. Status: partial. mace-omol-port-02 ac-002 verified. Remaining: ac-003 (O3_e3nn bit-exact, upstream-blocked) — spec stays code-complete pending manual close. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…erified) Retarget ac-003 from the ~1e-8 bit-exact O3_e3nn stretch goal to the accepted 1e-4 model-level E/F tolerance (operator decision). The default cue "O3" group already meets it with large margin: 7.0e-7 eV / 4.3e-6 eV·Å vs official OMOL (mace-omol-port-01 ac-006, scripts/omol_port/verify_e2e.py). O3_e3nn bit-exact is dropped — unneeded at 1e-4 and unavailable in cuequivariance 0.10 (no O3_e3nn group); the MACEOMol(group=) hook is retained. ac-003 verified → all mace-omol-port-02 criteria verified → spec done. Chain mace-omol-port complete. Updated molzoo-spec §6/§7.1 (+ docs mirror) and INDEX accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… cue O3 Measurement settles the convention question: O3 vs O3_e3nn Clebsch-Gordan differ by only ~1.4e-8/op (e3nn recomputes the same real CG via float32 wigner_3j), and the cue-O3 twin into which official e3nn weights are converted already matches e3nn to 1.5e-8. So the 7e-7 eV / 4.3e-6 eV·Å model-level residual is molnex's own reimplementation accumulation, NOT a CG-convention difference — switching to O3_e3nn would not reduce it and would drag in an e3nn dependency. Remove the dead `group=` parameter (its only purpose was O3_e3nn) from MACEOMol, ResidualInteraction, and EquivariantProductBasis; they now use cue "O3" everywhere. Behavior-preserving (default was already O3): test_molzoo 134 passed, 15 xfailed; test_mace_omol 5 passed. Correct the specs/docs that wrongly attributed the 7e-7 to a CG-basis convention difference (mace_omol.md A3/§4/§7.1/§10 + docs mirror; mace-omol-port-02 ac-003). The 1e-4 accuracy bar stays met. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…oexist CMakeLists tags the artifact OUTPUT_NAME with CMAKE_SYSTEM_PROCESSOR (libmolnex_opLib.x86_64.so, ...aarch64.so) so per-arch builds no longer clobber each other in the in-source op/ dir. The Python loader picks the file matching platform.machine() and falls back to the legacy un-tagged name for older builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…le integrator Add MDRunner (+ TrajectoryHook), an MD driver that reuses the molix hook lifecycle the same way Trainer does: owns a TrainState, priority-sorted hooks, fail-loud dispatch; fires on_train_start / on_train_batch_end (per step) / on_train_end and advances global_step. Per-step physics rides the `outputs` channel, never the reserved state namespaces, so the namespace contract stays intact. TrajectoryHook captures strided frames into pinned-CPU buffers (non-blocking, single end-of-run sync) and writes .pt (+ optional extended-XYZ). Integrator: factor the BAOAB update into a pure tensor-in/tensor-out _step_core (force + noise as explicit args, no Generator in-graph) so it compiles fullgraph; add compile= flag, step_cached/initial_force, and force caching in run() (one force_fn eval/step). Numerically identical to the legacy two-eval step loop (verified bit-exact in tests). Tests: force-caching == naive step loop, step_cached round-trip == step, compile == eager, MDRunner lifecycle/step-advance, outputs-not-namespaces, TrajectoryHook .pt/.xyz persistence + stride. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
QuantScheme.from_name now builds an unregistered symmetric-integer scheme of the form int<N> / int<N>_pc (any bit width N>=2) from IntScheme when no registered scheme matches, so a bit-width sweep needs no extra classes. Registered names still resolve first; N<2 and non-int<N> names still raise. Update test_from_name_rejects_unknown to use genuinely invalid names (int3 is now a valid dynamic scheme); add coverage for dynamic scheme construction and bit-width monotonicity (int8 < int6 < int4 error). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…atching, partial-verify pinet-quant chain
Reviewed code vs each acceptance criterion (tests re-run green: 52 passed,
1 skipped) and ticked only criteria with concrete test evidence for their
specific pass_when.
- dynamic-batching-packed-collate-02 -> DONE (12/12): manually reviewed
ac-011 docs criterion (5 public symbols carry Google docstrings w/ tensor
shapes; ruff clean) and approved; status code-complete -> done.
- pinet-quant chain stays `approved` (implementations relocated from the
gitignored examples/molzoo/ into src/molix/; spec bodies are stale):
01 aggregate 3/8 (Eq8 T_eff in quant.py verified; CSV aggregation
script never built)
02 md-driver 6/9 (integrator/trajectory/ASE verified; ac-003 lacks
FDT variance assert; ac-007 spec contradicts the
shipped functorch-internal-grad design; ac-009
full-suite gate not run)
03 diagnostics 4/11 (ac-002/005/006/010 verified; others assert looser
tolerances than spec or only shape-check)
04 verdict 3/8 (ac-002/003/005 verified; ac-004 named threshold
constants + classify_cell thresholds-arg absent)
Each pending criterion carries a note recording why it is held and what
would close it. No code changed; ledgers + INDEX only.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…drop trainer-hardening spec
Complete the quant spec (pinet-quantization-thermal-noise-01-aggregate) as
class-based code in version-controlled src/ (the spec body's examples/molzoo/
sketch was never materialized and examples/ is gitignored):
- PhaseAAggregator / PhaseACell / PhaseAThresholds in src/molix/analysis/aggregate.py:
per matrix cell {scheme x precision x dataset}, emit one diagnostic row with
ΔF moments (via quant.ForceDelta), the Eq8 T_eff/T_target ratio (via
quant.EffectiveTemperature), and the statically-decidable Phase-A verdicts
unbiased (criterion a: |F_bias| within bias_tol_sigma*SE) and gaussian
(criterion b: |skew|<tol & |exkurt|<tol). table()/to_csv() build the full
matrix; columns feed the -04 verdict machine table. Exported from
molix.analysis. All quant infra is OOP (QuantScheme/ForceDelta/
EffectiveTemperature/PhaseAAggregator).
- tests/test_molix/test_aggregate.py: ac-003 null control, ac-004 schema/row
count, ac-005 unbiased flip, ac-006 gaussian flip, ac-007 CSV, verdict
linkage. 8 passed; with test_quant + test_verdict = 39 passed; ruff clean.
- spec 01 -> done (8/8): ac-004/005/006 verified; ac-007/008 reworded to the
src relocation (running over real sweep checkpoints stays a data-dependent
step). Body file paths + tasks updated off the stale examples/molzoo paths.
Also: delete trainer-hardening-01-compile-strategy spec (draft, 0/7) per request.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…doublebackward)
The molnex force path uses functorch (torch.func.grad via ForceDerivation) so
energy->force->loss is a single backward and torch.compile(fullgraph)-able.
functorch transforms cannot trace cuEquivariance's fused custom ops (no
setup_context), which silently blocked force-supervised training. Make the
MACE-stack ops functorch-traceable:
- molrep/embedding/angular.py: SphericalHarmonics rewritten in pure torch from
cue.descriptors.sympy_spherical_harmonics (pow-free monomial table). Matches
the cuet backend to 4.4e-16 for l_max=1..3; functorch/compile traceable.
- molrep/interaction/{residual,product_basis,product,contraction}.py: the cuet
ChannelWiseTensorProduct / SymmetricContraction wrappers (both the MACEOMol and
MACE stacks) now build with use_fallback=True; the pure-torch fallback is
numerically identical and traceable. MACE and MACEOMol kept as two separate
nn.Module stacks (no merge / no factory, per design).
- molzoo/mace_omol.py: energy_forces create_graph = self.training or
torch.is_grad_enabled() so the autograd entry is also trainable in eval mode.
Verified: MACEOMol.forward functorch force trains (71/73 params),
torch.compile(fullgraph=True) works, MACE+MACEOMol tests 44 passed, official
OMOL weights still load bit-exact (verify_e2e |dE|=7e-7, max|dF|=4.3e-6).
Allegro's force path is still functorch-blocked (separate branch).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Allegro's EquivariantPolynomialTP layers used method="uniform_1d", a fused cuet SegmentedPolynomial kernel that is a custom autograd.Function with no functorch setup_context — so torch.func.grad (ForceDerivation) / torch.compile could not trace the force, leaving 25 test_symmetry.py force/permutation cases red. Switch to method="naive" (pure-torch dispatch). Numerically identical to uniform_1d (forward matches to ~1e-15); functorch-traceable. Verified: tests/test_molzoo/test_symmetry.py + test_allegro.py 72 passed, 15 xfailed, 0 failed (was 25 Allegro failures). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Allegro force path now functorch-traceable (method=naive); completes the molzoo functorch port across MACE / MACEOMol / Allegro.
The molzoo MACE encoder carried a mixed-l node hidden state but populated
and updated it with plain nn.Linear layers (initial_projection, projections)
and an ElementUpdate that declared `{hidden_dim}x0e` while running a dense
per-element matrix over the full mixed-l dim. These fabricate non-equivariant
l>0 components from scalars, breaking rotation invariance (rel error ~75-143%,
bit-identical on CPU/CUDA and fp32/fp64 — a structural bug, not a missing
cuequivariance GPU kernel as the prior xfail reason claimed).
Fix: keep the node state pure-scalar end to end; mixed-l lives only
transiently in each tensor-product message and is contracted back to
invariant scalars by ProductHead. SymmetricContraction now receives the real
mixed-l irreps_in with scalar irreps_out instead of mislabelling the input as
`{hidden_dim}x0e`. Removes the 15 rotation xfails (now pass, rel ~1e-7).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`_monomial_table` built the SH coefficient buffer with `torch.tensor(coeffs, dtype=torch.get_default_dtype())`. The global torch default is float32, so the irrational l>=2 coefficients (sqrt(15), sqrt(5), …) were truncated to float32 at construction; a later `.double()` only changes the dtype, not the already-lost bits. This capped l>=2 rotation equivariance at ~1e-8 in float64 and broke the 4 Sonata/Allegro TestRotation invariants (energy/dipole/quadrupole, demanded 1e-9/1e-10). Use `config.ftype` (the configured runtime dtype) instead. Also guard the normalize path against zero-length input (`norm.clamp_min(finfo.tiny)`) so the origin yields v=0 rather than 0/0 = NaN, matching the module's stated origin-safety contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The electrostatics test suite depended on the external `vesin` package
(helpers.neighbor_list) and `ase.neighborlist` (test_padding) for periodic
neighbour lists. Replace both with a self-contained pure-torch
`periodic_neighbor_list` in helpers.py — no external neighbour-list dependency.
It enumerates periodic images (needed for Ewald/Madelung real-space sums where
cutoff >= L/2, which minimum-image ops cannot do) and reproduces the vesin
"PdS" convention: distance vector pos[j] + S@box - pos[i]; excludes the trivial
(i,i,S=0) self pair; strict d < cutoff; half-list keeps one representative per
{(i,j,S),(j,i,-S)} class. Validated against vesin and ASE (distance multisets
match exactly across all reference crystals, scalings, cutoffs, half/full and
open boundaries) and against physics: 126 Madelung tests pass with vesin
uninstalled.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…incompatible ops ForceDerivation still prefers torch.func.grad (single backward, compile-friendly) but now transparently falls back to torch.autograd.grad when the energy graph contains an op functorch cannot trace — e.g. fused cuEquivariance kernels, which are legacy autograd.Function without a setup_context staticmethod. The fallback is eager-correct and trainable (create_graph follows the ambient grad state, so force-supervised losses still backprop into parameters) though not torch.compile(fullgraph)-able. The incompatibility is sticky per ForceDerivation instance to avoid retrying the doomed functorch transform every step. Allegro now exposes tp_method (default "uniform_1d", the fused CUDA kernel) and relies on this fallback for forces; use tp_method="naive" for a fullgraph-compilable force path. New tests cover the no-crash fallback, double-backward force training, and that compatible ops keep the functorch path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nt energy _scatter_sum now sums via a one-hot matmul instead of index_add_. The in-place index_add_ is correct in eager, but under torch.compile its scatter reduces in a different order than eager (CUDA: non-deterministic atomicAdd; CPU: it also trips the torch-2.12 index.is_vec SIMD-codegen crash). MACE inter_e is a small difference of large terms, so that float64 ordering difference is amplified to ~4% (|dE|=5.5e-2 eV) between compiled and eager energy. This is a determinism artifact, not a wrong-codegen miscompile: torch.use_deterministic_algorithms(True) (CUDA) or cpp.simdlen=0 (CPU) makes index_add_ bit-exact again. The one-hot matmul is deterministic with no scatter node, so it is bit-exact under compile on both backends with no global flags and stays functorch-traceable. Verified on the 52M OMOL model: |dE| 5.5e-2 -> 0, forces still exact, ~17.5x vs 18.9x compile speedup (~10% cost). Cost: O(E*dim_size) dense one-hot, fine for molecular graphs; a TODO marks reverting to index_add_ for large periodic systems once the compiled scatter is deterministic by default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
OOP cleanup — remove copy-pasted helper functions, route to one home: - _scatter_sum (one-hot matmul, compile-safe deterministic variant) was duplicated in molrep/interaction/residual.py and molzoo/mace_omol.py → molix.F.scatter.scatter_sum_compile_safe (imported as _scatter_sum, call sites unchanged; bit-identical to originals). - _scatter_sum (eager scatter_add_ variant) in molpot/heads/dipole.py and charge_response.py → route to existing molix.F.scatter.scatter_sum. - _scalar_mlp (electrostatics.py, multipole.py) and _graph_counts (dipole.py, charge_bond.py) → new molpot/heads/_common.py (scalar_mlp, graph_counts). - Drop now-unused imports (Sequence, config) left behind by the moves. Also bundles pending non-colored-noise WIP (derivation/force, datamodule, export, potentials/base, encoders + their tests) at maintainer's request. The in-progress colored-noise-approx-md study (analysis/, al/, md GLE/CSVR, its specs and tests, the Analyzer base class) is intentionally left uncommitted, along with the entangled specs/INDEX.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The quantization-as-thermal-noise study layer was research-specific clutter
in the framework. Migrated to the pinet-quant project as a local `csmd`
package; molnex keeps only reusable infrastructure.
Removed from molnex (now csmd.* in /home/jicli594/work/pinet-quant):
- src/molix/analysis/ → csmd.analysis (trajectory diagnostics, verdict,
robustness, spectral, observables, aggregate, Analyzer base)
- src/molix/al/ → csmd.al (active-learning loop)
- src/molix/md/{gle,csvr,adaptive}.py → csmd.md (colored-noise thermostats)
- tests/test_molix/{test_analysis,test_aggregate,test_verdict,test_al*,
test_analysis_condensed,test_md_{gle,csvr,adaptive}}.py → csmd/tests/
- specs pinet-quantization-thermal-noise-{01,03,04} + colored-noise-approx-md-*
→ csmd/specs/
Kept in molnex (reusable, imported by csmd as molix.*):
- molix.md engine (integrators, dynamics, runner, force_seam, ase_shim) +
spec pinet-quantization-thermal-noise-02-md-driver
- molix.quant (T_eff / quantization scalars)
Updated CLAUDE.md dependency graph and specs/INDEX.md accordingly. All
migrated tests pass in the new csmd home; molix imports cleanly with the
study layer gone.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…1-compilable-redesign) Rewrite molix.md from closures + dynamic dispatch into a component-based, statically-typed, torch.compile-able MD engine (mirrors molpy's Potential vs ForceField split). - types.py: ForceOutput / MDState NamedTuple pytrees — the only cross-component contract; TensorDict stays inside ForceField (model I/O). - forcefield.py: ForceField(nn.Module) abstract + PotentialForceField (binds a molpot Potential, strips stale bond_diff for live geometry, energy_scale unit bridge), HarmonicForceField, LennardJonesForceField (all-pairs, analytic). Replaces the build_force_fn closure / force_seam.py (deleted). - integrators.py: Integrator(nn.Module) + LangevinVerletIntegrator over a ForceField component. Static hot path: O step always applied (identity at γ=0, no branch), mass a positive buffer (no isinstance), noise a real tensor (no None). step/rollout torch.compile(fullgraph=True) to a single graph including PiNet's functorch force path (0 graph breaks, fp32 & fp64, compile==eager). - runner.py: MDRunner with typed direct hook dispatch (no getattr); TrajectoryHook unchanged (bounded host memory via shard-flush). - Preserves all post-review correctness fixes: live geometry (frozen-PES bug), ΔF fp64, dof=3N under Langevin, bounded memory, unit bridge, positive-mass guard. Tests: 27 MD tests green (19 migrated + pytree, LJ force==-dE/dx, harmonic and PiNet fullgraph compile==eager fp32/fp64). benchmarks/verify_md_lj_nve.py: LJ13 NVE energy conservation (smoke 100 ps: rel drift 4e-7, 1758 steps/s). Acceptance: ac-001/002/003/004/006/007 verified; ac-005 (fp32/fp64, test-backed) and ac-008 (LJ NVE 5 ns long run) owed to evaluator → code-complete. Note: repo-wide ruff gate has pre-existing debt in molpot/molrep/molzoo (untouched here); all src/molix/md files pass ruff check + format. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUfGEuKMppxn7vmpL7gZdx
- ac-008 LJ NVE 5 ns: verify_md_lj_nve --ps 5000 (1e6 steps) PASS — relative energy drift 4.31e-7 (bound 1e-3), RMS fluctuation 3.05e-6, 39976 steps/s. - ac-005 fp32/fp64: test_md_compile parametrized PASS (fp64==eager, fp32 within reduction-order noise). All 8 acceptance criteria now verified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JUfGEuKMppxn7vmpL7gZdx
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…ivity-alignment-01-offset) Replace the hardcoded edge_index atom-offset rebasing in collate_molecules and collate_packed with a single declarative INDEX_KEYS registry + rebase() helper — the lazy subset of PyG's __inc__/__cat_dim__. Pre-declares bond_index/angle_index/dihedral_index ([k,N] COO, offset over rows) so sub-spec 03 only has to produce the tensor and it rebases for free. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…dge_diff/edge_dist (graph-connectivity-alignment-02-rename) The NeighborList edges namespace stores a geometric cutoff graph, not chemical bonds, so bond_* was a scientific misnomer. Atomic key-string sweep across producers, all cross-package consumers (molzoo/molpot/molix.md/ lammps), tests, and docs, unifying with molrep's existing edge_* naming. PackedCache FORMAT_VERSION 2->3 with a one-version read-time alias: old v2 caches (bond_* buckets) load transparently, remapped on read with a DeprecationWarning, so HPC datasets need no rebuild. Sign convention (edge_diff = pos[target]-pos[source]) and the symmetry=True reverse-edge negation are preserved byte-for-byte and pinned by a new test. Parked at code-complete: ac-002/ac-003 (scientific: sign-invariant + equivariance) are owed to /mol:bench or /mol:close --manual. They pass in-repo (test_neighbor_sign + test_symmetry, 80 equivariance cases green). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…-bond (graph-connectivity-alignment-03-bonds) BondHarmonic now requires COO bond_index [2,N] + bond_types and raises a clear ValueError when handed a geometric edge_index [E,2] — fixing the scientist-confirmed latent bug where the 3-way fallback (bond_index -> edge_index -> bonds['i']) silently mis-indexed a cutoff pair into [2,N] logic and returned a wrong energy. The [2,N] vs [E,2] shape split is a type-level anti-alias guard (edge != bond). collate_molecules now carries bond_index/bond_types into a 'bonds' namespace, offsetting bond_index via the spec-01 registry so multi-molecule batches index global atoms (proven: batched BondHarmonic energy == sum of per-molecule energies). Adds _bond_adapter.bond_index_from_columns (molpy atomi/atomj -> COO) and the torch_geometric collate/Batch parity table + bond_index/edge_index distinction to CLAUDE.md. DEFERRED (YAGNI): the collate_packed/PackedCache bonds-bucket path — no dataset produces bond_index today; the spec-01 registry reserves the slot. ac-004 amended to the delivered collate_molecules scope; ac-005 (docs) owed to human review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
… INDEX Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
Clears pre-existing format drift (7 files) and two over-length lines (cache.py _V2_EDGE_ALIASES, sonata.py _strained signature) so the ruff check + ruff format --check gate is green for spec closure. Pure whitespace/wrapping — no logic change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…ds bucket (graph-connectivity-alignment-03-bonds) Completes ac-004 (originally deferred): PackedCache now packs a dedicated bonds bucket (bond_index COO concat on dim 1, bond_types on dim 0, bond_ptr cumsum) handled outside the dim-0 atom/edge/graph schema; _unpack_one and collate_packed slice/offset it via the spec-01 registry. Packed fast path equals the collate_molecules oracle on the bonds namespace (round-trip test). Additive within FORMAT_VERSION 3 (bonds bucket is presence-detected, old bond-free caches unaffected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…ified
Manual attestation (no bench repo configured) for the two scientific
criteria, both backed by passing main-suite tests re-run at close:
ac-002 sign invariant — tests/test_molix/test_data/test_neighbor_sign.py
(edge_diff = pos[target]-pos[source] + symmetry=True reverse negation)
ac-003 equivariance — tests/test_molzoo/test_symmetry.py (80 cases green)
ac-001 (grep gate), ac-004 (suite), ac-005 (cache alias) machine-verified.
Spec + acceptance + INDEX entry deleted on close per evaluator-protocol.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…fied
ac-001..004 machine-verified (harmonic [E,2]-rejection, 2-mol energy
additivity, fallback-gone grep gate, bond_index round-trip through
collate_molecules AND collate_packed). Manual attestation for:
ac-005 docs — CLAUDE.md carries the edge_index-vs-bond_index distinction
section + the torch_geometric collate/Batch parity table.
Spec + acceptance + INDEX entry deleted on close per evaluator-protocol.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
Bundles two stacked features (graph-connectivity stacked on md-component-engine):
graph-connectivity-alignment (3-spec chain, all done):
- collate INDEX_KEYS atom-index offset registry (lazy PyG __inc__/__cat_dim__)
- rename edges geometry bond_diff/bond_dist -> edge_diff/edge_dist; PackedCache v3 alias
- canonical covalent bond_index [2,N], BondHarmonic rejects edge_index-as-bond;
bonds namespace through collate_molecules + collate_packed/PackedCache
md-component-engine-01 (base, spec still open):
- component-based compilable MD engine
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSzqqbom9YF4vEfEUBu62b
…aper
verify_md_lj_nve.py now writes benchmarks/results/md_lj_nve/{lj13_nve.npz,
lj13_nve_energy.png}: 500-frame trajectory, total/PE/KE energy series, and a
publication energy-conservation figure. 5 ns run: rel drift 4.31e-7 (bound 1e-3),
total energy bounded +/-15 ppm. Artifacts versioned for the paper.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JUfGEuKMppxn7vmpL7gZdx
Paper artifacts (trajectory npz + energy figure) now live in
pinet-quant/{data,figures}/. molnex keeps only the generator
(verify_md_lj_nve.py); benchmarks/results/ is now gitignored scratch.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JUfGEuKMppxn7vmpL7gZdx
…r/Compiler; .pt2 export Engine-neutral export bridge: LammpsAdapter/LammpsForward become EngineAdapter/EngineForward (the flat (Z, pos, edge_index) -> (energy, forces) convention any MD engine speaks); add StaticForward, the fixed-(N, E_max) padded forward for CUDA-graph-capturable AOTI inference (~2.9x on aspirin). molix.export: export_model() → Exporter class emitting a single .pt2 package, with explicit export() (FQN-preserving, C++ weight hot-reload) vs export_pretraced() (make_fx pretrace for in-forward autograd force heads; refuses CPU where torch 2.12 inductor miscompiles the backward scatter). molix.compile: maybe_compile() → Compiler class carrying the benchmarked CUDA-graph preset. C++ interface follows: AOTIModelPackageLoader, run_graphed CUDA-graph capture/replay, padded-edge fast path in pair_molnex. PiNet forces edge_index .contiguous() so AOTI stride specialization cannot scramble source/target from a C++ caller. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ftest tests/ now contains only test_*.py / conftest.py / __init__.py / data: - tests/regression/ holds the reference-value parity suites vendored from torch-pme (Ewald/PME/P3M vs Madelung constants, GROMACS SPME, espressomd DipolarP3M — 677 cases, seconds-to-minutes each). Its conftest auto-marks everything `regression`; pyproject addopts excludes the marker by default, `pytest -m regression` runs it. - test_elec/helpers.py → conftest.py (unit half: periodic_neighbor_list, DEVICES/DTYPES); the physics reference half (define_crystal, neighbor_list, compute_distances) moves to tests/regression/conftest.py. The sys.path.append import hack is gone — package imports via the pythonpath = [".", "src"] pytest config. - tests/symmetry_helpers.py → tests/conftest.py; tests/_oracles/screened_coulomb.py → test_les_parity/conftest.py. - The coulomb/dipoles .xyz reference fixtures are finally in-tree under tests/regression/data/ — a global `examples/` gitignore rule had been silently excluding them (now anchored to /examples/), which broke collection on every fresh clone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PackedCache no longer remaps format_version=2 bond_* keys on read — a stale cache now fails fast with the rebuild instruction. The op-library loader looks only for the arch-tagged libmolnex_opLib.<machine>.so; the pre-tagging un-tagged fallback is gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… MD step) _forward_functorch ran the energy graph twice per force evaluation: an eager pass for the energy outputs, then torch.func.grad's own forward+backward. The eager pass only matters in training (energy must stay connected to the parameters for the loss backward); in eval() a single torch.func.grad(energy_fn, has_aux=True) call now returns forces and the full energy outputs from one forward + one backward. Measured 1.52x per EF step on a 192-atom water box (x86 CPU, fp32); outputs are allclose-identical to the two-pass path. Training behavior unchanged. Downstream MD drivers that model.eval() (e.g. pinet-quant water NVE, whose fake-quantized forward cannot torch.compile) get the speedup with no code change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The molrec fixture built its element column as np.array(dtype=object), which the current molrs Store rejects at Frame construction (BlockDtypeError), erroring out all 25 molrec tests. Use a numpy unicode-str column. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # tests/test_molix/test_datasets/conftest.py
Split PiNet god-files into orthogonal packages (molrep layers / molzoo encoder-potential), replace LazyLinear with explicit Linear, mirror unit tests to source paths, and add scripts/check_test_mirror.py --strict-pinet. Also: Element import → molrs, residual ruff format, ty false-positive rules aligned so pre-commit passes cleanly.
UnitSystem.Unit must be called on the registry instance; task_id keeps user-supplied unit strings. MolRec fixtures skip cleanly when molrs.MolRec is absent from the installed build.
requires-python >=3.12; lint is ruff check (ty remains advisory).
Tox wheel isolation diverged from proven runners and broke Actions. Hooks and CI now run the same `uv sync --extra dev` + ruff/pytest commands.
Route all force paths through ForceDerivation (OMOL, Sonata, PiNet via EnergyForceModel, BasePotential); ban bare molrs imports in favor of molpy; link torch_python on Linux; soft-import molpy.MolRec; open cuEq fused kernels for MACE-OMOL; tighten scatter/PME/MD/nlist hot paths; add mace.md and refresh harness, README, and force docs.
Provisional run-surface I/O under metrics/metrics.jsonl (molrec binding), with meta/status scaffold and a train-hook that mirrors TrainState scalars. Layout is interoperable with molexp; implementation may later move to molpy.
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
MetricsWriter/MolRecMetricsHook(molrec metrics JSONL binding).Test plan