Packmol

Packmol is a versatile tool for solvating proteins and organic molecules in non-standard solvents, frequently used in computational chemistry [1,2]. This guide provides instructions on installing Packmol and demonstrates how to solvate a benzene molecule within a cubic box of methanol molecules.

1.   Packmol Installation

It’s recommended to install the latest Packmol version. This example is based on installing version 20.15.2.

1.1      Access Root and Navigate to /opt Directory

Switch to the root user and navigate to the /opt directory:

sudo su

cd /opt

 

1.2      Download and Extract Packmol

Download the Packmol package from GitHub, then extract it:

wget https://github.com/m3g/packmol/archive/refs/tags/v20.15.2.tar.gz

tar -xzvf v20.15.2.tar.gz
 

1.3      Compile Packmol

Navigate to the Packmol directory and compile the package:

cd packmol-20.15.2

./configure

Make

1.4      Exit Root and Return to Home Directory

Exit the root environment and return to your home directory:

exit

cd

 

1.5      Add Packmol to Your .bashrc

To add Packmol to your PATH, update your .bashrc file:

cat <<EOF >> .bashrc

alias packmol="/opt/packmol-20.15.2/packmol"

EOF

. .bashrc

 

2.   Solvating Benzene in Methanol

In this example, we create a 40 × 40 × 40 Ĺ cubic box with a benzene molecule at the center, surrounded by methanol molecules.

2.1      Prepare PDB Files for Solute and Solvent

Use GaussView or another program to create PDB files for benzene (solute) and methanol (solvent). Assign unique residue names—BEN for benzene and SOL for methanol. Be sure each molecule has a residue number (in columns 23-26).

Example PDB Files

·         benzene.pdb

HETATM    1  C1  BEN     0       0.960   0.557   0.000                       C

HETATM    2  C2  BEN     0       2.356   0.557   0.000                       C

HETATM    3  C3  BEN     0       3.053   1.765   0.000                       C

HETATM    4  C4  BEN     0       2.355   2.973  -0.001                       C

HETATM    5  C5  BEN     0       0.961   2.973  -0.002                       C

HETATM    6  C6  BEN     0       0.263   1.765  -0.001                       C

HETATM    7  H1  BEN     0       0.411  -0.395   0.000                       H

HETATM    8  H2  BEN     0       2.905  -0.395   0.001                       H

HETATM    9  H3  BEN     0       4.153   1.765   0.001                       H

HETATM   10  H4  BEN     0       2.906   3.926  -0.001                       H

HETATM   11  H5  BEN     0       0.411   3.926  -0.003                       H

HETATM   12  H6  BEN     0      -0.837   1.765  -0.001                       H

·         methanol.pdb

HETATM    1  C1  SOL     1      -0.565  -0.792   0.000                       C

HETATM    2  H1  SOL     1      -0.208  -1.801   0.000                       H

HETATM    3  H2  SOL     1      -0.208  -0.287   0.874                       H

HETATM    4  H3  SOL     1      -0.208  -0.287  -0.874                       H

HETATM    5  O1  SOL     1      -1.995  -0.792   0.000                       O

HETATM    6  H4  SOL     1      -2.315   0.113   0.000                       H

 

 

2.2      Calculating the Number of Solvent Molecules

Use the following equation to estimate the number of methanol molecules required:

SN = (d × NA × a3) / (1030 × M)                           Eq.1

In this equation, dNAa, and M, indicate the density of the solvent in g/m3, Avogadro's number, the cubic box dimension in Ĺ, and the molecular mass of the solvent in g/mol, respectively. 

You can also use the Packmol package to solvate a solute with a mixture of two solvents. The number of the first solvent molecules (N1) in the mixture can be determined using Eq2:

N1 = (W1% × a3 × d × NA) / M1) × 10−26             Eq.2

where W1% represents the mass percent of the first solvent (note that the 10−26  factor in the equation should be 10−24  if you use the mass fraction, a number between 0 and 1, instead of mass percentage), a is the length of the cubic box in Ĺ, d is the density of the solvent mixture expressed in g/cm3NA is Avogadro's number, and M1 is the molar mass of the first solvent given in g/mol. A similar can be used to obtain the number of the second solvent molecules in the mixture.

2.3      Set Up Directory and Files

2.3.1      Create a working directory and copy both PDB files into it.

mkdir packmol-test

 

2.3.2      Create Packmol Input File

Generate a Packmol input file (packmol.inp) with the following specifications:

# Determine the minimum distance between molecules.

tolerance 2.0

# Specify the file format as PDB.

filetype pdb

# Output file name

output benzene-methanol.pdb

# Add TER cards between different molecules if needed.

# This is necessary if you want to create topology and coordinates files using the tleap module of the AMBER program.

add_amber_ter

# Periodic boundary conditions (PBC) settings

# Use a box from -20 Ĺ to 20 Ĺ along each axis (a box of 40 Ĺ3 size).

pbc -20.0 -20.0 -20.0 20.0 20.0 20.0

# Define the solute structure (benzene), placing it at the center.

structure benzene.pdb

  number 1                    # Only one solute molecule

  fixed 0. 0. 0. 0. 0. 0.     # Fix the solute in the center of the box

  centerofmass                # Place solute's center of mass at the specified coordinates

end structure

# Define the solvent structure (MET).

structure methanol.pdb

  number 953                  # Number of solvent molecules

  inside box -20.0 -20.0 -20.0 20.0 20.0 20.0  # Define cubic box for solvent

end structure

 

 

Note: The specified box dimensions will allow simulation programs like AMBER to apply periodic boundary conditions.

2.4      Run Packmol

Run Packmol to generate the output file:

packmol < packmol.inp

The resulting file benzene-methanol.pdb will contain one benzene molecule surrounded by methanol molecules (see Figure 1).

 

You can find more information and instructions on how to mix two different solvents on the following page.

https://pablito-playground.readthedocs.io/en/latest/tutorials/qmmm_amber_cpmd/packmol_custom_box.html#packmol-custom-box

For more details, see the Packmol User Guide

3.   References

[1]        L. Martinez, R. Andrade, E.G. Birgin, J.M. Martínez, PACKMOL: A package for building initial configurations for molecular dynamics simulations, J. Comput. Chem. 30 (2009) 2157–2164. https://doi.org/10.1002/JCC.21224.

[2]        J.M. Martínez, L. Martínez, Packing optimization for automated generation of complex system’s initial configurations for molecular dynamics and docking, J. Comput. Chem. 24 (2003) 819–825. https://doi.org/10.1002/JCC.10216.

Figure 1. A graphical representation of benzene-methanol.pdb shows benzene centered within the cubic box, surrounded by methanol.

 

 

University of Kurdistan, Sanandaj logo

Department of Chemistry, Faculty of Science, University of Kurdistan