Simple Water
The simple water example is a compact ALF workflow for a small molecular (water) system. It is intended as the first example to copy and adapt when setting up a new ALF run. The example connects all major ALF stages:
Build initial water-containing structures (bootstrapping)
Label bootstrap structures with QM engine (ORCA)
Train an initial HIPPYNN ensemble from the labeled data.
Sample new structures with ML-driven molecular dynamics.
Send selected high-uncertainty configurations to ORCA for QM labeling.
Store labeled data in HDF5 files.
Retrain a HIPPYNN ensemble once the number of high-uncertainty configurations exceeds
save_h5_threshold.
The files needed to run the example are located in examples/simple_water.
A cluster of randomly placed water molecules created by the Builder.
Before You Run
Configuration files must be modified in order to run the example on your available compute.
orca_config.jsoncontains an ORCA executable path. ReplaceQM_run_commandwith the ORCA command available on your machine.master_config.jsonpoints to a Parsl configuration namedparsl_configs.config_1node. Editexamples/simple_water/parsl_configs.pyor pointparsl_configurationto a different resource config for your cluster. This file is a placeholder template for Parsl executor, Slurm partition, account, QoS, walltime, module, launcher, and worker-count settings; it is not a ready-to-run cluster configuration.CPU-only resources and GPU ML/sampling resources should usually be configured separately. In the template, ORCA/QM tasks use
alf_QM_executorwhile HIPPYNN training and MLMD sampling usealf_ML_executorandalf_sampler_executor.HIPPYNN and its ML dependencies must be installed if you run ML training or sampling. See Common Configuration Fields for the ML task and sampler calculator settings. The builder and QM test modes can be used separately while bringing up the environment.
Paths such as
h5store/,models/,sampling/, andorca_scratch/are run outputs. Use a clean working directory or archive old output before starting a new production run.
See Parsl And HPC Execution for details on how Parsl resource configuration maps ALF tasks onto local or HPC resources.
Workflow Pattern
- Builder stage
simple_condensed_phase_builder_taskreadsbuilder_config.jsonand creates clusters of water molecules using the fragment library. In this example, the only fragment isfragment_library/water.xyz.- Sampler stage
simple_mlmd_sampling_taskreadsmlmd_config.jsonand drives MLMD using a HIPPYNN ensemble. Configurations are selected for QM if energy or force uncertainty exceeds the configured cutoffs.- QM stage
orca_calculator_taskreadsorca_config.json, writes ORCA input files, runs ORCA, parses requested properties, and returns a labeledMoleculesObject.- ML stage
train_HIPPYNN_ensemble_taskreadshippynn_config.jsonand trains a HIPPYNN model ensemble from the HDF5 data written by ALF. See ML Interfaces for the general ML interface pattern.
Recommended Bring-Up Commands
Run the stages one at a time before starting a full active-learning loop. From
the examples/simple_water directory:
python -m alframework --master master_config.json --test_builder
python -m alframework --master master_config.json --test_qm
python -m alframework --master master_config.json --test_ml
python -m alframework --master master_config.json --test_sampler
The test modes use parsl_debug_configuration when it is provided in the
master config. This lets you keep a smaller, faster Parsl configuration for
environment checks.
After the individual stages work, start the active-learning loop:
python -m alframework --master master_config.json
ALF writes status.txt and then continues running the active-learning loop,
periodically printing queue status for builder, sampler, QM, and ML tasks.
Batched Builder Variant
After the base simple water example is working, the next example to try is the
batched-builder variant in examples/simple_water_multi_builder. It builds
the same kind of condensed-phase water boxes with the same sampler, QM, ML, and
ORCA scratch settings, but changes the builder task and how many initial
structures each builder task returns.
The base examples/simple_water run uses
simple_condensed_phase_builder_task. Each builder task returns one generated
water box, and ALF sends that structure to one sampler task.
The examples/simple_water_multi_builder run uses
simple_multi_condensed_phase_builder_task. Each builder task returns a list
of generated water boxes, and ALF starts a sampler task for each structure in
that list. In the provided config, maximum_builder_structures is set to
5, so each builder task creates five independent initial candidates.
To run the batched variant, use the same staged bring-up commands from the
examples/simple_water_multi_builder directory:
python -m alframework --master master_config.json --test_builder
python -m alframework --master master_config.json --test_qm
python -m alframework --master master_config.json --test_ml
python -m alframework --master master_config.json --test_sampler
python -m alframework --master master_config.json
This variant is useful when builder overhead is significant or when you want a single builder submission to feed multiple sampler tasks. It does not change the chemical system being built or the ORCA scratch directory; it only changes the builder task throughput.
Expected Outputs
During staged checks and full runs, expect these files and directories:
Path |
Purpose |
|---|---|
|
Restart and progress state, including current model/data ids and failed task counters. |
|
Stored labeled data batches from converged QM results. |
|
Directories containing trained HIPPYNN ensembles. |
|
Per-sampling-task metadata, including uncertainty, temperature, density, and final structure information. |
|
QM scratch directory containing per-molecule ORCA run directories. |
|
Optional plots created by the configured plotting utility. |
Master Configuration
master_config.json connects the stages and controls the active-learning
loop.
Field |
Meaning |
|---|---|
|
Base directory for relative paths. |
|
Paths to the builder, sampler, QM, and ML JSON files. |
|
Import strings for the Python task functions ALF will submit through Parsl. |
|
Maps ALF result names to HDF5 dataset names, property scope, and unit conversion factor. See Units And Property Conversion for how these multipliers are applied. |
|
Output pattern for stored training data, such as
|
|
Output pattern for trained models, such as |
|
Queue thresholds controlling when ALF launches QM tasks and stores new labeled data. |
|
Target number of builder/sampler candidates ALF tries to keep active. This is a queue-depth target, not the number of GPUs or nodes requested. |
|
Number of initial QM labels to collect before the first model training. |
|
Import string for the production Parsl config. |
|
Import string for the smaller config used by stage test modes. |
|
Directory for QM input, output, and scratch subdirectories. |
Queue Depth And Resource Concurrency
target_queued_QM controls how much QM work ALF tries to keep queued, but
it does not by itself request more CPU nodes. During bootstrap, ALF first has
to generate structures with the builder; parallel_samplers controls how
many builder/sampler candidates ALF tries to keep active. The QM executor in
parsl_configs.py then controls how many queued QM tasks can actually run,
through settings such as max_blocks, nodes_per_block, and
max_workers_per_node.
For example, if the QM executor uses nodes_per_block=1,
max_blocks=10, and max_workers_per_node=1, Parsl may request up to ten
one-node QM allocations. ALF will only fill those allocations if enough
structures have been generated and enough QM tasks are queued. Likewise,
gpus_per_node tells ALF how sampler workers map onto GPUs, while the
sampler executor’s worker and block settings determine how many sampler tasks
can run at once.
Builder Configuration
builder_config.json controls initial structure construction.
Field |
Meaning |
|---|---|
|
Directory containing fragment files, relative to the example directory. |
|
Fragment combinations that may be placed as solutes. The water example uses one water molecule. |
|
Solvent fragment names and sampling weights. |
|
Minimum and maximum box lengths for each cell direction. |
|
Density or packing range used by the condensed-phase builder. |
|
Minimum allowed distance between generated structures. |
|
Number of placement attempts before the builder gives up. |
|
Whether to center the first molecule, useful for solute-centered systems. |
|
Random coordinate perturbation applied to generated structures. |
Sampler Configuration
mlmd_config.json controls uncertainty-driven MD sampling.
Field |
Meaning |
|---|---|
|
MD timestep in femtoseconds and maximum simulation time in picoseconds. |
|
Energy and force uncertainty thresholds for selecting configurations for QM labeling. |
|
Number of MD steps between uncertainty checks. |
|
Ranges for starting and ending temperatures. |
|
Ranges for temperature fluctuation amplitude and period. |
|
Density target and fluctuation controls. |
|
Directory for sampler metadata files. |
|
Import string for the ML ensemble calculator loader. |
|
Extra calculator options, such as the soft wall potential. |
|
Controls optional trajectory writing during sampling. |
ORCA Configuration
orca_config.json controls QM labeling through ORCA.
Field |
Meaning |
|---|---|
|
ORCA executable or launch command. Replace this path for your system. |
|
CPU count passed to the ORCA interface when applicable. |
|
Optional shell environment file sourced before ORCA execution. |
|
ORCA method, basis, and job keywords. |
|
Additional ORCA input blocks, such as memory, SCF, and property blocks. |
|
Thresholds used by double-calculation checks when using the double ORCA task. |
HIPPYNN Configuration
hippynn_config.json controls model architecture, training, and data
filtering. The broader HIPPYNN and new-backend configuration pattern is
described in ML Interfaces.
Field |
Meaning |
|---|---|
|
Number of models in the ensemble. |
|
HDF5 dataset names used for training. |
|
HIPPYNN architecture settings, including species, feature counts, distance cutoffs, and layer counts. |
|
Relative weights for energy, force, and regularization losses. |
|
Fractions of data reserved for validation and test splits. |
|
Initial optimizer learning rate. |
|
Learning-rate scheduler behavior, such as patience and decay factor. |
|
Training loop options, including batch size, maximum epochs, and early termination patience. |
|
Device selection behavior for training tasks. |
|
Optional data filtering thresholds before training. |
Adapting The Example
For a new molecular system, start by replacing the fragment library and builder configuration. Then update the QM method and executable path. Once the builder and QM tests work, tune the sampler thresholds and ML architecture for the target chemistry. Finally, update the Parsl configuration so the QM, ML, and sampler tasks request resources that match the software and hardware used on your cluster.