New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Andersen Thermostat gives non-zero momentum for multi-component systems #29

Closed
zhang10 opened this Issue Feb 27, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@zhang10

zhang10 commented Feb 27, 2013

my input/output is the following:
dynamod -m1 -C 10 --s1 1,1.05,1,1,.5:.9,1.05,.729,1,.5 -T 1 -o BinarySW.startconfig.xml
dynarun BinarySW.startconfig.xml -c 10000000 BinarySW.eqconfig.xml

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

@ghost ghost assigned toastedcrumpets Feb 28, 2013

@toastedcrumpets

This comment has been minimized.

Show comment
Hide comment
@toastedcrumpets

toastedcrumpets Feb 28, 2013

Owner

Hi,
Thanks for taking the time to report a bug, but I don't think that this is one.

I've simulated the system you've given and I've gotten these results for the momentum:

<SystemMomentum>
  <Current x="-1.08893035757427" y="116.72463234306" z="-35.2584754115088"/>
  <Average x="3.52165337998153" y="5.79806413491709" z="2.0840805982459"/>
</SystemMomentum>

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

<Entry Type="System" Name="Thermostat" Event="GAUSSIAN" Count="494657"/>

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:

    <SystemMomentum>
      <Current x="-65.0688680708049" y="-45.305217256979" z="-63.4630915853946"/>
      <Average x="3.38092098238895" y="0.312460480315974" z="-2.02639299092048"/>
    </SystemMomentum>

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.
Marcus

Owner

toastedcrumpets commented Feb 28, 2013

Hi,
Thanks for taking the time to report a bug, but I don't think that this is one.

I've simulated the system you've given and I've gotten these results for the momentum:

<SystemMomentum>
  <Current x="-1.08893035757427" y="116.72463234306" z="-35.2584754115088"/>
  <Average x="3.52165337998153" y="5.79806413491709" z="2.0840805982459"/>
</SystemMomentum>

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

<Entry Type="System" Name="Thermostat" Event="GAUSSIAN" Count="494657"/>

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:

    <SystemMomentum>
      <Current x="-65.0688680708049" y="-45.305217256979" z="-63.4630915853946"/>
      <Average x="3.38092098238895" y="0.312460480315974" z="-2.02639299092048"/>
    </SystemMomentum>

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.
Marcus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment