implement mdrun -rerun better, simplifying do_md - Redmine #1868
I think the main uses for mdrun -rerun
are to compute PE-like
quantities from the particle positions against the Hamiltonian in the
.tpr. This Hamiltonian might be different from that used in the
simulation, or possibly treats only a subset of the system, or with PE
decomposed into groups. Currently mdrun -rerun
accepts the .tpr and
does its best not to segfault, but it writes a large amount of numbers
that are either junk, or not a “rerun” even if you use the same .tpr.
Full reproduction of the results of a step with mdrun -rerun
requires
the velocity update to be reproducible, because trajectories are written
with x leading v (even for on-step integrators like velocity Verlet), so
one needs a velocity update to compute velocity-based quantities such as
KE, T, P, conserved E, etc. This is tricky because
- rerun can’t reproduce the velocity update for extended ensemble methods (Nose-Hoover, Parrinello-Rahman, MTTK) because these use extended-ensemble dynamical quantities such position and momentum of the extended variables that are not available from a trajectory (though they are often in .tpr and always in .cpt)
- rerun can’t reproduce any of the non-extended leapfrog thermostat or barostat velocity updates, unless nsttcouple1 and/or nstpcouple1, because the implementation computes a scaling factor at coupling steps, and then applies it at every intervening step, and that’s not saved to the trajectory
- the use of nsttcouple and nstpcouple mean that only the step number lets mdrun tell if the rerun velocity update should be associated with coupling even if the data was present - not a big deal in itself, because the user can’t expect a rerun if they changed the step numbers
- stochastic integrators (and also Bussi and Andersen thermostats) can
re-run only if the random numbers are drawn correctly - this is
probably
done right already, if the step number is present (and unchanged) - rerun can’t reproduce the v-rescale conserved quantity, which requires the integral of changes in KE over all steps, and the frames being rerun cannot be assumed to have any such property
- the use of
mdrun -gcom
makes reproducing a velocity update nearly impossible because we don’t know afterwards whether it was used unless we inspect the .log file
Already we hack nstglobalcomm = 1 for rerun, and we could make something work also by requiring all the coupling periods to be 1 (or requiring such a .tpr), but it’s not now a rerun, and enforcing this doesn’t have a clear purpose that I know of.
So, a rerun should simply evaluate potential energy and forces, report
those, and not pretend it can sensibly do anything else. If so, then we
can extract a much simpler implementation of do_rerun()
out of
do_md()
, and thereby simplify do_md()
.
If the rerun .tpr is NVE molecular dynamics (any integrator), or probably the various stochastical dynamics, then the velocity update is trivial and such a rerun could report things derived from velocities, e.g. computed from a new Hamiltonian, but does this serve any purpose? Or can one be imagined?
(from redmine: issue id 1868, created on 2015-12-02 by mark.j.abraham, closed on 2018-10-03)
- Relations:
- relates #1793 (closed)
- relates #2244 (closed)
- relates #2112 (closed)
- relates #1246 (closed)
- relates #2569 (closed)
- relates #2849 (closed)
- relates #3400 (closed)
- Changesets:
- Revision 280ba5a3 by Mark Abraham on 2018-03-28T11:49:28Z:
Free more memory in grompp and mdrun
This will be increasingly useful as we start adding more GoogleTest
cases that call grompp and mdrun repeatedly.
Refs #1793, #1868
Change-Id: Ic0faaa4c3dec2891d0cdc6166561f8ccd4391f44
- Revision 8ee76066 by Pascal Merz on 2018-04-04T10:51:37Z:
Move checkNumberOfBondedInteractions
In task #1868, we will move the rerun functionality from do_md to
a separate function in a new file. As both do_md and the new
do_rerun need access to checkNumberOfBondedInteractions(), it needs
to be moved to a more central location.
Change-Id: Iae0ace11db2f83e5034fdfae21ccac3e7b9e34d1
- Revision c7411433 by Mark Abraham on 2018-04-16T07:17:04Z:
Updated mdrun comparison infrastructure
The functionality for running grompp to produce a .tpr file useful for
comparing two mdrun calculations works better as free functions than a
base class. This patch is essentially a rewrite of the interface,
though the core functionality is roughly the same.
Used raw string literals for nicer looking embedded strings.
Refs #1868
Change-Id: I4b5137b34c3da286e344809b71afd985d9c7bfab
- Revision b70481d1 by Mark Abraham on 2018-08-21T07:59:25Z:
Re-implemented mdrun -rerun tests
Used the new infrastructure to let the rerun test check that the
energies and trajectories (including forces) produced by a rerun
actually match those produced by a normal mdrun. Such a test running
in parallel would have prevented #1868, and will help checking that
any changed or new integrator functionality does the job that it
should do.
Updated some infrastructure to not care whether it gets passed
a C or C++ string.
Removed small pieces of infrastructure originally intended for use by
this patch but which are no longer required.
Refs #1868, #2112
Change-Id: Ifcb211aba62ccb79ebaec21a3088c9e60a618c86
- Revision 564a67c0 by Pascal Merz on 2018-09-21T08:08:16Z:
Make CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS require global communication
Currently, giving the CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS flag, but
none of CGLO_TEMPERATURE, CGLO_STOPCM, CGLO_PRESSURE, CGLO_CONSTRAINT, or
CGLO_ENERGY does not prompt global_stat() in compute_globals(). This has
currently no implications because this specific flag is never set without
at least one of the others, but it is not intuitive and becomes a problem
when setting up a rerun without temperature calculation. This change fixes
this.
Refs #1868, #2647
Change-Id: I53b4dd9a1b7b273f1ce99e8e8c78bf386a693842
- Revision 8270c604 by Pascal Merz on 2018-09-25T00:37:49Z:
Prepare rerun commit
In Task #1868, we will break out rerun from the do_md code. This
results in new files, rerun.{h,cpp}, containing a do_rerun function
which includes only the portions of code in do_md which are relevant
for rerun. It does, however, make sense to diff this new function to
the current do_md to be able to review the changes made. This commit
therefore duplicates the current md.{h,cpp} files to allow for easier
reviewing of the following changes. It does also change runner.cpp to
send any rerun through the new code path. This allows to create to
independent follow-up commits, namely
1 Cleaning up do_md() [I17c9ae4c1c88bdb328e17e75fec55a558613cff0], and
2 Cleaning up do_rerun() [I522d56a610f2a6ff189484c9311b6f53c775ed47].
Commit 1 will thereby likely be easy to review and merge, while
commit 2 might require more discussion.
Refs #1868
Change-Id: I832ce07e3c5932a42151983deb8f527f988b2a2e
- Revision c52e6838 by Pascal Merz on 2018-09-25T05:32:59Z:
Remove unnecessary functionality from do_rerun
As discussed in task #1868, the rerun functionality gets reduced to essentially
"take a configuration and calculate forces and energies". If the trajectory contains
velocities, they are ignored. This allows to remove a lot of functionality from
do_rerun, which is done in this commit.
Functionality removed includes
* Reading of velocities in reruns (reruns won't contain kinetic energy)
* Constraints
* Temperature / pressure coupling
* Essential dynamics
* Interactive MD
* Simulated annealing
* Multisimulations
* AWH
* Expanded ensemble
* Replica exchange
* Checkpointing
* Counter resetting (no benchmarking)
* PME tuning
* FAHCORE
* EnergyHistory
The following quantities are not reported:
* Kinetic energy
* Total energy
* Conserved energy
* Temperature(s)
* Pressure, pressure tensor, and pressure dispersion correction
* Virial tensor(s)
This change also changes the rerun tests not to test for correct
reproduction of the velocities (since they are intentionally set
to zero), and adds some information to the documentation.
Refs #1868
Change-Id: I522d56a610f2a6ff189484c9311b6f53c775ed47
- Revision 11c0af7b by Pascal Merz on 2018-09-25T06:33:00Z:
Remove rerun from do_md
As the rerun functionality is handled in a separate function now, this
commit removes rerun from do_md.
refs #1868
Change-Id: I17c9ae4c1c88bdb328e17e75fec55a558613cff0
- Uploads: