franciscoadasme / chem.cr

Library for dealing with computational chemistry files
https://franciscoadasme.github.io/chem.cr/
MIT License
23 stars 1 forks source link

Add root mean square (rms) method #208

Open franciscoadasme opened 11 months ago

franciscoadasme commented 11 months ago

Many spatial measurement like RMSD and radius of gyration uses RMS, so it makes sense to have a general method for that.

def rdgyr : Float64
  center = self.com
  Math.sqrt mean(&.distance2(center))
end

could be simply

def rdgyr : Float64
  center = self.com
  rms &.distance2(center)
end