How to efficiently cool down simulated gas by time-dependent potential? I'm trying to simulate condensation of a highly diluted gas (a model gas, not any real one). For simplicity I restrict the simulation to 2 dimensions. To setup the simulation I take some interparticle potential like Lennard-Jones one, add gravity force and put the particles in a box.
Currently, to cool down the gas I just widen the box over time. Here's what the gas evolution looks like:

The problem is that once it is large enough, total energy almost ceases to decrease. This is because the particles hit the moving wall rarer with time.
Thus my question is: how can I make the cooling more uniform WRT time, and still based on time-dependent potential, i.e. not adding any friction terms to equations of motion?
 A: Instead of having the walls expand, all you can do is lower the 'temperature' of the walls. As it's only a simulation, you can simply assume the walls to be at a lower temperature that the particles. By doing this, when the particles collide with the wall, they would lose some kinetic energy. 
I've worked with simulations in Processing before and I assume that when a particle hits either the top or bottom wall, you multiply the Y component of the velocity by -1? Simply multiply this by something like -0.95 or any other arbitrary number that lies between -0.9 and -1 (not including -1).
A: I assume you handle moving boundary conditions properly so that a particle moving with velocity $v$ hitting a wall with velocity $a$ winds up with velocity $-v+a$. That is, it bounces perfectly in the Galilean frame where the wall is stationary. You might be handling interparticle collisions, probably as billiard-ball style collisions. This would definitely speed up the thermalization of the system - for gas particles to lose kinetic energy, they can just hit other particles that have hit a wall instead of directly hitting the wall themselves. 
If you've done both of those things, there isn't much left to do! As you mentioned, the obvious thing to do is to increase the collision rate. This can be done by: increasing the temperature, increasing the number of particles, decreasing the size of the box, or letting the walls move more slowly. In fact, increasing the temperature is computationally equivalent to letting the walls move more slowly: You end up increasing the velocity of the particles, so to preserve accuracy you make your timestep smaller, and now the particles look the same speed and the walls look slower!
Finally, recall that expansion into a vacuum does not change the temperature. If you have a balloon containing gas at temperature $T$ inside of a metal box containing vacuum, and you pop the balloon, the gas stays at temperature $T$ as it expands. The behavior you observe is expected for fast moving container walls: The temperature actually doesn't change as much as you'd expect for infinitely slow moving walls.
