Feature #2585: Infrastructure supporting external API
clean up mdrun log file handling
With a bit of effort, the mess that is the handling of the log file within mdrun can be cleaned up so that we open and close it in a single place, whether or not we are doing an appending restart.
This might also help implement aspects of gmxapi, or at least clarify how things can work in the long term.
Clarify distinct paths for mdrun log file handling
Opening for appending is actually handled in the checkpointing code,
which is now explicit in mdrunner.
Also handled the error case when the log file cannot be opened.
Also removed unnecessary dependency on commrec.
Extract helper functions for preparing for appending
This simplifies code so we can handle the log file pointer better.
Check log and other files differently during appending restart
We need to do different operations on the log file than the other
files, so it makes sense to separate those aspects of its handling,
while calling a common function for those that are common. That will
also prepare to clean up the opening of the log file in Mdrunner, so
we can do it in only one place.
Checked all the offsets were valid before doing any file operations.
Used a bit less preprocessing, too.
Open mdrun log file only once
The log file is now kept open with a t_fileio held RAII style, which
permits the appending restart code to truncate it if needed, so that
we don't have the opening and closing of the checkpoint file being
managed in several places.