Skip to content

Something wrong with rmsd calculation #11

Open
@wewewexiao2008

Description

@wewewexiao2008

Thanks for creating this useful repo! However the current implementation might indeed be missing a crucial step. A modification to add .sum(axis=0) at the end of the _rmsd function seems to align better with the RMSD formula.

This change would sum up the squared distances along the axis, which is necessary to compute the total squared deviation before taking the square root (which I assume happens elsewhere in the code).

$$ \text{RMSD} = \sqrt{\frac{1}{n} \sum_{i=1}^{n} | | x_i - y_i | | ^2} $$

current:

def _rmsd(self, theta, phi, psi, dx, dy, dz):
        matrix = self.get_matrix(theta, phi, psi, dx, dy, dz)
        coord = matrix.dot(self.coord2)
        dist = coord - self.coord1
        return (dist * dist)

should be modified as

def _rmsd(self, theta, phi, psi, dx, dy, dz):
        matrix = self.get_matrix(theta, phi, psi, dx, dy, dz)
        coord = matrix.dot(self.coord2)
        dist = coord - self.coord1
        return (dist * dist).sum(axis=0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions