Volume estimates
Two estimates help to choose the numbers of molecules, or the size of the box, of an input: the volume that the molecules fill at a given density, and the volume of the region available to the molecules of each structure type, given its constraints and the fixed molecules. Neither packs the system. From the command line, with the input file:
packmol --guess-volume input.inp # at 1 g/mL
packmol --guess-volume --density 0.8 input.inp
packmol --free-volume input.inpand in Julia, with guess_volume and free_volume, which take an input file or a PackmolSystem. Both are also online calculators, in the browser: the volume guesser and the free volume calculator, at the top of the Recipes tab.
The volume of the molecules at a density
guess_volume sums the masses of the molecules (the fixed ones included) and divides it by the density of the system, as the volume guesser of the Packmol web page: the result is the volume of the box, and the side of a cube of that volume. For the water and urea tutorial (1000 water and 400 urea molecules), at 1.09 g/mL:
using Packmolguess_volume("../tutorials/files/mixture/mixture.inp"; density = 1.09)
Volume guess, at a density of 1.09 g/mL:
water.pdb 1000 molecules of 18.02 g/mol
urea.pdb 400 molecules of 60.06 g/mol
Total mass: 42038 g/mol
Volume: 64041 ų
Side of cube: 40.01 Åwhich is the cube of 40 Å of the input. The molecules can also be given as structure files or molar masses (g/mol), with their numbers:
water = "../tutorials/files/mixture/water.pdb"guess_volume([water => 1000, 60.06 => 400]; density = 1.09)
Volume guess, at a density of 1.09 g/mL:
water.pdb 1000 molecules of 18.02 g/mol
60.06 g/mol 400 molecules of 60.06 g/mol
Total mass: 42039 g/mol
Volume: 64044 ų
Side of cube: 40.01 ÅThe volume available to each structure type
free_volume estimates, by Monte Carlo, the volume of the region of each structure type: the fraction of random points of a box that contains the region that satisfy its constraints and are farther than the tolerance from the atoms of the fixed molecules. With it comes the density at which the molecules of the structure type fill their region: much above the density of the liquid, there are too many molecules for the region (and the packing will be slow, or fail); much below, too few.
For the solvated protein, the water, sodium and chloride share the rhombic dodecahedron, without the volume of the protein:
input = "../tutorials/files/solvprotein/solvprotein.inp"free_volume(input; npoints = 500_000)
Volume available to each structure type (Monte Carlo, 500000 points):
Structure Number Volume (ų) ± error Density (g/mL)
water.pdb 35480 1061134 2879.0 1.0
CLA.pdb 96 1057648 2875.6 0.005
SOD.pdb 106 1062445 2880.3 0.004
The density is that at which the molecules of each structure type fill its region.The water fills its region at 1 g/mL. The densities of structure types that share a region add up: the water and the urea of the mixture above, in the same box, are at 0.47 and 0.62 g/mL, 1.09 g/mL together.
The region is that of the constraints that apply to the whole molecule. The constraints of some atoms only (in atoms blocks) are ignored, so that the volume is an upper bound, and a structure type with constraints of some atoms only has no estimate: in the lipid bilayer, the heads and the ends of the chains of the lipids are above and below planes, which do not bound a region of the molecules. The water around them has its own region:
free_volume("../tutorials/files/bilayer/bilayer.inp"; npoints = 500_000)
Volume available to each structure type (Monte Carlo, 500000 points):
Structure Number Volume (ų) ± error Density (g/mL)
popc.pdb 60 - - - region set by constraints of some atoms only
popc.pdb 60 - - - region set by constraints of some atoms only
water.pdb 1925 57321 181.8 1.005
water.pdb 1925 57460 181.9 1.002
The density is that at which the molecules of each structure type fill its region.A structure type whose region is not bounded (without periodic boundary conditions, by an inside box, cube, sphere, cylinder or ellipsoid) has no estimate either. The precision of the estimate is given by its standard error, which decreases with the square root of the number of points (npoints, 1 million by default).
Packmol.guess_volume — Function
guess_volume(input_file::String; density = 1.0)
guess_volume(system::PackmolSystem; density = 1.0)
guess_volume(molecules::AbstractVector{<:Pair}; density = 1.0)The volume (ų) that the molecules fill at the density (g/mL) of the whole system, and the side (Å) of a cube of that volume, as the volume guesser of the Packmol web page. The molecules are those of an input file or a PackmolSystem (fixed ones included), or pairs of a structure file or a molar mass (g/mol) and a number of molecules:
guess_volume(["water.pdb" => 1000, "urea.pdb" => 400]; density = 1.1)guess_volume([18.015 => 1000]) # 1000 water molecules at 1 g/mLReturns (; mass, volume, side): the total mass (g/mol, summed over the molecules), the volume and the side of the cube, and prints a summary.
Packmol.free_volume — Function
free_volume(input_file::String; npoints = 1_000_000, seed = 1)
free_volume(system::PackmolSystem; npoints = 1_000_000, seed = 1)The volume of the region available to each structure type, by Monte Carlo.
The volume (ų) of the region of the molecules of each structure type of an input file or a PackmolSystem is estimated from npoints random points of a box that contains the region: the fraction of them that satisfies the constraints of the structure type and is farther than the tolerance from the atoms of the fixed molecules. With the volume, the density at which the molecules of the structure type would fill the region (g/mL), which shows when too many (or too few) molecules were asked for.
The region is that of the constraints that apply to whole molecules. Those of some atoms only (in atoms blocks) are ignored: the volume is then an upper bound, and a structure type with constraints of some atoms only (as the lipids of a membrane, with their heads and tails above and below planes) has no estimate. Neither has one a structure type whose region is not bounded, by the periodic cell or by an inside box, cube, sphere, cylinder or ellipsoid.
Returns a vector with, for each structure type, (; structure, number, volume, error, density, note): the error is the standard error of the estimate (ų), and volume, error and density are NaN without an estimate (note says why). Prints a summary.