Move mdrun mainFunction to client code.
supports gmxapi milestone 4, described at #2605
API clients need to be able to initialize and run MD simulations with
calls from separate code blocks or even translation units. Also, we
need clear distinctions between a pre-launch master Mdrunner and the
non-master Mdrunner threads.
In this change:
* Insert a Builder on which to develop the distinction between user
interface and implementation code. User interface is handled in
Director code, while the Builder and code further down the mdrun call
stack should be user interface agnostic (i.e. not CLI-centric).
* Introduces a Context object to hold some resources. (see milestone 5
and issue #2587)
* Prepare for more stateful Mdrunner objects, documenting resources in
need of clearer management, describing future use cases and possible
implementation details.
* Make Mdrunner non-copyable and not constructable by clients. Worker
threads can initialize a new Mdrunner from the master instance with
cloneOnSpawnedThread.
* Clarify parameter setting for spawned Mdrunner threads.
* Begin to encapsulate filename options available to client code from
the actual client code.
* Remove extraneous variables `nfile` and `fnm`.
Later changes will:
* Separate Mdrunner into Launcher and Worker at mdrunner() call so that
tMPI runner does not look reentrant.
* Hide data and clarify ownership / modernize memory management /
clarify the subjects of the Builder `add` operations.
* Clarify separation of user interface from API parameters.
* Flesh out SimulationContext and related classes.
Refs #2605
Change-Id: I1db1d34b07ec0f8ba5f246ab763c74ad9eafe8f3