| 1 |
import "gaff2.lt" # <-- defines the "GAFF2" force field |
| 2 |
|
| 3 |
|
| 4 |
# The "gaff2.lt" file is usually located in $MOLTEMPLATE_PATH (and is |
| 5 |
# distributed with moltemplate. See the "Installation" section in the manual.) |
| 6 |
# It contains definitions of the "@atom:c3", "@atom:hc", atoms as well as the |
| 7 |
# force-field parameters for bonded and non-bonded interactions between them |
| 8 |
# (and many other atoms). |
| 9 |
# |
| 10 |
# WARNING: CHARGES ARE INCORRECT |
| 11 |
# For this example, I manually looked up the charge of each atom using the |
| 12 |
# OPLSAA parameters from the "oplsaa.prm" file distributed with TINKER: |
| 13 |
# http://dasher.wustl.edu/tinker/distribution/params/oplsaa.prm |
| 14 |
# -----> DO NOT DO THIS! <----- |
| 15 |
# Normally simulations in AMBER are typically assigned charges using the |
| 16 |
# "HF/6-31G* RESP2" or "AM1-BCC3" methods using AmberTools. |
| 17 |
# Using the OPLSAA charges instead will NOT reproduce the behavior of AMBER. |
| 18 |
# For more details how to calculate charges correctly, see: |
| 19 |
# https://github.com/jewettaij/moltemplate/blob/master/examples/all_atom/force_field_AMBER/README.md |
| 20 |
|
| 21 |
|
| 22 |
CH3 inherits GAFF2 { |
| 23 |
|
| 24 |
# atom-id mol-id atom-type charge x y z |
| 25 |
|
| 26 |
write("Data Atoms") { |
| 27 |
$atom:c $mol:... @atom:c3 -0.180 0.000000 0.000000 0.000000 |
| 28 |
$atom:h1 $mol:... @atom:hc 0.060 0.000000 0.6310438442242609 0.8924307629540046 |
| 29 |
$atom:h2 $mol:... @atom:hc 0.060 0.000000 0.6310438442242609 -0.8924307629540046 |
| 30 |
$atom:h3 $mol:... @atom:hc 0.060 -0.8924307629540046 -0.6310438442242609 0.000000 |
| 31 |
} |
| 32 |
|
| 33 |
# Note: The "..." in "$mol:..." tells moltemplate that this molecule may |
| 34 |
# be a part of a larger molecule, and (if so) to use the larger |
| 35 |
# parent object's molecule id number as it's own. |
| 36 |
# The CH3 group is part of the Hexadecane molecule. |
| 37 |
|
| 38 |
# Now specify which pairs of atoms are bonded: |
| 39 |
write('Data Bond List') { |
| 40 |
$bond:ch1 $atom:c $atom:h1 |
| 41 |
$bond:ch2 $atom:c $atom:h2 |
| 42 |
$bond:ch3 $atom:c $atom:h3 |
| 43 |
} |
| 44 |
|
| 45 |
} # CH3 |
| 46 |
|
| 47 |
|
| 48 |
# Optional: Shift all the coordinates in the +Y direction by 0.4431163. |
| 49 |
# This way, the carbon atom is no longer located at 0,0,0, but the |
| 50 |
# axis of an alkane chain containing this monomer is at 0,0,0. |
| 51 |
# (This makes it more convenient to construct a polymer later. |
| 52 |
# If this is confusing, then simply add 0.4431163 to the Y |
| 53 |
# coordinates in the "Data Atoms" section above.) |
| 54 |
|
| 55 |
CH3.move(0,0.4431163,0) |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
######### (scratchwork calculations for the atomic coordinates) ######### |
| 61 |
# Lcc = 1.5350 # length of the C-C bond (Sp3) |
| 62 |
# Lch = 1.0930 # length of the C-H bond |
| 63 |
# theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle) |
| 64 |
# DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594 |
| 65 |
# DeltaYc = Lcc*cos(theta/2) # = 0.8862326632060754 |
| 66 |
# # 0.5*DeltaYc = 0.4431163316030377 |
| 67 |
# DeltaZh = Lch*sin(theta/2) # = 0.8924307629540046 |
| 68 |
# DeltaYh = Lch*cos(theta/2) # = 0.6310438442242609 |
| 69 |
|