  Exploring the free-energy landscape along reaction coordinates or system
parameters $\lambda$ is central to many studies of high-dimensional model
systems in physics, e.g. large molecules or spin glasses. In simulations this
usually requires sampling conformational transitions or phase transitions, but
efficient sampling is often difficult to attain due to the roughness of the
energy landscape. For Boltzmann distributions, crossing rates decrease
exponentially with free-energy barrier heights. Thus, exponential acceleration
can be achieved in simulations by applying an artificial bias along $\lambda$
tuned such that a flat target distribution is obtained. A flat distribution is
however an ambiguous concept unless a proper metric is used, and is generally
suboptimal. Here we propose a multidimensional Riemann metric, which takes the
local diffusion into account, and redefine uniform sampling such that it is
invariant under nonlinear coordinate transformations. We use the metric in
combination with the accelerated weight histogram method, a free-energy
calculation and sampling method, to adaptively optimize sampling toward the
target distribution prescribed by the metric. We demonstrate that for complex
problems, such as molecular dynamics simulations of DNA base-pair opening,
sampling uniformly according to the metric, which can be calculated without
significant computational overhead, improves sampling efficiency by 50-70%.
