Skip to content

Commit

Permalink
Converters API (#2882)
Browse files Browse the repository at this point in the history
Fixes #2790 

## Work done in this PR
* Creates a new converters API
  * Makes u.atoms.convert_to("PACKAGE") case insensitive
  * Allows passing kwargs to converters: u.atoms.convert_to("rdkit", NoImplicit=False)
  * Adds u.atoms.convert_to.package() methods automatically from the metaclass magic, with TAB completion support, and docstring from the converter
* Moves RDKit, Parmed, and OpenMM to MDAnalysis.converters

Authored-by: Cédric Bouysset <[email protected]>
  • Loading branch information
cbouy authored May 10, 2021
1 parent 1a11ac8 commit cef7d3f
Show file tree
Hide file tree
Showing 33 changed files with 1,136 additions and 745 deletions.
10 changes: 10 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The rules for this file:
* 2.0.0

Fixes
* Fixed OpenMM converter documentation not showing up in the Converters
section (Issue #3262, PR #2882)
* WaterBridgeAnalysis double counts the water (Issue #3119, PR #3120)
* NCDFReader now defaults to a dt value of 1.0 ps when it cannot estimate
it from the first two frames of the file (Issue #3166)
Expand Down Expand Up @@ -175,6 +177,12 @@ Enhancements
checking if it can be used in parallel analysis. (Issue #2996, PR #2950)

Changes
* Introduces a new converter API with all converters in MDAnalysis.converters
(Issue #2790, PR #2882)
* The ParmEd classes were moved to the `converters` module (PR #2882)
* The `convert_to` method of the AtomGroup is now case-insensitive and
passes keyword arguments to the underlying converter. It can also be used
as `convert_to.lowercase_pkg_name()` for tab-completion (PR #2882)
* `analysis.polymer.PersistenceLength` class now stores `lb`,
`lp` and `fit` using the `analysis.base.Results` class
(Issues #3289, #3291)
Expand Down Expand Up @@ -250,6 +258,8 @@ Changes
* Added OpenMM coordinate and topology converters (Issue #2863, PR #2917)

Deprecations
* In 3.0.0 the ParmEd classes will only be accessible from the
`MDAnalysis.converters` module.
* The `analysis.polymer.PersistenceLength.lb`,
`analysis.polymer.PersistenceLength.lp` and
`analysis.polymer.PersistenceLength.fit` attributes are now deprecated in
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@

# After Universe import
from .coordinates.MMTF import fetch_mmtf
from . import converters

from .due import due, Doi, BibTeX

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""OpenMM structure I/O --- :mod:`MDAnalysis.coordinates.OpenMM`
"""OpenMM structure I/O --- :mod:`MDAnalysis.converters.OpenMM`
================================================================
Expand Down Expand Up @@ -66,8 +66,7 @@

import numpy as np

from . import base
from .. import units
from ..coordinates import base


class OpenMMSimulationReader(base.SingleFrameReaderBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""OpenMM topology parser
=========================
"""OpenMM topology parser :mod:`MDAnalysis.converters.OpenMMParser`
===================================================================
.. versionadded:: 2.0.0
Converts an
`OpenMM <http://docs.openmm.org/latest/api-python/generated/simtk.openmm.app.topology.Topology.html#simtk.openmm.app.topology.Topology>`_
`OpenMM topology <http://docs.openmm.org/latest/api-python/generated/simtk.openmm.app.topology.Topology.html#simtk.openmm.app.topology.Topology>`_
:class:`simtk.openmm.app.topology.Topology` into a :class:`MDAnalysis.core.Topology`.
Also converts some objects within the
Expand Down Expand Up @@ -57,8 +57,7 @@

import numpy as np

from .base import TopologyReaderBase
from .guessers import guess_types
from ..topology.base import TopologyReaderBase
from ..core.topology import Topology
from ..core.topologyattrs import (
Atomids,
Expand Down
Loading

0 comments on commit cef7d3f

Please sign in to comment.