The initial structure for md simulation will be generated by packmol then do an equilibrium step by lammps. The system I would like to prepare is 4M NaCl solution. ( 9 Na+ 9 Cl- and 115 H2O with the box size 15.5473 A. ) The template structure of Na+ and Cl- and tip4p H2O structure are prepared first.
na.xyz
2
Na 0.0 0.0 0.0
NaD 0.0 0.0 0.02
cl.xyz
2
Cl 0.0 0.0 0.0
ClD 0.0 0.0 0.02
tip4p.xyz
3
O 0.0 0.0 0.0
H -0.75695 0.58588 0.0
H 0.75695 0.58588 0.0
and also I have the input file for packmol with the name of packmol_NaClH2O.inp
#
# A mixture of water and NaCl
#
tolerance 2.5
filetype xyz
output NaClH2O.xyz
structure tip4p.xyz
number 115
inside box 0. 0. 0. 15.0473 15.0473 15.0473 # 15.5473
end structure
structure na.xyz
number 9
inside box 0. 0. 0. 15.0473 15.0473 15.0473 # 15.5473
end structure
structure cl.xyz
number 9
inside box 0. 0. 0. 15.0473 15.0473 15.0473 # 15.5473
end structure
Then run packmol.sh script
PACKMOL="$HOME/software/packmol/packmol/packmol"
INPUT=packmol_NaClH2O.inp
$PACKMOL < $INPUT
With the help of vmd program, the data file and psf topo file are generated.
mol new NaClH2O.xyz waitfor all
pbc set { 15.5473 15.5473 15.5473 }
#add bonds and angles
topo clearbonds
for {set i 0} {$i < 115} {incr i} {
topo addbond [expr $i*3] [expr $i*3+1] -bondtype 1 #bond O-H
topo addbond [expr $i*3] [expr $i*3+2] -bondtype 1 #bond O-H
topo addangle [expr $i*3+2] [expr $i*3] [expr $i*3+1] 1 #angle H-O-H
}
for {set i 0} {$i < 18} {incr i} {
topo addbond [expr 115*3+$i*2] [expr 115*3+1+$i*2] -bondtype 2
}
topo writelammpsdata data.NaClH2O
animate write psf NaClH2O.psf
Then I manually modified the molecule ids in data file.
After that, lammps is used to equilibrium the system.