From edee31d4110d1175c3a89ae858bc53ac67a7908d Mon Sep 17 00:00:00 2001 From: rlaplaza Date: Fri, 6 Oct 2023 14:02:00 +0200 Subject: [PATCH] Openbabel converts energies to kcal/mol! --- navicat_marc/clustering.py | 5 +---- navicat_marc/helpers.py | 1 - navicat_marc/molecule.py | 6 ++---- navicat_marc/rmsd.py | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/navicat_marc/clustering.py b/navicat_marc/clustering.py index 7bc3189..f27ec12 100755 --- a/navicat_marc/clustering.py +++ b/navicat_marc/clustering.py @@ -189,7 +189,6 @@ def kmeans_clustering(n_clusters, m: np.ndarray, rank=5, verb=0): f"{u[-1]+1} unique clusters found: {u} \nWith counts: {c} \nAdding up to {np.sum(c)}" ) for iclust in range(u.size): - # get all points assigned to each cluster: clusters.append(np.where(km.labels_ == iclust)[0]) @@ -222,7 +221,6 @@ def affprop_clustering(m, verb=0): f"{u[-1]+1} unique clusters found: {u} \nWith counts: {c} \nAdding up to {np.sum(c)}" ) for iclust in range(u.size): - # get all points assigned to each cluster: cluster_pts = m[ap.labels_ == iclust] clusters.append(np.where(ap.labels_ == iclust)[0]) @@ -279,7 +277,6 @@ def agglomerative_clustering(n_clusters, m: np.ndarray, rank=5, verb=0): f"{u[-1]+1} unique clusters found: {u} \nWith counts: {c} \nAdding up to {np.sum(c)}" ) for iclust in range(u.size): - # get all points assigned to each cluster: cluster_pts = m[ac.labels_ == iclust] clusters.append(np.where(ac.labels_ == iclust)[0]) @@ -315,7 +312,7 @@ def gaps_diff(data, refs=None, nrefs=10, ks=range(1, 11), verb=0): gaps = np.zeros((len(ks),)) s = np.zeros((len(ks),)) diff = np.zeros((len(ks) - 1,)) - for (i, k) in enumerate(ks): + for i, k in enumerate(ks): km = KMeans(n_clusters=k, n_init=5) _ = km.fit_predict(data) kmc = km.cluster_centers_ diff --git a/navicat_marc/helpers.py b/navicat_marc/helpers.py index 9135eb9..cf864fe 100755 --- a/navicat_marc/helpers.py +++ b/navicat_marc/helpers.py @@ -102,7 +102,6 @@ def molecules_from_file(filename, scale_factor=1.10, noh=True): def processargs(arguments): - mbuilder = argparse.ArgumentParser( prog="navicat_marc", description="Analyse conformer ensembles to find the most representative structures.", diff --git a/navicat_marc/molecule.py b/navicat_marc/molecule.py index 6526264..537f1d8 100755 --- a/navicat_marc/molecule.py +++ b/navicat_marc/molecule.py @@ -500,7 +500,7 @@ def from_file(self, filename, noh=True): if "Energy:" in title and energy is None: try: etitle = title.split(":")[1].split(" ")[1].rstrip() - energy = float(etitle) * ha_to_kcalmol + energy = float(etitle) # * ha_to_kcalmol except ValueError: energy = None except AttributeError: @@ -527,7 +527,6 @@ def from_file(self, filename, noh=True): # Use the number of atoms to not read beyond the end of a file for lines_read, line in enumerate(f): - if lines_read == n_atoms: break @@ -597,7 +596,7 @@ def from_lines(self, lines, noh=True): if "Energy:" in title and energy is None: try: etitle = title.split(":")[1].split(" ")[1].rstrip() - energy = float(etitle) * ha_to_kcalmol + energy = float(etitle) # * ha_to_kcalmol except ValueError: energy = None except AttributeError: @@ -624,7 +623,6 @@ def from_lines(self, lines, noh=True): # Use the number of atoms to not read beyond the end of a file for lines_read, line in enumerate(lines_iter): - if lines_read == n_atoms: break diff --git a/navicat_marc/rmsd.py b/navicat_marc/rmsd.py index 10996b0..7e011b5 100755 --- a/navicat_marc/rmsd.py +++ b/navicat_marc/rmsd.py @@ -403,7 +403,6 @@ def reorder_distance( view_reorder = np.zeros(q_atoms.shape, dtype=int) for atom in unique_atoms: - (p_atom_idx,) = np.where(p_atoms == atom) (q_atom_idx,) = np.where(q_atoms == atom)