fixed a bug in loop rmsd calculation