schrodinger.application.jaguar.autots_rmsd module

methods for comparison of structures using rmsd

class schrodinger.application.jaguar.autots_rmsd.MapScore(score, atom_map)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

atom_map

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

score

Alias for field number 0

schrodinger.application.jaguar.autots_rmsd.reform_barely_broken_bonds(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, fraction_different: float = 0.5, reform_always: bool = False) bool

Given two structures that have consistently ordered atoms, reform bonds that have not broken very much (stretched by less than fraction_different*d0). Return False if not all broken bonds can be reformed. Structures are run through mmlewis to get new bond orders and formal charges.

Parameters
  • st1 – the first structure

  • st2 – the second structure

  • fraction_different – if a bond breaks then it is also required that the bond distance increases by a factor of fraction_different*d0 where d0 is the bond distance before breaking

  • reform_always – If True, reform barely broken bonds even when doing so will not make the two structures into conformers. If False, only reform such bonds if doing so would render the two structures conformers.

schrodinger.application.jaguar.autots_rmsd.molecule_lists_are_conformers(m1: List[schrodinger.structure._structure.Structure], m2: List[schrodinger.structure._structure.Structure], same_molecularity: bool = True, use_chirality: bool = False) bool

Compare two non-empty lists of structures and return True if matching pairs of conformers can be found. The structures in m1 and m2 are assumed to be fully connected (molecules) if same_molecularity==True.

Returns False if the number of molecules differs and same_molecularity==True.

Parameters
  • m1 – first list of molecules

  • m2 – first list of molecules

  • same_molecularity – if True, require that the two lists be the same length (i.e. number of molecules)

Returns

whether the two lists of molecules are conformers

schrodinger.application.jaguar.autots_rmsd.align_all_molecules(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, sort_rms: bool = True)

Inspects whether all the molecules in reactant are conformers of those in product. If they are, each molecule in product is superimposed onto the corresponding reactant molecule.

Parameters
  • st1 – structure 1

  • st2 – structure 2

  • sort_rms – If True the structure in which the inter-molecule distances are larger is superimposes onto the smaller, see sort_by_centroid_distance, which does the sorting.

schrodinger.application.jaguar.autots_rmsd.sort_by_centroid_distance(strs: List[schrodinger.structure._structure.Structure]) List[schrodinger.structure._structure.Structure]

Given a list of structures sort the list in non-decreasing order using the rms distance between molecules in the structures. e.g. for two structures which are each water dimers, the water dimer with the smaller intermolecular distance would appear first in the list

Parameters

strs – list of structures to be sorted

Returns

sorted list

schrodinger.application.jaguar.autots_rmsd.align_path_strs(path_strs: List[schrodinger.structure._structure.Structure])

Align the structures in a path.

Parameters

path_strs – the structures along the path

schrodinger.application.jaguar.autots_rmsd.order_atoms(reactant: schrodinger.structure._structure.Structure, product: List[schrodinger.structure._structure.Structure], debug: bool = False) Tuple[schrodinger.structure._structure.Structure, schrodinger.structure._structure.Structure]

Renumber atoms in reactant and product in a consistent fashion.

Parameters
  • reactant – reactant structure

  • product – reactant structure

  • debug – include debug printing

Returns

renumbered reactant and product

class schrodinger.application.jaguar.autots_rmsd.AutoTSAtomMapper(optimize_mapping: bool, use_chirality: bool, debug: bool = False)

Bases: schrodinger.comparison.atom_mapper.BaseAtomMapper

Atom mapper used by AutoTS for reordering atoms of conformers. Uses element types and optionally chirality to equate atoms and all bonds are considered equivalent. Stereochemistry on atoms which are marked with the property “i_user_AutoTS_Atom_Class” are ignored when comparing stereochemistry. This property is used to mark the atoms in the reaction center.

Usage example: mapper = AutoTSAtomMapper(optimize_mapping=True, use_chirality=False) st1, st2 = mapper.reorder_atoms(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

RMSD_THRESH = 1e-08
__init__(optimize_mapping: bool, use_chirality: bool, debug: bool = False)
Parameters
  • optimize_mapping – if True search over all bijections to find the one with the lowest score

  • use_chirality – if True, in addition to element type use chirality (where defined) to equate atoms.

initialize_atom_types(st: schrodinger.structure._structure.Structure, invert_stereocenters: bool = False)

Initialize the atom types

Parameters
  • st – structure containing atoms

  • invert_stereocenters – whether R/S labels should be flipped

reorder_structures(st1, atlist1, st2, atlist2)

Reorder the atoms in the two structures.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

  • invert_stereocenters – If True, flip all R<->S, used for are_enantiomers

Returns

the two structures with structure 2 having had atoms reordered

score_mapping(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, atset: Set[int]) Tuple[int, int, int, int, float]

Score a mapping over the atoms listed in atlist. This returns a number of chirality mis-alignments and the rms mis-alignments are neglected for atoms which are marked with atom property “i_user_AutoTS_Atom_Class”

Parameters
  • st1 – first structure

  • st2 – second structure

  • atset – set of atoms that have been mapped (indexes refer to both structures)

Returns

the negative of the number of active bonds, the number of misaligned atom-numbering stereocenters, the negative of the number of active atoms, the number of separate components, and the rmsd

score_is_equivalent(score1: schrodinger.application.jaguar.autots_rmsd.MapScore, score2: schrodinger.application.jaguar.autots_rmsd.MapScore) bool

Here we declare 2 scores equivalent if the same number of chirality mismatches are present and the rmsd difference is within RMSD_THRESH. This resolves machine dependent discrepancies in the chosen map.

Parameters
  • score1 – the first score (chirality mismatches, active atoms, rms)

  • score2 – the first score (chirality mismatches, active atoms, rms)

Returns

boolean indicating if the score is the same or different

determine_active_bonds_info(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, atlist: List[int]) Tuple[int, int]

Determine the number of active bonds after numbering and the number of components.

It is possible for the numbering code to “deactivate” an active bond and such numbering should be considered invalid. The way this might happen is for the numbering to lead to two active bonds to be numbered equivalently. Say you have a reactant water with an O-H active and a product water with an O-H active (for example, in a water wire). The numbering code could decide to number both of these O’s the same and both H’s the same. Thus, the code thinks it has both O-H’s active but, in reality, now neither are because the equivalently numbered atoms have bonds in both reactant and product.

The active bonds have been stored as a binary vector (i.e. an int). An active bond destroying numbering will have the same two atom numbers as the endpoint of more than one active bond.

We define the number of ‘components’ as the number of disjoint sets of molecules that are involved in active bonds. That is, if all active bonds in reactants and products were drawn in one structure, how many “molecules” would there be? For example, it is possible to number a set of bonds in the reaction A+B+C+D -> E+F, where A+B->E and C+D->F or one in which atoms from all 4 reactant molecules appear among all 2 of the products. The former case is a 2-component reaction (consisting of (A, B, E) and (C, D, F)) and the latter is a 1-component reaction (A, B, C, D, E ,F). We assume that the user put in an irreducible reaction, and hence fewer component renumbered solutions are to be preferred.

Parameters
  • st1 – first structure

  • st2 – second structure

  • atlist – list of atoms that have been mapped (indexes refer to both structures)

Returns

number of active bonds from this numbering, number of components

ATOM_TYPE = 's_m_custom_atom_type'
MAPPER_INDEX = 'i_m_atom_mapper_index'
are_conformers(st1: schrodinger.structure._structure.Structure, atlist1: List[int], st2: schrodinger.structure._structure.Structure, atlist2: List[int]) bool

Determine if the two substructures, as defined by the atom lists, are conformers but do not explore isomorphisms.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

Returns

boolean indicating whether or not the two structures are conformers

are_consistently_ordered_conformers(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, atlist: List[int]) bool

Determine if two substructures are consistently ordered conformers. That is, they have the same atom numbering and bonding

Parameters
  • st1 – the first structure

  • st2 – the second structure

  • atlist – list of atom indexes defining the substructure

Returns

boolean indicating whether or not the two structures are ordered conformers

are_enantiomers(st1: schrodinger.structure._structure.Structure, atlist1: List[int], st2: schrodinger.structure._structure.Structure, atlist2: List[int]) bool

Determine if the two substructures, as defined by the atom lists, are enantiomers but do not explore isomorphisms.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

Returns

boolean indicating whether or not the two structures are conformers

comparator(d1: Dict, d2: Dict) bool

Comparison function to be used to determine if two nodes on graph are equivalent.

If this method is not used when constructing a GraphMatcher, node attributes will not be considered for the purpose of determining isomorphism.

Parameters
  • d1 (dict) – key=value dictionary from graph returned from st_to_graph which represents node 1

  • d1 – key=value dictionary from graph returned from st_to_graph which represents node 2

Returns

boolean indicating equilvalence

early_stop(score: float) bool

Check if score is such that we should abort the atom_mapper early.

Parameters

score – score to check for early stopping condition

Returns

If True, AtomMapper should stop early. By default, we will not have an early stopping condition

get_atom_type(at: schrodinger.structure._structure._StructureAtom) str

This value is used as an atom property

Parameters

at – atom we wish to obtain a type for

Returns

string which identifies atom type

invert_chirality(ch_list: List[str])

Invert the chirality (R/S) of an input list of chiralities.

Parameters

ch_list – list of chirality labels for a structure

isomeric_atom_sets(st1: schrodinger.structure._structure.Structure, atset1: Set[int], st2: schrodinger.structure._structure.Structure, atset2: Set[int]) bool

Check that the atom types in atset1 are the same as those in atset2. If not, the two structures cannot be conformers.

Parameters
  • st1 – the first structure

  • atset1 – set of atom indexes defining the first substructure

  • st2 – the second structure

  • atset2 – set of atom indexes defining the second substructure

Returns

a boolean indicating if these atom lists are isomeric

set_atom_type(at: schrodinger.structure._structure._StructureAtom, value: str)

Set the value of the atom type

Parameters
  • at – atom we wish to set type for

  • value – set the type of atom to this

st_to_graph(st: schrodinger.structure._structure.Structure, atset: Set[int]) networkx.classes.graph.Graph

Convert Structure instance to a networkx Graph using _StructureAtom instances as nodes and adding an atom type property

Parameters
  • st – the structure to convert

  • atset – a set of atoms to use to create the graph

Returns

networkx Graph

unique_job_name(base_name: str) str

Add an integer to the end of the base_name to get a unique name.

Parameters

base_name – base job name

Returns

unique name

class schrodinger.application.jaguar.autots_rmsd.AutoTSTemplateAtomMapper(optimize_mapping: bool, use_chirality: bool, debug: bool = False)

Bases: schrodinger.application.jaguar.autots_rmsd.AutoTSAtomMapper

Atom mapper used by AutoTS’s template code for reordering atoms to align template and input. Uses element types to equate atoms and all bonds are considered equivalent. Stereochemistry on atoms which are marked with the property “i_user_AutoTS_Atom_Class” are ignored when comparing stereochemistry.

This differs from the AutoTSAtomMapper in that it simultaneously renumbers 4 structures instead of 2, assuming two pairs of those structures are already consistently numbered. Moreover, the return value of this class is the optimal map that accomplishes the renumbering, as opposed to the renumbered Structures themselves.

Usage example: mapper = AutoTSTemplateAtomMapper(optimize_mapping=True, use_chirality=False) map = mapper.choose_template_map(reactant, product, input_indexes, r_template, p_template, template_indexes)

RMSD_THRESH = 1e-08
initialize_atom_types(st: schrodinger.structure._structure.Structure, active_ats: List[int], invert_stereocenters: bool = False)

Initialize the atom types

Parameters
  • st – structure containing atoms

  • active_ats – atom indices of the reaction center

  • invert_stereocenters – whether R/S labels should be flipped

score_mapping(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, st3: schrodinger.structure._structure.Structure, st4: schrodinger.structure._structure.Structure, atset: Set[int]) Tuple[int, int, int, int, float]

Score a mapping over the atoms listed in atlist. This returns a number of chirality mis-alignments and the rms mis-alignments are neglected for atoms which are marked with atom property “i_user_AutoTS_Atom_Class”

Parameters
  • st1 – first structure (reactant)

  • st2 – second structure (reactant)

  • st3 – first structure (product)

  • st4 – second structure (product)

  • atset – set of atoms that have been mapped (indexes refer to both structures)

Returns

the negative of the number of active bonds, the number of misaligned atom-numbering stereocenters, the negative of the number of active atoms, the number of separate components, and the rmsd

choose_template_map(reactant: schrodinger.structure._structure.Structure, product: schrodinger.structure._structure.Structure, input_indexes, r_template: schrodinger.structure._structure.Structure, p_template: schrodinger.structure._structure.Structure, template_indexes) dict

Determine the optimal map from the input reactant and product structures to the template reactant and product structures.

Parameters
  • reactant – input reactant structure

  • product – input product structure

  • input_indexes (RxnIndxDecomp instance) – breakdown of input atom indexes into core, reaction center

  • r_template – template reactant structure

  • p_template – template product structure

  • template_indexes (RxnIndxDecomp instance) – breakdown of template atom indexes into core, reaction center

Returns

mapping from input number to template numbering

ATOM_TYPE = 's_m_custom_atom_type'
MAPPER_INDEX = 'i_m_atom_mapper_index'
__init__(optimize_mapping: bool, use_chirality: bool, debug: bool = False)
Parameters
  • optimize_mapping – if True search over all bijections to find the one with the lowest score

  • use_chirality – if True, in addition to element type use chirality (where defined) to equate atoms.

are_conformers(st1: schrodinger.structure._structure.Structure, atlist1: List[int], st2: schrodinger.structure._structure.Structure, atlist2: List[int]) bool

Determine if the two substructures, as defined by the atom lists, are conformers but do not explore isomorphisms.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

Returns

boolean indicating whether or not the two structures are conformers

are_consistently_ordered_conformers(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, atlist: List[int]) bool

Determine if two substructures are consistently ordered conformers. That is, they have the same atom numbering and bonding

Parameters
  • st1 – the first structure

  • st2 – the second structure

  • atlist – list of atom indexes defining the substructure

Returns

boolean indicating whether or not the two structures are ordered conformers

are_enantiomers(st1: schrodinger.structure._structure.Structure, atlist1: List[int], st2: schrodinger.structure._structure.Structure, atlist2: List[int]) bool

Determine if the two substructures, as defined by the atom lists, are enantiomers but do not explore isomorphisms.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

Returns

boolean indicating whether or not the two structures are conformers

comparator(d1: Dict, d2: Dict) bool

Comparison function to be used to determine if two nodes on graph are equivalent.

If this method is not used when constructing a GraphMatcher, node attributes will not be considered for the purpose of determining isomorphism.

Parameters
  • d1 (dict) – key=value dictionary from graph returned from st_to_graph which represents node 1

  • d1 – key=value dictionary from graph returned from st_to_graph which represents node 2

Returns

boolean indicating equilvalence

determine_active_bonds_info(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, atlist: List[int]) Tuple[int, int]

Determine the number of active bonds after numbering and the number of components.

It is possible for the numbering code to “deactivate” an active bond and such numbering should be considered invalid. The way this might happen is for the numbering to lead to two active bonds to be numbered equivalently. Say you have a reactant water with an O-H active and a product water with an O-H active (for example, in a water wire). The numbering code could decide to number both of these O’s the same and both H’s the same. Thus, the code thinks it has both O-H’s active but, in reality, now neither are because the equivalently numbered atoms have bonds in both reactant and product.

The active bonds have been stored as a binary vector (i.e. an int). An active bond destroying numbering will have the same two atom numbers as the endpoint of more than one active bond.

We define the number of ‘components’ as the number of disjoint sets of molecules that are involved in active bonds. That is, if all active bonds in reactants and products were drawn in one structure, how many “molecules” would there be? For example, it is possible to number a set of bonds in the reaction A+B+C+D -> E+F, where A+B->E and C+D->F or one in which atoms from all 4 reactant molecules appear among all 2 of the products. The former case is a 2-component reaction (consisting of (A, B, E) and (C, D, F)) and the latter is a 1-component reaction (A, B, C, D, E ,F). We assume that the user put in an irreducible reaction, and hence fewer component renumbered solutions are to be preferred.

Parameters
  • st1 – first structure

  • st2 – second structure

  • atlist – list of atoms that have been mapped (indexes refer to both structures)

Returns

number of active bonds from this numbering, number of components

early_stop(score: float) bool

Check if score is such that we should abort the atom_mapper early.

Parameters

score – score to check for early stopping condition

Returns

If True, AtomMapper should stop early. By default, we will not have an early stopping condition

get_atom_type(at: schrodinger.structure._structure._StructureAtom) str

This value is used as an atom property

Parameters

at – atom we wish to obtain a type for

Returns

string which identifies atom type

invert_chirality(ch_list: List[str])

Invert the chirality (R/S) of an input list of chiralities.

Parameters

ch_list – list of chirality labels for a structure

isomeric_atom_sets(st1: schrodinger.structure._structure.Structure, atset1: Set[int], st2: schrodinger.structure._structure.Structure, atset2: Set[int]) bool

Check that the atom types in atset1 are the same as those in atset2. If not, the two structures cannot be conformers.

Parameters
  • st1 – the first structure

  • atset1 – set of atom indexes defining the first substructure

  • st2 – the second structure

  • atset2 – set of atom indexes defining the second substructure

Returns

a boolean indicating if these atom lists are isomeric

reorder_structures(st1, atlist1, st2, atlist2)

Reorder the atoms in the two structures.

Parameters
  • st1 – the first structure

  • atlist1 – list of atom indexes defining the first substructure

  • st2 – the second structure

  • atlist2 – list of atom indexes defining the second substructure

  • invert_stereocenters – If True, flip all R<->S, used for are_enantiomers

Returns

the two structures with structure 2 having had atoms reordered

score_is_equivalent(score1: schrodinger.application.jaguar.autots_rmsd.MapScore, score2: schrodinger.application.jaguar.autots_rmsd.MapScore) bool

Here we declare 2 scores equivalent if the same number of chirality mismatches are present and the rmsd difference is within RMSD_THRESH. This resolves machine dependent discrepancies in the chosen map.

Parameters
  • score1 – the first score (chirality mismatches, active atoms, rms)

  • score2 – the first score (chirality mismatches, active atoms, rms)

Returns

boolean indicating if the score is the same or different

set_atom_type(at: schrodinger.structure._structure._StructureAtom, value: str)

Set the value of the atom type

Parameters
  • at – atom we wish to set type for

  • value – set the type of atom to this

st_to_graph(st: schrodinger.structure._structure.Structure, atset: Set[int]) networkx.classes.graph.Graph

Convert Structure instance to a networkx Graph using _StructureAtom instances as nodes and adding an atom type property

Parameters
  • st – the structure to convert

  • atset – a set of atoms to use to create the graph

Returns

networkx Graph

unique_job_name(base_name: str) str

Add an integer to the end of the base_name to get a unique name.

Parameters

base_name – base job name

Returns

unique name