Suppose we want to extend the "forcefield.lt" file from this simple example.
# --- new file "forcefield_variant.lt" ---
import "forcefield.lt" #<--defines "ForceField"
ForceField {
# ADD YOUR NEW ATOM TYPES AND BONDED INTERACTIONS HERE
# Note: This will not overwrite the preexisting "ForceField" object.
# (Instead, it augments the "ForceField" object defined earlier.)
# Now add a new atom type ("@atom:CB")
write_once("Data Masses") {
@atom:CB 20.0
}
:
# Define a new dihedral interaction:
write_once("Data Dihedrals By Type") {
@dihedral:XCCX @atom:* @atom:CA @atom:CA @atom:*
}
:
}
(Incidentally, this is how the LOPLS force field was implemented.
See loplsaa.lt .)
In the last line of this example, "@atom:*" will match with "@atom:CA", "@atom:R", and "@atom:CB", since they all belong to the same "ForceField" object. In the last line of this example, "@atom:*" will match with "@atom:CA", "@atom:R", and "@atom:CB", since they all belong to the same "ForceField" object. Molecules that use the new force field version will import the new "forcefield_variant.lt" file.
import "forcefield_variant.lt"
MoleculeV2 inherits ForceField {
# Here you can refer to @atoms, @bonds, etc... defined in either file:
# - "forcefield.lt" (eg. @atom:CA, @atom:R, ...)
# - "forcefield_variant.lt" (eg. @atom:CB, @dihedral:XCCX)
}
Note: Don't try to create a new force-field object containing only the new @atom, @bond, @angle, @dihedral or @improper types. (For example "ForceField2 inherits ForceField".) See section 7.8 of the moltemplate manual for details.