| 1 |
# This example looks complicated because I split the |
| 2 |
# hexadecane molecule into individual CH2 and CH3 monomers. |
| 3 |
# |
| 4 |
# I defined it this way so that you can easily modify |
| 5 |
# it to change the length of the alkane chain. |
| 6 |
|
| 7 |
|
| 8 |
import "oplsaa2024.lt" # load the "OPLSAA" object (force-field information) |
| 9 |
import "ch2.lt" # load the definition of the "CH2" object |
| 10 |
import "ch3.lt" # load the definition of the "CH3" object |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
Polyethylene16 inherits OPLSAA { |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
# (Note: Normally I put "create_var {$mol}" at the beginning of a polymer. |
| 19 |
# But I did not include "create_var {$mol}" here because I want all of |
| 20 |
# the atoms in the entire parent molecule (Polyethylene16Star12) to share |
| 21 |
# the same molecule-ID, not just this individual polymer.) |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
# Now create an array of 16 "CH2" objects distributed along the X axis |
| 26 |
|
| 27 |
monomers = new CH2 [16].rot(180,1,0,0).move(1.2533223,0,0) |
| 28 |
|
| 29 |
# Each monomer is rotated 180 degrees with respect to the previous |
| 30 |
# monomer, and then moved 1.2533223 Angstroms down the X axis. |
| 31 |
|
| 32 |
# ---- Now, modify the ends: --- |
| 33 |
# Delete the CH2 groups at the end of the chain, and replace it with CH3. |
| 34 |
|
| 35 |
delete monomers[15] |
| 36 |
|
| 37 |
monomers[15] = new CH3 |
| 38 |
|
| 39 |
# Move the CH3 group to the correct location at the end of the chain: |
| 40 |
|
| 41 |
monomers[15].rot(180.0,0,0,1).move(18.7998345,0,0) |
| 42 |
# Note: 18.7998345 = (16-1) * 1.2533223 |
| 43 |
|
| 44 |
|
| 45 |
# Now add a list of bonds connecting the carbon atoms together: |
| 46 |
|
| 47 |
write('Data Bond List') { |
| 48 |
$bond:b1 $atom:monomers[0]/c $atom:monomers[1]/c |
| 49 |
$bond:b2 $atom:monomers[1]/c $atom:monomers[2]/c |
| 50 |
$bond:b3 $atom:monomers[2]/c $atom:monomers[3]/c |
| 51 |
$bond:b4 $atom:monomers[3]/c $atom:monomers[4]/c |
| 52 |
$bond:b5 $atom:monomers[4]/c $atom:monomers[5]/c |
| 53 |
$bond:b6 $atom:monomers[5]/c $atom:monomers[6]/c |
| 54 |
$bond:b7 $atom:monomers[6]/c $atom:monomers[7]/c |
| 55 |
$bond:b8 $atom:monomers[7]/c $atom:monomers[8]/c |
| 56 |
$bond:b9 $atom:monomers[8]/c $atom:monomers[9]/c |
| 57 |
$bond:b10 $atom:monomers[9]/c $atom:monomers[10]/c |
| 58 |
$bond:b11 $atom:monomers[10]/c $atom:monomers[11]/c |
| 59 |
$bond:b12 $atom:monomers[11]/c $atom:monomers[12]/c |
| 60 |
$bond:b13 $atom:monomers[12]/c $atom:monomers[13]/c |
| 61 |
$bond:b14 $atom:monomers[13]/c $atom:monomers[14]/c |
| 62 |
$bond:b15 $atom:monomers[14]/c $atom:monomers[15]/c |
| 63 |
} |
| 64 |
|
| 65 |
} # Polyethylene16 |
| 66 |
|
| 67 |
|
| 68 |
########################## NOTES ############################ |
| 69 |
### (scratchwork calculations for the atomic coordinates) ### |
| 70 |
# Lcc = 1.5350 # length of the C-C bond (Sp3) |
| 71 |
# Lch = 1.0930 # length of the C-H bond |
| 72 |
# theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle) |
| 73 |
# DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594 |
| 74 |
# DeltaYc = Lcc*cos(theta/2) # = 0.8862326632060754 |
| 75 |
# # 0.5*DeltaYc = 0.4431163316030377 |
| 76 |
# DeltaZh = Lch*sin(theta/2) # = 0.8924307629540046 |
| 77 |
# DeltaYh = Lch*cos(theta/2) # = 0.6310438442242609 |
| 78 |
############################################################ |
| 79 |
# Polyethylene16 is frequently called "hexadecane". |
| 80 |
# However hexadecane has 16 carbon atoms: CH3-(CH2)^14-CH3. |
| 81 |
# |
| 82 |
# However Polyethylene16 was defined as (CH2)^15-CH3. |
| 83 |
# Only one end of Polyethylene16 was capped with a CH3group. |
| 84 |
# This was done to allow you to add another bond to the other |
| 85 |
# end of the polymer so you can attach it to something else.) |
| 86 |
# If you prefer, you could start with hexadecane and delete |
| 87 |
# monomer[0] and then replace it with CH2group again. But |
| 88 |
# I thought that defining everything from scratch is easier.) |
| 89 |
# |
| 90 |
# You can download the "hexadecane.lt" file here: |
| 91 |
# https://github.com/jewettaij/moltemplate/blob/master/examples/all_atom/force_field_OPLSAA/hexadecane/moltemplate_files/hexadecane.lt |
| 92 |
############################################################ |
| 93 |
|