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