BioPandas / biopandas

Working with molecular structures in pandas DataFrames
https://BioPandas.github.io/biopandas/
BSD 3-Clause "New" or "Revised" License
715 stars 121 forks source link

Improve RMSD function to take molecular symmetry into consideration? #13

Open ravila4 opened 8 years ago

ravila4 commented 8 years ago

Just wondering what the algorithm is behind the RMSD calculation.

rasbt commented 8 years ago

It should be the "usual" RMSD equation, i.e. screen shot 2016-11-18 at 9 27 21 pm

(https://en.wikipedia.org/wiki/Root-mean-square_deviation_of_atomic_positions)

Here's a link to the actual code: https://github.com/rasbt/biopandas/blob/master/biopandas/pdb/pandas_pdb.py#L152

and the relevant lines are

        total = ((df1['x_coord'] - df2['x_coord'])**2 +
                 (df1['y_coord'] - df2['y_coord'])**2 +
                 (df1['z_coord'] - df2['z_coord'])**2)
        rmsd = round((total.sum() / df1.shape[0])**0.5, 4)
        return rmsd