  The sensitivity of molecular dynamics on changes in the potential energy
function plays an important role in understanding the dynamics and function of
complex molecules.We present a method to obtain path ensemble averages of a
perturbed dynamics from a set of paths generated by a reference dynamics. It is
based on the concept of path probability measure and the Girsanov theorem, a
result from stochastic analysis to estimate a change of measure of a path
ensemble. Since Markov state models (MSM) of the molecular dynamics can be
formulated as a combined phase-space and path ensemble average, the method can
be extended toreweight MSMs by combining it with a reweighting of the Boltzmann
distribution. We demonstrate how to efficiently implement the Girsanov
reweighting in a molecular dynamics simulation program by calculating parts of
the reweighting factor "on the fly" during the simulation, and we benchmark the
method on test systems ranging from a two-dimensional diffusion process to an
artificial many-body system and alanine dipeptide and valine dipeptide in
implicit and explicit water. The method can be used to study the sensitivity of
molecular dynamics on external perturbations as well as to reweight
trajectories generated by enhanced sampling schemes to the original dynamics.
