mchammer.Optimizer

class mchammer.Optimizer(step_size, target_bond_length, num_steps, bond_epsilon=50, nonbond_epsilon=20, nonbond_sigma=1.2, nonbond_mu=3, beta=2, random_seed=1000)[source]

Bases: object

Optimize target bonds using MC algorithm.

A Metropolis MC algorithm is applied to perform rigid translations of the subunits separatred by the target bonds.

Methods

compute_potential

Compute the potential of a molecule.

get_result

Get final result of optimization run on mol.

get_trajectory

Get trajectory of optimization run on mol.

Parameters:
compute_potential(mol, bond_pair_ids)[source]

Compute the potential of a molecule.

Parameters:
Return type:

tuple[float, float]

get_result(mol, bond_pair_ids, subunits)[source]

Get final result of optimization run on mol.

Parameters:
  • mol (Molecule) – The molecule to be optimized.

  • bond_pair_ids (list) – iterable of tuple of ints Iterable of pairs of atom ids with bond between them to optimize.

  • subunits (dict) – The subunits of mol split by bonds defined by bond_pair_ids. Key is subunit identifier, Value is iterable of atom ids in subunit.

Returns:

The optimized molecule.

result:

The result of the final optimization step.

Return type:

mol

get_trajectory(mol, bond_pair_ids, subunits)[source]

Get trajectory of optimization run on mol.

Parameters:
  • mol (Molecule) – The molecule to be optimized.

  • bond_pair_ids (list[tuple]) – iterable of tuple of ints Iterable of pairs of atom ids with bond between them to optimize.

  • subunits (dict) – The subunits of mol split by bonds defined by bond_pair_ids. Key is subunit identifier, Value is iterable of atom ids in subunit.

Returns:

The optimized molecule.

result:

The result of the optimization including all steps.

Return type:

mol