|It would be useful to have a removeForce() method for System objects. Now that these objects support deep copies, this method would aid in the manipulation of System objects, such as the construction of alchemical intermediates.|
Here's a suggested method interface:
* Remove a Force from the System. The System relinquishes ownership of it, returning a pointer to the Force, at which point it can be reused or deleted. Remaining Force objects in the System are renumbered accordingly.
* @param index the index within the System of the Force to be removed
* @return a pointer to the Force object that was removed
Force *removeForce(int index);
Failure might trigger an exception or return a null pointer---whichever is most consistent with current OpenMM API conventions.
It need not be this way---another option would be to take the Force pointer as an argument. If it is difficult for the System to simply relinquish ownership, the Force could simply be deleted instead, and success or failure signaled with an integer.