## Modeling Macroscopic Mechanics using MD2D

Even though MD2D is principally intended as an engine for simulating molecular dynamics, it can be used to create numerically accurate simulations of macroscopic mechanics by following some unit-scaling conventions. This is possible because, like other molecular dynamics simulators, MD2D treats atoms as particles that obey Newton's Law, and simulates molecular behavior using force fields that also apply to macroscopic objects. For example, pairwise bonds are modeled as Hooke's Law springs, and electrostatic interactions, e.g. between charged ions, follow Coulomb's Law. Furthermore, MD2D takes the extra step of simulating gravitational fields, which are negligibly weak in the real-world situations modeled in molecular dynamics simulations, but which are very useful for modeling macroscopic phenomena.

As a concrete example, one can create a model of a pendulum by modeling two atoms connected by a very stiff “bond” with an very long equilibrium length, affixing a restraint to the topmost atom (making it a “pivot”) and applying a gravitational field many orders of magnitude stronger than Earth's (so that its effects are actually visible at the microscopic scale). This model is not a simulation of any realistic molecular-scale phenomenon, but—modulo the scale—it behaves just like an ordinary macroscopic pendulum.

A number of models like this were created using Classic MW. However, they were designed for rough, qualitative versimilitude; measurement units were omitted from the interface, and users were not expected to perform quantitative analysis of the models' behavior. In the Next Gen MW project, however, there are a number of use cases that require quantitive accuracy of these models.

In order to create models which stand up to quantitative analysis, however, it is necessary to settle on an convention which relates a measurement the microscopic units reported by the MD2D engine to an equivalent measurement in macroscopic units. For example, we propose a convention by which a length of $$n$$ nm is considered to represent $$n$$ m. We can freely choose conventions to relate length, time, and mass; once those three are selected, the conversion factors for all other units used by MD2D are completely determined, and can be derived. This will be demonstrated below in the discussion of a proposed convention for conversion of MD2D's native units to MKS units.

## Converting MD2D Units to MKS Units: Free Choices

### Length

MD2D records lengths in nanometers. Therefore, it is reasonable to let 1 nanometer represent 1 meter: $$\text{1 nm $$\rightarrow$$ 1 m}$$

### Mass

MD2D records masses in atomic mass units (amu, sometimes also called Daltons.) Therefore, let 1 amu represent 1 kilogram: $$\text{1 amu $$\rightarrow$$ 1 kg}$$

### Time

MD2D records time in femtoseconds. If we choose a reasonable timeStep such as 1 fs, and a timeStepsPerTick of 167 time steps per view refresh, then 167 fs of model time will pass between view refreshes, which occur 60 times per second. (At least for simpler models that run at the full frame rate.) In that scenario, 1 second of wall clock time corresponds to approximately $$10^4 \mbox{ fs}$$ of model time.

In order to maintain an approximately 1:1 ratio of wall-clock time to the time reported by the model (after the transformation from femtoseconds), let $$10^4$$ femtoseconds represent 1 second: $$10^4 \text{ fs} \rightarrow 1 \text{ s}$$ $$\text{ (also ensure timeStep $$\times$$ timeStepsPerTick = 167 fs/frame)}$$

## Converting MD2D Units to MKS Units: Derived Units

The remaining units can be derived from the choices described above, as follows:

### Velocity

MD2D records velocities in $$\text{nm / fs}$$. Using the conversions above, $$\text{1 nm/fs $$\times$$ 1 m/nm $$\times 10^4$$ fs/s $$= 10^4$$ m/s}$$ $$\therefore \text{1 nm/fs $$\rightarrow 10^4$$ m/s}$$

### Acceleration

MD2D records accelerations in $$\text{nm / fs\(^2$$}\). $$1 \mbox{ nm/fs}^2 \times 1 \mbox{ m/nm} \times (10^4 \mbox{ fs/s})^2 = 10^8 \mbox{ m/s}^2$$ $$\therefore 1 \mbox{ nm/fs}^2 \rightarrow 10^8 \mbox{ m/s}^2$$

### Force

MD2D records forces in $$\text{amu nm / fs\(^2$$}\). $$\text{1 amu nm / fs$$^2 \times 1$$ kg / amu $$\times$$ 1 m / nm $$\times (10^4$$ fs/s)$$^2 = 10^8$$ kg m/s$$^2$$ = 10$$^8$$ N }$$ $$\therefore \text{1 amu nm / fs$$^2 \rightarrow 10^8$$ N }$$

### Energy

MD2D records energies internally in $$\text{amu nm\(^2$$ / fs$$^2$$}\). However, it converts energies to $$\text{eV}$$ before reporting them.

First, note the following conversion from true $$\text{eV}$$ to true $$\text{amu nm\(^2$$ / fs$$^2$$}\). $$\text{1 eV = 1.602} \times 10^{-19} \text{ J}$$ $$\text{(remember that 1 J} = \text{1 kg m}^2 / \text{s}^2)$$ $$1.602 \times 10^{-19} \text{ kg m}^2 / \text{s}^2 \times 6.0221 \times 10^{26} \text{ amu/kg} \times (10^9 \text{ nm/m})^2 \times (10^{-15} \text{ s/fs})^2 = 9.649 \times 10^{-5} \text{ amu nm}^2/\text{fs}^2$$

Then, apply our macroscopic–unit conventions to derive the conversion: $$1 \text{ eV} = 9.649 \times 10^{-5} \text{ amu nm}^2/\text{fs}^2 \times 1 \text{ kg/amu} \times (1 \text{ m/nm})^2 \times (10^4 \text{ fs/s})^2 = 9.649 \times 10^3 \text{ kg m}^2 / \text{s}^2$$ $$\therefore1 \text{ eV} \rightarrow 9.649 \times 10^3 \text{ J}$$

### Density

MD2D records densities in $$\text{amu} / \text{nm}^2$$. Straightforwardly, $$1 \text{ amu} / \text{nm}^2 \rightarrow 1 \text{ kg} / \text{m}^2$$

### Damping Force

MD2D can simulate a damping force (“friction”) on selected atoms, according to the rule $$F_d = -bv, \text{ where } b = \text{ friction } \times \text{ viscosity }$$.

The “viscosity” is treated as a dimensionless multiplier of the friction, so friction is a ratio of force to velocity. In MD2D, this is represented as a ratio of $$\text{amu nm}/ \text{fs}^2$$ to $$\text{nm / fs}$$, or $$\text{amu / fs}$$. $$1 \text{ amu/fs} \cdot 10^4 \text{ fs/s} \cdot 1 \text{ kg/amu} = 10^4 \text{ kg/s } (= 1 \frac{\text{N}}{^\text{m}/_\text{s}})$$ $$\therefore 1 \text{ amu/fs} \rightarrow 10^4 \text{ kg/s } (= 10^4 \frac{\text{N}}{^\text{m}/_\text{s}})$$

### Spring Constants

Following the lead of Classic MW, MD2D treats the spring constants of bonds and restraints using units that indicate the change in the energy gradient for a given displacement from the equilibrium. Therefore, in MD2D, spring constants are notated in units of $$\text{eV} / \text{nm}^2$$.

Using the translation of energy units derived above, the correspondence is: $$1 \text{ eV} / \text{nm}^2 \cdot (9.649 \times 10^3 \text{ J}/\text{eV}) \cdot (1 \text{ nm}/\text{m})^2 = 9.649 \times 10^3 \text{ J}/\text{m}^2 = 9.649 \times 10^3 \text{ N} / \text{m}$$ $$\therefore 1 \text{ eV} / \text{nm}^2 \rightarrow 9.649 \times 10^3 \text{ N} / \text{m}$$

### Charge

MD2D records charges in multiples of the elementary charge $$\rm e$$. We can work out the equivalent macroscopic charge by calculating the force that MD2D would compute for two charged atoms, $$1 \text{ nm}$$ apart, having charges $$\rm +1e$$ and $$\rm -1e$$. Translating the geometry of the model to its macroscopic equivalent, and then translating the force calculated by MD2D to its macroscopic equivalent, allows us to compute the macroscopic-equivalent charge that would be required to generate that force.

A complication (at least for now) is that, in order to maintain compatability with Classic MW, MD2D uses an effective value of the Coulomb constant that is 0.346 of the true value. (Search for CLASSIC_MW_FUDGE_FACTOR in the code.)

We can start by calcuting the actual force between the two point charges $$+1\rm e$$ and $$-1 \rm e$$ 1 nm apart: $$q_e \cdot \frac{+1\rm e \cdot -1 \rm e}{(1 \text{ nm})^2} = 8.9876 \times 10^9 \text{ N m}^2/\text{C}^2 \cdot -(1.602 \times 10^{-19} \text{ C})^2 \cdot 10^{18} \text{ m}^{-2} = 2.307 \times 10^{-10} \text{ N}$$

This needs to be converted to the MD2D base unit for force: $$2.307 \times 10^{-10} \text{ N} = 2.307 \times 10^{-10} \text{ kg m}/\text{s}^2 \cdot 6.0221 \times 10^{26} \text{ amu/kg} \cdot 10^9 \text{ nm/m} \cdot (10^{-15} \text{ s/fs})^2 = 1.389 \times 10^{-4} \text{ amu nm/fs}^2$$

Then, it is important to multiply by the “fudge factor” mentioned above to determine the actual value of the force as it will be calculated by MD2D for this situation. (We require the values computed by MD2D to be quantitatively accurate after we apply the macroscopic unit transformation, thus we must deal with the values it actually calculates, rather than the theoretically correct calculation above.) $$1.389 \times 10^{-4} \text{ amu nm/fs}^2 \cdot 0.346 = 4.807 \times 10^{-5} \text{ amu nm/fs}^2$$

Note that the microscopic situation corresponds to two point charges separated by 1m. (Recall that the shell theorem tells us we can treat the charged “balls” of the atoms just like point charges located at their centers.) Using the macroscopic equivalence described above for forces, we see that MD2D would calculate the following macroscopic force between the 1–meter–apart charges as follows: $$4.807 \times 10^{-5} \text{ amu nm/fs}^2 \cdot 1 \text{ amu/kg} \cdot 1 \text{ m/nm} \cdot (10^4 \text{ fs/s})^2 = 4.807 \times 10^3 \text{ N}$$

We can compute the charges that would be required to generate this force: $$\sqrt{\frac{4.807 \times 10^3 \text{ N} \cdot (1 \text{ m})^2}{8.9876 \times 10^9 \text{ N m}^2/\text{C}^2 }} = 7.313 \times 10^{-4} \text{ C}$$

Finally, putting it all together: $$1 \text{ e} \rightarrow 7.313 \times 10^{-4} \text{ C}$$