diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_templates/class.rst b/docs/_templates/class.rst new file mode 100644 index 00000000..afbed2d4 --- /dev/null +++ b/docs/_templates/class.rst @@ -0,0 +1,24 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + {% if methods %} + {% for item in methods %} + .. automethod:: {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..df9b1676 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,96 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('..')) + +import sphinx + + +# -- Project information ----------------------------------------------------- + +project = 'Open Force Field for PELE' +copyright = '2020, Barcelona Supercomputing Center' +author = 'Martí Municoy' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'm2r', + 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', ] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +def monkeypatch(cls): + """ decorator to monkey-patch methods """ + def decorator(f): + method = f.__name__ + old_method = getattr(cls, method) + setattr(cls, method, lambda self, *args, **kwargs: f(old_method, self, *args, **kwargs)) + return decorator + + +# workaround until https://github.com/miyakogi/m2r/pull/55 is merged +@monkeypatch(sphinx.registry.SphinxComponentRegistry) +def add_source_parser(_old_add_source_parser, self, *args, **kwargs): + # signature is (parser: Type[Parser], **kwargs), but m2r expects + # the removed (str, parser: Type[Parser], **kwargs). + if isinstance(args[0], str): + args = args[1:] + return _old_add_source_parser(self, *args, **kwargs) + + +# Custom options +autosummary_generate = True +#autoclass_content = "class" +#autodoc_default_flags = ['members', 'inherited-members'] +autodoc_member_order = 'bysource' +#numpydoc_class_members_toctree = False +source_suffix = ['.rst', '.md'] +master_doc = 'index' + +import offpele +version = offpele.__version__ + +pygments_style = 'sphinx' + +html_theme = 'sphinx_rtd_theme' + +napoleon_google_docstring = False +napoleon_use_param = False +napoleon_use_ivar = True +#html_theme = 'bootstrap' +#html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..92e2ca78 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,25 @@ +Open Force Field for PELE +========================= + +The Open Force Field for PELE is a Python package that builds +PELE-compatible force field templates using the Open Force Field +toolkit. + + +User guide +---------- + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + +API documentation +----------------- + +.. toctree:: + :maxdepth: 1 + + topology + template + solvent diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..2119f510 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/solvent.rst b/docs/solvent.rst new file mode 100644 index 00000000..1e48e96f --- /dev/null +++ b/docs/solvent.rst @@ -0,0 +1,20 @@ +.. _solvent :: + +Solvent models +============== + +This module provides different methods to parameterize solvent models +for PELE. + +.. currentmodule:: offpele.solvent + +Primary objects +--------------- + +.. autosummary:: + :nosignatures: + :toctree: api/autogenerated + :template: class.rst + + OBC1 + OBC2 diff --git a/docs/template.rst b/docs/template.rst new file mode 100644 index 00000000..45858503 --- /dev/null +++ b/docs/template.rst @@ -0,0 +1,35 @@ +.. _template :: + +Template handlers +================= + +This module provides a toolkit to generate parameter templates for PELE. + +.. currentmodule:: offpele.template + +Primary objects +--------------- + +.. autosummary:: + :nosignatures: + :toctree: api/autogenerated + :template: class.rst + + Impact + + +Secondary objects +----------------- + +.. autosummary:: + :nosignatures: + :toctree: api/autogenerated + :template: class.rst + + impact.WritableWrapper + impact.WritableAtom + impact.WritableBond + impact.WritableAngle + impact.WritableProper + impact.WritableImproper + diff --git a/docs/topology.rst b/docs/topology.rst new file mode 100644 index 00000000..3aa8dda3 --- /dev/null +++ b/docs/topology.rst @@ -0,0 +1,44 @@ +.. _topology :: + +Topology representations +======================== + +This module provides different topological representations to +translate from external toolkits the different molecular parameters +for PELE. + +.. currentmodule:: offpele.topology + +Primary objects +--------------- + +.. autosummary:: + :nosignatures: + :toctree: api/autogenerated + :template: class.rst + + Molecule + + +Secondary objects +----------------- + +.. autosummary:: + :nosignatures: + :toctree: api/autogenerated + :template: class.rst + + Atom + Bond + Angle + Dihedral + Proper + Improper + molecule.DummyAtom + topology.OFFDihedral + topology.OFFProper + topology.OFFImproper + ZMatrix + rotamer.Rotamer + rotamer.RotamerLibrary + rotamer.MolecularGraph