pymatgen.analysis.molecule_matcher module¶
-
class
AbstractMolAtomMapper[source]¶ Bases:
monty.json.MSONableAbstract molecular atom order mapping class. A mapping will be able to find the uniform atom order of two molecules that can pair the geometrically equivalent atoms.
-
get_molecule_hash(mol)[source]¶ Defines a hash for molecules. This allows molecules to be grouped efficiently for comparison.
Parameters: mol – The molecule. OpenBabel OBMol or pymatgen Molecule object Returns: A hashable object. Examples can be string formulas, etc.
-
uniform_labels(mol1, mol2)[source]¶ Pair the geometrically equivalent atoms of the molecules.
Parameters: - mol1 – First molecule. OpenBabel OBMol or pymatgen Molecule object.
- mol2 – Second molecule. OpenBabel OBMol or pymatgen Molecule object.
Returns: (list1, list2) if uniform atom order is found. list1 and list2 are for mol1 and mol2, respectively. Their length equal to the number of atoms. They represents the uniform atom order of the two molecules. The value of each element is the original atom index in mol1 or mol2 of the current atom in uniform atom order. (None, None) if unform atom is not available.
-
-
class
InchiMolAtomMapper(angle_tolerance=10.0)[source]¶ Bases:
pymatgen.analysis.molecule_matcher.AbstractMolAtomMapperPair atoms by inchi labels.
Parameters: angle_tolerance – Angle threshold to assume linear molecule. In degrees.
-
class
IsomorphismMolAtomMapper[source]¶ Bases:
pymatgen.analysis.molecule_matcher.AbstractMolAtomMapperPair atoms by isomorphism permutations in the OpenBabel::OBAlign class
-
uniform_labels(mol1, mol2)[source]¶ Pair the geometrically equivalent atoms of the molecules. Calculate RMSD on all possible isomorphism mappings and return mapping with the least RMSD
Parameters: - mol1 – First molecule. OpenBabel OBMol or pymatgen Molecule object.
- mol2 – Second molecule. OpenBabel OBMol or pymatgen Molecule object.
Returns: (list1, list2) if uniform atom order is found. list1 and list2 are for mol1 and mol2, respectively. Their length equal to the number of atoms. They represents the uniform atom order of the two molecules. The value of each element is the original atom index in mol1 or mol2 of the current atom in uniform atom order. (None, None) if unform atom is not available.
-
-
class
MoleculeMatcher(tolerance=0.01, mapper=<pymatgen.analysis.molecule_matcher.InchiMolAtomMapper object>)[source]¶ Bases:
monty.json.MSONableClass to match molecules and identify whether molecules are the same.
Parameters: - tolerance – RMSD difference threshold whether two molecules are different
- mapper – MolAtomMapper object that is able to map the atoms of two molecule to uniform order
-
fit(mol1, mol2)[source]¶ Fit two molecules.
Parameters: - mol1 – First molecule. OpenBabel OBMol or pymatgen Molecule object
- mol2 – Second molecule. OpenBabel OBMol or pymatgen Molecule object
Returns: A boolean value indicates whether two molecules are the same.