Relax#
TMol provides a Rosetta-inspired pack/minimize schedule. Its scoring, search, and acceptance behavior are TMol-specific.
Packing and minimization protocols for structural relaxation.
- tmol.relax.accept_best(sfxn: ScoreFunction, best_pose_stack: PoseStack, best_pose_score: Tensor, candidate_pose_stack: PoseStack, verbose: bool = False) tuple[PoseStack, Tensor][source]#
Keep the lower-scoring conformation independently for each pose.
- Parameters:
sfxn – Score function used for comparison.
best_pose_stack – Best poses from previous repeats.
best_pose_score – Best scores shaped
[n_poses].candidate_pose_stack – Newly minimized poses.
verbose – Print accepted scores.
- Returns:
Updated best poses and scores shaped
[n_poses].
- tmol.relax.fast_relax(pose_stack: PoseStack, sfxn: ScoreFunction, packer_pallete: PackerPalette, move_map: MoveMap | CartesianMoveMap, fold_forest: FoldForest, *, task_operations: Sequence[Callable[[PackerTask], None]] | None = None, num_repeats: int = 2, ramp_constraints: bool | None = None, schedule: Sequence[float | int | dict[str, float]] | None = None, min_fn: RelaxMinimizer | None = None, cuda_graph: bool | None = None, verbose: bool = False) PoseStack[source]#
Relax poses through repeated side-chain packing and minimization.
Each repeat applies the MonomerRelax2019 fa_rep ramp and retains the lowest-scoring conformation independently for every pose in the batch.
- Parameters:
pose_stack – Input poses to relax.
sfxn – Packing and minimization score function. Constraints are active only when its constraint weight is nonzero.
packer_pallete – Residue types available to the packer.
move_map – Specifies which DOFs are free to move during minimization.
fold_forest – Fold forest defining the kinematic connectivity.
task_operations – In-place task configuration callbacks. By default, restrict to repacking with Dunbrack, fixed-AA, and current rotamers.
num_repeats – Number of complete pack-minimize ramps.
ramp_constraints – Ramp an active constraint weight to zero. Defaults to true; the input weight is restored after relaxation.
schedule – Numeric fa_rep fractions or dictionaries with separate pack, minimize, and optional constraint fractions. Defaults to
DEFAULT_RELAX_SCHEDULE.min_fn – Minimizer called with the pose, score function, fold forest, move map, and verbosity. Defaults to Cartesian minimization.
cuda_graph – Capture the default Cartesian minimizer’s repeated CUDA scoring path. By default, enable it automatically for CUDA poses containing DNA or RNA, where launch overhead dominates. Pass
Falseto disable it. It cannot be combined with a custommin_fn.verbose – Print timing information for each step.
- Returns:
Best-scoring relaxed poses across all repeats.
- tmol.relax.relax_pack_min_step(pose_stack: PoseStack, sfxn: ScoreFunction, fold_forest: FoldForest, move_map: MoveMap | CartesianMoveMap, packer_pallete: PackerPalette, fa_rep_pack_weight: float, fa_rep_min_weight: float, cst_weight: float, task_operations: Sequence[Callable[[PackerTask], None]], min_fn: RelaxMinimizer, verbose: bool) PoseStack[source]#
Execute one weighted packing and minimization stage.
- Parameters:
pose_stack – Current poses.
sfxn – Score function whose repulsive and constraint weights are updated.
fold_forest – Connectivity passed to the minimizer.
move_map – Movable degrees of freedom passed to the minimizer.
packer_pallete – Residue types available during packing.
fa_rep_pack_weight – Repulsive weight for packing.
fa_rep_min_weight – Repulsive weight for minimization.
cst_weight – Constraint weight for both operations.
task_operations – In-place task configuration callbacks.
min_fn – Minimization callable.
verbose – Print synchronized stage timings.
- Returns:
The minimized pose stack.