Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Andersen Thermostat gives non-zero momentum for multi-component systems #29
my input/output is the following:
After running, the average system momentum in my output file is significantly nonzero.
I tried running a configuration file without the "-T 1" andersen thermostat. That run gave an effectively zero net momentum.
Thus, I conclude that the Andersen thermostat is broken for multicomponent systems
I've simulated the system you've given and I've gotten these results for the momentum:
If you check the output plugin reference documentation, you'll see that this is the average momentum of the system. In this system you have 4000 particles, so your average momentum per particle is actually (0.00088,0.0014,0.00052), giving an average magnitude of 0.00093.
We can check if this is a reasonable deviation from zero. The total number of thermostat events is
Each Andersen thermostat event only thermostats one particle. So we have something like 124 thermostat events per particle. The average momentum per particle doesn't seem so bad in this context, so I don't think this is a bug in the simulator. To double check, I've run the simulation 4x longer to see what happens to the deviation. The results are:
This gives an average per particle of (0.00085,0.000078,-0.00050) with an average magnitude of 0.00048. This is roughly half of the previous value, as expected from a sqrt(N_coll) scaling of sampling from a Gaussian.
To obtain an accurate estimate of the predicted error, we could try assuming that each thermostat is a direct sampling of a Gaussian, and use this to estimate the variance of the sample mean but this is difficult as we don't resample all velocities at once.
Hopefully this clarifies the operation of the thermostat, and gives you a little more confidence in its operation. I'll close this issue as its not a bug but the expected behaviour of the system, but please comment again if you think I've missed something or if its still not clear.