Samplers
Samplers explore configuration space and decide whether a structure should be
sent to QM labeling. In most ALF workflows, the sampler receives a
MoleculesObject from the builder, evaluates it with an ensemble ML
calculator, and returns either a selected high-uncertainty configuration or a
marker that no QM calculation is needed.
In a master configuration, the selected sampler is specified with the
sampler_task import string:
{
"sampler_task": "alframework.samplers.mlmd_sampling.simple_mlmd_sampling_task",
"sampler_config_path": "mlmd_config.json"
}
Sampler tasks usually run on the alf_sampler_executor Parsl executor. GPU
assignment is controlled by gpus_per_node in the master configuration and
the worker layout in the Parsl resource configuration.
Supported Sampler Tasks
Sampler task |
What it does |
Typical use |
|---|---|---|
|
Runs Langevin molecular dynamics with an ensemble ML calculator, monitors energy and force uncertainty, and returns configurations that exceed uncertainty or distance criteria. |
General active-learning loops based on MD exploration. |
|
Runs MLMD with an uncertainty-driven dynamics bias that steers trajectories toward high ensemble energy uncertainty while retaining the usual QM-selection threshold checks. |
Exploration runs where biasing MD toward model disagreement is desired. |
|
Uses NEB and/or dimer-style searches from reaction metadata, monitors ensemble uncertainty along reaction pathways, and returns uncertain structures for QM labeling. |
Reaction-pathway active learning with reactant, transition-state, and product structures. |
Common Configuration Fields
- MLMD dynamics fields
These fields control the length and cadence of MD sampling.
Field
Meaning
dtMD timestep in femtoseconds.
maxtMaximum simulation time in picoseconds.
NcheckNumber of MD steps between uncertainty checks.
min_timeOptional minimum simulation time before uncertainty checks can select a structure.
distcutMinimum allowed interatomic distance. Structures can be rejected if atoms come too close.
- Uncertainty thresholds
These fields decide when a sampled configuration should be sent to QM.
Field
Meaning
EscutEnergy standard-deviation threshold.
FscutMean force standard-deviation threshold.
forces_stdev_maxThe MLMD sampler also checks the maximum per-force uncertainty using an internal threshold of
3 * Fscut.- Temperature schedule fields
The sampler randomly chooses temperature schedule parameters from configured ranges for each task.
Field
Meaning
srt_tempRange for the starting temperature.
end_tempRange for the ending temperature.
amp_tempRange for sinusoidal temperature fluctuation amplitude.
per_tempRange for temperature fluctuation period.
- Density schedule fields
Density changes are optional. Use
nullforend_dens,amp_dens, andper_densto disable density changes.Field
Meaning
end_densTarget final density range.
nulldisables cell rescaling.amp_densRange for density fluctuation amplitude.
per_densRange for density fluctuation period.
- ML calculator fields
These fields control how sampler tasks load and wrap ML models. See How ALF Uses ML Interfaces and Adding New ML Architectures for the corresponding ML interface requirements.
Field
Meaning
ase_calculatorImport string for the ML calculator or model-loader function.
MLMD_calculator_optionsOptions passed to
MLMD_calculator, such aswell_params.translate_to_centerWhether to translate the incoming structure so its center of mass is near the origin before sampling.
- Uncertainty-driven dynamics
Uncertainty-driven dynamics (UDD) is a biased MLMD sampler that steers dynamics toward regions where the model committee has high ensemble energy uncertainty. The usual
EscutandFscutthreshold logic still decides whether a sampled configuration is returned for QM labeling.Select UDD in
master_config.jsonwith a separate sampler task:{ "sampler_task": "alframework.samplers.udd_sampling.simple_udd_sampling_task" }
Set the bias strength in the sampler config:
{ "udd_bias_weight": 0.45, "MLMD_calculator_options": { "well_params": null } }
udd_bias_weightcontrols the strength of the energy-uncertainty bias. Usesimple_mlmd_sampling_taskinstead when no UDD bias is desired.- Output and trajectory fields
These fields control sampler metadata and optional trajectory output.
Field
Meaning
meta_dirormeta_pathDirectory for sampler metadata files. Examples use both names; the task input builder maps compatible names to the sampler function.
trajectory_frequencyProbability of writing a trajectory for a sampling task.
trajectory_intervalMD-step interval for trajectory writes when trajectory output is enabled.
- Reactive sampler fields
These fields are used by
reactive_sampling.Field
Meaning
reactive_sampling_methodReactive search mode. Values containing
NEBrun NEB; values containingDIMERrun dimer sampling.N_nebNumber of intermediate NEB images.
max_iterMaximum number of repeated reactive-sampling attempts.
neb_stepsOptimizer steps for each NEB or dimer call.
Escut,FscutEnergy and force uncertainty thresholds.
FmmultMultiplier applied to
Fscutfor maximum force uncertainty. The default is3.0.
What The Sampler Returns
If uncertainty or another selection criterion triggers, the returned
MoleculesObject keeps its atoms. ALF then passes that structure to the QM
task queue for labeling.
If sampling completes without selecting a configuration, the sampler sets the
atoms to None on the returned MoleculesObject. ALF treats this as a
successful sampling attempt that does not need QM labeling.
Sampler metadata records the relevant diagnostics, including uncertainty
values, temperature and density schedule history, distance checks, selection
flags, final positions, and cell information. MLMD metadata is commonly written
to files such as sampling/metadata-<moleculeid>.p when meta_dir or a
compatible metadata path is configured.
Sampler API Links
You can link from this guide directly to API pages: