Solute-Water-Ions system
Here, SolutionBoxUWI stands for Solute (U), Water (W), and Ions (I): a solute solvated by water and a background salt at a target ionic concentration (0.15u"mol/L", physiological saline, by default). The solute's own net charge (solute_charge, computed from the PDB file's charge records unless given explicitly) is automatically neutralized with extra counter-ions, on top of the bulk salt.
The example below: the polymer in water, with sodium (orange) and chloride (green) ions, and the oxygen atoms of one in ten water molecules (light blue) (drag to rotate, scroll to zoom).
Packmol.SolutionBoxUWI — Type
SolutionBoxUWI(;
solute_pdbfile::String,
solute_charge::Integer, # optional - computed from PDB file by default
water_pdbfile::String, # optional
cation_pdbfile::String, # optional - SOD (Na+) by default
anion_pdbfile::String, # optional - CLA (Cl-) by default
cation_charge::Integer, # optional - 1 by default
anion_charge::Integer, # optional - -1 by default
solute_molar_mass = nothing, # optional
water_molar_mass = nothing, # optional
cation_molar_mass = nothing, # optional
anion_molar_mass = nothing, # optional
density_table::Matrix{<:Number} = density_NaCl_aq, # optional
density_table_units = "mol/kg", # optional
)Setup a system composed of a solute (U), water (W), a cation and an anion (I, for ions).
cation_charge must be a positive integer and anion_charge a negative integer. Molar masses are computed from the atom types in the PDB files if not provided.
density_table provides the density of the salt solution as a function of ionic concentration, used to size the number of water molecules. It defaults to the density of aqueous NaCl, appropriate for the default (sodium/chloride) ions; a custom table should be provided (as a concentration_units => density matrix, with density_table_units set accordingly) if custom ions are used and an accurate solution density is required.
Packmol.packmol — Method
packmol(
system::SolutionBoxUWI;
ionic_concentration::Number=0.15u"mol/L",
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 + Water + Ions system, without writing an input file.
It is equivalent to calling write_packmol_input followed by packmol on the resulting file.
ionic_concentration, 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::SolutionBoxUWI;
ionic_concentration::Number=0.15u"mol/L",
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 + Water + Ions system.
ionic_concentration is the target bulk salt concentration (e.g. NaCl), assumed to be in mol/L if given unitless. Enough additional counter-ions (of a single sign) are added, on top of the bulk salt, to exactly neutralize the solute's own charge (system.solute_charge); an ArgumentError is thrown if that charge cannot be exactly neutralized with the ions' charges (e.g. neutralizing an odd solute charge with only doubly-charged counter-ions).
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
By default the ions are sodium and chloride (charges +1/-1), generated automatically, and the solution density as a function of ionic strength is looked up from a table of aqueous NaCl densities:
using Packmoltest_dir = Packmol.RecipesDirectory * "/test"system = SolutionBoxUWI( solute_pdbfile = "$test_dir/data/poly_h.pdb", solute_charge = 2,)==================================================================
SolutionBoxUWI properties (Solute + Water + Ions):
==================================================================
Solute pdb file: poly_h.pdb
Solute charge: 2
Water pdb file: HOH.pdb
Cation pdb file and charge: SOD.pdb +1
Anion pdb file and charge: CLA.pdb -1
Molar masses:
solute: 5612.80078125 g mol^-1
water: 18.01534080505371 g mol^-1
cation: 22.989770889282227 g mol^-1
anion: 35.452999114990234 g mol^-1
Ionic concentration range: 0.09953429399586157 mol L^-1 - 5.30461986641539 mol L^-1
Density range: 1.00116 g mL^-1 - 1.19412 g mL^-1
==================================================================Custom cation/anion PDB files can be given with the cation_pdbfile/ anion_pdbfile keywords (with their cation_charge/anion_charge); a matching density_table should then be provided too, since the default one is specific to NaCl.
Packing the system
The system is built and packed directly, at a target ionic concentration:
packmol(system; ionic_concentration = 0.15u"mol/L", margin = 20.0, output = "system.pdb",)This gives the system shown at the top of this page.
Enough cations or anions (of a single sign) are added on top of the bulk salt to exactly neutralize system.solute_charge; a SolutionBoxUWI with default (monovalent) ions can neutralize any integer solute charge. An ArgumentError is raised if the requested charge cannot be exactly neutralized with the ions' charges (for instance, a solute charge of -3 with only doubly-charged cations available). margin, box_sides, and pbc behave as in SolutionBoxUS.
Writing a Packmol input file
Instead of packing the system, write_packmol_input writes the input file of Packmol for it, to be inspected, edited or run later (see Writing a Packmol input file):
write_packmol_input( system; ionic_concentration = 0.15u"mol/L", margin = 20.0, input = "box.inp", output = "system.pdb",)==================================================================
Summary:
==================================================================
Target ionic concentration = 0.15 mol L^-1
Solution density (at that concentration) = 1.0032156090904947 g mL^-1
Box volume = 1.677100110841e6 Å^3
Solution volume = 1.6677524931509653e6 Å^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
Solute charge = 2
Number of water (HOH.pdb) molecules = 55435
Number of cations (SOD.pdb, charge +1) = 151
Number of anions (CLA.pdb, charge -1) = 153
Total system charge (check) = 0
==================================================================
Wrote file: box.inp
==================================================================