Showing posts with label Packmol. Show all posts
Showing posts with label Packmol. Show all posts

Sep 21, 2016

How to prepare a solvated system of large molecules automatically

The Packmol distribution includes the solvate.tcl script, which is used to solvate large molecules, usually proteins, with water and ions (Na+ and Cl-).  Given the PDB file of the biomolecule, just run the script with:
        solvate.tcl PROTEIN.pdb

And the script will create a input file for packmol called packmol_input.inp. With this file, run Packmol with:
        packmol < packmol_input.inp

And your large molecule will be solvated by a shell of 15. Angs. of water, and ions to keep the system neutral and a physiological NaCl concentration of 0.16M. The script usually makes reasonable choices for every parameter (number of water molecules, number of ions, etc.), but these may be controlled manually with additional options, as described below:
        solvate.tcl structure.pdb -noions
        solvate.tcl structure.pdb -shell 15.  -charge +5  -density 1.0 -i pack.inp -o solvated.pdb

Where: structure.pdb is the pdb file to be solvated (usually a protein)

"15." is the size of the solvation shell. This is an optional parameter. If not set, 15. will be used.

"-charge +5" is the total charge of the system, to be neutralized. This is also and optional parameter, if not used, the package considers histidine residues as neutral, Arg and Lys as +1 and Glu and Asp as -1. The Na+ and Cl- concentrations are set the closest possible to 0.16M, approximately the physiological concentration.  Alternatively, use the -noions to not add any ions, just water.

1.0 is the desired density. Optional. If not set, the density will be set to 1.0 g/ml.

solvated.pdb: is the (optional) name for the solvated system output file. If this argument is not provided, it will be the default solvated.pdb file.

pack.inp: is the (optional) name for the packmol input file that will be generated. If not provided, packmol_input.inp will be used.

All these options are output when running the "solvate.tcl" script without any parameter. The script also outputs the size of the box and the suggested periodic boundary condition dimensions to be used.


obtained from Packmol user-guide (http://www.ime.unicamp.br/~martinez/packmol/userguide.shtml)

Sep 20, 2016

How to compile in Cygwin console

To compile in Cygwin console, additional installation is often required.
For example, gfortran is required to compile (build) Packmol.
However, default cygwin installation process does not include compilers (e.g., gcc, gfortran).

When installing Cygwin, we need to select necessary packages.
In a package search window, type "gcc" and then gcc packages will appear.
Change the default option into "install" or we can select particular packages in a subfolder.

In this way, other packages can be installed.
For example, to prepare MD simulation environment on Windows OS system, we will need:
required package of cygwin + python (for Moltemplate) + gcc (for Packmol) + make (for Packmol)
(gcc package includes gfortran)

Apr 22, 2011

An easy way to create initial molecular system for computer simulation

Creating a single molecular structure is relatively easy if we use a molecule editor (e.g, Avogadro, Materials Studio, etc).
However, a molecular system consisting of many molecules cannot be easily prepared by those editors.
"Packmol" is a good software for readily creating such a large system.
or  http://leandro.iqm.unicamp.br/packmol/versionhistory/


1. Install "Packmol" as instructed. (it can easily be built in Cygwin64 console.)
2. Prepare component molecules in pdb, xyz, etc file format.
    (component molecules can be DPD structure.)
3. Make an input script 
4. Run "packmol < filename.inp"



An example Packmol input script is below:


# Every atom from diferent molecules will be far from each other at least 2.0 Angstroms in the system.
tolerance 2.0 

# Coordinate file types will be in pdb format (keyword not required for pdb file format, but required for tinker, xyz or moldy).
filetype xyz

# The output configuration filename
output 100water_5Na_5Cl.xyz


# The first three numbers are the minimum x, y, z coordinates for this molecules, the last three are maximum coordinates. 

structure Na.xyz
  number 5
  inside box 0. 0. 0. 20. 20. 20.
end structure

structure Cl.xyz
  number 5
  inside box 0. 0. 0. 20. 20. 20.
end structure 

structure water.xyz 
  number 100
  inside box 0. 0. 0. 20. 20. 20.
# inside box  Xmin Ymin Zmin  Xmax Ymax Zmax
# inside sphere  10.0 10.0 15.0 8.0
# inside sphere  a b c d  (a,b,c,d in a sphere equation, (x-a)^2 + (y-b)^2 + (z-c)^2 - d^2 = 0,  d is the diameter)
# inside cylinder  0.0 0.0 0.0  1.0 0.0 0.0  5.0  10.0    
# inside cylinder  x1 y1 z1  x2 y2 z2  d  l  (direction_of_line_in_vector_(x1 y1 z1  x2 y2 z2),  distance_to_the_line_(d),  length_of_cylinder_(l))

end structure