Skip to content

Commit

Permalink
Added some minor fixes for edge cases where isomorphisms cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaplaza committed Dec 4, 2024
1 parent 12e93ff commit fbdb87a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion navicat_marc/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def molecules_from_file(filename, scale_factor=1.10, noh=True):
def processargs(arguments):
input_list = sys.argv
input_str = " ".join(input_list)
version_str = "0.2.3"
version_str = "0.2.4"
mbuilder = argparse.ArgumentParser(
prog="navicat_marc",
description="Analyse conformer ensembles to find the most representative structures.",
Expand Down
14 changes: 11 additions & 3 deletions navicat_marc/rmsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ def rmsd_matrix(mols, sort=False, truesort=False, normalize=True):
save_rotated_coordinates = rotated_coordinates
if np.isclose(0, min_res):
break
pos_ibj.append(save_ibj)
assert all(mols[i].atoms == mols[j].atoms[save_ibj])
mols[j].update(mols[j].atoms[save_ibj], save_rotated_coordinates)
if len(iviews) == 0:
min_res, save_rotated_coordinates = kabsch_rmsd(
mols[i].coordinates, mols[j].coordinates
)
assert all(mols[i].atoms == mols[j].atoms)
mols[j].update(mols[j].atoms, save_rotated_coordinates)
else:
pos_ibj.append(save_ibj)
assert all(mols[i].atoms == mols[j].atoms[save_ibj])
mols[j].update(mols[j].atoms[save_ibj], save_rotated_coordinates)
M[i, j] = M[j, i] = min_res
if not sort and len(pos_ibj) > 0:
for k, ibj in enumerate(pos_ibj):
Expand All @@ -78,6 +85,7 @@ def rmsd_matrix(mols, sort=False, truesort=False, normalize=True):
if not truesort:
sort = False
maxval = np.max(M)
max_idxs = np.unravel_index(M.argmax(), M.shape)
if normalize:
M = np.abs(M) / maxval
return M, maxval
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "navicat_marc"
version = "0.2.3"
version = "0.2.4"
authors = [
{ name="R. Laplaza", email="[email protected]" },
]
Expand All @@ -17,7 +17,7 @@ dependencies = [
'networkx >= 3.0',
'numpy >= 1.24.4',
'scikit_learn >= 1.2.0',
'scipy >= 1.10.1',
'scipy == 1.10.1',
'setuptools >= 65.4.1',
]
classifiers = [
Expand Down

0 comments on commit fbdb87a

Please sign in to comment.