schrodinger.application.jaguar.autots_rmsd module

methods for comparison of structures using rmsd

schrodinger.application.jaguar.autots_rmsd.compare_consistently_ordered_structures(st1, st2, heavy_only=False, fraction_different=0.5, fix_bonds=True)

Compare two structures by individually superimposing the molecules contained in these structures.

raises a ConformerError the two structures are not conformers. It is assumed that the atoms in st1 and st2 are consistently ordered

Parameters:
  • st1 (Structure instance) – structure 1
  • st2 (Structure instance) – structure 2
  • heavy_only (boolean) – if true, only use heavy atoms in computing rms
  • fraction_different (float) – if a bond breaks then it is also required that the bond distance increases by a factor of 0.5*d0 where d0 is the bond distance before breaking
  • fix_bonds (boolean) – if True and if the structures are determined to be conformers then any bonds that are broken but are less than a fraction_difference different are reformed. If this operation is performed we also run any modified structures through mmlewis to get new bond orders and formal charges.
Return type:

RMS difference

schrodinger.application.jaguar.autots_rmsd.are_consistently_ordered_conformers(st1, st2, fraction_different=0.5, fix_bonds=True)

Given two structures that have consistently ordered atoms. Analyze the bonding to see if the two structures are conformers.

Parameters:
  • st1 (Structure) – the first structure
  • st2 (Structure) – the second structure
  • fraction_different (float) – if a bond breaks then it is also required that the bond distance increases by a factor of 0.5*d0 where d0 is the bond distance before breaking
  • fix_bonds (boolean) – if True and if the structures are determined to be conformers then any bonds that are broken but are less than a fraction_difference different are reformed. If this operation is performed we also run any modified structures through mmlewis to get new bond orders and formal charges.
schrodinger.application.jaguar.autots_rmsd.are_conformers(st1, st2, consistently_ordered=False)

Determine if two structures are conformers. st1 and st2 can either be lists of Structures or single Structure instances. If they are lists than the Structures in the lists are assumed to be fully connected (molecules, not complexes)

Parameters:
  • st1 (Structure or list of Structures) – first structure
  • st2 (Structure or list of Structures.) – second structure
  • consistently_ordered (boolean) – if True, the atoms in st1 and st2 consistently ordered.
Returns:

True/False if two structures are conformers

schrodinger.application.jaguar.autots_rmsd.are_same_structure(st1, st2, rms_thresh, heavy_only, conformers_only, consistently_ordered=False)

Determine if two structures are the same.

st1 and st2 can either be lists of Structures or single Structure instances. If they are lists than the Structures in the lists are assumed to be fully connected (molecules, not complexes)

If consistently_ordered=True and the consistently ordered comparison returns False we apply the comparison for inconsistently ordered structures as a backup test.

Parameters:
  • st1 (Structure or list of Structures) – first structure
  • st2 (Structure or list of Structures) – second structure
  • rms_thresh (float) – threshold for RMS only used if conformers_only=False
  • heavy_only (boolean) – if True excude hydrogens when computing RMS
  • conformers_only (boolean) – if True, only require that structures are conformers
  • consistently_ordered (boolean) – if True, the atoms in st1 and st2 consistently ordered.
Returns:

True/False whether structures are the same.

schrodinger.application.jaguar.autots_rmsd.compare_structures(st1, st2, heavy_only=False)

Compare two structures by individually superimposing the molecules contained in these structures.

To clarify a structure can contain any number of molecules. A molecule is defined as a set of atoms that are bonded to one another. i.e. for a water dimer, there are two molecules that can be combined in a single structure.

Raises a IsomerError if the number of molecules differs or a ConformerError they are not conformers.

Parameters:
  • st1 (schrodinger.structure.Structure instance) – structure 1
  • st2 (schrodinger.structure.Structure instance) – structure 2
  • heavy_only (boolean) – if true, only use heavy atoms in computing rms
Return type:

float

:return average rms of difference between individual molecules

schrodinger.application.jaguar.autots_rmsd.compare_molecule_lists(m1, m2, heavy_only=False)

Compare two lists of molecules and return an average rms if matching pairs of conformers can be found. The structures in m1 and m2 are assumed to be fully connected (molecules).

Raises a IsomerError if the number of molecules differs or a ConformerError if matching conformers cannot be found.

Parameters:
  • m1 (list of structures) – first list of molecules
  • m2 (list of structures) – first list of molecules
  • heavy_only (boolean) – if true, only use heavy atoms in computing rms
Return type:

float

:return average rms of difference between individual molecules

schrodinger.application.jaguar.autots_rmsd.rms_structures(structure1, structure2, heavy_only=False)

Compute the rms between structures st1 and st2.

Raises a ValueError if the two structures are not isomers. and a ConformerError if the two structures are not conformers.

if nats = 1, we only compare element names if nats = 2 compare element names and return diff in bond length. else call above mentioned functions.

formal charges are removed before comparison.

Parameters:
  • structure1 (schrodinger.structure.Structure instance) – structure 1
  • structure2 (schrodinger.structure.Structure instance) – structure 2
  • heavy_only (boolean) – if true, only use heavy atoms in computing rms
Return type:

float

:return average rms of difference between individual molecules

schrodinger.application.jaguar.autots_rmsd.align_all_molecules(st1, st2, sort_rms=True)

Inspects whether or not 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 (schrodinger.structure.Structure instance) – structure 1
  • st2 (schrodinger.structure.Structure instance) – structure 2
  • sort_rms (boolean) – 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)

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 schrodinger.structure.Structure instances) – list of structures to be sorted
Return type:list of schrodinger.structure.Structure instances
Returns:sorted list
schrodinger.application.jaguar.autots_rmsd.align_path_strs(path_strs)

Align the structures in a path.

Parameters:path_strs (list of structures) – the structures along the path
schrodinger.application.jaguar.autots_rmsd.impose_molecules_on_structure(st, mol_list, mol_indx)

Superimpose the molecules in mol_list onto the structure st.

each “molecule” in mol_list is a structure instance that is a substructure in st and must have an accompanying list of indexes in mol_indx. This is useful for optimizing the molecules in st then superimposing them into the same orientation.

Parameters:
  • st (structure instance) – structure object with molecules
  • mol_list (list of structure instances) – each entry is a structure which represents a molecule in st. One way to get this list is the following: mol_list = [mol.extractStructure() for mol in st.mol]
  • mol_indx (list of lists of ints) – list of atom indexes for each molecule. The indexes correspond to atoms in st. That is, it is a map from molecule atoms to structure atoms.
Returns:

A copy of the input structure with the molecules imposed onto their positions and orientations in the input structure (st).

schrodinger.application.jaguar.autots_rmsd.order_atoms(reactant, product, active_atoms={}, debug=False)

Renumber atoms in reactant and product in a consistent fashion.

Parameters:
Return type:

tuple of two structures

Returns:

renumbered reactant and product

schrodinger.application.jaguar.autots_rmsd.label_indexes(st, label)

store atom indexes in property label

Parameters:st (Structure) – structure to add labels to
schrodinger.application.jaguar.autots_rmsd.hash_of_list(lst)

Hash an iterable of strings, order independent.

This is done by hashing each item, sorting and hashing a concatenation of the list.

Parameters:lst (list of strings) – list of strings to hash as one item
schrodinger.application.jaguar.autots_rmsd.num_bonds(at, inclusions)

count number of bonds from at to atoms with indexes in list inclusions

Parameters:
  • at (_StructureAtom) – atom to search around
  • inclusions (list of ints) – atom indexes to include in returned list
Returns:

int, the number of bonded neighbors in the inclusions list

schrodinger.application.jaguar.autots_rmsd.fill_map(atom_map)

Fill in a partial map, the empty locations are indicated by Nones in the atom_map. These entries are filled in by unmapped atoms.

class schrodinger.application.jaguar.autots_rmsd.BaseAtomMapper(optimize_mapping, debug=False)

Bases: object

Base class for an atom mapper which reorders atoms in a Structure instance using graph isomorphism as implemented in networkx.

This class can be used to easily construct atom mapping algorithms and/or to determine if two structures are conformers. The essential features of implementing a new algorithm are to define an atom type (graph invariant) which identifies nodes and a method to score particular atom mappings. For more control one can also define methods to define new methods for creating and comparing graphs.

Once the abstract methods have been implemented in a subclass (call this MyAtomMapper for example) the mapper can be used reorder the atoms of two structure instances:

mapper = MyAtomMapper(optimize_mapping=True) st1, st2 = mapper.reorder_atoms(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

or two determine if the two structures are conformers: are_conformers = mapper.are_conformers(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

MAPPER_INDEX = 'i_m_atom_mapper_index'
MAP_THRESH = 1e-08
__init__(optimize_mapping, debug=False)
@parram optimize_mapping: if True search all possible bijections
to deliver the one with the lowest score
Parameters:debug (boolean) – print extra debugging information
initialize_atom_types(st)

Initialize the atom types

Parameters:st (Structure) – structure containing atoms to initial type of
get_atom_type(at)

get the value of an atom type

Parameters:at (_StructureAtom) – atom that we want a descriptor for
Returns:string
set_atom_type(at, value)

Set the value of the atom type

Parameters:
  • at (_StructureAtom) – atom that we want to set/modify a descriptor for
  • value (string) – value to set atom type to
score_mapping(st1, st2, atlist)

Scores a particular atom reordering.

Parameters:
@pararm atlist: the atoms which have been mapped. This may be a subset
of the atoms in the two structures as we test partial as well as full maps.
Returns:any metric which measures the goodness of a particular relative atom ordering in st1 and st2. Can be any type that has the less than operator implemented.
unique_job_name(base_name)

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

Parameters:base_name (str) – base job name
st_to_graph(st, atlist)

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

Parameters:
  • st (Structure) – the structure to convert
  • atlist (list of ints) – a list of atoms to use to create the graph
Returns:

networkx Graph

comparator(d1, d2)

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

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

isomeric_atom_lists(st1, atlist1, st2, atlist2)

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

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

a boolean indicating if these atom lists are isomeric

are_conformers(st1, atlist1, st2, atlist2)

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

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

boolean indicating whether or not the two structures are conformers

reorder_structures(st1, atlist1, st2, atlist2)

Reorder the atoms in the two structures.

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

the two structures with structure 2 having had atoms reordered

class schrodinger.application.jaguar.autots_rmsd.AutoTSAtomMapper(optimize_mapping, use_chirality, active_atoms={}, debug=False)

Bases: schrodinger.application.jaguar.autots_rmsd.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.

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))

ATOM_TYPE = 's_m_custom_atom_type'
__init__(optimize_mapping, use_chirality, active_atoms={}, debug=False)
Parameters:
  • optimize_mapping (boolean) – if True search over all bijections to find the one with lowest score
  • use_chirality (boolean) – if True, in addition to element type use chirality (where defined) to equate atoms.
  • active_atoms (set of ints) – set of atoms indices in the reaction center, shouldn’t be checked for atom-numbering chirality
initialize_atom_types(st)

Initialize the atom types

Parameters:st (Structure) – structure containing atoms
get_atom_type(at)

This value is used as an atom property

Parameters:at (_StructureAtom) – atom we wish to obtain a type for
Returns:string which identifies atom type
set_atom_type(at, value)

Set the value of the atom type

Parameters:
  • at (_StructureAtom) – atom we wish to set type for
  • value (string) – set the type of atom to this
score_mapping(st1, st2, atlist)

Score a mapping over the atoms listed in atlist. This returns a number of chirality mis-alignments and an rms

Parameters:
  • st1 (Structure) – first structure
  • st2 (Structure) – second structure
  • atlist (list of ints) – list of atoms that have been mapped (indexes refer to both structures)
Returns:

a integer indicating the number of misaligned atom numbering stereocenters and a real representing the rmsd

MAPPER_INDEX = 'i_m_atom_mapper_index'
MAP_THRESH = 1e-08
are_conformers(st1, atlist1, st2, atlist2)

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

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

boolean indicating whether or not the two structures are conformers

comparator(d1, d2)

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

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

isomeric_atom_lists(st1, atlist1, st2, atlist2)

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

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list 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 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

the two structures with structure 2 having had atoms reordered

st_to_graph(st, atlist)

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

Parameters:
  • st (Structure) – the structure to convert
  • atlist (list of ints) – a list of atoms to use to create the graph
Returns:

networkx Graph

unique_job_name(base_name)

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

Parameters:base_name (str) – base job name
schrodinger.application.jaguar.autots_rmsd.valid_chiral_comp(ch1, ch2)

Maestro’s chirality checker returns both E/Z double bond isomer labels and R/S chirality labels. If a reaction (e.g. and addition or elimination reaction) changes a molecule from a double bond to a single bond, merely checking if the chirality labels match will always lead to an apparent mismatch, even though there is no actual problem. This function returns True if the chirality types can be correctly compared and False if not.

Parameters:
  • ch1 (string) – chirality label of atom 1
  • ch2 (string) – chirality label of atom 2
Returns:

True if chiralities are comparable else False