コード例 #1
0
ファイル: test_molecule.py プロジェクト: wangvei/megnet
 def test_featurizer(self):
     mg = MolecularGraph()
     mol = mol_from_smiles(self.qm9_000001['smiles'])
     mol_graph = mg.convert(mol)
     self.assertEqual(len(mol_graph['index1']), 20) # 20 bonds in total, including double counting
     self.assertEqual(len(mol_graph['atom']), 5) # 5 atoms
     self.assertListEqual(mol_graph['state'][0], [0, 0]) # dummy state [0, 0]
     mol_graph = mg.convert(mol, state_attributes=[[1, 2]])
     self.assertListEqual(mol_graph['state'][0], [1, 2])
コード例 #2
0
 def setUpClass(cls):
     with open(os.path.join(module_dir, 'qm9', '000001.json'), 'r') as f:
         cls.qm9_000001 = json.load(f)
     cls.mol = mol_from_smiles(cls.qm9_000001['smiles'])
コード例 #3
0
 def setUpClass(cls):
     with open(os.path.join(module_dir, "qm9", "000001.json")) as f:
         cls.qm9_000001 = json.load(f)
     cls.mol = mol_from_smiles(cls.qm9_000001["smiles"])