Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions spyrmsd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
parser.add_argument(
"-n", "--nosymm", action="store_false", help="No graph isomorphism"
)
parser.add_argument(
"-k", "--noCache", action="store_false", help="Compute the isomorphism for each molecule"
)
parser.add_argument(
"-g",
"--graph-backend",
Expand Down Expand Up @@ -77,6 +80,7 @@
center=args.center,
minimize=args.minimize,
strip=not args.hydrogens,
cache= args.noCache
)

for RMSD in RMSDlist:
Expand Down
32 changes: 17 additions & 15 deletions spyrmsd/rmsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ def symmrmsd(
coordsref: np.ndarray,
coords: Union[np.ndarray, List[np.ndarray]],
apropsref: np.ndarray,
aprops: np.ndarray,
apropsList: Union[np.ndarray, List[np.ndarray]],
amref: np.ndarray,
am: np.ndarray,
amList: Union[np.ndarray, List[np.ndarray]],
center: bool = False,
minimize: bool = False,
cache: bool = True,
Expand All @@ -230,12 +230,12 @@ def symmrmsd(
Coordinates of other molecule
apropsref: np.ndarray
Atomic properties for reference
aprops: np.ndarray
Atomic properties for other molecule
apropsList: List[np.ndarray]
Atomic properties for other molecules
amref: np.ndarray
Adjacency matrix for reference molecule
am: np.ndarray
Adjacency matrix for other molecule
amList: List[np.ndarray]
Adjacency matrix for other molecules
center: bool
Centering flag
minimize: bool
Expand Down Expand Up @@ -271,7 +271,7 @@ def symmrmsd(
best_isomorphism: Any = []
isomorphism = None

for c in coords:
for i, c in enumerate(coords):
if not cache:
# Reset isomorphism
isomorphism = None
Expand All @@ -280,9 +280,9 @@ def symmrmsd(
coordsref,
c,
apropsref,
aprops,
apropsList[i],
amref,
am,
amList[i],
center=center,
minimize=minimize,
isomorphisms=isomorphism,
Expand All @@ -297,9 +297,9 @@ def symmrmsd(
coordsref,
coords,
apropsref,
aprops,
apropsList,
amref,
am,
amList,
center=center,
minimize=minimize,
isomorphisms=None,
Expand Down Expand Up @@ -358,6 +358,8 @@ def rmsdwrapper(

cref = molecule.coords_from_molecule(molref, center)
cmols = [molecule.coords_from_molecule(mol, center) for mol in mols]
apropsList = [mol.atomicnums for mol in mols]
amList = [mol.adjacency_matrix for mol in mols]

RMSDlist = []

Expand All @@ -366,21 +368,21 @@ def rmsdwrapper(
cref,
cmols,
molref.atomicnums,
mols[0].atomicnums,
apropsList,
molref.adjacency_matrix,
mols[0].adjacency_matrix,
amList,
center=center,
minimize=minimize,
cache=cache,
)
else: # No symmetry
for c in cmols:
for i, c in enumerate(cmols):
RMSDlist.append(
rmsd(
cref,
c,
molref.atomicnums,
mols[0].atomicnums,
apropsList[i],
center=center,
minimize=minimize,
)
Expand Down