Skip to content

Commit 166679d

Browse files
Allow linking to individual FAQ entries
1 parent e65de19 commit 166679d

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

source/_static/js/faq.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
function openElementByAnchor() {
2+
// Get the anchor from the URL
3+
var urlFragment = document.URL.split(/#(.*)/s)[1];
4+
5+
// Get the element with the anchored ID, then walk up the DOM to a details tag
6+
var elAnchor = document.getElementById(urlFragment);
7+
while (elAnchor !== null && elAnchor.tagName !== "DETAILS") {
8+
elAnchor = elAnchor.parentElement;
9+
}
10+
if (elAnchor === null) {
11+
return;
12+
}
13+
14+
// Open the details tag
15+
elAnchor.open = true;
16+
}
17+
18+
window.addEventListener("load", openElementByAnchor);
19+
window.navigation.addEventListener("navigate", openElementByAnchor);

source/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
# Configure the linkcheck builder
127127
linkcheck_anchors = False # This generates lots of false positives
128128
linkcheck_ignore = [
129-
r'https://pubs.acs.org/doi/' # ACS 403s the link checker. Thanks ACS.
129+
r"https://pubs.acs.org/doi/" # ACS 403s the link checker. Thanks ACS.
130130
]
131131

132132
# Cookbook stuff
@@ -149,6 +149,9 @@
149149
"css/cookbook.css",
150150
"css/faq.css",
151151
]
152+
html_js_files = [
153+
"js/faq.js",
154+
]
152155

153156
# List of patterns, relative to source directory, that match files and
154157
# directories to ignore when looking for source files.

source/faq.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Getting Started
44

55
:::::{faq-entry} What do I need to know to get started?
6+
---
7+
name: faq-get-started
8+
---
69

710
OpenFF tools follow a philosophy of failing with a descriptive error message rather than trying to interpret intention from ambiguous information, so you
811
might find you have to provide more information than you're used to.
@@ -12,6 +15,9 @@ Once you're ready to start coding, check out [](install.md) and [](examples.md).
1215
:::::
1316

1417
:::::{faq-entry} What kinds of input files can I apply SMIRNOFF parameters to?
18+
---
19+
name: faq-input-files
20+
---
1521

1622
SMIRNOFF force fields use direct chemical perception meaning that, unlike many molecular mechanics (MM) force fields, they apply parameters based on substructure searches acting directly on molecules.
1723
This creates unique opportunities and allows them to encode a great deal of chemistry quite simply, but it also means that the *starting point* for parameter assignment must be well-defined chemically, giving not just the elements and connectivity for all of the atoms of all of the components of your system, but also providing the formal charges and bond orders.
@@ -31,6 +37,9 @@ A force field which uses the chemical identity of molecules to assign parameters
3137
:::::
3238

3339
:::::{faq-entry} Can I use an Amber or GROMACS topology/coordinate file as a starting point for applying a SMIRNOFF force field?
40+
---
41+
name: faq-amber-gmx-top
42+
---
3443

3544
Amber and GROMACS topologies and coordinate files do not include enough explicit chemical information to apply a SMIRNOFF force field.
3645
For example, bond orders are not present in either format; one could infer bond orders based on bond lengths, or attempt to infer bond orders from force constants, but such inference work would be error-prone and is outside the scope of SMIRNOFF.
@@ -43,6 +52,9 @@ Amber and GROMACS topology and coordinate files can be [experimentally loaded] b
4352
:::::
4453

4554
:::::{faq-entry} Can I use an Amber force field with SMIRNOFF ligands?
55+
---
56+
name: faq-amber-ff
57+
---
4658

4759
Experimental support for this approach is available through Interchange. Briefly, the ligands are parametrized in the usual SMIRNOFF way to produce an Interchange, the Amber components are parametrized through OpenMM and then loaded into a second Interchange with [`Interchange.from_openmm()`], and then the two Interchanges are combined.
4860

@@ -51,6 +63,9 @@ Experimental support for this approach is available through Interchange. Briefly
5163
:::::
5264

5365
:::::{faq-entry} What about starting from a PDB file?
66+
---
67+
name: faq-pdb
68+
---
5469

5570
PDB files are a ubiquitous coordinate format, but the interpretation of the chemistry of a given PDB file is ambiguous in many ways.
5671
Without a complete and accurate chemical description of the system, SMIRNOFF parameters cannot be applied.
@@ -72,12 +87,18 @@ Given a PDB file of a hypothetical biomolecular system of interest containing a
7287
:::::
7388

7489
:::::{faq-entry} What about starting from an XYZ file?
90+
---
91+
name: faq-xyz
92+
---
7593

7694
XYZ files generally only contain elements and positions, and are therefore similar in content to PDB files. See the above section "What about starting from a PDB file?" for more information.
7795

7896
:::::
7997

8098
:::::{faq-entry} What do you recommend as a starting point?
99+
---
100+
name: faq-recommended-starting-point
101+
---
81102

82103
For application of SMIRNOFF force fields, we recommend that you begin your work with formats which provide the chemical identity of your small molecule (including formal charge and bond order).
83104
This means we recommend one of the following or equivalent:
@@ -92,6 +113,9 @@ Essentially, anything which provides the full identity of what you want to simul
92113
:::::
93114

94115
:::::{faq-entry} How can I transfer my prepared system to HPC resources for simulation?
116+
---
117+
name: faq-hpc
118+
---
95119

96120
OpenFF recommends exporting a prepared `Interchange` to the target MD engine and using the MD engine's recommended method to transfer it to HPC resources. This way, no additional dependencies need to be installed on the HPC resource to use OpenFF tools during preparation. For most MD engines, simply transfer the files produced by the appropriate [`Interchange.to_*()`] methods. For OpenMM, create a `System` Python object with [`Interchange.to_openmm_system()`] or [`ForceField.create_openmm_system()`] and transfer it by [serializing to XML].
97121

@@ -104,6 +128,9 @@ OpenFF recommends exporting a prepared `Interchange` to the target MD engine and
104128
## Errors and Performance Issues
105129

106130
:::::{faq-entry} Why does partial charge assignment fail during conformer generation, even though my molecule has conformers?
131+
---
132+
name: faq-charge-conformers
133+
---
107134

108135
Assigning partial charges with a quantum chemical method requires conformers, as they are an essential input to a quantum chemical calculation.
109136
Because the charges assigned by a SMIRNOFF force field should be transferrable between systems, we default to generating our own set of conformers during charge assignment.
@@ -144,6 +171,9 @@ interchange = force_field.create_interchange(
144171
:::::
145172

146173
:::::{faq-entry} I'm getting stereochemistry errors when loading a molecule from a SMILES string.
174+
---
175+
name: faq-stereochemistry-errors-from-smiles
176+
---
147177

148178
By default, the OpenFF Toolkit throws an error if a molecule with undefined stereochemistry is loaded. This is because the stereochemistry of a molecule may affect its partial charges, and assigning parameters using [direct chemical perception](https://pubs.acs.org/doi/pdf/10.1021/acs.jctc.8b00640) may require knowing the stereochemistry of chiral centers. In addition, coordinates generated by the Toolkit for undefined chiral centers may have any combination of stereochemistries; the toolkit makes no guarantees about consistency, uniformity, or randomness. Note that the main-line OpenFF force fields currently use a stereochemistry-dependent charge generation method, but do not include any other stereospecific parameters.
149179

@@ -152,6 +182,9 @@ This behavior is in line with OpenFF's general attitude of requiring users to ex
152182
:::::
153183

154184
:::::{faq-entry} Parameterizing my system, which contains a large molecule, is taking forever. What's wrong?
185+
---
186+
name: faq-slow-parametrization
187+
---
155188

156189
The mainline OpenFF force fields use AM1-BCC to assign partial charges (via the `<ToolkitAM1BCCHandler>` tag in the OFFXML file). This method unfortunately scales poorly with the size of a molecule and ligands roughly 100 atoms (about 40 heavy atoms) or larger may take so long (i.e. 10 minutes or more) that it seems like your code is simply hanging indefinitely. If you have an OpenEye license and OpenEye Toolkits [installed](installation/openeye), the OpenFF Toolkit will instead use `quacpac`, which can offer better performance on large molecules. Otherwise, it uses AmberTools' `sqm`, which is free to use.
157190

@@ -160,6 +193,9 @@ In the future, the use of AM1-BCC in OpenFF force fields may be replaced with me
160193
:::::
161194

162195
:::::{faq-entry} How can I silence warnings I'm expecting my code to generate?
196+
---
197+
name: faq-warnings
198+
---
163199

164200
OpenFF libraries often issue warnings when they detect that the user might be doing something they don't intend. These warnings are largely borne out of bug reports from users, and we'd rather make sure new users understand our software, so they can get noisy for experienced developers. We use the Python [`warnings`] module from the standard library, so warnings can be filtered from a particular section of code like so:
165201

@@ -172,11 +208,15 @@ with warnings.catch_warnings():
172208
)
173209

174210
Molecule.from_smiles("[H:1][O:4][H:2]")
211+
```
175212
:::::
176213

177214
## Installation Issues
178215

179216
:::::{faq-entry} I'm having troubles installing the OpenFF Toolkit on my Apple Silicon Mac.
217+
---
218+
name: faq-apple-silicon
219+
---
180220

181221
As of August 2022, some upstreams (at least AmberTools, possibly more) are not built on `osx-arm64`, so installing the OpenFF stack is only possible with [Rosetta]. See the [platform support] section of the installation documentation for more.
182222

@@ -188,6 +228,9 @@ As of August 2022, some upstreams (at least AmberTools, possibly more) are not b
188228
:::::
189229

190230
:::::{faq-entry} My mamba/conda installation of the toolkit doesn't appear to work. What should I try next?
231+
---
232+
name: faq-conda-install-broken
233+
---
191234

192235
We recommend that you install the toolkit in a fresh environment, explicitly passing the channels to be used, in-order:
193236

@@ -202,6 +245,9 @@ Taking the approach that conda/mamba environments are generally disposable, even
202245
:::::
203246

204247
:::::{faq-entry} My mamba/conda installation of the toolkit STILL doesn't appear to work.
248+
---
249+
name: faq-conda-install-broken-contd
250+
---
205251

206252
Many of our users encounter issues that are ultimately due to their terminal finding a different `conda` at higher priority in their `PATH` than the `conda` deployment where OpenFF is installed. To fix this, find the conda deployment where OpenFF is installed. Then, if that folder is something like `~/miniconda3`, run in the terminal:
207253

@@ -216,6 +262,9 @@ and then try rerunning and/or reinstalling the Toolkit.
216262
## Under the Hood
217263

218264
:::::{faq-entry} How are partial charges assigned in a SMIRNOFF force field?
265+
---
266+
name: faq-partial-charges
267+
---
219268

220269
There are [many charge methods](https://openforcefield.github.io/standards/standards/smirnoff/#partial-charge-and-electrostatics-models) supported by the SMIRNOFF specification. With the exception of water, mainline OpenFF force fields only use AM1-BCC (through `ToolkitAM1BCC`) to assign partial charges. (A future biopolymer force field will likely use library charges for standard residues.)
221270

@@ -230,6 +279,9 @@ A future charge method may use [NAGL](https://github.com/openforcefield/openff-n
230279
:::::
231280

232281
:::::{faq-entry} I understand the risks and want to perform bond and formal charge inference anyway
282+
---
283+
name: faq-chemical-inference
284+
---
233285

234286
If you are unable to provide a molecule in the formats recommended above and want to attempt to infer the bond orders and atomic formal charges, there are tools available elsewhere that can provide guesses for this problem. These tools are not perfect, and the inference problem itself is poorly defined, so you should review each output closely (see our [Core Concepts](users/concepts) for an explanation of what information is needed to construct an OpenFF Molecule). Some tools we know of include:
235287

@@ -240,6 +292,9 @@ If you are unable to provide a molecule in the formats recommended above and wan
240292
:::::
241293

242294
:::::{faq-entry} The partial charges generated by the toolkit don't seem to depend on the molecule's conformation! Is this a bug?
295+
---
296+
name: faq-charges-conformation-independent
297+
---
243298

244299
No! This is the intended behavior. The force field parameters of a molecule should be independent of both their chemical environment and conformation so that they can be used and compared across different contexts. When applying AM1BCC partial charges, the toolkit achieves a deterministic output by ignoring the input conformation and producing several new conformations for the same molecule. Partial charges are then computed based on these conformations. This behavior can be controlled with the `use_conformers` argument to [Molecule.assign_partial_charges()](openff.toolkit.topology.Molecule.assign_partial_charges).
245300

@@ -248,6 +303,9 @@ No! This is the intended behavior. The force field parameters of a molecule shou
248303
## SMIRNOFF Force Fields
249304

250305
:::::{faq-entry} How can I distribute my own force fields in SMIRNOFF format?
306+
---
307+
name: faq-distribute-smirnoff
308+
---
251309

252310
We support conda data packages for distribution of force fields in `.offxml` format! Just add the relevant entry point to `setup.py` and distribute via a conda (or PyPI) package:
253311

@@ -264,6 +322,9 @@ Where `get_my_new_force_field_paths` is a function in the `my_package` module pr
264322
:::::
265323

266324
:::::{faq-entry} What does "unconstrained" mean in a force field name?
325+
---
326+
name: faq-unconstrained-ff
327+
---
267328

268329
Each release of an [OpenFF force field](https://github.com/openforcefield/openff-forcefields/tree/main/openforcefields/offxml) has two associated `.offxml` files: one unadorned (for example, `openff-2.0.0.offxml`) and one labeled "unconstrained" (`openff_unconstrained-2.0.0.offxml`). This reflects the presence or absence of holonomic constraints on hydrogen-involving bonds in the force field specification.
269330

@@ -286,6 +347,9 @@ Starting with v2.0.0 (Sage), TIP3P water is included in OpenFF force fields. The
286347
:::::
287348

288349
:::::{faq-entry} How do I add or remove constraints from my own force field?
350+
---
351+
name: faq-add-remove-constraints
352+
---
289353

290354
To make applying or removing bond constraints easy, constrained force fields released by OpenFF always include full bond parameters. Constraints on Hydrogen-involving bonds inherit their lengths from the harmonic parameters also included in the force field. To restore the harmonic treatment, simply remove the appropriate constraint entry from the force field.
291355

0 commit comments

Comments
 (0)