Multicanonical MD by a variable-temperature thermostat or variable-pressure barostat

The code is an enhanced sampling method for a flat-energy-distribution, or a flat-density-distribution, molecular dynamics simulation. It is freely distributed under the Lesser GNU Public License.


Molecular dynamics (MD) is a useful tool in studying complex molecular systems. A regular MD simply follows Newton’s equation, which conserves the total energy E and thus generates configurations in a microcanonical ensemble. We can, however, modify the equation of motion by an artificial thermostat to sample a different distribution, in which the total energy fluctuates, such as the canonical distribution.

For a system with high energy barriers, the limited exploration of the energy landscape in the canonical distribution is insufficient. A multicanonical ensemble, in which the energy is broadly sampled, is more suitable. The construction of the multicanonical ensemble is nontrivial, for the flat energy distribution requires the inverse of the unknown density of states, 1/Ω(E), as the sampling weight.

We here pursue the construction of multicanonical MD by using a variable temperature equal to β(E) = d log Ω(E) / dE. We describe several thermostats to set this temperature. The method is built on a previous Monte Carlo method by Yan and de Pablo. Here the sampling along the total energy is directly incorporated into the thermostat for the MD simulation.

Source code and usage

The source code is contained in We assume a Linux environment. To use the package,


Program Description
ljmd Flat-energy-distribution simulation on a Lennard-Jones system.
ljvol Flat-volume-distribution simulation on a Lennard-Jones system.
gomd Flat-energy-distribution simulation on a structure-based model of proteins.
enerw Energy-reweighting program for the output of ljmd and gomd.
volrw Volume-reweighting program for the output of ljvol.

The output of ljmd is "avb.dat" (energy histogram, temperature, etc.) and "epot.his" (potential energy histogram). To check if a flat energy distribution is reached, you can type the following in Gnuplot
    plot [][0:] "avb.dat" u 1:5 w l

The output of gomd is similar, but the name is "goavb.dat" instead of "avb.dat".

The output of ljvol is "avp.dat" (density histogram, pressure, etc.) and "vol.his" (volume histogram). To check if a flat density distribution is reached, type
    plot [][0:] "avp.dat" u 1:5 w l
in Gnuplot.

Feedback is an unsupported software. Please send questions and comments to

Professor Michael W. Deem
Rice University
Department of Physics and Astronomy
6100 Main Street - MS61
Houston, TX 77005-1892 USA


1) C. Zhang and M. W. Deem, ``Multicanonical Molecular Dynamics by Variable-Temperature Thermostats and Variable-Pressure Barostats,'' A reprint is available.