| 1 |
import "ch2.lt" # load the definition of the "CH2" object |
| 2 |
import "ch3.lt" # load the definition of the "CH3" object |
| 3 |
|
| 4 |
|
| 5 |
Butane inherits OPLSAA { |
| 6 |
|
| 7 |
create_var {$mol} # optional:force all monomers to share the same molecule-ID |
| 8 |
|
| 9 |
# Create an array of 4 objects distributed along the X axis |
| 10 |
|
| 11 |
monomer1 = new CH3 |
| 12 |
monomer2 = new CH2.rot(180,1,0,0).move(1.2533223,0,0) |
| 13 |
monomer3 = new CH2.move(2.5066446,0,0) |
| 14 |
monomer4 = new CH3.rot(180,0,0,1).move(3.7599669,0,0) |
| 15 |
|
| 16 |
# Now add a list of bonds connecting the carbon atoms together: |
| 17 |
# (Angles, dihedrals, impropers will be automatically added later.) |
| 18 |
|
| 19 |
write('Data Bond List') { |
| 20 |
$bond:b1 $atom:monomer1/c $atom:monomer2/c |
| 21 |
$bond:b2 $atom:monomer2/c $atom:monomer3/c |
| 22 |
$bond:b3 $atom:monomer3/c $atom:monomer4/c |
| 23 |
} |
| 24 |
|
| 25 |
# The angles, dihedrals, and impropers will be generated automatically as well |
| 26 |
# However, by default, moltemplate might not always choose the optimal |
| 27 |
# parameters (types) for each dihedral. In this example, we can do better |
| 28 |
# by overriding one of the dihedral interactions which was chosen by default. |
| 29 |
# |
| 30 |
# ---- OPTIONAL: Customize the dihedrals ---- |
| 31 |
# |
| 32 |
# The default type choice for dihedrals is: |
| 33 |
# "@dihedral:CT_CT_CT_CT__1", which is a generic dihedral for alkane carbons |
| 34 |
# However we can improve the simulation accuracy by selecting this version: |
| 35 |
# "@dihedral:CT_CT_CT_CT__2" which is specific to butane (and is more stiff). |
| 36 |
|
| 37 |
write("Data Dihedrals") { |
| 38 |
$dihedral:c1_c2_c3_c4 @dihedral:CT_CT_CT_CT__2 $atom:monomer1/c $atom:monomer2/c $atom:monomer3/c $atom:monomer4/c |
| 39 |
} |
| 40 |
|
| 41 |
# NOTE: If you remove or comment out the write("Data Dihedrals") section above |
| 42 |
# the simulation will still run, but with suboptimal dihedral parameters. |
| 43 |
|
| 44 |
} # Butane |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
# HOW TO TELL IF YOU NEED A CUSTOM "Data Dihedrals" section: |
| 51 |
# |
| 52 |
# The "oplsaa2024.lt" file contains lists of many types of interactions. |
| 53 |
# This "oplsaa2024.lt" file is too long to browse through all these interactions |
| 54 |
# to see which best apply to your molecule. |
| 55 |
# |
| 56 |
# Instead, you can ask moltemplate to warn you if it encountered any ambiguity |
| 57 |
# in the best dihedral type to use, by running it this way: |
| 58 |
# |
| 59 |
# moltemplate.sh system.lt -report-duplicates bytype __ |
| 60 |
# |
| 61 |
# It will generate a file named "warning_duplicate_dihedrals.txt" if it was |
| 62 |
# unsure what the best choice was. The file will be long, since the same |
| 63 |
# warning will be printed for every copy of each molecule with ambiguous |
| 64 |
# dihedral. So it's better to do this on a small system.lt file with only |
| 65 |
# one copy of each molecule type. |
| 66 |
# |
| 67 |
# Open up the "warning_duplicate_dihedrals.txt". It will list out the possible |
| 68 |
# choices (such as "@dihedral:CT_CT_CT_CT__1", "@dihedral:CT_CT_CT_CT__2"). |
| 69 |
# |
| 70 |
# Open up the "oplsaa2024.lt" file and search for these interactions. |
| 71 |
# "oplsaa2024.lt" usually has a comment next to each choice explaining when |
| 72 |
# to use it (eg. "@dihedral:CT_CT_CT_CT__2 ... # butane only OPLS/2020"). |
| 73 |
# Choose best the dihedral type for your molecule ("@dihedral:CT_CT_CT_CT__2") |
| 74 |
# |
| 75 |
# Once you have determined the best @dihedral type to use, create a custom |
| 76 |
# "Data Dihedrals" section similar to the one in the example above. |
| 77 |
# Each line should have 6 entries: |
| 78 |
# |
| 79 |
# $dihedral:SOME_UNIQUE_NAME @dihedral:BEST_TYPE followed by the four $atoms |
| 80 |
# |
| 81 |
# Do this for each interaction you want to override. |
| 82 |
# (Note: Overriden dihedrals don't appear in the warning_duplicate_dihedrals.txt |
| 83 |
# file. So when all ambiguous dihedrals have been overriden, this file will |
| 84 |
# go away.) |
| 85 |
# |
| 86 |
# |
| 87 |
# NOTE: |
| 88 |
# In addition to dihedrals, ambiguity can also happen for bonds, angles, |
| 89 |
# and impropers. For example, you might also notice a file named |
| 90 |
# "warning_duplicate_angles.txt". If so, follow the same procedure described |
| 91 |
# above to choose the best angle type. Then create a custom "Data Angles" |
| 92 |
# section (similar to the "Data Dihedrals" section above) with 5 columns |
| 93 |
# on each line ($angle, @angle, and the three $atoms). |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
#### (scratchwork calculations for the horizontal distance between carbons) #### |
| 99 |
# Lcc = 1.5350 # length of the C-C bond (Sp3) |
| 100 |
# theta=2*atan(sqrt(2)) # ~= 109.5 degrees = tetrahedronal angle (C-C-C angle) |
| 101 |
# DeltaXc = Lcc*sin(theta/2) # = 1.2533222517240594 |