Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

📐 Symmetry-corrected RMSD in Python

License

NotificationsYou must be signed in to change notification settings

RMeli/spyrmsd

Repository files navigation

pytestflake8mypycodecov

DocsDocumentation Status

LicensePyPIConda Version

J. Cheminform.Zenodo

Python tool for symmetry-corrected RMSD calculations.


If you findspyrmsd useful, please consider citing the following paper:

@article{spyrmsd2020,  Author = {Meli, Rocco and Biggin, Philip C.},  Journal = {Journal of Cheminformatics},  Number = {1},  Pages = {49},  Title = {spyrmsd: symmetry-corrected RMSD calculations in Python},  Volume = {12},  Year = {2020}}

Installation

spyrmsd is available onPyPI andconda-forge and can be easily installed from source. SeeDependencies for a description of all the dependencies.

Note

spyrmsd will installrustworkx (multi-platform) when usingpip orconda. You can install other backends manually.

Warning

Ifspyrmsd is used as a standalone tool, it is required to install eitherRDKit orOpen Babel. Neither is automatically installed withpip norconda.

PyPI

pip install spyrmsd

conda

conda install spyrmsd -c conda-forge

GitHub

git clone https://github.com/RMeli/spyrmsd.gitcd spyrmsdpip install.

Dependencies

spyrmsd can be used both as a module or as a standalone tool.

Module

The following packages are required to usespyrmsd as a module:

One of the following graph libraries is required:

Note

spyrmsd uses the following priority when multiple graph libraries are present:graph-tool,rustworkx,NetworkX.This order might change. Useset_backend to ensure you are always using the same backend, if needed.

Standalone Tool

Additionally, one of the following packages is required to usespyrmsd as a standalone tool:

Usage

Standalone Tool

spyrmsd provides a convenient CLI tool. Seespyrmsd's--help for the usage:

python -m spyrmsd -h

Module

fromspyrmsdimportrmsd

RMSD

The functionrmsd.rmsd computes RMSD without symmetry correction. The atoms are expected to be in the same order for both molecules being compared (no atom matching is performed).

defrmsd(coords1:np.ndarray,# Coordinates of molecule 1coords2:np.ndarray,# Coordinates of molecule 2aprops1:np.ndarray,# Atomic properties of molecule 1aprops2:np.ndarray,# Atomic properties of molecule 2center:bool=False,# Flag to center molecules at originminimize:bool=False,# Flag to compute minimum RMSDatol:float=1e-9,# Numerical tolerance for QCP method)

Note

Atomic properties (aprops) can be any Python object when usingNetworkX andrustworkx, or integers, floats, or strings when usinggraph-tool.

Symmetry-Corrected RMSD

The functionrmsd.symmrmsd computes symmetry-corrected RMSD using molecular graph isomorphisms. Symmetry correction requires molecular adjacency matrices describing the connectivity but needs not the atoms to be in the same order.

Atom matching is performed according to the molecular graph. This function should also be used when atoms in the molecules being compared are not in the same order (even if there is not symmetry to be accounted for).

defsymmrmsd(coordsref:np.ndarray,# Reference coordinatedcoords:Union[np.ndarray,List[np.ndarray]],# Coordinates (one set or multiple sets)apropsref:np.ndarray,# Reference atomic propertiesaprops:np.ndarray,# Atomic propertiesamref:np.ndarray,# Reference adjacency matrixam:np.ndarray,# Adjacency matrixcenter:bool=False,# Flag to center molecules at originminimize:bool=False,# Flag to compute minimum RMSDcache:bool=True,# Cache graph isomorphismsatol:float=1e-9,# Numerical tolerance for QCP method)

Note

Atomic properties (aprops) can be any Python object when usingNetworkX andrustworkx, or integers, floats, or strings when usinggraph-tool.

Select Backend

spyrmsd supports the following graph libraries for the calculation of graph isomorphisms:

You can check which backend is being used with

spyrmsd.get_backend()

You can also manually select your preferred backend with

spyrmsd.set_backend("networkx")# spyrmsd uses NetworkXspyrmsd.set_backend("graph_tool")# spyrmsd uses graph_tool

The available backends (which depend on the installed dependencies) are stored inspyrmsd.available_backends.

Development

To ensure code quality and consistency the following tools are used during development:

Pre-commitgit hooks can be installed withpre-commit.

Copyright

Copyright (c) 2019-2024, Rocco Meli.

References

References are tracked withduecredit. Run thecredits.sh script in order to print up-to-date references.

Acknowledgements

Project based on theComputational Molecular Science Python Cookiecutter version1.1.


[8]ページ先頭

©2009-2025 Movatter.jp