def test_connect_mat(): connect_mat_true = [[1, 2], [1, 3], [1, 5], [1, 6], [2, 4], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [4, 13], [4, 14]] d = Molecule('data/xyz/butane.xyz') assert np.allclose(connect_mat_true,d.connect)
sigma = 2.5 K = get_local_kernels(X, X, [sigma], cut_distance=10.0)[0] K[np.diag_indices_from(K)] += 1e-8 alpha = cho_solve(K, y) np.save('/ihome/ghutchison/dlf57/ml-benchmark/alpha-sig25-5k.npz', alpha) data = [] for out in sorted(glob.iglob( '/ihome/ghutchison/dlf57/ml-benchmark/molecules/stretch/*/sdf/*.sdf'), key=numericalSort): name = out.split('stretch/')[1].split('/sdf')[0] pt = out.split('sdf/')[1].split('.')[0] if name != 'HF': mol = Molecule(out) coords = mol.xyz at_num = mol.at_num rep = generate_representation(coords, at_num, max_size=45) rep = np.array([rep]) K_pred = get_local_kernels(rep, X, [sigma], cut_distance=10.0)[0] energy = list(np.dot(K_pred, alpha))[0] d = {} d.update({'name': name}) d.update({'point': pt}) d.update({'fchl_energy': energy}) data.append(d) else:
def test_sdf_import(): d = Molecule('data/sdf/butane.sdf') assert d.n_atom == 14
def test_symbol(): with pt.raises(KeyError): Molecule('data/incorrect/butane_incorrectsymbol.xyz')
def test_import_failure(): with pt.raises(NotImplementedError): Molecule('data/incorrect/empty.abc')
def test_cif_import(): d = Molecule('data/cif/cyclo_pentane.cif') assert d.n_atom == 15
def test_cml_import(): d = Molecule('data/cml/butane.cml') assert d.n_atom == 14
def test_cclib_import(): d = Molecule('data/cclib/butane.cclib') assert d.n_atom == 14
def test_xyz_import(): d = Molecule('data/xyz/butane.xyz') assert d.n_atom == 14