  We present a method for performing multithermal-multibaric molecular dynamics
simulations that sample entire regions of the temperature-pressure (TP) phase
diagram. The method uses a variational principle [Valsson and Parrinello, Phys.
Rev. Lett. 113, 090601 (2014)] in order to construct a bias that leads to a
uniform sampling in energy and volume. The intervals of temperature and
pressure are taken as inputs and the relevant energy and volume regions are
determined on the fly. In this way the method guarantees adequate statistics
for the chosen TP region. We show that our multithermal-multibaric simulations
can be used to calculate all static physical quantities for all temperatures
and pressures in the targeted region of the TP plane. We illustrate our
approach by studying the density anomaly of TIP4P/Ice water.
