Simplify gmx chi
This change is pure refactoring that prepares for performance
improvements to ResidueType handling that will benefit both grompp and
pdb2gmx.
Use vector and ArrayRef to replace C-style memory handling. Some
histogram vectors were being over-allocated by 1, which is no longer
safe to do now that the size of the vector is relevant when looping,
so those are reduced.
Eliminated and reduce scope of iteration variables. Removed an unused
function and some debug code in comments. Used const references rather
than pointers where possible. Used range-based for and algorithms in
some places that are now possible to do so.