Three repos involved: icotable (library), duello (table generator), faunus-rs (MC lookup). Both duello and faunus depend on icotable via git.
Each (R, Ο) slab has its own angular resolution. Lookup uses nearest-bin rounding for R and Ο
(same as Table6DFlat), so at the boundary where resolution drops (e.g. n_div=2 β n_div=1)
the transition is a hard switch. This is acceptable because the resolution only drops when the
angular gradient is already below threshold β the coarser mesh captures the smooth surface well.
Possible mitigations if needed:
- Linear R blending: at transition bins, interpolate between fine and coarse slab results
- Overlap validation: evaluate transition slabs at both resolutions, assert small difference
Table6DAdaptive currently lacks metadata, tail_energy(), and validate_metadata() that
Table6DFlat has and Faunus requires.
src/adaptive.rsβ Addpub metadata: Option<TableMetadata>field toTable6DAdaptive<T>. Addtail_energy(&self, r: f64) -> f64andvalidate_metadata(&self) -> Result<()>methods (same logic asTable6DFlat, reuseTableMetadataandTailCorrectionTermfromflat.rs). UpdateAdaptiveBuilder::build()to setmetadata: None.src/lib.rsβ Already re-exportsTable6DAdaptive; no changes needed.
src/icoscan.rs β Replace the current Table6D β Table6DFlat::<f16> workflow with AdaptiveBuilder:
- Add fields to
ScanConfig:max_n_div: usize(default 3),gradient_threshold: f64(default 10.0). - Replace
Table6D::from_resolution(...)withAdaptiveBuilder::new(rmin, rmax, dr, omega_step, max_n_div, gradient_threshold). Computeomega_stepfromangle_resolutionthe same way dihedral_angles are built now. - Outer loop over distances (shortβlong R): use
builder.current_n_vertices()per R slice. Get vertex directions frombuilder.vertex_directions(builder.current_level()). - GPU batch path: for each R, for each omega, build
PoseParamsfrom vertex directions +icotable::orient(), collect into batch, callbackend.compute_energies(), feed flat n_vΓn_v array intobuilder.set_slab(ri, oi, &energies). - After all omega slabs for one R: call
builder.finish_r_slice(ri). - After all R:
let table = builder.build(). Attach metadata + tail correction. Calltable.save(path). - PMF/partition-function calculation: iterate over
tableslabs instead ofTable6Daccessors β or keep the existing PMF code alongside by also computing partition function from the slab data.
src/main.rs β Add --max-ndiv and --gradient-threshold CLI args to the Scan command, pass to ScanConfig.
src/lib.rs β Update re-exports if needed (add AdaptiveBuilder, Table6DAdaptive).
Cargo.toml β Point icotable to branch/commit with Step 1 changes (or use path dependency during dev).
faunus/src/energy/tabulated6d.rs:
- Replace
Entry.table: Arc<Table6DFlat<f16>>with an enum:Implement shared accessors:enum TableKind { Flat(Table6DFlat<f16>), Adaptive(Table6DAdaptive<f32>), }
rmin,rmax,tail_energy(r),lookup_boltzmann(r, omega, dir_a, dir_b, beta),validate_metadata(). - Loading: try
Table6DAdaptive::<f32>::load()first; if deserialization fails, fall back toTable6DFlat::<f16>::load(). Or use file extension / config field to distinguish. pair_energy()hot path is unchanged β it callslookup_boltzmann()on whichever variant.
faunus/Cargo.toml β Point icotable to branch/commit with Step 1 changes.
The CPU (rayon) path currently uses Table6D::get_icospheres() to iterate vertex pairs.
Replace with explicit loop over builder.vertex_directions() Γ builder.vertex_directions(),
computing energy per pose via backend.compute_energy(), then builder.set_slab().
| Repo | File | Change |
|---|---|---|
| icotable | src/adaptive.rs |
Add metadata, tail_energy(), validate_metadata() |
| duello | src/icoscan.rs |
Replace Table6D with AdaptiveBuilder |
| duello | src/main.rs |
Add --max-ndiv, --gradient-threshold CLI args |
| duello | Cargo.toml |
Update icotable dependency |
| faunus-rs | faunus/src/energy/tabulated6d.rs |
Add TableKind enum, auto-detect format |
| faunus-rs | faunus/Cargo.toml |
Update icotable dependency |
# icotable
cd ~/github/icotable && cargo test
# duello (after icotable changes)
cd ~/github/duello && cargo test
# faunus-rs (after icotable changes)
cd ~/github/faunus-rs && cargo test