Solute-Solvent system
Here, SolutionBoxUS stands for Solute (U) and Solvent (S). The density of the pure solvent is given directly (g/mL by default, or mol/L for molarity).
The example below: the polymer in water, in a cubic periodic box, with the oxygen atoms of one in ten water molecules (light blue) (drag to rotate, scroll to zoom).
Packmol.SolutionBoxUS — Type
SolutionBoxUS(;
solute_pdbfile::String,
solvent_pdbfile::String,
density::Union{Quantity,Real}, # density, using Unitful units, or assumed to be g/mL
solute_molar_mass = nothing, # optional
solvent_molar_mass = nothing, # optional
)Setup a system composed of a solute (U) and a solvent (S).
The mass or molar density can be provided. If unitless specified, the density will be assumed to be in g/mL, and the molar masses in g/mol.
If the molar masses are not provided, they will be computed from the atom types in the PDB file.
Packmol.packmol — Method
packmol(
system::SolutionBoxUS;
output="system.pdb",
# box size
box_sides::AbstractVector{<:Number}, # or
margin::Number,
pbc::Symbol = :cubic, # or :orthorhombic, :dodecahedral, :octahedral
kwargs...,
)Builds and packs a Solute + Solvent system, without writing an input file.
It is equivalent to calling write_packmol_input followed by packmol on the resulting file.
output, box_sides, margin, and pbc (see Cell shapes) behave as in write_packmol_input. Any other keyword (nloop, maxit, seed, ...) is forwarded to the packing engine — see packmol(::PackmolSystem).
Returns the built PackmolSystem, with the packing outcome in its .status field — see packmol(::PackmolSystem).
Packmol.write_packmol_input — Method
write_packmol_input(
system::SolutionBoxUS;
input="box.inp",
output="system.pdb",
# box size
box_sides::AbstractVector{<:Number}, # or
margin::Number,
pbc::Symbol = :cubic, # or :orthorhombic, :dodecahedral, :octahedral
)Function that generates an input file for Packmol for a Solute + Solvent system.
The box sides are given in Ångströms, and can be provided as a vector of 3 elements. Alternatively, the margin can be provided, and the box sides will be calculated as the maximum and minimum coordinates of the solute plus the margin in all 3 dimensions.
pbc selects the shape of the periodic cell (see Cell shapes): :cubic (the default) forces all 3 sides to their maximum, :orthorhombic keeps box_sides/margin as given (possibly with unequal sides), and :dodecahedral/:octahedral build a rhombic dodecahedron/truncated octahedron cell (see dodecahedral_unitcell/ octahedral_unitcell): with margin, the smallest in which every atom of the solute (centered in the cell, in the orientation of its file) is at least margin from the faces of the cell, so that solutes of any shape fit in it; with box_sides, of minimum-image distance equal to their maximum.
Setting up the system properties
We initialize the system data structure given the PDB files of one molecule of the solute (a polymer, poly_h.pdb) and one molecule of the solvent (water):
using Packmoltest_dir = Packmol.RecipesDirectory * "/test"system = SolutionBoxUS( solute_pdbfile = "$test_dir/data/poly_h.pdb", solvent_pdbfile = "$test_dir/data/water.pdb", density = 1.0u"g/mL",)==================================================================
SolutionBoxUS properties (Solute + Solvent):
==================================================================
Solute pdb file: poly_h.pdb
Solvent pdb file: water.pdb
Density of pure solvent: 1.0 g mL^-1
Molarity of pure solvent: 55.50824771072204 mol L^-1
Molar masses:
solute: 5612.80078125 g mol^-1
solvent: 18.01534080505371 g mol^-1
==================================================================The molar masses of the solute and solvent can be provided explicitly with the solute_molar_mass/solvent_molar_mass keywords. If not, they are computed from the atom types in the PDB files, which may fail if the mass of some atom type is unknown.
Packing the system
The system is built and packed directly, with packmol:
packmol(system; margin = 20.0, output = "system.pdb")This gives the system shown at the top of this page. output is the name of the file of the packed system.
margin sets the size of the cell from the box of the solute plus this margin, in every dimension. pbc selects its shape: :cubic (the default), :orthorhombic, :dodecahedral or :octahedral (see Cell shapes). For elongated solutes, the rhombic dodecahedron and the truncated octahedron can be larger than the cube.
Alternatively, the box size can be given explicitly with box_sides = [a, b, c] (in Å), instead of margin.
Writing a Packmol input file
Instead of packing the system, write_packmol_input writes the input file of Packmol for it (the input parameter), to be inspected, edited or run later:
write_packmol_input( system; margin = 20.0, input = "box.inp", output = "system.pdb",)==================================================================
Summary:
==================================================================
Target concentration = 55.50824771072204 mol L^-1
(of solvent ) = 0.03342784810549159 Å^-3
= 1.0 g mL^-1
Box volume = 1.677100110841e6 Å^3
Solution volume = 1.6677798358674704e6 Å^3
Solute extrema = [ -38.685 Å, -24.895 Å, -39.405 Å, 38.685 Å, 24.895 Å, 39.405 Å ]
Periodic box (pbc = :cubic) = a = 118.81 Å, b = 118.81 Å, c = 118.81 Å
α = 90.0°, β = 90.0°, γ = 90.0°
Solute molar mass = 5612.80078125 g mol^-1
Solvent molar mass = 18.01534080505371 g mol^-1
Number of solvent (water.pdb) molecules = 55750
==================================================================
Wrote file: box.inp
==================================================================The input file is run with the packmol executable, or with packmol("box.inp") in Julia (see Writing a Packmol input file).