moleculekit.openmmtools module#

moleculekit.openmmtools.minimize_soft_potential(mol, mobile_atom_indices, max_iterations=200)#

Run a soft-potential energy minimization on selected atoms.

All other atoms are frozen (mass = 0). Uses a soft repulsive CustomNonbondedForce so overlapping atoms are gently pushed apart rather than exploding. Only interactions involving at least one mobile atom are computed.

Harmonic bond and angle restraints are added for bonds in mol.bonds involving at least one mobile atom; equilibrium values are taken from the current coordinates. This keeps bond lengths and angles close to their starting geometry so the minimization resolves clashes by rotating dihedrals rather than distorting covalent structure.

Parameters:
  • mol (Molecule) – The molecule to minimize (modified in place).

  • mobile_atom_indices (set or list of int) – Indices of atoms that are free to move.

  • max_iterations (int, optional) – Maximum number of minimization iterations. Default 200.

Returns:

True if minimization was performed, False if OpenMM is unavailable.

Return type:

bool

moleculekit.openmmtools.openmm_to_molecule(topology, positions)#