Jump to content

Mod:Hunt Research Group/packmol 1

From ChemWiki

install

tar -xvzf packmol.tar.gz
  • make
cd packmol
make
if a simple make does not work, see the wiki on installing fortran using mac ports
there is a hard link in the packmol Makefile change this to the macports install location of /opt/local/bin/gfortran
since adding your ~/bin to PATH doesn't work for a mac, make an alias to direct the call, add the following to your .bashrc
alias packmol="/Users/tricia/bin/packmol/packmol"

using packmol

  • note
for a molten salt it is better to start from a crystal structure, don't use packmol
for an ionic liquid it is better to start the system as a disordered solvent, use packmol
for a solute in a liquid, use packmol
  • running packmol is easy, where file.inp is your input file
packmol < pack.inp
  • the resulting coordinates will be in the output file you specified
  • make sure visualise the structure in VMD to check that it looks ok
start vmd
load simbox.xyz
to visualise the cell get the cell dimension from the config.pdb file
head config.pdb
then set the boundaries in vmd
pbc set { 65.685 65.685 65.685} –all
then display them in vmd
pbc box_draw
  • sizing your box
packmol will sometimes places molecule over the edges
you have two options
option1
run packmol and then increase the box side length by 10-20%
our box was 61.5014+1.5=63.001*0.1=6.3 so our box will be close enough to 70.0Å
this of courses lowers the density, which will be corrected for when you run the NPT
now edit the config.pdb file changing the box dimensions from 63.0 to 70.0
option2
when running packmol only partially fill your box to make it 10-120% smaller
set the first set of xyz coords to a little above zero
you will see in the example below that the molecules are all a little inside the cell boundaries

example input files

  • you might have a file created by fftool, for example: pack.inp
# created by fftool
tolerance 2.5
filetype xyz
output simbox.xyz

structure c4c1im_pack.xyz
  number 256
  inside box 1.5000 1.5000 1.5000 64.1855 64.1855 64.1855
end structure

structure ntf2_pack.xyz
  number 256
  inside box 1.5000 1.5000 1.5000 64.1855 64.1855 64.1855
end structure
  • here is another one for water
#  Generation of the NaCl in water
tolerance 2.0
filetype xyz
output nacl_1330-spce.xyz

structure na.xyz
number 1
inside box   0.   0.   0. 10. 10. 10.
end structure

structure cl.xyz
number 1
inside box -10. -10. -10.  0.  0.  0.
end structure

structure spce.xyz
number 1330
inside box -17. -17. -17. 17. 17. 17.
end structure

input file structure

  • tolerance
tolerance is the distance between molecules and is used so that things don't overlap
for smaller molecule such as water set at about 2 or 3
a good number for ILs is between 3.4-3.8 but for IL's up to 5 has been used
  • filetype
filetype can be xyz or pdb (default)
  • output
the name of the output file
  • then the individual molecules/ions to be included are defined
each molecule is inside the structure and end structure strings
define the file in which the structure coordinates are to be found
  • .xyz file has the format: number of atoms, descriptive title, atom identifier and xyz coordinates
then identify the number of molecules of this type in the cell
then identify were to place these molecules within that cell

where to put your molecules

  • just forming a box of solvent this is not so important
  • but if you want to place solutes in particular places you want to specify where they go
  • format is
far back corner to closest front corner on the diagonal
eg -1,-1,-1 is the far corner and +1,+1,+1 is the closest front corner
for a full box centered at 0,0,0 you need to give -x -x -x +x +x +x
to distribute solute1 in the back of the box then use -y -y -y 0.0 0.0 0.0 where y<x
to distribute solute2 in the front of the box then use 0.0 0.0 0.0 +y +y +y where y<x
  • see the example above for NaCl in water
in this case we are building a cell of length approx 34Å
it is important to make sure the 0,0,0 is in the centre, hence the -17 to +17
we also want our Na+ and Cl- well separated, to ensure this we make sure it is distributed roughly in opposite corners of the box, but not right on the edges as we don't want the ions on the cell boundaries
  • see the manual for various ways of controlling how the ions are distributed within the cell

comment on the number of molecules or volume of cell

  • define box/cell size based on relevant literature and/or what you want to do
  • OR define the number of molecules you can potentially simulate in a realistic time
  • then use density=mass/volume to predict the other quantity
  • you do need to have an experimental density or a very good estimate (for the final temperature) in g/cm3
  • see this equation Volume=molar mass/(0.6022*(density/number of molecules))
    • 0.6022 is used as it combines Avagadros constant and a conversion from Å^3 to cm^3
  • if you have different molecules e.g. NaCl in water, take volume of NaCl and add to the volume of water
  • take the cubed root of the volume to get a first estimate of the box length

problems?

  • If packmol is taking a long time to generate the simulation box
it could be that the tolerance is too low. Try increasing the tolerance slightly (by 1) high tolerance gives a lower density box as larger spaces are used between molecules/ions.