Changelog¶
The public reproduction snapshot for the published study is archived as
v0.0.1.
Use that tag for exact reproduction of the paper results. The current workflow
release is 0.5.2.
0.5.2 - 2026-11-10¶
Fixed¶
buildaveraged the NpT box incorrectly: MDAnalysis reuses one box array for every frame, so the "average" over the last 80 % of the.xtcwas the box of a single frame. The box is now the true average, and the last frame is rescaled to it before it is written tosystems/<system_id>/coordinates.gro: every molecule moves with its center of mass, its geometry unchanged. Before, the coordinates of the last frame were written with a different box, leaving a gap or an overlap at the periodic boundary.- Figure text scales with the panel size (7-13 pt) instead of a fixed 15 pt,
which was unreadable on small corner plots.
plot_cornermakes a figure about 7 in wide by default (figsize=None: panels of 1.3-2.5 in), takes afontsizefor the axis labels, writes each diagonal title on one line as the median with the distances to the outer quantiles, rotates the bottom-row tick labels and keeps ticks off the panel edges, where labels of neighbouring panels collided. The parameter names are the bottom-row axis labels and no longer repeat in the titles. In the marginal plots, rotated tick labels are anchored at their end so that neighbours no longer overlap.
0.5.1 - 2026-10-14¶
Added¶
sample-parameterswithresume: trueand a largern_samplesappends the missing samples to the staged campaign instead of ignoring the new value. The extra samples form a new Latin hypercube of their own and continue the sample IDs; existing samples and their results are untouched.
Fixed¶
- A
define <DIRECTIVE>parameter that no configured topology contains (for exampledefine VSAagainst a topology whose directive isVSAIN) was silently ignored, so a validation ran with the wrong geometry.validateandsample-parametersnow stop with an error naming the parameter.
0.5.0 - 2026-10-09¶
Changed¶
- BFF pins
gmxtopology==0.3.0, so upgradingbfflearnalso upgradesgmxtopology. Topologies are read with their conditional blocks evaluated, bonded parameters are matched on bonded atom types, and written topologies keep only the molecule types, atom types and CMAP grids of the system. - Examples are streamlined. The acetate example has one directory per stage,
named after its command (
01-build,02-reference-md,03-sample-parameters,04-build-qoi-datasets,05-fit-lgp,06-learn,07-validate), each holding oneconfig.yaml; the oldconfigs/directory and its copy step are gone. It has two systems:acetate(QoI: acetate-water RDFs) andcalcium-acetate, whose Ca-C2 distance is biased by Colvars metadynamics (inputs/colvars.dat) and whose PMF is a QoI read by the custom file routineinputs/pmf.pyand compared with an MLIP reference PMF (02-reference-md/calcium-acetate.pmf). The sampling config runs locally and carries the Slurm settings as a commented block. The CP2K inputs of the labeling script (revPBE0-D3 only) are in02-reference-md/cp2k/. The two acetate notebooks are merged into06-learn/posterior.ipynb, and the arbitrary-data and neon notebooks are shortened.LGPCommittee.n_effis inferred from the reference curve when the committee is created. fit-lgpalways runs on the CPU in float64 (fit.deviceis removed) and the hyperparameter search uses L-BFGS-B with autograd gradients inside box bounds derived from the priors, with up to two restarts from prior draws.fit.lris removed;fit.max_iter(default500) andfit.tol_grad(default1e-4, largest gradient component) control the search. On the acetate data it needs 8-25 iterations instead of the former 10,000 steps. The Laplace covariance of committees floors non-positive curvatures. Model files hold CPU tensors and load on any machine (including models fitted on a GPU by earlier versions);bff learnmoves them once tomcmc.device, which now defaults toauto(cudaif available). The sampling loop no longer synchronizes with the host:Specs,Priors, the likelihood, and the accept step run on the device.gaussian_kernelalways uses explicit differences (nocdistswitch),LocalGaussianProcesshas nodeviceargument (use.to(device, dtype)), andfit_surrogateshas nodeviceargument.log_posteriorno longer takesdevice.- MCMC convergence uses one diagnostic,
bff.mcmc.convergence.diagnose: rank-normalized split R-hat plus bulk and tail effective sample sizes from the pooled multi-walker autocovariance (Geyer truncation), for every parameter and the log probability. Sampling stops whenrhat_tolandess_minare met at two consecutive checks;ess_minnow defaults to400.Results.diagnostics()reports the same quantities (rhat,ess_bulk,ess_tail; no autocorrelation time) andResults.info["mcmc"]storesmax_rhatandmin_ess.ConvergenceInfoand the autocorrelation helpers are removed; older checkpoints cannot be resumed. learnwrites one self-containedoutputs/results.pt(prior, posterior chain, specifications, QoI information, per-QoI likelihoods) instead ofposterior.ptplusprior.pt, andbff.ResultsreplacesPosteriorResults. It providessamplesin physical units,map(the state of highest log posterior),summary(),diagnostics(),draw(), and the plot methods. Samples are no longer stripped of outliers, and nuisance columns are namednoise <qoi>.validategainsposterior.include_map. Plot functions take only aResultsand return the figure. In Python,LearningProblem(constraint=...)isspecs=..., andfn_posterior/fn_priorsisfn_results. Checkpoints and posterior files of earlier versions cannot be read; rerunbff learn.-
Specsis the single parameter specification (bounds,names,explicit_names,implicit_names,complete,is_valid,violations).latin_hypercube(specs, n, seed)replacesRandomParamsGenerator. -
learninfers each QoI's effective number of observations from the correlation length of its reference curve (Satterthwaite degrees of freedom; scalars count once per value) instead of the peak-counting heuristic.models.<name>.toleranceis now the accepted deviation from the reference in the QoI's units and adds to the likelihood variance (sigma^2 + tolerance^2); it defaults to0.bff.bayes.effective_observationsprovideseffective_observations,curve_n_eff, andcorrelation_length. - Surrogates and datasets use common Gaussian-process names.
QoIDataset:X,y,y_ref(wereinputs,outputs,outputs_ref).LocalGaussianProcess:mean,lengthscales,amplitude,noise_variance(werey_mean,lengths,width,sigma;sigmawas always a variance),n_inputs,n_outputs.LGPCommittee:members,y_ref,test_error,n_members(werelgps,reference_values,error,size).fit_surrogates(y_means=...)is nowmeans=.... - Surrogate means:
meandefaults todata(the average training output per value) instead of0; it also accepts a number,sigmoid, or a custompath.py:function/module:function. The RDF sigmoid is centred where each reference RDF first reaches 0.5 instead of at a fixed 3 angstrom. Custom means are saved in models by reference. A saved model is reused only when both its dataset and its mean are unchanged; otherwise it is refitted. - Charge constraints:
implicitnames an atom (name or type) of exactly onecharge ...parameter inboundsinstead of the parameter label. Each constraint is one linear equation, and all implicit charges are solved together; the rules for nested, non-overlapping constraints and their ordering are gone. - Campaign artifacts: one
campaign.yamlholds the job settings shared by all samples (jobs run asbff md campaign.yaml <sample_id>) instead of aconfig.yamlper sample.samples.yamlnames its parameter columns (parameter_names), listssystemswith theirn_steps, and records each sample's outputs per system by role, including the sample's owntopology, whichcleanupnow always keeps. YAML is read and written with libyaml when available. build-qoi-datasetsanalyzes each sample with its own topology, so routines see the sampled charges. A sample with missing files, a failing trajectory or routine, or mismatching QoIs is skipped with a warning instead of stopping the stage. In-memory trajectories that would not fit in the available memory are read from disk. Datasets recordsample_idsandparameter_names; fitted models keep the parameter names, andlearnrejects models fitted to other parameters than itsspecs.yaml.- Stage logs share one layout: the stage title,
Configand one line per input or setting,<step>: Done. | ...lines, warnings, and a final<Stage>: Done. | summary | time | output. Progress lines are shown on the console only. sample-parametersandvalidateshare one campaign flow: both writespecs.yamlinto the campaign, check every parameter sample against the bounds before staging, list all samples insamples.yamlfrom the start, record the parameter source undersamples.yamlprovenance, and log the same parameter summary. New options:resume(continue a campaign, running only samples not yet completed),overwrite,local.max_parallel_jobs(parallel local samples), andseedforsample-parameters(a fresh seed is drawn and recorded otherwise).- Charge-constraint compilation moved to
bff.domain.charge_constraints(compile_specs,check_specs_topologies). - All stage configurations are read by one shared reader with the same rules:
unknown keys are errors,
nullmeans "use the default", integers must be whole numbers, numbers must be finite (exponent strings such as1e-3are accepted), booleans must betrue/false, and every error names the full key path. Values are now range-checked consistently: for examplensteps.prod >= 1,boundswithlower < upper,mcmc.rhat_tol > 1,mcmc.priors_disttypeinnormal/uniform,fit-lgpmeana number orsigmoid, and devicescpu,cuda[:N], ormps. - The configuration reference lists every option of every stage with type, default, and meaning, plus a new conventions page.
charge_constraints(sample-parameters),fit(fit-lgp), andmcmc(learn) may be omitted to use their defaults.- Simulation campaigns can run GROMACS in a node-local
scratch_dirand copy results back, and on Slurm stop production runs cleanly beforesbatch.time(mdrun -maxh). Withmax_restarts, samples stopped by the time limit are resubmitted and continue from their checkpoints. - The production step count is written into a generated
production-run.mdp(which replacesproduction-colvars.mdp) instead of being passed asmdrun -nsteps. - Built-in
rdfandhydrogen_bondsroutines now use the same interface as custom routines and validate their own options when they run. Their outputs are unchanged; hydrogen-bond analysis is substantially faster. - Moved
bff.qoi.datatobff.qoi.datasetandbff.tools.get_unitcelltobff.qoi. Custom routines importQoI,get_unitcell, andselect_atomsfrombff.qoi. - Routines are called as
routine(universe, *, frames, options)orroutine(*, inputs, options);system_idandsample_idare no longer passed. - Moved surrogate fitting (
fit_surrogates, MAP search) tobff.bayes.fit;bff.bayes.learningholds posterior learning only. - Simulation campaigns (
sample-parameters,validate) run on Slurm as job arrays of onerun.shinstead of one submission per job.slurm.max_parallel_jobslimits running tasks; the newslurm.max_array_size(default 1000) splits large campaigns into consecutive arrays. - Campaign jobs write directly to
samples/<sample_id>/; theoutputs/working directory is gone. GROMACS runs inside each system's run directory, somdout.mdpand bias outputs no longer land in input directories. - A sample whose MD fails no longer aborts a local campaign; it is recorded
as
failed, as on Slurm. sample-parametersdraws all samples from one Latin hypercube instead of drawing them one at a time, so samples now fill the parameter space evenly.-
buildshares an equilibration only between systems with identical topology, templates, box, MDP files, and step counts. -
MCMC log-probabilities stay on the compute device (no per-step GPU-to-CPU copy), and local-GP predictions reuse a precomputed
K^-1 (y - mean)instead of multiplying by the inverse kernel each call. - A NaN parameter vector now gets
-inffor its own walker only. - The source distribution on PyPI no longer contains the tests (the wheel never did); they stay in the repository.
- Documentation is reorganized: a settings overview links every option group of every stage, How BFF Works replaces the architecture page (the package map moved to Development), and the README and docs state that BFF does not generate reference data.
slurm.sbatch.timemust be a quoted string; YAML reads an unquoted4:00:00as the number 14400.slurm.teardownalso runs after a failed task.build.systems[].boxaccepts only rectangular boxes, as molecule insertion always assumed.validate.posterior.seedmust be >= 0.- Errors of every stage are reported as one line naming the stage, instead of a usage message about the config argument.
Removed¶
- The top-level
data/directory of force-field, MDP, and water templates: provide your own inputs, for example fromexamples/acetate/inputs/. mcmc.include_implicit_charge,Bounds,ChargeConstraint,RandomParamsGenerator,Priorsfile I/O andfrom_any,sample_posterior, andprepare_samples.- Removed
models.<name>.n_effandmodels.<name>.independent_observationsfrom learn configs, andestimate_curve_n_eff. - Removed the build stage's per-system
system.yaml(no stage read it),build-qoi-datasets'qoi/raw.jsonwith itsoutput.write_rawoption, and itstraining_samples.progress_strideoption. - Removed the
project: <path>shorthand and the undocumented top-levelfn_logfrom build configs (useproject.directoryandproject.log), thekindkey of buildbiasmappings, and boolean or single-stringstorevalues.plots.max_marginal_samples: nullnow means the default; use-1for all samples. - Removed
bff label-snapshots, the hiddenlabel-snapshot-jobcommand, thebff.label_snapshotsandProject.label_snapshotsPython API, andbff.io.cp2k/bff.io.extxyz. BFF no longer runs CP2K; the reference MD is an external step documented in the new "Reference trajectories" page. The standalone, Slurm-onlyscripts/label_structures.pylabels foundation-model MD frames with CP2K for MLIP fine-tuning (train/valid/test EXTXYZ and isolated-atom energies keyed by atomic number). - Removed the
chargeandmultiplicitybuild keys and the matchingsystem.yamlfields; only CP2K labeling used them.
Fixed¶
- A campaign's final cleanup deleted the checkpoints of samples that were
still incomplete, so
resume: truehad to restart them from scratch; it now prunes only systems whose production run finished. A rerun no longer fails on the topology left by an attempt that never reached a checkpoint. - A Slurm task stopped by
SIGTERM(time limit,scancel) now lets the running mdrun checkpoint, copies its files back, and is recorded asincomplete, somax_restartscontinues it; before, the sample was lost asfailed. A sample whose job writes no result isfailedinstead of reusing a result from an earlier round, and local reruns append torun.outinstead of truncating it. - MDP files with inline comments (
nsteps = 500 ; 1 ps), indented comments, or_spellings of keys failed or were patched twice; MDP keys are now read the way GROMACS reads them. - Custom trajectory routines receive the universe positionally, as
documented, so its parameter may have any name. Samples whose QoI settings
(for example a grid) differ from the reference are skipped.
~is expanded in reference inputs and custom routine paths. Parallel analysis caps in-memory trajectories by the Slurm memory allocation, and a worker killed for lack of memory is reported with a hint. scripts/label_structures.py runcollected results while array tasks were still running, becausesbatch --waitreturned early; it now pollssqueueuntil the arrays leave the queue.bff learnresumes a checkpoint written on another device type (CPU vs. CUDA) instead of failing on the random-generator state.- A charge-constraint selection that fails reports the underlying error instead of calling the selection invalid.
fit-lgprefits a model file written by an older BFF version instead of stopping withreuse_models: true.build-qoi-datasetswrites its progress to the log every 100 samples and announces the start of the reference and of the sample analysis; a batch job's console shows the same lines instead of one per sample.mean: sigmoidno longer fails when the sigmoid values are built into the surrogate.- Running
sample-parametersorvalidateagain on an existing campaign no longer mixes newly drawn parameters with the old samples' trajectories; it is an error unlessresumeoroverwriteis set. - Validation campaigns in explicit
parametersmode now containspecs.yaml, sobuild-qoi-datasetscan analyze them. validaterejects parameter samples outside the bounds, unknown parameter names, and charge constraints that give a different equation in the validation systems before staging, instead of failing in every MD job.-
max_restartswithjob_scheduler: localis an error instead of being ignored. -
Campaigns started from a build directory (
source) no longer require the build'sproduction.xtc,npt.mdp, or a loadablesystem.yaml; only the files they use must exist. - A campaign sample is complete once its production run reaches
n_steps, read from the final checkpoint in the GROMACS log. Runs whose MDP writes no compressed trajectory, or whose trajectory is not stored, are no longer reported asincompleteand resubmitted. Aproduction.donemarker keeps finished systems from rerunning aftercleanupin a scratch directory. -
Samples whose campaign did not store a trajectory are usable by build-qoi-datasets when their routines only read stored files; a routine that needs a missing output fails before analysis with the sample, system, and missing role. A missing stored output file is reported per sample.
-
The learning-rate search no longer accepts runs that diverged to NaN.
- Walkers can be initialized from uniform priors without charge constraints.
ChargeConstraintobjects can be copied and pickled.- The adaptive proposal accumulates its covariance in float64, avoiding non-positive-definite proposals in long float32 runs.
- A transient
squeuefailure no longer counts submitted jobs as finished. - Trajectory completeness uses the configured
n_steps, so production MDP files withnsteps <= 0ornstxout-compressed = 0no longer mark every sample as failed or crash. - Element guessing keeps name-based elements for deuterium and repartitioned hydrogens instead of failing.
- Molecule insertion stops with an error instead of looping forever when the box is too small.
0.4.2 - 2026-10-02¶
Local Gaussian-process fitting now derives its default hyperparameter-prior centers from the input and residual target scales. This makes the defaults more robust for scalar QoIs and mixed parameter scales.
Posterior plotting now limits expensive KDE and QoI-attribution work to
deterministic subsets by default, evaluates QoI likelihood contributions in
adaptive batches, and exposes these limits through the plots section of the
learn configuration. Marginal plots report KDE modes, use more legible panel
layouts and legends, and support per-parameter labels for arbitrary define
parameters. Local validation campaigns now display progress immediately and
advance the count after each completed MD job, including single-sample runs.
0.4.1 - 2026-08-25¶
RDF selection handling and atom-type expansion moved into the QoI adapter, leaving the numerical kernel to operate directly on MDAnalysis AtomGroups. Dynamic selections and numerical behavior are preserved.
0.4.0 - 2026-08-24¶
The pipeline now uses semantic system IDs and explicit role-based manifests.
Snapshot extraction and CP2K labeling are unified under bff label-snapshots;
all molecular and isolated-atom CP2K inputs are supplied explicitly by users;
the remaining stages are named sample-parameters, build-qoi-datasets, and
fit-lgp. This is a breaking config change; follow the
pipeline migration guide.
Build systems now include stable virtual-site-free reference assets,
label-snapshots writes a detailed results manifest, and validation can draw
samples directly from outputs/posterior.pt. Learning copies the authoritative
parameter specification into its fixed outputs/ directory.
QoI analysis now parallelizes complete training samples, processes all systems
of a sample sequentially, and treats the reference through the same execution
path. Custom routines infer file-based execution from declared inputs rather
than a separate loader setting.
Static hydrogen-bond selections now reuse their donor topology and possible labels across frames, substantially reducing reference-analysis time. QoI dataset metadata is also guaranteed to remain acyclic during serialization.
Colvars-enabled sampling and validation jobs now rewrite
colvars-configfile relative to the GROMACS working directory, fixing missing
bias files in staged local and Slurm campaigns.
The numbered examples follow the new stage contract. The self-contained
notebooks use CUDA when available and otherwise fall back to CPU. pytest is
now installed through the dev extra instead of as a runtime dependency.
See the repository changelog for the complete list of breaking changes and fixes.
0.3.0 - 2026-06-11¶
Highlights¶
- Effective observation counts are now configured during
bff learnas explicit counts, independent scalar observations, or tolerance-derived curve features. - The Gaussian likelihood uses an
n_eff-weighted mean squared residual, so posterior width is not determined by arbitrary curve binning. bff learnwritesqoi-marginals.pdfto show which QoIs support different posterior regions.- Different QoIs may use different numbers of surrogate-training rows.
- Build templates are optional when a system does not need them, and the CLI
uses the single
bff <command>entry point. - User-defined analysis routines now work with multiprocessing workers.
pytestis included in the standard installation.
Warning
The learn configuration and .lgp model format changed in 0.3.0. Refit
models created by earlier releases and migrate path-only model entries to
the nested format documented in the
learn configuration.
0.2.1 - 2026-06-01¶
Fixed¶
- Restored Python 3.10 compatibility by replacing the Python 3.11-only
typing.Selfannotation in Gaussian-process model loading.
0.2.0 - 2026-06-01¶
Reference Points¶
The code history contains two useful paper-era comparison points:
- Earlier branches used ParmEd to parse and modify GROMACS topologies.
- The later public
v0.0.1snapshot had already moved to an intermediategmxtopparser together with MDAnalysis. - The current line uses
gmxtopologyand MDAnalysis selections.
Publication Snippet¶
Relative to the paper-era implementation, Bayesic Force Fields has been
refactored into a staged, configuration-driven workflow for system preparation,
reference-data generation, force-field sampling, surrogate fitting, posterior
learning, and validation. The refactor replaces the external emcee sampling
backend with an in-package Torch MCMC implementation, moves topology handling
away from the earlier ParmEd-based path, and adds reusable quantity-of-interest
datasets, local and Slurm execution, hierarchical charge constraints, broader
GROMACS topology updates, and notebook-first examples for externally generated
data.
Architecture Changes¶
| Area | Paper-Era Implementation | 0.2.0 |
|---|---|---|
| Posterior sampling | emcee.EnsembleSampler and its HDF backend |
Torch parallel Metropolis-Hastings sampler with adaptive proposals |
| Diagnostics | Autocorrelation handling through emcee results |
Checkpoints, restart support, split R-hat, autocorrelation time, and effective sample size |
| Topologies | ParmEd in earlier branches; intermediate gmxtop in v0.0.1 |
gmxtopology with MDAnalysis selections |
| Constraints | One molecular total charge and one implicit charge parameter | Hierarchical residue- or system-level constraints with compatibility checks |
| Data model | Monolithic training arrays and YAML sidecars | Reusable serialized QoIDataset objects |
| API | Broad workflow commands | Focused stages from build through validate |
Highlights¶
- Removed the runtime
emceedependency in favor of the Torch MCMC stack. - Replaced the earlier ParmEd topology path with GROMACS-native handling.
- Split monolithic structures and inference code into focused modules.
- Reconstructable
specs.yamlfiles and hierarchical charge constraints. - CP2K snapshot collection, bias inputs, and local or Slurm campaigns.
- Reusable quantity-of-interest datasets and notebook-first examples.
- More stable Gaussian-process fitting, posterior learning, and plotting.
- Function-9 GROMACS dihedral updates using labels such as
dihedraltype9_3_180.
The repository CHANGELOG.md keeps the complete grouped history.