# ---------------------------------------------------------------------- # -- General comment: -- # -- The write() and write_once() commands create and append text to -- # -- files (replacing variables beginning with @ or $ with counters.) -- # -- File names beginning with "In " or "Data " are special. -- # -- They will be pasted into the LAMMPS input script and -- # -- data files which are generated by moltemplate. The syntax -- # -- of these files is exactly the same as the syntax from the -- # -- corresponding sections of a LAMMPS input script or data file. -- # ---------------------------------------------------------------------- Monomer { # atom-id mol-id atom-type charge x y z write("Data Atoms") { $atom:CA $mol:... @atom:CA 0.0 0.000 0.4000 0.00000 $atom:R1 $mol:... @atom:R 0.0 0.000 1.000 1.000 $atom:R2 $mol:... @atom:R 0.0 0.000 1.000 -1.000 } # Note: The "..." in "$mol:..." tells moltemplate that this molecule may # be a part of a larger molecule, and (if so) to use the larger # parent object's molecule id number as it's own # atom-type mass write_once("Data Masses") { @atom:CA 13.0 @atom:R 50.0 } # atom-type atom-type epsilon sigma write_once("In Settings") { pair_coeff @atom:CA @atom:CA 0.05 2.0 pair_coeff @atom:R @atom:R 0.50 2.0 } # bond-id bond-type atom-id1 atom-id2 write("Data Bonds") { $bond:CR1 @bond:sidechain $atom:CA $atom:R1 $bond:CR2 @bond:sidechain $atom:CA $atom:R2 } write_once("In Settings") { # bond-type k r0 bond_coeff @bond:sidechain 30.0 1.2 bond_coeff @bond:bb 30.0 2.0 # "bb" shorthand for "backbone" } # For a compound molecule consisting of smaller building blocks (such as a # polymer built from monomers), it is tedious to explicitly list all of the # angles, dihedrals in the entire molecule. Instead, you can define rules # for automatically generating all the angular interactions between bonded # atoms according to their connectivity and the atom/bond type. # Later, when you connect multiple monomers together to form a polymer, # appropriate bond-angle forces will be applied to these atoms automatically # (as well as dihedral and improper forces, if defined). # Rules for determining 3 and 4-body bonded interactions by type # angle-type atomType1 atomType2 atomType3 bondType1 bondType2 write_once("Data Angles By Type") { @angle:backbone @atom:CA @atom:CA @atom:CA @bond:* @bond:* @angle:sidechain @atom:CA @atom:CA @atom:R @bond:* @bond:* @angle:RCR @atom:R @atom:CA @atom:R @bond:* @bond:* } # ("@angle:RCR" defines the angle between the R-C-R atoms within a monomer. # The other angular interactions are between atoms in neighboring monomers.) # dihedral-type AtomType1 AtomType2 AtomType3 AtomType4 bondType1 btyp2 btyp3 write_once("Data Dihedrals By Type") { @dihedral:backbn @atom:CA @atom:CA @atom:CA @atom:CA @bond:* @bond:* @bond:* } # Parameters for these new angular interactions must be defined. (I recommend # putting all force-field parameters (coeffs) in the "In Settings" section.) write_once("In Settings") { # angle-type k theta0 angle_coeff @angle:backbone 50.00 160 angle_coeff @angle:sidechain 50.00 120 angle_coeff @angle:RCR 50.00 120 # dihedral-type K1 K2 K3 K4 dihedral_coeff @dihedral:backbn 1.411036 -0.271016 3.145034 0.0 } } # Monomer # ------------------------------------------------------------------------- # Heteropolymers: # # There is a similar example for heteropolymers which is distributed online # bundled with the moltemplate software. It is named "2bead_heteropolymer", # and it demonstrates how to share backbone (CA) atoms, bonds and angles # (so that you don't have to define them seperately for each type of monomer). # -------------------------------------------------------------------------