Skip to content

Commit fe58810

Browse files
committedApr 10, 2012
Add "docs in progress"
1 parent 915a56f commit fe58810

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed
 

‎docs-in-progress.txt

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
Issues with temperature control and velocity rescaling
2+
3+
First, note that [erfectly elastic reflective collisions with walls impart linear and angular momentum to the system
4+
every time a particle bounces off the wall.
5+
6+
Here are some options for dealing with translation and rotation:
7+
8+
1. Not adjusting for translation or rotation at all.
9+
10+
This leads to rather distracting problems with condensed clusters:
11+
12+
- If you form a cluster, and it bumps a wall or otherwise gets significant translation or rotation when it's
13+
relatively cold, and then you increase the temperature, the translation and rotation get scaled up so the thing
14+
bounces around between the walls and/or spins like crazy.
15+
16+
Although, considered from a macro scale, this translation and rotation of the whole cluster could legitimately be
17+
considered thermal energy--if the cluster had real surfaces to interact with, the energy would be quickly
18+
repartitioned--it still presents a pretty non-representative picture of thermal energy. It also is especially
19+
unrepresentative of how thermal energy would be added in a real experiment.
20+
21+
22+
- If you leave a non-moving, cold cluster alone, eventually it will accelerate spontaneously due to the way velocity
23+
rescaling works. Basically, rescaling periodically multiplies all velocities by a factor that is proportional to
24+
sqrt(1/T) where T is the temperature at that instant. But T fluctuates as molecules vibrate, and the time average
25+
of sqrt(1/T) is greater than sqrt(1/(the time average of T)) to the extent that T fluctuates. This results in a
26+
"pump" that slowly takes energy out of vibrational modes and puts it into translation and/or rotation (this
27+
causes T to fluctuate less). This transfer isn't obvious at first, but once the acceleration starts it quickly
28+
becomes very obvious.
29+
30+
31+
2. Removing translation of the center of mass and rotation around the center of mass before scaling velocities, and
32+
adding them back after scaling velocities. (This is what is currently done.)
33+
34+
This has some advantages relative to case (1) above:
35+
36+
- Now, once a cluster has begun to spin or translate, increasing the temperature doesn't make the whole cluster
37+
spin or bounce around quite so wildly. However, if there are two or more clusters, they may move and spin relative
38+
to each other, and the non-equipartitioned nature of the thermal energy is again obvious, just not as blatant as
39+
or long-lived as in case (1) above.
40+
41+
- In addition, velocity rescaling should no longer cause the whole cluster to accelerate as it does in case (1)
42+
above. That said, individual particles that escape a cluster can appear to accelerate by themselves for the same
43+
reason as described above for the whole cluster. However, they are much smaller and their independence from the
44+
cluster is usually short lived, so again this effect is not as blatant as in case (1) above.
45+
46+
However, there are some side effects of this choice.
47+
48+
- First, if the system is in a "gaseous" phase so that molecules bounce off the walls, then dropping the temperature
49+
quickly stops the relative motion of the particles but makes the whole system appear to drift and/or spin. This
50+
can be discocerting.
51+
52+
- Second, the kinetic energy of the system is no longer perfectly related to the thermal energy, since the overall
53+
translation and rotation is not considered part of the system's thermal energy. This might lead to some confusion
54+
if not managed carefully (for example, by making it explicit that there are translational, rotational, and
55+
thermal contributions to the kinetic energy, and making it possible to visualize these.)
56+
57+
58+
3. Using periodic boundary conditions.
59+
60+
A different take on how to deal with distracting effects caused by the combination of velocity rescaling and
61+
motions caused by collisions with hard walls is to remove the hard wall boundary conditions entirely, and instead to
62+
use a scheme commonly employed in research simulations, "periodic" boundary conditions.
63+
64+
In this case, particles "wrap around" the left edge to re-appear at the right edge, and vice versa, and similarly
65+
for the bottom and top. This is a bit like the old-school video game "Asteroids". When calculating the interaction
66+
between two particles, the simulation considers whether which "wrapped around" image of the second particle is
67+
closer, and that closest image is used for subequent calculations.
68+
69+
This has the advantage of simulating the essential properties of a fluid in the tiny volume that is practical to
70+
simulate, without incurring effects that are caused by having a large proportion of the particles being so near the
71+
edge -- there effectively is no "edge".
72+
73+
On the other hand, for our purposes this may not be ideal, because "wrap around" behavior isn't visually realistic
74+
and students (or other naive observers) are almost certain to be confused by it. Molecular Workbench does use
75+
periodic boundary conditions in some cases, although the wrap-around behavior is apparently hidden by only
76+
revealing the center of the simulated area, not the edges where the wrap-around happens.
77+
78+
For the "Simple Atoms" demo, one might be concerned that if we used this solution, then a cluster of atoms might
79+
wander off the edge of the screen, but actually the solution might be workable. The large cluster would not wander
80+
off the edge of the screen because the system doesn't get constant "kicks" from the wall.
81+
82+
83+
- Because the system doesn't get "kicks" from the wall, any velocity of the center of mass is due to numerical error
84+
and can be safely subtracted out and, correspondingly, increasing the temperature won't simply scale up translation
85+
and rotation. Relative motion of two condensed clusters, of course, will scale up when temperature is scaled up, as
86+
in case (2) above.
87+
88+
- However, unlike in case (2) above, because of the lack of "kicks" from collision with the wall, the condensed
89+
clusters may not move relative to each other at all, and it may be hard to get them to condense with each other.
90+
Bounces off the wall in case (1) and (2) provide mixing.
91+
92+
- Spontaneous acceleration of particles may be reduced relative to case (2) because the center of mass isn't being
93+
subject to "kicks". I haven't experimented with this yet, however.
94+
95+
96+
4. Removing translation of the center of mass and rotation around the center of mass at every frame (while
97+
distributing the translational and rotational energy removed back into the thermal motion of the particles)
98+
99+
In some ways, this is the most aggressively "artificial" treatment of the center of mass in that it involves the
100+
most blatant adjustment of the laws of motion. It leads to artifacts because it's not obvious to observers that,
101+
in effect, the "camera" is moving and rotating to compensate when particles move relative to each other.
102+
103+
That said, the micro behavior is still reasonable, and this may be the best approximation to the periodic boundary
104+
condition case that still allows particles to bounce off the walls.
105+
106+
107+
108+
* Potential speedups
109+
110+
* Running md outside the browser using Node

0 commit comments

Comments
 (0)
Please sign in to comment.