htmd.adaptive.adaptive module#
- class htmd.adaptive.adaptive.AdaptiveBase#
Bases:
ABC,ProtocolInterfaceBase class for adaptive sampling strategies.
- Parameters:
app (
SimQueueobject, optional) – A SimQueue class object used to retrieve and submit simulations.project (str, optional) – The name of the project.
nmin (int, optional) – Minimum number of running simulations.
nmax (int, optional) – Maximum number of running simulations.
nepochs (int, optional) – Stop adaptive once we have reached this number of epochs.
nframes (int, optional) – Stop adaptive once we have simulated this number of aggregate simulation frames.
inputpath (str, optional) – The directory used to store input folders.
generatorspath (str, optional) – The directory containing the generators.
dryrun (bool, optional) – A dry run means that the adaptive will retrieve and generate a new epoch but not submit the simulations.
updateperiod (float, optional) – When set to a value other than 0, the adaptive will run synchronously every updateperiod seconds.
coorname (str, optional) – Name of the file containing the starting coordinates for the new simulations.
boxname (str, optional) – Name of the file containing the starting box dimensions for the new simulations. Set to ‘none’ to disable box writing.
lock (bool, optional) – Lock the folder while adaptive is ongoing.
mps (int, optional) – If mps > 0, it will run simulations using the Multi-Process Service (MPS) with the number of processes specified. If set to 0, mps is disabled.
- run()#
Run the adaptive sampling loop.
Starts the adaptive run, which iterates over epochs: retrieving completed simulations, running the selection algorithm, writing new inputs, and submitting them. When
updateperiodis greater than 0 the loop repeats synchronously at that interval; otherwise it runs a single epoch and returns.Examples
>>> adapt = AdaptiveMD() >>> adapt.run()
- htmd.adaptive.adaptive.epochSimIndexes(simlist: list) dict#
Find the simulation indexes for each epoch.
Creates a dictionary with the epoch number as key and values the simlist indexes of the simulations corresponding to the given epoch.
- htmd.adaptive.adaptive.getEpochFromName(name: str) int#
Return the epoch number for a given adaptive simulation name.
- htmd.adaptive.adaptive.reconstructAdaptiveTraj(simlist: ndarray, trajID: int) tuple#
Reconstruct a long trajectory out of short adaptive simulation runs.
Walks back through the parent chain of an adaptive trajectory identified by
trajIDand concatenates all ancestor trajectory segments into a single continuousMoleculeobject.- Parameters:
- Returns:
mol (
Molecule) – A Molecule object containing the full reconstructed trajectory.chain (list) – Tuples of
(sim, piece, frame)for all simulations involved in order.pathlist (list) – Trajectory file paths for all simulations involved, in order.
Examples
>>> mol, chain, pathlist = reconstructAdaptiveTraj(data.simlist, 52)