I've seen a number of particle based simulations of things like magnets settling or crystaline structure forming or other phase transitions assosciated with temperature. I can kind of accept that an increase in temperature could be modelled by boosting the velocity of random particles, but that doesn't seem very physical, and if thermal motion is supposed to be random, does that necessarily mean that you can't just increase the speed, you have to change the direction too? Also, how does one arrive at a Blackbody distribution of energies by doing this?

I thought that maybe a way to do it would be to "shake the container" so that particles bouncing off the walls would have a random change in their velocity but that feels like it could decrease energy as often as it increased it. It does have the advantage of representing the particles interacting with something "outside the system" in order to gain and lose energy.

I understand how to calculate the temperature once I have the simulation, but I don't understand how I can change the temperature in a physically accurate way.

(Also I understand that the temperature would remain constant during changes of phase so that's not really important. I suppose my real question is how to add/remove Thermal Energy to a system being simulated as either hard-sphere particles or some kind of simple power law type interaction like Lennard-Jones or Ionic.)

  • 2
    $\begingroup$ The folks over at Matter Modeling SE have plenty of relevant experience here. But note that for heat transfer to occur at the walls of a container, a random amount of energy is added/subtracted during collisions (and it is both added and subtracted, just more is added if heat is flowing in vs out). $\endgroup$
    – Jon Custer
    Commented Aug 3, 2022 at 13:37
  • $\begingroup$ I had no idea there was such a stack-exchange. Thanks for letting me know. Could you perhaps link a question on there that's particularly relevant? $\endgroup$
    – Disgusting
    Commented Aug 3, 2022 at 13:43
  • 1
    $\begingroup$ Something like mattermodeling.stackexchange.com/questions/9374/… gets into the nitty-gritty pretty quickly... $\endgroup$
    – Jon Custer
    Commented Aug 3, 2022 at 13:51

1 Answer 1


The simple answer is that in order to change the temperature, it is sufficient to add to or remove from the simulation system enough energy. It doesn't matter the precise way the variation of energy is implemented. After a transient, usually short with respect to any other relaxation time, a Maxwell-like distribution of velocities is restored, and the system can be considered equilibrated at a new temperature.

The key mechanism underlying such behavior is the chaotic, mixing character of the dynamics of interacting systems. The system equilibrates, and the memory of a possibly non-physical starting configuration is quickly washed out.

  • $\begingroup$ This makes sense to me. If I wanted to simulate the system making contact with another system of a specific temperature, would it be sufficient to randomly boost particles with below the "average Kinetic Energy of the wall" and reduce the speed of particles with "above the average Kinetic Energy of the wall"? I probably should have put something about a Thermal Resevoir in the question as this answer feels like it might be too imprecise a method for me to use. $\endgroup$
    – Disgusting
    Commented Aug 3, 2022 at 14:19
  • $\begingroup$ @Disgusting Well, if there's a wall at a certain temperature, maybe it makes the most sense to make your adjustments at that wall only instead of everywhere in the bulk. As the answer says: the final equilibrium state won't be sensitive to how you're setting the temperature, but the way you get to the equilibrium may be. Relevant MM question: mattermodeling.stackexchange.com/q/528. $\endgroup$
    – HTNW
    Commented Aug 3, 2022 at 15:44
  • $\begingroup$ @Disgusting Since the final state does not depend on how the variation of energy is implemented, it makes sense. But the way and the time you get equilibrium may be, adjustment at the wall is much less efficient than a bulk adjustment. To get convinced of that, you have just to try. $\endgroup$ Commented Aug 3, 2022 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.