schrodinger.application.peptide_workflow.monte module¶
- class schrodinger.application.peptide_workflow.monte.MonteOptions(CACHE_SIZE: int = 10, SWAP_INTERVAL: int = 1000, LOCAL_MINIMIZATION_INTERVAL: int = 100, NO_IMPROVE_STOP_STEP: int = 300000, NO_IMPROVE_HEAT_INTERVAL: int = 700, DEFAULT_MOVE_AMPLITUDE: float = 0.2, TEMP_KELVIN: float = 298.0, CHECKPOINT_INTERVAL: int = 10000)¶
Bases:
objectOptions for monte so that args are not passed directly.
- CACHE_SIZE: int = 10¶
- SWAP_INTERVAL: int = 1000¶
- LOCAL_MINIMIZATION_INTERVAL: int = 100¶
- NO_IMPROVE_STOP_STEP: int = 300000¶
- NO_IMPROVE_HEAT_INTERVAL: int = 700¶
- DEFAULT_MOVE_AMPLITUDE: float = 0.2¶
- TEMP_KELVIN: float = 298.0¶
- CHECKPOINT_INTERVAL: int = 10000¶
- classmethod fromArgs(args)¶
Creates an instance from arguments.
- Parameters:
args (argparse.Namespace) – job settings
- __init__(CACHE_SIZE: int = 10, SWAP_INTERVAL: int = 1000, LOCAL_MINIMIZATION_INTERVAL: int = 100, NO_IMPROVE_STOP_STEP: int = 300000, NO_IMPROVE_HEAT_INTERVAL: int = 700, DEFAULT_MOVE_AMPLITUDE: float = 0.2, TEMP_KELVIN: float = 298.0, CHECKPOINT_INTERVAL: int = 10000) None¶
- schrodinger.application.peptide_workflow.monte.update_peptide_cache(peptide, cache_list, cache_size, cluster_method)¶
Update the clustered cache_list if a move is accepted :param peptide: incoming peptide :type peptide: Peptide :param cache_list: the clustered cached peptides in the run :type cache_list: [Peptide] :param cache_size: size of the cache list :type cache_size: int :param cluster_method: method used to cluster the peptide :type cluster_method: BasicCluster :return: Whether the cache is updated :rtype: bool
- class schrodinger.application.peptide_workflow.monte.StepCounters(step: int = 0, last_update: int = 0, last_best: int = 0, last_heat: int = 0, last_checkpoint: int = 0)¶
Bases:
objectStep indices persisted in the checkpoint for exact state recovery.
- step: int = 0¶
- last_update: int = 0¶
- last_best: int = 0¶
- last_heat: int = 0¶
- last_checkpoint: int = 0¶
- __init__(step: int = 0, last_update: int = 0, last_best: int = 0, last_heat: int = 0, last_checkpoint: int = 0) None¶
- schrodinger.application.peptide_workflow.monte.save_checkpoint(cache_list, checkpoint_file, counters)¶
Atomically write the cache pool to a checkpoint file.
Each cached peptide’s structure is written with its energy and original title stored as structure properties so they can be restored on load. Step counters are stored on the first structure so the simulation can resume with the exact same state.
- Parameters:
cache_list (list[Peptide]) – the cached peptides from the MC run
checkpoint_file (str) – path to write the checkpoint
counters (StepCounters) – step counters to persist
- schrodinger.application.peptide_workflow.monte.load_checkpoint(checkpoint_file)¶
Restore a cache pool from a checkpoint file.
- Parameters:
checkpoint_file (str) – path to read the checkpoint from
- Return type:
tuple[list[Peptide], StepCounters]
- Returns:
reconstructed cache list and step counters
- schrodinger.application.peptide_workflow.monte.monte(peptide, mover, minimizer, cluster_method, random_seed, monte_options, maxsteps=500000, checkpoint_file=None)¶
Run MC with input mover and minimizer.
- Parameters:
peptide (Peptide) – input peptide
mover (PeptideMovements) – movement sampler to be used
cluster_method (BasicCluster) – method to cluster the poses
minimizer (PeptideMinimizer) – minimizer to be used
random_seed (int) – random seed to create random generator
monte_options (monte options class obj) – contains constants for monte
maxsteps (int) – maximum steps for the simulation
checkpoint_file (str or None) – path for checkpoint save/restore; when provided the cache pool is periodically written here and restored on restart
- schrodinger.application.peptide_workflow.monte.simulated_annealing(curr_temperature, curr_step, last_heat_step, temperature, no_improve_heat_interval)¶
Set the appropriate temperature given the current step and temperature
- Parameters:
curr_temperature (float) – Current temperature of the simulation
curr_step (int) – Current step of the simulation
last_heat_step (int) – Last time we reset or heat the temperature
temperature (float) – Baseline simulation temperature
no_improve_heat_interval (int) – interval to increase temperature
- schrodinger.application.peptide_workflow.monte.sort_write_to_output(cache_list, writer)¶
Sort the clustered results and write to the output
- Parameters:
cache_list ([Peptide]) – the clustered cached peptides in the run
writer (StructureWriter) – structure writer
- schrodinger.application.peptide_workflow.monte.metropolis(new_energy, old_energy, temp, random_generator)¶
Metropolis MC
- Parameters:
new_energy (float) – the energy after the move
old_energy (float) – the energy before the move
temp (float) – the current simulation temperature
random_generator (numpy.random.default_rng object) – random number generator object