# Define the "CH2" and "CH3" objects: import "ch2group.lt" import "ch3group.lt" Hexadecane inherits Alkanes { # Create an array of 16 "CH2" objects monomers = new CH2.move(0,0.4431163,0) [16].rot(180,1,0,0).move(1.2533223,0,0) # "monomers" is a 1-dimensional array containing 16 copies of the CH2 molecule # Each copy is rotated 180 degrees and shifted along the x axix. # (For an explanation, read sections 7.1-7.3 of the moltemplate manual.) # Notes: # 1.2533223 = DeltaXc = how far each CH2 group is shifted along the axis # 0.4431163 = DeltaYc/2 = lateral displacement of carbons along axis # ---- Now, modify the ends: --- # Delete the CH2 groups at the beginning and end, and replace them with CH3. # (Note: Alternately, instead of deleting the CH2 groups at each end, you # could modify them by adding an extra hydrogen atom to those carbons.) delete monomers[0] delete monomers[15] monomer_begin = new CH3 monomer_end = new CH3 # Move the CH3 groups to the correct location at either end of the chain: monomer_begin.move(0,0.4431163,0) monomer_end.move(0,0.4431163,0).rot(180,0,0,1).move(18.7998345,0,0) # Note: 18.7998345 = (16-1) * DeltaXc # Now add a list of bonds connecting the carbon atoms together: write('Data Bonds') { $bond:b1 @bond:CC $atom:monomer_begin/C $atom:monomers[1]/C $bond:b2 @bond:CC $atom:monomers[1]/C $atom:monomers[2]/C $bond:b3 @bond:CC $atom:monomers[2]/C $atom:monomers[3]/C $bond:b4 @bond:CC $atom:monomers[3]/C $atom:monomers[4]/C $bond:b5 @bond:CC $atom:monomers[4]/C $atom:monomers[5]/C $bond:b6 @bond:CC $atom:monomers[5]/C $atom:monomers[6]/C $bond:b7 @bond:CC $atom:monomers[6]/C $atom:monomers[7]/C $bond:b8 @bond:CC $atom:monomers[7]/C $atom:monomers[8]/C $bond:b9 @bond:CC $atom:monomers[8]/C $atom:monomers[9]/C $bond:b10 @bond:CC $atom:monomers[9]/C $atom:monomers[10]/C $bond:b11 @bond:CC $atom:monomers[10]/C $atom:monomers[11]/C $bond:b12 @bond:CC $atom:monomers[11]/C $atom:monomers[12]/C $bond:b13 @bond:CC $atom:monomers[12]/C $atom:monomers[13]/C $bond:b14 @bond:CC $atom:monomers[13]/C $atom:monomers[14]/C $bond:b15 @bond:CC $atom:monomers[14]/C $atom:monomer_end/C } create_var { $mol } # Define a molecule ID number for this polymer # This causes monomer[0], monomer[1], ... to share the same molecule-ID. # (because in the ch2group.lt file, the "..." in "$mol:..." looks for # a counter of type "$mol" in a parent molecule or earlier ancestor.) } # Hexadecane ######### (scratchwork calculations for the atomic coordinates) ######### # Lcc = 1.5350 # length of the C-C bond (Sp3) # Lch = 1.0930 # length of the C-H bond # theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle) # DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594 # DeltaYc = Lcc*cos(theta/2) # = 0.8862326632060754 # # 0.5*DeltaYc = 0.4431163316030377 # DeltaZh = Lch*sin(theta/2) # = 0.8924307629540046 # DeltaYh = Lch*cos(theta/2) # = 0.6310438442242609