Dec 18, 2015

assign force field parameters using Moltemplate

Moltemplate (http://www.moltemplate.org/) is a powerful tool of configuring molecules for LAMMPS.
Its best function is surely to assign force field parameters for molecules automatically.

1. Prepare a molecule in *.xyz format (e.g., using Avogadro).

2. Create an LT file (e.g., oplsaa.lt) containing force field parameters for the system.  See the Moltemplate manual (or example folder contains txt manual for this) to create this file.
e.g., oplsaa_moltemplate.py  oplsaa_subset.prm

3. Using the xyz coordination, create another LT file containing molecules with positions of each atom and bonds between atoms.  For example,
        import "oplsaa.lt"
        isobutane inherits OPLSAA {
                write('Data Atoms') {
                        $atom:C1  $mol @atom:90  -0.0600  -0.001  -0.001  -0.439
                        $atom:C2  $mol @atom:90  -0.1800  -1.257  -0.726   0.078  
                        ...
                 write('Data Bond List') {
                        $bond:C12  $atom:C1 $atom:C2
                        $bond:C23  $atom:C2 $atom:C3
                        ...
        }
        water {
                  ...
        }
        write_once("Data Boundary") {
                  0.0  20.0  xlo xhi
                  0.0  40.0  ylo yhi
                  0.0  50.0  zlo zhi
        }
        isobutanes = new isobutane [1].move(0.00, 0.00, 15.0)
                                                    [2].move(0.00, 15.0, 0.00)
                                                    [5].move(8.0, 0.00, 0.00)
       waters = new SPCE [10].move(0.00, 0.00, 3.45)
                                         [10].move(0.00, 3.45, 0.00)
                                         [10].move(3.45, 0.00, 0.00)
        isobutanes[*][*][*].move(1.725, 1.725, 1.725)

Or in case we use a premade configuration file (e.g., *.xyz prepared using Packmol), an LT file should be like:
        import "oplsaa.lt"
        isobutane inherits OPLSAA {
                write('Data Atoms') {
                        $atom:C1  $mol @atom:90  0.00   0.00   0.00  0.00
                        $atom:C2  $mol @atom:90  0.00   0.00   0.00  0.00  
                        ...
                 write('Data Bond List') {
                        $bond:C12  $atom:C1 $atom:C2
                        $bond:C23  $atom:C2 $atom:C3
                        ...
        }
        water {
                  ...
        }
        write_once("Data Boundary") {
                  0.0  20.0  xlo xhi
                  0.0  40.0  ylo yhi
                  0.0  50.0  zlo zhi
        }
        isobutanes = new isobutane[10]
        waters  = new SPCE[1000]


4. Run moltemplate with the LT file.  This will create LAMMPS input and data files.
        moltemplate.sh  -atomstyle "full"  isobutane_water.lt
        or
        moltemplate.sh  -xyz  isobutane_water.xyz  -atomstyle "full"  isobutane_water.lt
        (This will use a premade xyz configuration of system, e.g., isobutane_water.xyz).

5. If necessary, modify the LAMMPS input file (e.g., xxx.in.charges) created from the Moltemplate run.

6. Run LAMMPS with the input and data files.



For your information,
"oplsaa.lt" containing all force field parameters required for the system,  "xxx.lt" containing a list of all atom types and bonds in the system + simulation box dimensions and number of each molecule.  "xxx.lt" file can be more than one file, e.g., xxx1.lt contains a list of atom types and bonds for first type of molecules in the system, xxx2.lt is for second type of molecules, xxx3.lt is for third type, xxx.lt contains simulation box dimensions, number of each molecule.  "import" function should be used in xxx.lt file to retrieve information of atom types and bonds of component molecules (xxx1~3.lt).


No comments:

Post a Comment