generalize the c++ rigid body framework so it works with custom atom indices.