Skip to content

Commit

Permalink
Fix all sphinx warnings (#1796)
Browse files Browse the repository at this point in the history
* Fix Sphinx warnings and fail on warning

* Fix remaining Sphinx warnings by translating release history to markdown

* Update changelog

* fix weird formatting thing in releasehistory

* fix unclosed literal in to_qcschema docstring

---------

Co-authored-by: Jeff Wagner <[email protected]>
Co-authored-by: Jeff Wagner <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2024
1 parent 0375d5f commit 5ffcb58
Show file tree
Hide file tree
Showing 13 changed files with 903 additions and 986 deletions.
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
version: 2
sphinx:
configuration: docs/conf.py
fail_on_warning: true
build:
os: ubuntu-20.04
tools:
Expand Down
5 changes: 4 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ This behavior is in line with OpenFF's general attitude of requiring users to ex

## I'm having troubles installing the OpenFF Toolkit on my Apple Silicon Mac.

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](https://support.apple.com/en-au/HT211861). See the [platform support](installation/m1) section of the installation documentation for more.
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.

(Keywords `osx-arm64`, M1 Mac, M2 Mac)

[Rosetta]: https://support.apple.com/en-au/HT211861
[platform support]: inv:#install_arm

## My mamba/conda installation of the toolkit doesn't appear to work. What should I try next?

We recommend that you install the toolkit in a fresh environment, explicitly passing the channels to be used, in-order:
Expand Down
6 changes: 3 additions & 3 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ channels:
dependencies:
- pip
# readthedocs dependencies
- myst-nb
- myst-parser>=0.14
- myst-nb=1
- myst-parser
- docutils
- sphinx-notfound-page
- sphinx>=5.0,<6
- sphinx=6
# conda build dependencies
- python=3.9
- setuptools
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If you do not have Mamba or Conda installed, see the [ecosystem installation doc
Installation via the Mamba package manager is the recommended method since all dependencies are automatically fetched and installed for you.
:::

[ecosystem installation documentation]: openff.docs:install
[ecosystem installation documentation]: inv:openff.docs#install

(installation/platforms)=

Expand Down
1,799 changes: 849 additions & 950 deletions docs/releasehistory.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ including offering serialization to a variety of standard formats (including [XM

## Primary objects

:::{eval-rst}
```{eval-rst}
.. currentmodule:: openff.toolkit.topology
.. autosummary::
:nosignatures:
Expand All @@ -20,11 +20,11 @@ including offering serialization to a variety of standard formats (including [XM
FrozenMolecule
Molecule
Topology
:::
```

## Secondary objects

:::{eval-rst}
```{eval-rst}
.. currentmodule:: openff.toolkit.topology
.. autosummary::
:nosignatures:
Expand All @@ -37,5 +37,5 @@ including offering serialization to a variety of standard formats (including [XM
ImproperDict
HierarchyScheme
HierarchyElement
:::
```

2 changes: 1 addition & 1 deletion docs/users/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ OpenFF [`ForceField`](openff.toolkit.typing.engines.smirnoff.forcefield.ForceFie
: An object generated from an OFFXML file (or other source of SMIRNOFF data).
Most information from the SMIRNOFF data source is stored in this object's several `ParameterHandler`s, however some top-level SMIRNOFF data is stored in the `ForceField` object itself.

OpenFF [`Interchange`](openff.interchange:index)
OpenFF [`Interchange`](inv:openff.interchange#index)
: A `Topology` that has been parametrized by a `ForceField`. An `Interchange` contains all the information needed to calculate an energy or start a simulation. `Interchange` also provides methods to export this information
to MD simulation engines.
4 changes: 2 additions & 2 deletions docs/users/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Some CI builds run using only RDKit as a backend, some run using only OpenEye To

The CI matrix is currently as follows:

:::{eval-rst}
```{eval-rst}
+-----------------------+------------+-----------+-------------+------------+-----------+-------------+
| | Linux | macOS |
+-----------------------+------------+-----------+-------------+------------+-----------+-------------+
Expand All @@ -414,4 +414,4 @@ The CI matrix is currently as follows:
+-----------------------+------------+-----------+-------------+------------+-----------+-------------+
| Python 3.12 and newer | Pending official releases and upstream support |
+-----------------------+------------+-----------+-------------+------------+-----------+-------------+
:::
```
2 changes: 1 addition & 1 deletion docs/users/smirnoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ general or as specific as needed.
[SMIRKS]: https://www.daylight.com/dayhtml/doc/theory/theory.smirks.html
[standards repository]: https://openforcefield.github.io/standards/standards/smirnoff/
[`Interchange`]: openff.interchange.Interchange
[producing input files and data]: openff.interchange:using/output
[producing input files and data]: inv:openff.interchange#using/output

:::{hint}
This page is not the SMIRNOFF spec; it has been moved to the
Expand Down
2 changes: 1 addition & 1 deletion openff/toolkit/topology/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -4416,7 +4416,7 @@ def to_qcschema(self, multiplicity=1, conformer=0, extras=None):
The kekule structure of the molecule is saved in two places on the returned Molecule:
* ``extras["canonical_isomeric_explicit_hydrogen_mapped_smiles"]
* ``extras["canonical_isomeric_explicit_hydrogen_mapped_smiles"]``
* ``identifiers["canonical_isomeric_explicit_hydrogen_mapped_smiles"]``
.. warning :: This API is experimental and subject to change.
Expand Down
18 changes: 10 additions & 8 deletions openff/toolkit/topology/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ def from_pdb(
All molecules in the PDB file have the following requirements:
* Polymer molecules must use the standard atom names described in the
`PDB Chemical Component dictionary <https://www.wwpdb.org/data/ccd>`_
`PDB Chemical Component Dictionary <https://www.wwpdb.org/data/ccd>`_
(PDB CCD).
* There must be no missing atoms (all hydrogens must be explicit).
* All particles must correspond to an atomic nucleus (particles in the
Expand Down Expand Up @@ -1669,13 +1669,15 @@ def from_pdb(
HierarchyElement ('B', '2', ' ', 'CYS') of iterator 'residues' containing 11 atom(s),
HierarchyElement ('B', '3', ' ', 'NME') of iterator 'residues' containing 6 atom(s)]
Polymer systems can also be supported if _custom_substructures are given as a dict[str, list[str]],
where the keys are unique atom names and the values are lists of substructure smarts. The
substructure smarts must follow the same format as given in
"proteins/aa_residues_substructures_explicit_bond_orders_with_caps_explicit_connectivity.json":
”<bond>[#<atomic number>D<degree>+<formal charge>:<id>]<bond>” for monomer atoms and
”<bond>[*:<id>]” for adjacent neighboring atoms
(NOTE: This functionality is experimental!)
Polymer systems can also be supported if ``_custom_substructures`` are
given as a ``dict[str, list[str]]``, where the keys are unique atom
names and the values are lists of substructure SMARTS. The substructure
SMARTS must follow the same format as given in the `residue
substructure connectivity library
<https://github.com/openforcefield/openff-toolkit/blob/main/openff/toolkit/data/proteins/aa_residues_substructures_explicit_bond_orders_with_caps_explicit_connectivity.json>`_:
``"<bond>[#<atomic number>D<degree>+<formal charge>:<id>]<bond>"`` for monomer
atoms and ``"<bond>[*:<id>]"`` for adjacent neighboring atoms
(NOTE: This functionality is experimental!)
>>> PE_substructs = {
... "PE": [
Expand Down
19 changes: 9 additions & 10 deletions openff/toolkit/typing/engines/smirnoff/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,15 @@ def label_molecules(self, topology):
For each molecule, a dictionary of force types is returned, and for each force type,
each force term is provided with the atoms involved, the parameter id assigned, and the corresponding SMIRKS.
.. todo::
What is the most useful API for this method?
- Should we instead accept :class:`Molecule` objects as input and
individually return labels?
- Should we attach the labels to the :class:`Molecule` object?
- Or should we label all interactions in a :class:`Topology` instead
of just labeling its ``unique_molecules``?
Parameters
----------
topology : openff.toolkit.topology.Topology
Expand All @@ -1253,16 +1262,6 @@ def label_molecules(self, topology):
['HarmonicBondForce']`` gives details for the harmonic bond
parameters for the first molecule. Each element is a list of the
form: ``[ ( [ atom1, ..., atomN], parameter_id, SMIRKS), ... ]``.
.. todo::
What is the most useful API for this method?
- Should we instead accept :class:`Molecule` objects as input and
individually return labels?
- Should we attach the labels to the :class:`Molecule` object?
- Or should we label all interactions in a :class:`Topology` instead
of just labeling its ``unique_molecules``?
"""
from openff.toolkit import Topology
from openff.toolkit.typing.engines.smirnoff.parameters import VirtualSiteHandler
Expand Down
21 changes: 17 additions & 4 deletions openff/toolkit/typing/engines/smirnoff/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@
_cal_mol_a2 = unit.calorie / unit.mole / unit.angstrom**2


# Hack to make Sphinx happy without breaking changes
class _UNDEFINED:
"""
Marker type for an undeclared default parameter.
Custom type used by ``ParameterAttribute`` to differentiate between ``None``
and undeclared default.
"""

pass


UNDEFINED = _UNDEFINED


def _linear_inter_or_extrapolate(points_dict, x_query):
"""
Linearly interpolate or extrapolate based on a piecewise linear function
Expand Down Expand Up @@ -320,10 +335,8 @@ class ParameterAttribute:
"""

class UNDEFINED:
"""Custom type used by ``ParameterAttribute`` to differentiate between ``None`` and undeclared default."""

pass
UNDEFINED = UNDEFINED
"""Marker type for an undeclared default parameter."""

def __init__(
self,
Expand Down

0 comments on commit 5ffcb58

Please sign in to comment.