openmm-mdanalysis-reporter


Nameopenmm-mdanalysis-reporter JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryMDAnalysis based reporter for OpenMM
upload_time2023-05-25 21:24:16
maintainer
docs_urlNone
authorStephen Farr
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Stephen Farr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords molecular simulations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            openmm-mdanalysis-reporter
==============================
[//]: # (Badges)

| **Latest release** | [![Last release tag](https://img.shields.io/github/release-pre/sef43/openmm-mdanalysis-reporter.svg)](https://github.com/sef43/openmm-mdanalysis-reporter/releases) ![GitHub commits since latest release (by date) for a branch](https://img.shields.io/github/commits-since/sef43/openmm-mdanalysis-reporter/latest)  |
| :------ | :------- |
| **Status** | [![GH Actions Status](https://github.com/sef43/openmm-mdanalysis-reporter/actions/workflows/gh-ci.yaml/badge.svg)](https://github.com/sef43/openmm-mdanalysis-reporter/actions?query=branch%3Amain+workflow%3Agh-ci) [![codecov](https://codecov.io/gh/sef43/openmm-mdanalysis-reporter/branch/main/graph/badge.svg)](https://codecov.io/gh/sef43/openmm-mdanalysis-reporter/branch/main) |
| **Community** | [![Powered by MDAnalysis](https://img.shields.io/badge/powered%20by-MDAnalysis-orange.svg?logoWidth=16&logo=data:image/x-icon;base64,AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJD+XwCY/fEAkf3uAJf97wGT/a+HfHaoiIWE7n9/f+6Hh4fvgICAjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACT/yYAlP//AJ///wCg//8JjvOchXly1oaGhv+Ghob/j4+P/39/f3IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJH8aQCY/8wAkv2kfY+elJ6al/yVlZX7iIiI8H9/f7h/f38UAAAAAAAAAAAAAAAAAAAAAAAAAAB/f38egYF/noqAebF8gYaagnx3oFpUUtZpaWr/WFhY8zo6OmT///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICAn46Ojv+Hh4b/jouJ/4iGhfcAAADnAAAA/wAAAP8AAADIAAAAAwCj/zIAnf2VAJD/PAAAAAAAAAAAAAAAAICAgNGHh4f/gICA/4SEhP+Xl5f/AwMD/wAAAP8AAAD/AAAA/wAAAB8Aov9/ALr//wCS/Z0AAAAAAAAAAAAAAACBgYGOjo6O/4mJif+Pj4//iYmJ/wAAAOAAAAD+AAAA/wAAAP8AAABhAP7+FgCi/38Axf4fAAAAAAAAAAAAAAAAiIiID4GBgYKCgoKogoB+fYSEgZhgYGDZXl5e/m9vb/9ISEjpEBAQxw8AAFQAAAAAAAAANQAAADcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjo6Mb5iYmP+cnJz/jY2N95CQkO4pKSn/AAAA7gAAAP0AAAD7AAAAhgAAAAEAAAAAAAAAAACL/gsAkv2uAJX/QQAAAAB9fX3egoKC/4CAgP+NjY3/c3Nz+wAAAP8AAAD/AAAA/wAAAPUAAAAcAAAAAAAAAAAAnP4NAJL9rgCR/0YAAAAAfX19w4ODg/98fHz/i4uL/4qKivwAAAD/AAAA/wAAAP8AAAD1AAAAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGxsVyqqqr/mpqa/6mpqf9KSUn/AAAA5QAAAPkAAAD5AAAAhQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADkUFBSuZ2dn/3V1df8uLi7bAAAATgBGfyQAAAA2AAAAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0AAADoAAAA/wAAAP8AAAD/AAAAWgC3/2AAnv3eAJ/+dgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9AAAA/wAAAP8AAAD/AAAA/wAKDzEAnP3WAKn//wCS/OgAf/8MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIQAAANwAAADtAAAA7QAAAMAAABUMAJn9gwCe/e0Aj/2LAP//AQAAAAAAAAAA)](https://www.mdanalysis.org)|

MDAnalysis based reporter for OpenMM

openmm-mdanalysis-reporter is bound by a [Code of Conduct](https://github.com/sef43/openmm-mdanalysis-reporter/blob/main/CODE_OF_CONDUCT.md).

*Currently a WIP but it should work* 

This is an [OpenMM](https://openmm.org/) Reporter class that uses [MDAnalysis](https://www.mdanalysis.org/) for output. This means it can use any [format supported by MDAnalysis](https://userguide.mdanalysis.org/stable/formats/index.html).
It also supports MDAnalysis [selection strings](https://docs.mdanalysis.org/stable/documentation_pages/selections.html).

The reporter is called `MDAReporter`, once this package is installed it can be imported as:
```python
from mdareporter import MDAReporter
```

# Installation
Pip:
```bash
pip install git+https://github.com/sef43/openmm-mdanalysis-reporter
```
From source:
```bash
git clone https://github.com/sef43/openmm-mdanalysis-reporter.git
cd openmm-mdanalysis-reporter
pip install .
```


# Usage
It is used like the existing OpenMM reporters, where the file format is read from the suffix of the output file by MDAnalysis, e.g. to output in XYZ format:
```python

from mdareporter import MDAReporter

...

simulation.reporters.append(MDAReporter('traj.xyz',100))
...

```

Additionally it supports the [MDAnalysis selection syntax](https://docs.mdanalysis.org/stable/documentation_pages/selections.html)
```python

# using MDAnalysis selection string to output just Carbon atoms

simulation.reporters.append(MDAReporter('traj.xyz',100, selection='name C'))
```

# Example

Full example of using MDAReporter to output just the protein (script and data file in `cd` [example](./example)):
```python
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout
from mdareporter import MDAReporter


pdb = PDBFile('villin.pdb')
forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')
system = forcefield.createSystem(pdb.topology, nonbondedMethod=PME,
        nonbondedCutoff=1*nanometer, constraints=HBonds)
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
simulation = Simulation(pdb.topology, system, integrator)
simulation.context.setPositions(pdb.positions)
simulation.minimizeEnergy(maxIterations=100)

# output just protein in xyz format
simulation.reporters.append(MDAReporter('traj.xyz',100, enforcePeriodicBox=False, selection="protein"))

simulation.reporters.append(StateDataReporter(stdout, 100, step=True,
        potentialEnergy=True, temperature=True))

simulation.step(1000)
    
```

# Testing
testsuite can be run using `pytest`
```
cd mdareporter/tests
pytest
```
or
```
pytest --pyargs mdareporter.tests   
```

# Benchmarks
A benchmarking script which writes trajectory snapshots every 10 steps for 1000 steps can be found at [example/benchmark.py](example/benchmark.py)

The output on a M2 Macbook is:
```
OpenMM PDBReporter time =  7.989748208987294 s
OpenMM DCDReporter time =  5.6639587499958 s
MDAReporter format DCD time =  3.5682871250028256 s
MDAReporter format NCDF time =  3.609358207992045 s
MDAReporter format PDB time =  11.491382707987214 s
MDAReporter format TRR time =  4.7894440419913735 s
MDAReporter format XTC time =  4.086603666975861 s
MDAReporter format XYZ time =  5.835725833981996 s
```

Excluding MDAReporter using PDB format the MDAReporter formats are all as fast, or faster than the OpenMM formats.


#### Acknowledgements
 
Project based on the 
[MDAnalysis Cookiecutter](https://github.com/MDAnalysis/cookiecutter-mda) version 0.1.
Please cite [MDAnalysis](https://github.com/MDAnalysis/mdanalysis#citation) when using openmm-mdanalysis-reporter in published work.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "openmm-mdanalysis-reporter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Stephen Farr <stephen.farr@ed.ac.uk>",
    "keywords": "molecular simulations",
    "author": "Stephen Farr",
    "author_email": "Stephen Farr <stephen.farr@ed.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/b1/0a/67cbbc2d7179ffc64729d43a7e21b6893e79c64ce95481756c789d0be2d0/openmm-mdanalysis-reporter-0.1.tar.gz",
    "platform": null,
    "description": "openmm-mdanalysis-reporter\n==============================\n[//]: # (Badges)\n\n| **Latest release** | [![Last release tag](https://img.shields.io/github/release-pre/sef43/openmm-mdanalysis-reporter.svg)](https://github.com/sef43/openmm-mdanalysis-reporter/releases) ![GitHub commits since latest release (by date) for a branch](https://img.shields.io/github/commits-since/sef43/openmm-mdanalysis-reporter/latest)  |\n| :------ | :------- |\n| **Status** | [![GH Actions Status](https://github.com/sef43/openmm-mdanalysis-reporter/actions/workflows/gh-ci.yaml/badge.svg)](https://github.com/sef43/openmm-mdanalysis-reporter/actions?query=branch%3Amain+workflow%3Agh-ci) [![codecov](https://codecov.io/gh/sef43/openmm-mdanalysis-reporter/branch/main/graph/badge.svg)](https://codecov.io/gh/sef43/openmm-mdanalysis-reporter/branch/main) |\n| **Community** | [![Powered by MDAnalysis](https://img.shields.io/badge/powered%20by-MDAnalysis-orange.svg?logoWidth=16&logo=data:image/x-icon;base64,AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJD+XwCY/fEAkf3uAJf97wGT/a+HfHaoiIWE7n9/f+6Hh4fvgICAjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACT/yYAlP//AJ///wCg//8JjvOchXly1oaGhv+Ghob/j4+P/39/f3I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AAAAAAAAAAAAAAAAAAAAAAAAAA9AAAA/wAAAP8AAAD/AAAA/wAKDzEAnP3WAKn//wCS/OgAf/8MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIQAAANwAAADtAAAA7QAAAMAAABUMAJn9gwCe/e0Aj/2LAP//AQAAAAAAAAAA)](https://www.mdanalysis.org)|\n\nMDAnalysis based reporter for OpenMM\n\nopenmm-mdanalysis-reporter is bound by a [Code of Conduct](https://github.com/sef43/openmm-mdanalysis-reporter/blob/main/CODE_OF_CONDUCT.md).\n\n*Currently a WIP but it should work* \n\nThis is an [OpenMM](https://openmm.org/) Reporter class that uses [MDAnalysis](https://www.mdanalysis.org/) for output. This means it can use any [format supported by MDAnalysis](https://userguide.mdanalysis.org/stable/formats/index.html).\nIt also supports MDAnalysis [selection strings](https://docs.mdanalysis.org/stable/documentation_pages/selections.html).\n\nThe reporter is called `MDAReporter`, once this package is installed it can be imported as:\n```python\nfrom mdareporter import MDAReporter\n```\n\n# Installation\nPip:\n```bash\npip install git+https://github.com/sef43/openmm-mdanalysis-reporter\n```\nFrom source:\n```bash\ngit clone https://github.com/sef43/openmm-mdanalysis-reporter.git\ncd openmm-mdanalysis-reporter\npip install .\n```\n\n\n# Usage\nIt is used like the existing OpenMM reporters, where the file format is read from the suffix of the output file by MDAnalysis, e.g. to output in XYZ format:\n```python\n\nfrom mdareporter import MDAReporter\n\n...\n\nsimulation.reporters.append(MDAReporter('traj.xyz',100))\n...\n\n```\n\nAdditionally it supports the [MDAnalysis selection syntax](https://docs.mdanalysis.org/stable/documentation_pages/selections.html)\n```python\n\n# using MDAnalysis selection string to output just Carbon atoms\n\nsimulation.reporters.append(MDAReporter('traj.xyz',100, selection='name C'))\n```\n\n# Example\n\nFull example of using MDAReporter to output just the protein (script and data file in `cd` [example](./example)):\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\nfrom sys import stdout\nfrom mdareporter import MDAReporter\n\n\npdb = PDBFile('villin.pdb')\nforcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')\nsystem = forcefield.createSystem(pdb.topology, nonbondedMethod=PME,\n        nonbondedCutoff=1*nanometer, constraints=HBonds)\nintegrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)\nsimulation = Simulation(pdb.topology, system, integrator)\nsimulation.context.setPositions(pdb.positions)\nsimulation.minimizeEnergy(maxIterations=100)\n\n# output just protein in xyz format\nsimulation.reporters.append(MDAReporter('traj.xyz',100, enforcePeriodicBox=False, selection=\"protein\"))\n\nsimulation.reporters.append(StateDataReporter(stdout, 100, step=True,\n        potentialEnergy=True, temperature=True))\n\nsimulation.step(1000)\n    \n```\n\n# Testing\ntestsuite can be run using `pytest`\n```\ncd mdareporter/tests\npytest\n```\nor\n```\npytest --pyargs mdareporter.tests   \n```\n\n# Benchmarks\nA benchmarking script which writes trajectory snapshots every 10 steps for 1000 steps can be found at [example/benchmark.py](example/benchmark.py)\n\nThe output on a M2 Macbook is:\n```\nOpenMM PDBReporter time =  7.989748208987294 s\nOpenMM DCDReporter time =  5.6639587499958 s\nMDAReporter format DCD time =  3.5682871250028256 s\nMDAReporter format NCDF time =  3.609358207992045 s\nMDAReporter format PDB time =  11.491382707987214 s\nMDAReporter format TRR time =  4.7894440419913735 s\nMDAReporter format XTC time =  4.086603666975861 s\nMDAReporter format XYZ time =  5.835725833981996 s\n```\n\nExcluding MDAReporter using PDB format the MDAReporter formats are all as fast, or faster than the OpenMM formats.\n\n\n#### Acknowledgements\n \nProject based on the \n[MDAnalysis Cookiecutter](https://github.com/MDAnalysis/cookiecutter-mda) version 0.1.\nPlease cite [MDAnalysis](https://github.com/MDAnalysis/mdanalysis#citation) when using openmm-mdanalysis-reporter in published work.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Stephen Farr  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "MDAnalysis based reporter for OpenMM",
    "version": "0.1",
    "project_urls": null,
    "split_keywords": [
        "molecular",
        "simulations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e36081bc6ffb18024d6f89885e2e635ca47ac20bd7ba221af59335861e066ce",
                "md5": "bdf6aae044e65bf8e2fe5553a575f999",
                "sha256": "04b731c4529be1948bbb8ebd04cc977aea7139f87a5a91568f4e20d8723e0529"
            },
            "downloads": -1,
            "filename": "openmm_mdanalysis_reporter-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdf6aae044e65bf8e2fe5553a575f999",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 140298,
            "upload_time": "2023-05-25T21:24:14",
            "upload_time_iso_8601": "2023-05-25T21:24:14.658819Z",
            "url": "https://files.pythonhosted.org/packages/5e/36/081bc6ffb18024d6f89885e2e635ca47ac20bd7ba221af59335861e066ce/openmm_mdanalysis_reporter-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b10a67cbbc2d7179ffc64729d43a7e21b6893e79c64ce95481756c789d0be2d0",
                "md5": "08c6debb5de9e02970706459747f1f55",
                "sha256": "07197732dc8e629297a5d2103bf133ac464d388e2e17ff06b242d3513aa972d8"
            },
            "downloads": -1,
            "filename": "openmm-mdanalysis-reporter-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "08c6debb5de9e02970706459747f1f55",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 277889,
            "upload_time": "2023-05-25T21:24:16",
            "upload_time_iso_8601": "2023-05-25T21:24:16.627277Z",
            "url": "https://files.pythonhosted.org/packages/b1/0a/67cbbc2d7179ffc64729d43a7e21b6893e79c64ce95481756c789d0be2d0/openmm-mdanalysis-reporter-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-25 21:24:16",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "openmm-mdanalysis-reporter"
}
        
Elapsed time: 0.07591s