Reputation: 61
I transformed the coordinates of two atoms into an array: coord
And I must calculate the root mean squared deviation (RMSD) between the two sets of these coordinates.
For this I have:
def cal_rmsd_numpy(coord_1, coord_2):
rmsd = np.sqrt(((coord_1 - coord_2) ** 2).mean()) ## this would be the formula
return rmsd
rmsd = cal_rmsd_numpy(coord_1, coord_2)
print(rmsd)
But the result does not give me the correct number. I think the error is in the formula. Could someone please help me correct what I have wrong?
The formule for RMSD is:
Upvotes: 0
Views: 7688
Reputation: 21
I believe that there's a mistake in the first formula. You probably wanted to say:
rmsd = np.sqrt((((coordenadas_1 - coordenadas_2)**2).mean()))
Upvotes: 0
Reputation: 77
You have to add up the subtraction of the coordinates firs:
rmsd = np.sqrt((((coordenadas_1 - coordenadas_2)**2).sum()).mean())
Or even more intuitive looking to the formula:
rmsd = np.sqrt((((coordenadas_1 - coordenadas_2)**2).sum())/len(coordenadas_1))
Upvotes: 0
Reputation: 61
Solution found:
rmsd = np.sqrt(((((coordenadas_1 - coordenadas_2)** 2))*3).mean())
Upvotes: 1