Skip to content

Commit c750007

Browse files
committed
simplified the procedure for using the OPLSAA force field. (Checking for alternate dihedrals and their associated warnings is now clearly marked as optional. Consequently the OPLSAA examples now run moltemplate.sh the ordinary way using "moltemplate.sh system.lt")
1 parent 09d0258 commit c750007

File tree

43 files changed

+461
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+461
-388
lines changed

examples/all_atom/force_field_OPLSAA/README.md

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,9 @@ There is no guarantee that simulations prepared using moltemplate will reproduce
66

77

88

9-
### Suggestion: Make a local copy of the "oplsaa2023.lt" file
9+
-------------------------
1010

11-
WARNING: The OPLSAA force field changes slightly over time.
12-
When it happens, it can cause the names of the
13-
@atoms, @bonds, @angles, and @dihedrals types to change.
14-
This could break backward compatibility,
15-
and cause moltemplate.sh to fail when reading your .lt files.
16-
So if you are using OPLSAA, it's a good idea to make a backup copy of the
17-
[oplsaa2023.lt file](../../../moltemplate/force_fields/oplsaa2023.lt)
18-
(located in the
19-
[moltemplate/force_fields/](../../../moltemplate/force_fields/) folder).
20-
Copy it to the folder with your other .lt files for the simulation you are working on. (Moltemplate will look in the local folder first for all the .lt files that it needs, including "oplsaa2023.lt".)
21-
This will protect you from force-field parameter changes, and you
22-
will be able to continue using your existing atom and bonded type names safely.
23-
24-
25-
26-
27-
### Atomic charges
11+
## Atomic charges
2812

2913
In most of the OPLSAA examples,
3014
the atomic charges are determined by their @atom types
@@ -35,7 +19,6 @@ LT files will be ignored.)*
3519
**These charges can be overridden.**
3620

3721

38-
3922
### Customizing atomic charges in OPLSAA molecules
4023

4124
#### Background information
@@ -86,39 +69,68 @@ of the [spce.lt](waterSPCE+methane/moltemplate_files/spce.lt) file.
8669

8770

8871

72+
-------------------------
8973

74+
## Minor issue: Bloated lammps input scripts
9075

76+
By default, LAMMPS input scripts prepared using moltemplate contain
77+
the entire contents of the OPLSAA force-field, even when simulating
78+
small systems with just a few atom types.
79+
This is harmless, but if you want to get rid of this extra information,
80+
follow the instructions in the "README_remove_irrelevant_info.sh" files.
9181

92-
### Optional: Duplicate dihedrals, angles, and bonds
9382

94-
Sometimes, even after you have specified the (OPLSAA-specific) atom types
95-
for the atoms in your molecule, there may be multiple possible choices
96-
of dihedral, angle, or bond interactions between those atoms
97-
available in OPLSAA force field (stored in the "oplsaa2023.lt" file).
98-
When that happens, moltemplate.sh will *attempt to make a reasonable guess*,
99-
chosing the original (oldest, most common) version of the interaction between
100-
those atom types. However, you can override this choice:
83+
-------------------------
10184

102-
- The new (2023) version of OPLSAA contains many additional choices for your dihedral, angle, and bond interactions. This gives you an opportunity to improve your simulation accuracy, but it also requires more effort on your part. To see the list of choices, you must now run moltemplate with the "-report-duplicates bytype __" arguments. For example:
103-
```
104-
moltemplate.sh system.lt -report-duplicates bytype __
105-
```
106-
- If you see a file named "warning_duplicate_dihedrals.txt", "warning_duplicate_angles.txt", "warning_duplicate_bonds.txt", or "warning_duplicate_impropers.txt" after running moltemplate, then it might be a good idea to read the first few warning messages
107-
in those files and modify your .lt files accordingly (for example, by adding a custom "Data Dihedrals" section). Several example .lt files demonstrate how to do that, including:
108-
- butane/moltemplate_files/butane.lt
109-
- benzene+benzoic_acid/moltemplate_files/benzoic_acid.lt
85+
## *OPTIONAL*
86+
## Customizing dihedrals, angles, and bonds
11087

88+
The OPLSAA force field contains many alternative parameter choices for
89+
dihedral, angle, and bond interactions.
90+
It's not always possible to for determine the optimal choice of dihedral angle
91+
parameters from the @atom types alone. By default, moltemplate hides this
92+
issue, and will *attempt to make a reasonable guess*, chosing the most generic
93+
version of the interaction between those atom types.
94+
*(The same is true with most other molecule builder programs.)*
11195

96+
***Most of the time, this is fine.***
97+
At the beginning when you are trying to get your simulation to run,
98+
don't worry about choosing the optimal dihedral, angle, or bond parameters.
99+
The default choice is often good enough.
112100

113-
### Minor issue: Improper angles
101+
*Eventually, if you want to improve the accuracy of your simulation somewhat,
102+
then you can detect these ambiguous duplicate dihedrals and angles.
103+
Then you can override the default choice by following the (somewhat laborious)
104+
procedure below.*
114105

115-
The style of improper interaction used by OPLS force fields depends on an angle which depends on the order of the atoms surrounding the central atom. When multiple atoms have the same type, this creates ambiguity in atom order. Since there is no guarantee that moltemplate will choose the same atom order as other molecule builders (such as VMD), this can lead to small unavoidable discrepancies in energies and forces computed by LAMMPS and NAMD. But their effect should be neglegible.
116-
*(Please let us know if this is not the case.)*
117-
118-
119-
120-
### Minor issue: Bloated lammps input scripts
121-
122-
By default, LAMMPS input scripts prepared using moltemplate contain the entire contents of the OPLS force-field, even when simulating small systems with just a few atom types.
106+
Again, moltemplate hides this issue by default.
107+
To be informed when moltemplate detects multiple ambiguous dihedrals
108+
(or angles), you must run moltemplate.sh with the optional
109+
`-report-duplicates bytype __` arguments.
110+
For example:
111+
```
112+
moltemplate.sh system.lt -report-duplicates bytype __
113+
```
114+
- If you see a file named "warning_duplicate_dihedrals.txt" after running
115+
moltemplate.sh, then moltemplate found multiple plausible
116+
dihedral interactions between the same set of atoms in your molecules.
117+
If you see this file, then read the first few warning messages in that file.
118+
*(This file is typically long and redundant, since there are typically many
119+
copies of the same molecules in a simulation.)*
120+
Then modify your .lt files accordingly.
121+
*(This requires adding a custom "Data Dihedrals" section where you specify
122+
the version of the @dihedral that you want to use for those atoms.
123+
Several example .lt files demonstrate how to do that in detail, including
124+
[butane.lt](./butane/moltemplate_files/butane.lt) and
125+
[benzoic_acid_optimizations.lt](./benzene+benzoic_acid/moltemplate_files/optimized_version_using_custom_dihedrals/benzoic_acid_optimizations.lt).)*
126+
- Each time you add a line to your "Data Dihedrals" section, the corresponding
127+
warning(s) in the "warning_duplicate_dihedrals.txt" file will be removed.
128+
So read the first warning, add a corresponding line to the "Data Dihedrals"
129+
section to address that warning, and run moltemplate.sh again. Repeat this
130+
until the "warning_duplicate_dihedrals.txt" file is no longer being generated.
131+
- If you see a file named "warning_duplicate_angles.txt"
132+
or "warning_duplicate_bonds.txt", then follow the same procedure.
133+
Read those warning messages and add a custom "Data Angles" or "Data Bonds"
134+
section to your .lt files to override the default choice of
135+
@angle or @bond type.
123136

124-
This is harmless, but if you want to get rid of this extra information, follow the instructions in the "README_remove_irrelevant_info.sh" files.

examples/all_atom/force_field_OPLSAA/alkane_chain_single/README_setup.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ cd moltemplate_files
44

55
# run moltemplate
66

7-
# This was the original (simple) way to run moltemplate:
8-
# moltemplate.sh system.lt <-- COMMENTING OUT
9-
# Instead, this is the recommended way to run moltemplate with OPLSAA:
7+
moltemplate.sh system.lt
108

11-
moltemplate.sh system.lt -report-duplicates bytype __
12-
13-
# (The optional "-report-duplicates bytype __" arguments check to make
14-
# sure that there was no ambiguity in the dihedrals that were generated.
15-
# This is an issue with OPLSAA. If there was, then moltemplate will create
16-
# a file named "warning_duplicate_dihedrals.txt".)
9+
# --- OPTIONAL: ---
10+
# You can also check for missing angle,dihedral params this way:
11+
# moltemplate.sh -checkff system.lt
1712
#
18-
# (Note: You can also check for missing angle,dihedral params this way:)
19-
# moltemplate.sh -checkff system.lt
13+
# You can also check for alternative possible OPLSAA parameters this way:
14+
# moltemplate.sh system.lt -report-duplicates bytype __
15+
# This will check to make sure that there was no ambiguity in the OPLSAA
16+
# force-field parameters. Unfortunately, if you do that, moltemplate
17+
# will create a "warning_duplicate_dihedrals.txt" which often contains
18+
# more spurious warnings than you could possibly hope to read. Most
19+
# OPLSAA molecule builder programs do not warn you about these ambiguities.
20+
# Moltemplate does warn you, but in my experience, it's often not worth the
21+
# trouble to worry about them. Just use: "moltemplate.sh system.lt"
22+
# --- OPTIONAL: ---
2023

2124

2225
# Moltemplate generates various files with names ending in *.in* and *.data.

examples/all_atom/force_field_OPLSAA/alkane_chain_single/run.in.min

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PREREQUISITES:
22
#
3-
# You must use moltemplate.sh to create 3 files:
4-
# system.data system.in.init system.in.settings
3+
# You must use moltemplate.sh to create 4 files:
4+
# system.data system.in.init system.in.settings system.in.charges
55
#
66
# ------------------------------- Initialization Section --------------------
77

examples/all_atom/force_field_OPLSAA/alkane_chain_single/run.in.nvt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PREREQUISITES:
22
#
3-
# 1) You must use moltemplate.sh to create 3 files:
4-
# system.data system.in.init system.in.settings
3+
# 1) You must use moltemplate.sh to create 4 files:
4+
# system.data system.in.init system.in.settings system.in.charges
55
# (Follow the instructions in README_setup.sh,
66
# or run the file as a script using ./README_setup.sh)
77
# 2) You must minimize the system beforehand by using "run.in.min".

examples/all_atom/force_field_OPLSAA/benzene+benzoic_acid/README_setup.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ cd moltemplate_files
44

55
# run moltemplate
66

7-
# This was the original (simple) way to run moltemplate:
8-
# moltemplate.sh system.lt <-- COMMENTING OUT
9-
# Instead, this is the recommended way to run moltemplate with OPLSAA:
7+
moltemplate.sh system.lt
108

11-
moltemplate.sh system.lt -report-duplicates bytype __
12-
13-
# (The optional "-report-duplicates bytype __" arguments check to make
14-
# sure that there was no ambiguity in the dihedrals that were generated.
15-
# This is an issue with OPLSAA. If there was, then moltemplate will create
16-
# a file named "warning_duplicate_dihedrals.txt".)
17-
#
18-
# (Note: You can also check for missing angle,dihedral params this way:)
9+
# --- OPTIONAL: ---
10+
# You can also check for missing angle,dihedral params this way:
1911
# moltemplate.sh -checkff system.lt
12+
#
13+
# You can also check for alternative possible OPLSAA parameters this way:
14+
# moltemplate.sh system.lt -report-duplicates bytype __
15+
#
16+
# The optional "-report-duplicates bytype __" arguments check to make
17+
# sure that there was no ambiguity in the chosen dihedrals parameters
18+
# Often moltemplate.sh will create a "warning_duplicate_dihedrals.txt"
19+
# file containing more warnings than you could possibly hope to read. Most
20+
# OPLSAA molecule builder programs do not warn you about these ambiguities.
21+
# Moltemplate does warn you, but in my experience, it's not worth the
22+
# trouble to worry about them. Just use: "moltemplate.sh system.lt"
23+
# --- OPTIONAL: ---
2024

2125

2226
# Moltemplate generates various files with names ending in *.in* and *.data.

examples/all_atom/force_field_OPLSAA/benzene+benzoic_acid/moltemplate_files/benzene.lt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ import "oplsaa2023.lt"
66
# @atom:146 "H - HA | Benzene H"
77
# The "oplsaa2023.lt" file is located at:
88
# https://github.com/jewettaij/moltemplate/tree/master/moltemplate/force_fields/
9-
# If you want to customize oplsaa2023.lt, download it and copy it to this folder.
9+
# If you want to customize oplsaa2023.lt, download it and copy it to this folder
1010

1111

1212

1313
Benzene inherits OPLSAA {
1414

15-
# atom-id mol-id atom-type charge X Y Z # comment
15+
# atom-id mol-id atom-type charge X Y Z
1616

1717
write("Data Atoms") {
18-
$atom:c1 $mol @atom:145 0.00 -0.739 1.189 -0.00733 # @atom:145 --> C - CA | Benzene C
19-
$atom:c2 $mol @atom:145 0.00 0.614 1.208 0.35167 # @atom:145 --> C - CA | Benzene C
20-
$atom:c3 $mol @atom:145 0.00 1.353 0.019 0.35867 # @atom:145 --> C - CA | Benzene C
21-
$atom:c4 $mol @atom:145 0.00 0.739 -1.189 0.00667 # @atom:145 --> C - CA | Benzene C
22-
$atom:c5 $mol @atom:145 0.00 -0.614 -1.208 -0.35133 # @atom:145 --> C - CA | Benzene C
23-
$atom:c6 $mol @atom:145 0.00 -1.353 -0.019 -0.35833 # @atom:145 --> C - CA | Benzene C
24-
$atom:h1 $mol @atom:146 0.00 -1.309 2.106 -0.01233 # @atom:146 --> H - HA | Benzene H
25-
$atom:h2 $mol @atom:146 0.00 1.088 2.14 0.62267 # @atom:146 --> H - HA | Benzene H
26-
$atom:h3 $mol @atom:146 0.00 2.397 0.034 0.63467 # @atom:146 --> H - HA | Benzene H
27-
$atom:h4 $mol @atom:146 0.00 1.309 -2.106 0.01267 # @atom:146 --> H - HA | Benzene H
28-
$atom:h5 $mol @atom:146 0.00 -1.088 -2.14 -0.62233 # @atom:146 --> H - HA | Benzene H
29-
$atom:h6 $mol @atom:146 0.00 -2.397 -0.034 -0.63533 # @atom:146 --> H - HA | Benzene H
18+
$atom:c1 $mol @atom:145 0.00 -0.739 1.189 -0.00733
19+
$atom:c2 $mol @atom:145 0.00 0.614 1.208 0.35167
20+
$atom:c3 $mol @atom:145 0.00 1.353 0.019 0.35867
21+
$atom:c4 $mol @atom:145 0.00 0.739 -1.189 0.00667
22+
$atom:c5 $mol @atom:145 0.00 -0.614 -1.208 -0.35133
23+
$atom:c6 $mol @atom:145 0.00 -1.353 -0.019 -0.35833
24+
$atom:h1 $mol @atom:146 0.00 -1.309 2.106 -0.01233
25+
$atom:h2 $mol @atom:146 0.00 1.088 2.14 0.62267
26+
$atom:h3 $mol @atom:146 0.00 2.397 0.034 0.63467
27+
$atom:h4 $mol @atom:146 0.00 1.309 -2.106 0.01267
28+
$atom:h5 $mol @atom:146 0.00 -1.088 -2.14 -0.62233
29+
$atom:h6 $mol @atom:146 0.00 -2.397 -0.034 -0.63533
3030
}
3131

3232
# Note: You don't have to specify the charge in this example because we are

0 commit comments

Comments
 (0)