Molecular dynamics may also have a role as on optimization tool. Let us suppose that a set of N particles has many possible equilibrium configurations. The energy of these configurations is in general different, and one of them will be the optimal one; all of them, however, correspond to local minima in the energy, and are each other separated by energy barriers. Such a situation occurs very commonly, for instance, in cluster physics.
Finding the optimal structure within an approach based on traditional minimization techniques (steepest descent method, conjugate gradient method, etc.) is tricky, as these methods do not normally overcome energy barriers and tend to fall into the nearest local minimum. One therefore would have to try out several different starting points, corresponding to different ``attraction basins'' in the energy landscape, and relax each of them to the bottom of the basin. The optimal structure would then be the one with the lowest energy, provided that we were sage enough to select it in the list of candidates to try.
Temperature in a molecular dynamics (or Monte Carlo) calculation provides a way to ``fly over the barriers'': states with energy E are visited with a probability . If T is sufficiently large, the system can ``see'' the simultaneous existence of many different minima, spending more time in the deeper ones. By decreasing slowly T to 0, there is a good chance that the system will be able to pick up the best minimum and land into it. This consideration is the base of simulated annealing methods, where the system is equilibrated at a certain temperature and then slowly cooled down to T=0. While this procedure does not guarantee that the true minimum will be reached, it often brings the system into a good minimum, and as no a priori assumptions are made about the optimal structure, it often brings about structures which were difficult to foresee by intuition alone.
This method is often used to optimize atomic structures, but its validity is more general: given an objective function depending on N parameters, one can regard each of these parameters as a degree of freedom, assign a ``mass' to it, and move the system with a molecular dynamics or Monte Carlo algorithm to perform simulated annealing. One of the early application of this method can be found in a famous paper discussing an application to the ``traveling salesman'' problem .