Compilation and portability fixes
Fixed a bunch of stylistic and performance issues discovered via cppcheck.
Added utility to recenter a simulation on the center of mass