schrodinger.application.matsci.reorder module

Creates a frame that contains widgets to aid in reordering two structures to have the same atom order, plus functions to estimate atom ordering.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.reorder.map_hydrogens(struct1, struct2, atom_map)

For all heavy atoms already mapped, if they only have a single hydrogen attached to them we can also map that hydrogen.

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures. No atoms in this dictionary will be added to the dictionary returned by this method.
Return type:

dict

Returns:

dictionary, keys are indexes of H atoms in struct1 that were mapped by this method, each value is the index of a struct2 H atom that maps to the key atom.

schrodinger.application.matsci.reorder.map_neighboring_hydrogens(struct1, struct2, atom, protons1, protons2, atom_map, threshold=10.0)

If two or more hydrogens are bonded to an atom, we have to look at the similarities of the dihedrals between the structures to map them from struct2 to struct1

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • protons1 (list) – list of atom indexes of protons bound to atom in struct1
  • protons2 (list) – list of atom indexes of protons bound to atom in struct2
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures
  • threshold (float) – The dihedral angle difference threshold for considering protons “the same” between the two structures (degrees).
Return type:

dict

Returns:

dictionary, keys are indexes of H atoms in struct1 that were mapped by this method, each value is the index of a struct2 H atom that maps to the key atom.

schrodinger.application.matsci.reorder.find_atoms_near_point(struct, distance, xyz)

Find all atoms in struct that are within distance of point xyz

Parameters:
  • struct (schrodinger.structure.Structure) – The structure containing the atoms to search.
  • distance (float) – Find all atoms within this distance in Angstroms
  • xyz (list) – list of [x, y, z] coordinates
Return type:

list

Returns:

list of atom indexes within distance of point xyz. The list is sorted by distance with the index of the closest atom first.

schrodinger.application.matsci.reorder.compare_molecular_formulas(struct1, struct2)

Check to ensure the molecular formulas of both structures are the same

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
Return type:

bool, str, str

Returns:

True if the molecular formulas are the same, False if not, and then both molecular formulas

schrodinger.application.matsci.reorder.map_by_lone_element(struct1, struct2, atom_map=None, check_formula=False)

Return a map of atoms in struct2 to atoms in struct1. The only criteria used is that if only a single atom of an element exists in both structures, those atoms are mapped to each other. All other atoms are unmapped.

Note that this function assumes that a reaction might have taken place between the two structures, so just because there is a single F atom in both structures does not mean that the C atoms bound to the F is the same in both structures.

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures
  • check_formula (bool) – True if the molecular formulas should be checked to ensure they are identical, False if not
Return type:

dict

Returns:

A mapping of atom numbers in struct2 to atom numbers in struct1. keys are struct1 atom numbers, values are struct2 atom numbers. Dictionary contains only those atoms mapped by this method

Raises:

ValueError – if the molecular formulas of the two structures are not equal and check_formula is not False

schrodinger.application.matsci.reorder.map_by_smiles(struct1, struct2, atom_map=None, also_map_hydrogens=True, stereo='annotation_and_geom')

Return a map of atoms in struct2 to atoms in struct1. Unique SMILES strings are generated for both structures - if they are the same, then a mapping is produced that maps the atom indexes of struct2 onto the atom indexes of struct 1. Protons are not mapped, except where only a single proton is attached to a mapped atom.

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures. No atoms in this dictionary are returned in the final mapping.
  • also_map_hydrogens (bool) – By default, an attempt will be made to map hydrogen atoms based on the heavy atom mapping. Set to False to not do this.
  • stereo (smiles module constant) – The stereo value to feed to the SMILES generator. By default this is smiles.STEREO_FROM_ANNOTATION_AND_GEOM, use smiles.NO_STEREO to generate SMILES strings with no stereo information
Return type:

dict

Returns:

A mapping of atom numbers in struct2 to atom numbers in struct1. keys are struct1 atom numbers values are struct2 atom numbers

schrodinger.application.matsci.reorder.map_by_smarts(struct1, struct2, atom_map=None, also_map_hydrogens=True)

Return a map of atoms in struct2 to atoms in struct1. If the SMARTS pattern for each entire molecule matches, then atoms are set to that order. Otherwise, struct1 is searched for atoms that have a unique SMARTS pattern. If only one atom in struct2 also has that SMARTS pattern, the two atoms are mapped to each other. This is done for each unique pair in the two structures.

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures. No atoms in this dictionary are returned in the final mapping.
  • also_map_hydrogens (bool) – By default, an attempt will be made to map hydrogen atoms based on the heavy atom mapping even if they are not mapped via SMARTS patterns. Set to False to not do this. Even if this paramter is False, hydrogens that uniquely match SMARTS patterns will be mapped.
Return type:

dict

Returns:

A mapping of atom numbers in struct2 to atom numbers in struct1. keys are struct1 atom numbers values are struct2 atom numbers. Dictionary contains only those atoms mapped by this method.

Raises:

ValueError – if the SMILES strings of the two structures do not match

schrodinger.application.matsci.reorder.map_by_superposition(struct1, struct2, atom_map, check_formula=False, preserve_elements=True, threshold=1.0, also_map_hydrogens=True)

Return a map of atoms in struct2 to atoms in struct1. struct2 is first superimposed on struct1 using the atom lists supplied. Then all atoms in struct2 that are within threshold distance of an atom in struct1 are mapped to the closest atom.

Note that this function assumes that a reaction might have taken place between the two structures, so just because there is a single F atom in both structures does not mean that the C atoms bound to the F is the same in both structures.

Parameters:
  • struct1 (schrodinger.structure.Structure) – The first structure
  • struct2 (schrodinger.structure.Structure) – The structure to compare to the first structure
  • atom_map (dict) – keys are atom indexes for struct1, values are atom indexes for struct2. Each key, value pair represents an atom that is the same atom in both structures. atom_map must be at least 3 atoms long - the superposition will be done using atom_map. No atoms in this dictionary are returned in the final mapping.
  • check_formula (bool) – True if the molecular formulas should be checked to ensure they are identical, False if not
  • preserve_elements (bool) – True if only atoms of the same element should be mapped to each other, False if not
  • threshold (float) – Only atoms closer than this in Angstroms will be considered for mapping
  • also_map_hydrogens (bool) – By default, an attempt will be made to map hydrogen atoms based on the heavy atom mapping even if they are not mapped via superposition. Set to False to not do this. Even if this paramter is False, hydrogens that map via superposition will be mapped.
Return type:

dict

Returns:

A mapping of atom numbers in struct2 to atom numbers in struct1. keys are struct1 atom numbers values are struct2 atom numbers

Raises:
  • ValueError – if the molecular formulas of the two structures are not equal and check_formula is not False
  • RuntimeError – if atom_map is shorter than 3 atoms