# How to choose between Molecular Dynamics and Monte Carlo when beginning to simulate either equilibrium or non-equilibrium systems?

Answers to Are MD and MC both able to study both equilibrium and non-equilibrium systems? include lots of examples pointing to "yes".

I'm currently faced with a task of modelings small islands of 2D materials on a crystal surface - how they rotate, translate, grow, and settle down into certain rotational and translational equilibrium orientations. Right now I use Hooke's law for bonds and a 2D periodic surface potential.

For me, I can simply pop in any solver I want; for Molecular Dynamics I use Python's solve_ivp and have a Python implementation of FIRE and will be coding a FIRE method in C.

For Monte Carlo I have an ugly, slow Python implementation and there are some (presumably faster) packages out there I could try.

My question is more general, but you can use that context if it helps an answer.

Question: What are the differentiating factors that tell us how to choose between Molecular Dynamics and Monte Carlo when beginning to simulate either equilibrium or non-equilibrium systems?

The main difference between MD and MC is, MD is a deterministic method, and MC is a probabilistic method.

So, MC is unable to simulate something which needs total accuracy. For instance, if you want to simulate the movement of a spacecraft, MC cannot do that. Or, rather it would be highly unreliable.

Another thing to consider is, it is very hard (research is ongoing) to parallelize MC algorithms. Therefore, if you want to run MC in GPU or in a distributed system, it would be a very very difficult task.

On the other hand, MD cannot simulate on-lattice models. I.e., the atoms need to be freely movable, e.g., gas or liquid.

Finally, the decision depends on the nature of the problem. If you are simulating, say a protein folding, and you are following the all-atom method rather than Coarse Graining, MD would be very very expensive to run. Because it will take huge computing resources.

• "On the other hand, MD cannot simulate on-lattice models. I.e., the atoms need to be freely movable, e.g., gas or liquid." I disagree with this. If you assemble your atoms using a harmonic oscillator potential for bonds and don't include a separate thermal bath, a damped dynamical method like FIRE will allow you to do a relaxation and find an energy minimum, and the atoms will remain on-lattice. Would not such a calculation be called molecular dynamics.
– uhoh
Commented May 29, 2023 at 16:31
• @uhoh, Molecular dynamics simulations typically involve the numerical integration of equations of motion for atoms or particles, often utilizing interatomic potentials to model the forces between them. These simulations typically include a thermal bath to account for the effects of temperature and allow the system to explore different energy states. The thermal bath helps maintain a desired temperature by exchanging energy with the system. Commented May 29, 2023 at 16:46
• @uhoh, In the scenario you described, without a separate thermal bath and only using a harmonic oscillator potential for bonds, the system is likely to behave differently. The absence of a thermal bath means that temperature effects and energy exchange with the environment are not considered. As a result, the system would not exhibit the characteristic dynamics observed in traditional MD simulations. Commented May 29, 2023 at 16:46
• @uhoh, Instead, the relaxation process you described, where the atoms are allowed to relax and find an energy minimum using a damped dynamical method like FIRE, could be considered a form of energy minimization or geometry optimization. It focuses on finding the minimum energy configuration of the system by iteratively adjusting atom positions. However, it does not involve the time evolution of the system as in molecular dynamics. Commented May 29, 2023 at 16:47
• @uhoh, Please, post a separate question and wait for others to post an answer. I have nothing more to add. Commented May 29, 2023 at 23:17

The shortest advice I can give you is to search the literature. You must look at the approaches that have been previously tried for your system, especially because these only tend to be published when they work reasonably well. Without doing that you are just following the advice of strangers on the Internet, and while that's perfectly acceptable when deciding where to eat for lunch, that's very difficult to justify in trying to seriously produce scientific knowledge.

Almost exactly a year ago I put this picture on MMSE, from Allen and Tildesley's essential textbook:

It is very tempting to start "at the top" of this diagram and say "Let's simulate surface hopping in vapour deposition!" or whatever your phenomenon is. But you need to start at the bottom and ask yourself:

• Do I have experimental results to compare to a model of my phenomenon of interest?
• Do I have a theoretical framework to explain what I see in a model of my phenomenon of interest?

Ask in addition what the precision of those results and frameworks are,1 because that in turn determines the amount of simulation data you need -- the longer (shorter) you can run your simulation, the more (less) precise your model estimate will be.

You also face the problem of how to efficiently use your computational time. You need to search the literature! There are packages out there that are thousands of times more efficient than a Python solve_ivp script. You could spend a day writing up a Python implementation and then find that it takes a year to run your simulations -- or you could spend a month learning a package like LAMMPS or GROMACS and then run your simulations in a week. Which sounds better?

But most importantly, you must make sure your model can efficiently calculate theoretical details that can be compared with your experiments. Take, again, surface hopping during vapour deposition. You could just dump a bunch of particles on a surface and run a NumPy integrator and get a diffusivity. But when your experimental value turns out to be a hundred times smaller, what are you going to change? The model masses? The bond strength? What if, it turns out, your model was already as accurate as it could be for its simplicity, and you spend months tweaking parameters only to find out that every tweak makes things worse? And what if it turns out you had the simplest of typos (while converting units, let's say -- the bane of every molecular modeller), and you had the right answer all along?

That's why you must search the literature, and if you are new to the field, you should start by trying to replicate a known study. This also familiarises you with the process of comparing theory to model to experiment.

For what it's worth, in your situation, I'd immediately search for "kinetic Monte Carlo simulation of surface deposition", for which Google returns me an excellent-looking review. But a kMC simulation (as they're known for short) requires you to input sensible reaction rates. You'd probably need to get those from a quantum calculation of some sort, probably a nudged-elastic band calculation of the individual reaction energy profiles using density functional theory. Note that the latter does not fall in your "MC or MD" question, and the former might not have fallen in your umbrella MC category either (most kMC people I know think of themselves as doing something more specialised than regular molecular MC, using something like the GOMC package, and they're not wrong).

But again -- you shouldn't be basing your scientific research on what a stranger says on MMSE. Go look through the literature and see what the field is doing. There is no shortcut for that.

1 If I want to explain why gravitational acceleration is 9.8 meters per second squared, I just need to know Newton's law of gravity and the mass and radius of the earth. If I want to explain its value to nine decimal places, suddenly I have to learn general relativity too.

• Thank! Still looking for "if you need linear impulse use a hammer; if torque then screw-driver" rather than "hammers are for driving nails, screwdrivers are for driving screws" answer because the only way I learn things well is from the fundamentals first, from the inside-out, not "follow the leader" style. As for "you shouldn't be basing your scientific research on what a stranger says on MMSE" I never base anything on what folks say here, I use my brain quite well. But I definitely do gain real insights in "aha!" moments when the answer author's thinking is well impedance matched to mine :-)
– uhoh
Commented May 30, 2023 at 4:21
• After asking over 3,000 Stack Exchange questions I've learned to integrate it well with my own work. For a few "Aha!" examples: What does "symplectic" mean in reference to numerical integrators, and does SciPy's odeint use them? and determining if a coincident point in a pair of rotated hexagonal lattices is closest to the origin? I never would have thought to move to the complex plane and treat the lattice points as Eisenstein integers!
– uhoh
Commented May 30, 2023 at 4:29
• so for me, being different than you, to "Which sounds better?" of course writing the python and running small problems first, tweaking the algorithm, moving from solve_ivp() to FIRE using Python's Ctypes is infinitely more enjoyable, rewarding and educational than quickly learning to assemble a script for a behemoth black box package. Of course I'll eventually get around to that if it turns out that I need to, but for me the reward is in the process, not just getting result after result as quickly as possible. Perhaps it's a luxury of being old?
– uhoh
Commented May 30, 2023 at 4:43
• I'm glad you're comfortable working "from the foundations up" -- but I do find a bit of value working at the forefront of the field! For example, you've been told many times that "MD is deterministic" -- but lots of work is done with probabilistic Langevin thermostats, and there's a fantastic theory (Girsanov reweighting) that uses the randomness to probe fluctuations effectively! Commented May 30, 2023 at 4:57
• Small system sizes are also known to bias all kinds of observables in MD simulations, so the danger of using a very slow program is that you may limit yourself to very small system sizes and then produce results that are not extensible to more realistic systems. But, I'm sure you will know how to proceed according to your own plans. All the best, and I hope that what I told you was at least of some use! Commented May 30, 2023 at 4:59