| 1 |
# This file contains a definition for the "CH3" molecular subunit. |
| 2 |
# First, load the COMPASS force field parameters we will need: |
| 3 |
|
| 4 |
import "compass_published.lt" # <-- defines the "COMPASS" force field |
| 5 |
|
| 6 |
# (The "compass_published.lt" file is located in the "force_fields" |
| 7 |
# subdirectory distributed with moltemplate.) |
| 8 |
# Then define "CH3": |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
CH3 inherits COMPASS { |
| 14 |
|
| 15 |
# atom-id mol-id atom-type charge x y z |
| 16 |
|
| 17 |
write("Data Atoms") { |
| 18 |
$atom:c $mol:... @atom:c4 0.0 0.000000 0.000000 0.000000 |
| 19 |
$atom:h1 $mol:... @atom:h1 0.0 0.000000 0.631044 0.892431 |
| 20 |
$atom:h2 $mol:... @atom:h1 0.0 0.000000 0.631044 -0.892431 |
| 21 |
$atom:h3 $mol:... @atom:h1 0.0 -0.892431 -0.631044 0.000000 |
| 22 |
} |
| 23 |
|
| 24 |
write('Data Bond List') { |
| 25 |
$bond:ch1 $atom:c $atom:h1 |
| 26 |
$bond:ch2 $atom:c $atom:h2 |
| 27 |
$bond:ch3 $atom:c $atom:h3 |
| 28 |
} |
| 29 |
|
| 30 |
} # CH3 |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
# COMMENTS: |
| 36 |
# 1) Atom type names (eg. "c4", "h1") are defined in "compass_published.lt". |
| 37 |
# 2) In this example, the atomic charge of an atom is calculated by summing |
| 38 |
# partial charge contributions from neighboring atoms bonded to this atom. |
| 39 |
# (according to the rules in "compass_published.lt"). For this reason, |
| 40 |
# we can ignore the "charge" column in the "Data Atoms" section. Just |
| 41 |
# leave theses charges as "0.0" for now. Moltemplate will recalculate them. |
| 42 |
# 3) The "..." in "$mol:..." tells moltemplate that this molecule may be part |
| 43 |
# of a larger molecule, and (if so) to use the larger parent object's |
| 44 |
# molecule id number as it's own. |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
# Optional: Shift all the coordinates in the +Y direction by 0.4431163. |
| 50 |
# This way, the carbon atom is no longer located at 0,0,0, but the |
| 51 |
# axis of an alkane chain containing this monomer is at 0,0,0. |
| 52 |
# (This makes it more convenient to construct a polymer later. |
| 53 |
# If this is confusing, then simply add 0.4431163 to the Y |
| 54 |
# coordinates in the "Data Atoms" section above.) |
| 55 |
|
| 56 |
CH3.move(0,0.4431163,0) |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
######### (scratchwork calculations for the atomic coordinates) ######### |
| 62 |
# |
| 63 |
# Lcc = 1.5350 # length of the C-C bond (Sp3) |
| 64 |
# Lch = 1.0930 # length of the C-H bond |
| 65 |
# theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle) |
| 66 |
# DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594 |
| 67 |
# DeltaYc = Lcc*cos(theta/2) # = 0.8862326632060754 |
| 68 |
# # 0.5*DeltaYc = 0.4431163 |
| 69 |
# DeltaZh = Lch*sin(theta/2) # = 0.892431 |
| 70 |
# DeltaYh = Lch*cos(theta/2) # = 0.631044 |