Debian Codegraph @

examples/all_atom/force_field_COMPASS/hexadecane/moltemplate_files/hexadecane.lt

raw
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 "compass_published.lt" # load the "COMPASS" force-field
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 Hexadecane inherits COMPASS {
15
16
17 create_var {$mol} # optional:force all monomers to share the same molecule-ID
18
19 # Now create an array of 14 "CH2" monomers and 2 "CH3" monomers
20
21 ## --- Method 1: Specify the position of each monomer manually ---
22 monomers[0] = new CH3.rot(0,1,0,0).move(0.0,0,0)
23 monomers[1] = new CH2.rot(180,1,0,0).move(1.2533223,0,0)
24 monomers[2] = new CH2.rot(360,1,0,0).move(2.5066446,0,0)
25 monomers[3] = new CH2.rot(540,1,0,0).move(3.7599669,0,0)
26 monomers[4] = new CH2.rot(720,1,0,0).move(5.0132892,0,0)
27 monomers[5] = new CH2.rot(900,1,0,0).move(6.2666115,0,0)
28 monomers[6] = new CH2.rot(1080,1,0,0).move(7.5199338,0,0)
29 monomers[7] = new CH2.rot(1260,1,0,0).move(8.7732561,0,0)
30 monomers[8] = new CH2.rot(1440,1,0,0).move(10.0265784,0,0)
31 monomers[9] = new CH2.rot(1620,1,0,0).move(11.2799007,0,0)
32 monomers[10] = new CH2.rot(1800,1,0,0).move(12.533223,0,0)
33 monomers[11] = new CH2.rot(1980,1,0,0).move(13.7865453,0,0)
34 monomers[12] = new CH2.rot(2160,1,0,0).move(15.0398676,0,0)
35 monomers[13] = new CH2.rot(2340,1,0,0).move(16.2931899,0,0)
36 monomers[14] = new CH2.rot(2520,1,0,0).move(17.5465122,0,0)
37 monomers[15] = new CH3.rot(2700,1,0,0).rot(180,0,1,0).move(18.7998345,0,0)
38 # (See below for a python script to generate this long list of commands.)
39
40 ## Alternative strategies:
41 ##
42 ## --- Method 2: Create many monomers with a single "new" command ---
43 ## The first monomer is of type "CH3"
44 # monomers[0] = new CH3
45 ## The monomers in the middle of the polymer (indices 1-14) are of type "CH2"
46 ## We can create them all with a single command.
47 # monomers[1-14] = new CH2[14].rot(180,1,0,0).move(1.2533223,0,0)
48 ## Note: Each monomer is rotated 180 degrees with respect to the previous
49 ## monomer, and then moved 1.2533223 Angstroms down the X axis.
50 ## Now move monomers 1-14 to avoid overlap with the first monomer(monomers[0])
51 # monomers[1-14].rot(180,1,0,0).move(1.2533223,0,0)
52 ## The final monomer is of type "CH3" and we want to position it at the end:
53 # monomers[15] = new CH3.rot(180.0,0,0,1).move(18.7998345,0,0)
54 ## Note: 18.7998345 = (16-1) * 1.2533223
55 ##
56 ## --- Method 3: create polymer and redefine the ends: ----
57 ## Create a long polymer consisting only of monomers of type "CH2"
58 # monomers = new CH2 [16].rot(180,1,0,0).move(1.2533223,0,0)
59 ## Delete the CH2 monomers at the beginning and end, and replace them with CH3
60 # delete monomers[0]
61 # delete monomers[15]
62 # monomers[0] = new CH3
63 # monomers[15] = new CH3
64 ## Move the final CH3 monomer to the correct location at the end of the chain:
65 # monomers[15].rot(180.0,0,0,1).move(18.7998345,0,0)
66 ## (Note: This approach changes the order of the atoms in the DATA file.)
67
68
69 # Now add a list of bonds connecting the carbon atoms together:
70
71 write('Data Bond List') {
72 $bond:b1 $atom:monomers[0]/c $atom:monomers[1]/c
73 $bond:b2 $atom:monomers[1]/c $atom:monomers[2]/c
74 $bond:b3 $atom:monomers[2]/c $atom:monomers[3]/c
75 $bond:b4 $atom:monomers[3]/c $atom:monomers[4]/c
76 $bond:b5 $atom:monomers[4]/c $atom:monomers[5]/c
77 $bond:b6 $atom:monomers[5]/c $atom:monomers[6]/c
78 $bond:b7 $atom:monomers[6]/c $atom:monomers[7]/c
79 $bond:b8 $atom:monomers[7]/c $atom:monomers[8]/c
80 $bond:b9 $atom:monomers[8]/c $atom:monomers[9]/c
81 $bond:b10 $atom:monomers[9]/c $atom:monomers[10]/c
82 $bond:b11 $atom:monomers[10]/c $atom:monomers[11]/c
83 $bond:b12 $atom:monomers[11]/c $atom:monomers[12]/c
84 $bond:b13 $atom:monomers[12]/c $atom:monomers[13]/c
85 $bond:b14 $atom:monomers[13]/c $atom:monomers[14]/c
86 $bond:b15 $atom:monomers[14]/c $atom:monomers[15]/c
87 }
88
89 } # Hexadecane
90
91
92
93 # -------------------------------------------------------------------------
94 # Note: The following short python script was used to generate the text above:
95 #N=16
96 #print(' monomers[0] = new CH3')
97 #for i in range(1,N-1):
98 # print(' monomers['+str(i)+'] = new CH2.rot('+str(180*i)+',1,0,0).move('+str(i*1.2533223)+',0,0)')
99 #i=N-1
100 #print(' monomers['+str(i)+'] = new CH3.rot('+str(180*i)+',1,0,0).rot(180,0,1,0).move('+str(i*1.2533223)+',0,0)')
101 ## generate the list of bonds
102 #print(' write("Data Bond List") {')
103 #for i in range(0,N-1):
104 # print(' $bond:b'+str(i+1)+' $atom:monomers['+str(i)+']/c $atom:monomers['+str(i+1)+']/c')
105 #print(' }')
106 # ---------- (scratchwork calculations for the atomic coordinates) ----------
107 # Lcc = 1.5350 # length of the C-C bond (Sp3)
108 # Lch = 1.0930 # length of the C-H bond
109 # theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle)
110 # DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594
111 # DeltaYc = Lcc*cos(theta/2) # = 0.8862326632060754
112 # # 0.5*DeltaYc = 0.4431163316030377
113 # DeltaZh = Lch*sin(theta/2) # = 0.8924307629540046
114 # DeltaYh = Lch*cos(theta/2) # = 0.6310438442242609
115 # -------------------------------------------------------------------------