public static Atom centerOfMass ( Atom [ ] points ) { Atom center = new AtomImpl ( ) ; float totalMass = 0.0f ; for ( Atom a : points ) { float mass = a . getElement ( ) . getAtomicMass ( ) ; totalMass += mass ; center = scaleAdd ( mass , a , center ) ; } center = scaleEquals ( center , 1.0f / totalMass ) ; return center ; }
Returns the center of mass of the set of atoms . Atomic masses of the Atoms are used .