Add tests for selection mass evaluation and fix it.

Removed unnecessary and at times incorrect precalculation of total
masses and charges for selected positions. Evaluate them again for each
frame if they may have changed.

Noticed when adding some tests for this behavior; the tests are also
added here.

Also store the masses and charges again in continuous arrays in
preparation for exposing those arrays.

Fixes #1145.

Change-Id: Ifa23d042706d9f2a0b8aa142338812f055f6f60a