# How to calculate molarity and the number of molecules for a mixture in a simulation box?

I want to do a simulation of a mixture which consists a total of $512$ molecules of glycine, ammonia, and water molecules mixture in a cubic box of, say, length $\pu{2.6 nm}$; $\pu{2.6 nm}^3 = \pu{17.576 nm3}$ in terms of volume.

I want [1 glycine molecule + $x$ ammonia molecules + $y$ water molecules] which together comes to a total of $512$ molecules and in a box volume of $\pu{17.576 nm3}$ and molarity should be $\pu{15 M}$.

Actually here I am fixing the glycine molecule which is only one and varying only the number of ammonia and water molecules to get different molar concentrations, say, $\pu{5 M / 10 M / 15 M}$ and $\pu{18 M}$, where the total number of molecules is constant, i.e. $512$ molecules only (see the example below). Since a maximum of $\pu{18 M}$ solution can be prepared (since ammonia solubility is $\pu{31 g}$ in $\pu{100 mL}$), so, I am trying to study with varying the $\%$ composition of ammonia and water molecules.

In this case I want to get a concentration of $\pu{15 M}$. How to calculate the number of $x$ ammonia and $y$ water molecules that need to be taken in order to get $\pu{15 M}$, considering the conversion of number of molecules to mass, amount of substance, etc..

For example:

• $1$ molecule of glycine + $52$ molecules of ammonia + $459$ molecules of water is $10 : 90$ mixture (total $512$ molecules);
• $1$ molecule of glycine + $104$ molecules of ammonia + $408$ molecules of water is $20 : 80$ mixture (total $512$ molecules).

Then what would be the molarity of the above two mixtures ($1 : 90$, $20 : 80$) considering the same volume ($\pu{17.576 nm}$)?

• Do you need molarity specifically? Often with molecular simulations, you will see molality used instead because it is easier to calculate when you dealing with a reasonably countable number of solvent molecules. – Tyberius Dec 16 '17 at 1:25

I would use a slightly different approach than andselisk, based on the volume on your box, and that I don't think you can neglect the volume of your ammonia molecules. Given $V(\text{sol}) = \pu{17.576E-27 m3}$ and $c(\ce{NH3}) = \pu{15.0E3 mol m-3}$ we can calculate the number of ammonia molecules we need: \begin{align} && c(\ce{NH3}) &= \frac{n(\ce{NH3})}{V(\text{sol})};\\ && n(\ce{NH3}) &= \frac{N(\ce{NH3})}{N_\mathrm{A}};\\ &\to& c(\ce{NH3}) &= \frac{N(\ce{NH3})}{N_\mathrm{A}\cdot V(\text{sol})}\\ &\Longleftrightarrow& N(\ce{NH3}) &= c(\ce{NH3})\cdot N_\mathrm{A}\cdot V(\text{sol}) \approx 159 \end{align}

Since you want to limit the number of molecules to $512$, we know that all other molecules have to be water: $$N(\ce{H2O}) = 512 - N(\ce{Gly}) - N(\ce{NH3}) = 352$$

Lastly, let's check whether the density is anywhere close to what we would expect, we take $M_\mathrm{m}(\ce{Gly}) = \pu{75 u}$, $M_\mathrm{m}(\ce{H2O}) = \pu{18 u}$, and $M_\mathrm{m}(\ce{NH3})= \pu{17 u}$. \begin{align} \rho(\text{sol}) &= \frac{m(\text{sol})}{V(\text{sol})}\\ &= \frac{\left( N(\ce{Gly})M_\mathrm{m}(\ce{Gly}) + N(\ce{H2O})M_\mathrm{m}(\ce{H2O}) + N(\ce{NH3})M_\mathrm{m}(\ce{NH3})\right)\frac{m_\mathrm{u}}{\pu{u}} }{V(\text{sol})}\\ \rho(\text{sol}) &\approx \pu{861 kg m-3} = \pu{0.861 g cm-3} \end{align}

Citing Wikipedia's entry of ammonia I would say you are quite close:

Solvent properties
Ammonia is miscible with water. [...] The maximum concentration of ammonia in water (a saturated solution) has a density of $\pu{0.880 g cm-3}$ and is often known as '.880 ammonia'. [...]

The Handbook of Chemistry and Physics has a concentration table (91st Edition p. 8-53; currently 98th Edition, also online), and I'll reproduce a couple of values for comparison, at $\pu{20 ^\circ C}$.

\begin{array}{rrr} \text{Mass\%} & c / \pu{mol L-1} & \rho / \pu{g cm-3}\\\hline 5.0 & 2.868 & 0.9770\\ 9.0 & 5.080 & 0.9613\\ 12.0 & 6.695 & 0.9502\\ 18.0 & 9.823 & 0.9294\\ 24.0 & 12.826 & 0.9102\\ 28.0 & 14.764 & 0.8920\\\hline \end{array}

In conclusion, you are a few water molecules short, or your box is slightly too large, or your solution is not dense enough. I would expect some trade-offs when doing such a study and keeping the named constraints, so I guess you should have a close look at everything and settle for the optimum you can afford.

• The last row (28 Mass%) would be well reproduced by 139 ammonia, 471 water in a cubic box of 2.5 nm. (18 Mass%) 93 NH3, 394 H2O, 2.5 pm. – Martin - マーチン Dec 18 '17 at 13:02
• Can u kindly tell what is mu/u in the density equation..?? and one more thing... how to type the rho symbols, and subscripts/superscripts, equations here..?? – D.H.N Dec 18 '17 at 16:44
• @D.H.N Have a look here and here for MathJax tutorials. The $m_\mathrm{u}/\pu{u}$ is only the conversion factor from the unified atomic mass unit, to the SI unit (kg). (And when you click the edit link, you can have a look at the source code, too.) – Martin - マーチン Dec 18 '17 at 16:52
• @Tyberius I actually really dislike using \to instead of \implies, for me it simply has a completely different meaning. Why are you doing that anyway? Thanks for catching the spelling errors though. – Martin - マーチン Dec 19 '17 at 7:22
• @Martin I tend to change \implies to \to because \implies doesn't show up in the app and I personally consider them as conveying the same idea. I can understand wanting to use them differently and that it might not help much in this case since \pu blocks a lot of the post anyway. I've just figured in cases where it was the one obstruction to reading the post on the app, I would change it and if the poster didn't think it was right it could be quickly reversed. – Tyberius Dec 19 '17 at 15:03

Using conventional macroscale quantities and SATP, one can express the desired concentration of aqueous ammonia using the amount $n$ and the volume $V$ of the solution:

$$C(\ce{NH3}) = \frac{n(\ce{NH3})}{V(\ce{H2O})} \tag{1}$$

Let's find the ratio between the numbers of molecules of ammonia ($N(\ce{NH3})$) and water ($N(\ce{H2O})$). By definition of a mole ($N_\mathrm{A}$ – Avogadro's number):

$$n(\ce{NH3}) = \frac{N(\ce{NH3})}{N_\mathrm{A}} \tag{2}$$

Volume of water required to achieve given concentration can be found using density $\rho$ and molecular weight $M$:

$$V(\ce{H2O}) = \frac{m(\ce{H2O})}{\rho (\ce{H2O})} = \frac{n(\ce{H2O}) \cdot M(\ce{H2O})}{\rho (\ce{H2O})} = \frac{N(\ce{H2O}) \cdot M(\ce{H2O})}{\rho (\ce{H2O}) \cdot N_\mathrm{A}} \tag{3}$$

Assembling (2) and (3) in (1):

$$\frac{N(\ce{H2O})}{N(\ce{NH3})} = \frac{\rho (\ce{H2O})}{C(\ce{NH3}) \cdot M(\ce{H2O})} = \frac{\pu{1.0e3 g L-1}}{\pu{15 mol L-1} \cdot \pu{18.015 g mol-1}} = 3.70 \tag{4}$$

Now, knowing the ratio between ammonia and water, total number of molecules in system and assuming that single glycine molecule remains intact, one can count the exact numbers:

$$1 + N(\ce{NH3}) + 3.70 \cdot N(\ce{NH3}) = 512$$ $$\to N(\ce{NH3}) \approx 109$$ $$\to N(\ce{H2O}) \approx 402$$

By the way, 402 water molecules would only occupy $\pu{1.20e-26 m^3}$ (formula (3)), assuming this molecular assembly (cluster) behaves similarly to its macro counterpart (which is probably not exactly true). This means that you need a slightly smaller cube with a side of about $\sqrt{\pu{1.20e-26 m^3}} = \pu{2.3 nm}$.

The same procedure can be repeated for other concentrations.

• I've looked up the densities of ammonia solutions, and what I calculated is surprisingly close to what you would find in the theoretical setup. – Martin - マーチン Dec 18 '17 at 12:49