Sample Parameters Configuration¶
Source code:
bff/workflows/sample_parameters/config.pybff/workflows/sample_parameters/main.pybff/workflows/_shared/campaign.py
Purpose¶
bff sample-parameters draws parameter vectors, stages a sampled FFMD campaign, and runs
the corresponding GROMACS jobs.
Minimal Example¶
campaign_dir: ./
source: ../01-build
systems:
- system_id: acetate
n_steps: 1000
bounds:
charge C2: [0.0, 1.0]
charge O1 O2: [-0.8, -0.3]
charge_constraints:
- selection: "resname ACE"
target: -0.8
scope: residue
implicit: "charge C2"
n_samples: 10
gmx_cmd: gmx
job_scheduler: local
Top-Level Keys¶
campaign_dirOutput directory for sampled topologies, metadata, and trajectories.systemsNon-empty list of exact build-system IDs plus system-specific MD lengths, or systems with fully explicitinputsmappings.sourceBuild stage root containingsystems/<system_id>/. Do not combine this with direct per-system inputs.boundsMapping from parameter label to lower and upper bounds.charge_constraintsCharge equations compiled from MDAnalysis selections. Each constraint definesselection,target,scope, and a distinct boundedimplicitparameter.n_samplesNumber of force-field vectors sampled for the campaign.gmx_cmdGROMACS executable.job_schedulerEitherlocalorslurm.dispatchIftrue, launch jobs immediately after staging them.compressIftrue, compress finished simulation outputs.cleanupIftrue, prune each system result directory to the extensions listed instoreand delete the campaign-leveloutputs/directory after successful collection. Iffalse, retain every generated system file andoutputs/.storeFile extensions to retain, without leading dots. Defaults to['xtc']. Files such as Colvarsproduction.pmfthat are created in the job working directory are assigned to the system that produced them and moved undersamples/<sample_id>/<system_id>/.slurmSlurm-only runtime settings.
systems[] Keys¶
system_idStable ID used for all paths and metadata matching.inputsWithoutsource, explicit rolestopology,coordinates,index,mdp_production, optionalmdp_em, and optionalbias.n_stepsProduction MD length for this prepared system within the sampled campaign.
When a system carries a Colvars bias, BFF copies the bias file into each
samples/<sample_id>/<system_id>/ run directory and writes a
production-colvars.mdp. Its colvars-configfile value is generated relative
to the actual GROMACS working directory, so users do not need to edit paths for
local or Slurm campaigns.
charge_constraints[] Keys¶
selectionMDAnalysis atom selection. Selections must be disjoint or strictly nested; partial overlaps are rejected.targetRequired total charge for the selected group.scopeEithersystemfor one complete-system sum orresidueto apply the target independently to each selected residue.implicitParameter reconstructed to satisfy this equation. It must exist inbounds, belong to this selection, and not occur in a descendant selection.
Nested constraints are reconstructed from the smallest selected groups outward.
Parameter Labels¶
The bounds keys determine which GROMACS force-field parameters are sampled
and subsequently learned. BFF currently supports:
| Parameter | Label syntax | Example | GROMACS quantity |
|---|---|---|---|
| Partial charge | charge <name-or-type> [<name-or-type> ...] |
charge O1 O2 |
Atomic charge |
| Lennard-Jones sigma | sigma <atom-type> [<atom-type> ...] |
sigma OW |
LJ sigma |
| Lennard-Jones epsilon | epsilon <atom-type> [<atom-type> ...] |
epsilon OW |
LJ epsilon |
| Function-9 dihedral force constant | dihedraltype9_<multiplicity>_<phase> |
dihedraltype9_3_180 |
Periodic-dihedral force constant |
Values use the native units of the GROMACS topology: elementary charge for partial charges, nm for sigma, kJ mol^-1 for epsilon, degrees for the dihedral phase, and kJ mol^-1 for the dihedral force constant.
Charges¶
Charge labels resolve each token by atom name first and fall back to atom type when no atom has that name. Multiple tokens in one label tie all matching atoms to one sampled value:
bounds:
charge O1 O2: [-0.8, -0.3]
charge HW: [0.1, 0.6]
Here, O1 and O2 share one charge parameter. If there is no atom named
HW, all atoms of type HW share the second parameter. Charge labels must not
overlap: one topology atom cannot be controlled by two entries in bounds.
Charge parameters may participate in the hierarchical charge_constraints
described above. Parameters of the other supported families are sampled
directly.
Lennard-Jones Parameters¶
Sigma and epsilon labels address GROMACS atom types. Multiple atom types in one label tie those types to one sampled value:
bounds:
sigma OW: [0.25, 0.38]
epsilon OW: [0.58, 0.72]
sigma NA CL: [0.20, 0.45]
Function-9 Dihedrals¶
To sample a GROMACS function-9 dihedral force constant, use
dihedraltype9_<multiplicity>_<phase>:
bounds:
dihedraltype9_3_180: [0.0, 10.0]
This updates the force constant of every matching function-9 dihedral term in the topology while preserving its multiplicity and phase. If the topology has several function-9 terms with the same multiplicity and phase, the label ties all of them to the same sampled value.
Outputs¶
bff sample-parameters writes:
campaign_dir/specs.yamlcampaign_dir/samples.yamlcampaign_dir/systems/<system_id>/campaign_dir/samples/<sample_id>/<system_id>/campaign_dir/outputs/<sample_id>/- per-sample modified topologies
- stored trajectories and energy files
Each samples/<sample_id>/ contains the available config.yaml, run.sh, and
Slurm run.out, alongside one directory per system. Non-trajectory files are
recorded by extension under each samples.yaml output's inputs mapping; for
example, store: [xtc, pmf] creates inputs.pmf for systems that produced a
PMF.
outputs/<sample_id>/ is the live job working area containing gmx.log and
other operational files. With cleanup: false it is retained, and every file
generated under the system result directories is also retained. With
cleanup: true, system directories retain only requested extensions and the
entire outputs/ tree is deleted after the sample job files have been copied
to samples/<sample_id>/.