本文整理汇总了Python中pymatgen.analysis.molecule_matcher.MoleculeMatcher类的典型用法代码示例。如果您正苦于以下问题:Python MoleculeMatcher类的具体用法?Python MoleculeMatcher怎么用?Python MoleculeMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoleculeMatcher类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_and_from_dict
def test_to_and_from_dict(self):
mm = MoleculeMatcher(tolerance=0.5, mapper=InchiMolAtomMapper(angle_tolerance=50.0))
d = mm.to_dict
mm2 = MoleculeMatcher.from_dict(d)
self.assertEqual(d, mm2.to_dict)
mm = MoleculeMatcher(tolerance=0.5, mapper=IsomorphismMolAtomMapper())
d = mm.to_dict
mm2 = MoleculeMatcher.from_dict(d)
self.assertEqual(d, mm2.to_dict)
示例2: test_group_molecules
def test_group_molecules(self):
mm = MoleculeMatcher(tolerance=0.001)
with open(os.path.join(test_dir, "mol_list.txt")) as f:
filename_list = [line.strip() for line in f.readlines()]
mol_list = [Molecule.from_file(os.path.join(test_dir, f))
for f in filename_list]
mol_groups = mm.group_molecules(mol_list)
filename_groups = [[filename_list[mol_list.index(m)] for m in g]
for g in mol_groups]
with open(os.path.join(test_dir, "grouped_mol_list.txt")) as f:
grouped_text = f.read().strip()
self.assertEqual(str(filename_groups), grouped_text)
示例3: fit_with_mapper
def fit_with_mapper(self, mapper):
coords = [[0.000000, 0.000000, 0.000000],
[0.000000, 0.000000, 1.089000],
[1.026719, 0.000000, -0.363000],
[-0.513360, -0.889165, -0.363000],
[-0.513360, 0.889165, -0.363000]]
mol1 = Molecule(["C", "H", "H", "H", "H"], coords)
op = SymmOp.from_origin_axis_angle([0, 0, 0], [0.1, 0.2, 0.3], 60)
rotcoords = [op.operate(c) for c in coords]
mol2 = Molecule(["C", "H", "H", "H", "H"], rotcoords)
mm = MoleculeMatcher(mapper=mapper)
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "benzene1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "benzene2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "benzene1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "t2.xyz"))
self.assertFalse(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "c1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "c2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "t3.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "t4.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "j1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "j2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "ethene1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "ethene2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "toluene1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "toluene2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "cyclohexane1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "cyclohexane2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mol1 = Molecule.from_file(os.path.join(test_dir, "oxygen1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "oxygen2.xyz"))
self.assertTrue(mm.fit(mol1, mol2))
mm = MoleculeMatcher(tolerance=0.001, mapper=mapper)
mol1 = Molecule.from_file(os.path.join(test_dir, "t3.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "t4.xyz"))
self.assertFalse(mm.fit(mol1, mol2))
示例4: test_get_rmsd
def test_get_rmsd(self):
mm = MoleculeMatcher()
mol1 = Molecule.from_file(os.path.join(test_dir, "t3.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "t4.xyz"))
self.assertEqual('{0:7.3}'.format(mm.get_rmsd(mol1, mol2)), "0.00488")
示例5: test_cdi_23
def test_cdi_23(self):
mm = MoleculeMatcher(tolerance=0.05, mapper=InchiMolAtomMapper())
mol1 = Molecule.from_file(os.path.join(test_dir, "cdi_23_1.xyz"))
mol2 = Molecule.from_file(os.path.join(test_dir, "cdi_23_2.xyz"))
self.assertFalse(mm.fit(mol1, mol2))
示例6: test_thiane_ethynyl
def test_thiane_ethynyl(self):
mm = MoleculeMatcher(tolerance=0.05, mapper=InchiMolAtomMapper())
mol1 = Molecule.from_file(os.path.join(test_dir, "thiane_ethynyl1.sdf"))
mol2 = Molecule.from_file(os.path.join(test_dir, "thiane_ethynyl2.sdf"))
self.assertFalse(mm.fit(mol1, mol2))
示例7: test_strange_inchi
def test_strange_inchi(self):
mm = MoleculeMatcher(tolerance=0.05, mapper=InchiMolAtomMapper())
mol1 = Molecule.from_file(os.path.join(test_dir, "k1.sdf"))
mol2 = Molecule.from_file(os.path.join(test_dir, "k2.sdf"))
self.assertTrue(mm.fit(mol1, mol2))
示例8: test_get_rmsd
def test_get_rmsd(self):
mm = MoleculeMatcher()
mol1 = BabelMolAdaptor.from_file(os.path.join(test_dir, "t3.xyz")).pymatgen_mol
mol2 = BabelMolAdaptor.from_file(os.path.join(test_dir, "t4.xyz")).pymatgen_mol
self.assertEqual('{0:7.3}'.format(mm.get_rmsd(mol1, mol2)), "0.00488")
示例9: test_thiane
def test_thiane(self):
mm = MoleculeMatcher(tolerance=0.05, mapper=InchiMolAtomMapper())
mol1 = read_mol(os.path.join(test_dir, "thiane1.sdf"))
mol2 = read_mol(os.path.join(test_dir, "thiane2.sdf"))
self.assertFalse(mm.fit(mol1, mol2))