BoxMaker

How many solvent molecules, solutes and ions go into a simulation box at a target concentration, and what concentration the rounded counts actually give.

Why does the box size matter?

Molecule counts must be whole numbers, so a small box can only reach certain concentrations. The steps show the concentration that the rounded count actually gives as the box grows, for the solute most affected by rounding, against its target (dashed). Your box is marked. At physiological salt (0.15 M) a 4 nm box holds only about six ion pairs, so a single ion changes the concentration by 17%.

About BoxMaker

Setting up a crowded or salty solution means converting a concentration from a paper (molar, molal, mass or mole fraction) into exact molecule counts for a box, and keeping the total mass consistent with the solution density. BoxMaker does the conversion, shows the error from rounding, and writes the commands to build the box.

Python: pip install git+https://github.com/siba-p/nanomatkit, then nanomatkit box --edge 4 --solute glycine:75.07:2.0:m.

Method

Mass balance of a box of volume VV at solution density ρ\rho:

ρV=NwMw+∑sNsMsNA.\rho V = \frac{N_w M_w + \sum_s N_s M_s}{N_A}.

Concentration units for solute ss:

cs=NsNAV,ms=NsNwMw,xs=NsNw+∑tNt,ws=NsMsNAρV.c_s = \frac{N_s}{N_A V}, \qquad m_s = \frac{N_s}{N_w M_w}, \qquad x_s = \frac{N_s}{N_w + \sum_t N_t}, \qquad w_s = \frac{N_s M_s}{N_A \rho V}.

Molar and fixed-count solutes are placed first; the solvent then fills the remaining mass, with molal and mole-fraction solutes solved together with it.

Check: a 3 nm water box (0.997 g/cm³) holds 900 molecules; molality and mole-fraction targets are reproduced exactly before rounding.