Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something wrong with rmsd calculation #11

Open
wewewexiao2008 opened this issue Jul 30, 2024 · 0 comments
Open

Something wrong with rmsd calculation #11

wewewexiao2008 opened this issue Jul 30, 2024 · 0 comments

Comments

@wewewexiao2008
Copy link

wewewexiao2008 commented Jul 30, 2024

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant