BioSimSpace.Align.merge#

BioSimSpace.Align.merge(molecule0, molecule1, mapping=None, allow_ring_breaking=False, allow_ring_size_change=False, force=False, property_map0={}, property_map1={})[source]#

Create a merged molecule from ‘molecule0’ and ‘molecule1’ based on the atom index ‘mapping’. The merged molecule can be used in single topology free-energy simulations.

Parameters:
  • molecule0 (Molecule) – A molecule object.

  • molecule1 (Molecule) – A second molecule object.

  • mapping (dict) – The mapping between matching atom indices in the two molecules. If no mapping is provided, then atoms in molecule0 will be mapped to those in molecule1 using “matchAtoms”, with “rmsdAlign” then used to align molecule0 to molecule1 based on the resulting mapping.

  • allow_ring_breaking (bool) – Whether to allow the opening/closing of rings during a merge.

  • allow_ring_size_change (bool) – Whether to allow changes in ring size.

  • force (bool) – Whether to try to force the merge, even when the molecular connectivity changes not as the result of a ring transformation. This will likely lead to an unstable perturbation. This option takes precedence over ‘allow_ring_breaking’ and ‘allow_ring_size_change’.

  • property_map0 (dict) – A dictionary that maps “properties” in molecule0 to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }

  • property_map1 (dict) – A dictionary that maps “properties” in molecule1 to their user defined values.

Returns:

molecule – The merged molecule.

Return type:

Molecule

Examples

Merge molecule0 and molecule1 based on a precomputed mapping.

>>> import BioSimSpace as BSS
>>> merged = BSS.Align.merge(molecule0, molecule1, mapping)

Merge molecule0 with molecule1. Since no mapping is passed one will be autogenerated using matchAtoms with default options, following which rmsdAlign will be used to align molecule0 to molecule1 based on the resulting mapping.

>>> import BioSimSpace as BSS
>>> molecule0 = BSS.Align.merge(molecule0, molecule1)