def test_batch_construction(self): mol_batch = NPMol.create_from_batch(batch_atoms=atoms, batch_distances=distances) for i in range(len(distances)): npt.assert_allclose(mol_batch[i].distances, distances[i]) npt.assert_allclose(mol_batch[i].distance_matrix, distance_matrix[i]) npt.assert_equal(mol_batch[i].atoms, atom_types[i]) self.assertTrue(isinstance(mol_batch[i].smiles, str))
def test_empty(self): atoms_empty = np.zeros([batch_size, num_atoms, num_atom_types]) atoms_empty[:, :, -1] = 1 mol_batch = NPMol.create_from_batch(batch_atoms=atoms_empty, batch_distances=distances) for mol in mol_batch: npt.assert_equal(mol.distance_matrix, np.zeros([0, 0])) npt.assert_equal(mol.coordinates, np.zeros([0, 3])) npt.assert_equal(mol.smiles, '') npt.assert_equal(mol.atoms, [])