Giter Site home page Giter Site logo

izumitkh / rmsd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from charnley/rmsd

0.0 0.0 0.0 543 KB

Calculate Root-mean-square deviation (RMSD) of two molecules, using rotation, in xyz or pdb format

License: BSD 2-Clause "Simplified" License

Python 99.66% Makefile 0.34%

rmsd's Introduction

Calculate Root-mean-square deviation (RMSD) of Two Molecules Using Rotation

The root-mean-square deviation (RMSD) is calculated, using Kabsch algorithm (1976) or Quaternion algorithm (1991) for rotation, between two Cartesian coordinates in either .xyz or .pdb format, resulting in the minimal RMSD.

For more information please read RMSD and Kabsch algorithm.

Motivation

You have molecule A and B and want to calculate the structural difference between those two. If you just calculate the RMSD straight-forward you might get a too big of a value as seen below. You would need to first recenter the two molecules and then rotate them unto each other to get the true minimal RMSD. This is what this script does.

No Changes Re-centered Rotated
begin translate rotate
========== =========== ==========
RMSD 2.50 RMSD 1.07 RMSD 0.25

Citation

Please cite this project when using it for scientific publications.

Installation

Easiest is to get the program vis PyPi under the package name rmsd,

pip install rmsd

or download the project from GitHub via

git clone https://github.com/charnley/rmsd

There is only one Python file, so you can also download calculate_rmsd.py and put it in your bin folder.

wget -O calculate_rmsd https://raw.githubusercontent.com/charnley/rmsd/master/rmsd/calculate_rmsd.py
chmod +x calculate_rmsd

Usage examples

Use calculate_rmsd --help to see all the features. Usage is pretty straight forward, call calculate_rmsd with two structures in either .xyz or .pdb. In this example Ethane has the exact same structure, but is translated in space, so the RMSD should be zero.

calculate_rmsd tests/ethane.xyz tests/ethane_translate.xyz

It is also possible to ignore all hydrogens (useful for larger molecules where hydrogens move around indistinguishable) and print the rotated structure for visual comparison. The output will be in XYZ format.

calculate_rmsd --no-hydrogen --print tests/ethane.xyz tests/ethane_mini.xyz

If the atoms are scrambled and not aligned you can use the --reorder argument which will align the atoms from structure B unto A. Use --reorder-method to select what method for reordering. Choose between Hungarian (default), distance (very approximate) and brute force (slow).

calculate_rmsd --reorder tests/water_16.xyz tests/water_16_idx.xyz

It is also possible to use RMSD as a library in other scripts, see example.py for example usage.

Problems?

Submit issues or pull requests on GitHub.

Contributions

Please note that we are using black with line length of 99. Easiest way to abide to the code standard is to install the following package.

pip install pre-commit

and run the following command in your repository

pre-commit install

This will install a hook in your git and re-format your code to adhere to the standard. As well as check for code quality.

rmsd's People

Contributors

charnley avatar larsbratholm avatar kplauritzen avatar ashafix avatar xg590 avatar cstein avatar nbehrnd avatar hmcezar avatar mcocdawc avatar benjfitz avatar aandi avatar yurivict avatar termehansen avatar dubinnyi avatar biomadeira avatar charlielaughton avatar andersx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.