Skip to content

Commit

Permalink
Rename project to "YAMMBS"
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Mar 21, 2024
1 parent 77cb485 commit 6d8146c
Show file tree
Hide file tree
Showing 41 changed files with 97 additions and 69 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- name: Run tests
run: |
pytest -v -n logical --durations=10 \
--cov=ibstore/ --cov-report=xml --cov-config=setup.cfg \
ibstore/
pytest -r fEx -n logical --durations=10 \
--cov=yammbs/ --cov-report=xml --cov-config=setup.cfg \
yammbs/
- name: CodeCov
uses: codecov/codecov-action@v3
Expand Down
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
ib
==
YAMMBS
======

Yet Another Molecular Mechanics Benchmaring Suite (YAMMBS, pronounced like "yams") is a tool for
benchmarking force fields.

YAMMBS is currently developed for internal use at Open Force Field. It is not currently recommended for external use. No guarantees are made about the stability of the API or the accuracy of any results.

# Getting started

## Installation

Use the file `../devtools/conda-envs/dev.yaml` and also install `ibstore` with something like `python -m pip install -e .`.
Use the file `./devtools/conda-envs/dev.yaml` and also install `yammbs` with something like `python -m pip install -e .`.

## Data source
## Data sources

It is assumed that the input molecules are stored in a `openff-qcsubmit` model like `OptimizationResultCollection`.

Expand All @@ -18,7 +23,7 @@ See the file `run.py` for a start-to-finish example.
Load a molecule dataset into the used representation:

```python
from ibstore import MoleculeStore
from yammbs import MoleculeStore

store = MoleculeStore.from_qcsubmit_collection(
collection=my_collection,
Expand All @@ -32,19 +37,18 @@ Run MM optimizations of all molecules using a particular force field
store.optimize_mm(force_field="openff-2.1.0.offxml")
```

Run DDE or RMSD analysis and save to disk:
Run DDE (or RMSD, TFD, etc.) analyses and save to results disk:

```python
ddes = store.get_dde(force_field="openff-2.1.0.offxml")
ddes.to_csv(f"{force_field}-dde.csv")

rmsds = store.get_rmsd(force_field="openff-2.1.0.offxml")
rmsds.to_csv(f"{force_field}-rmsd.csv")
```

Note that the pattern
Note that the pattern in the script

```python
from multiprocessing import freeze_support

def main():
# Your code here

Expand All @@ -54,6 +58,12 @@ if __name__ == "__main__":
```

must be used for Python's `multiprocessing` module to behave well.

### License

YAMMBS is open-source software distrubuted under the MIT license (see LICENSE). It derives from
other open-source work that may be distributed under other licenses (see LICENSE-3RD-PARTY).

### Copyright

Copyright (c) 2022, Open Force Field Initiative
6 changes: 3 additions & 3 deletions devtools/conda-envs/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: ib-dev
name: yammbs-dev
channels:
- openeye
- conda-forge
dependencies:
- python =3.10
- python

- openff-toolkit
- openff-qcsubmit
Expand All @@ -27,4 +27,4 @@ dependencies:
- pytest-timeout

- pip:
- git+https://github.com/mattwthompson/de-forcefields.git@periodic-nonperiodic-methods
- git+https://github.com/jthorton/de-forcefields.git@eb99f5ea1347dc3fd079038a52a21554b9e44caf
4 changes: 2 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from matplotlib import pyplot
from openff.qcsubmit.results import OptimizationResultCollection

from ibstore._store import MoleculeStore
from yammbs import MoleculeStore


def main():
Expand All @@ -29,7 +29,7 @@ def main():
else:
store = MoleculeStore.from_qcsubmit_collection(
OptimizationResultCollection.parse_file(
f"ibstore/_tests/data/01-processed-qm-{data}.json",
f"yammbs/_tests/data/01-processed-qm-{data}.json",
),
database_name=f"{data}.sqlite",
)
Expand Down
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = ibstore
name = yammbs
version = 0.0.0
description = Internal benchmarking storage tools
long_description = file: README.md
Expand All @@ -26,10 +26,10 @@ exclude =

[coverage:run]
omit =
ibstore/_tests/*
yammbs/_tests/*
versioneer.py
setup.py
ibstore/_version.py
yammbs/_version.py

[coverage:report]
exclude_lines =
Expand All @@ -41,16 +41,16 @@ exclude_lines =
max-line-length = 119
ignore = E203
per-file-ignores =
ibstore/__init__.py:F401
yammbs/__init__.py:F401

[isort]
profile = black

[versioneer]
VCS = git
style = pep440
versionfile_source = ibstore/_version.py
versionfile_build = ibstore/_version.py
versionfile_source = yammbs/_version.py
versionfile_build = yammbs/_version.py
tag_prefix = 'v'

[mypy]
Expand Down
4 changes: 2 additions & 2 deletions ibstore/__init__.py → yammbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ibstore._store import MoleculeStore
from ibstore._version import get_versions
from yammbs._store import MoleculeStore
from yammbs._version import get_versions

__all__ = ("MoleculeStore",)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ibstore/_db.py → yammbs/_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sqlalchemy import Column, Float, ForeignKey, Integer, PickleType, String
from sqlalchemy.orm import declarative_base, relationship

from ibstore.models import MMConformerRecord, QMConformerRecord
from yammbs.models import MMConformerRecord, QMConformerRecord

DBBase = declarative_base()

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions ibstore/_minimize.py → yammbs/_minimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from pydantic.v1 import Field
from tqdm import tqdm

from ibstore._base.array import Array
from ibstore._base.base import ImmutableModel
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel

_AVAILABLE_FORCE_FIELDS = get_available_force_fields()

Expand Down Expand Up @@ -135,15 +135,15 @@ def _run_openmm(
)

if input.force_field.startswith("gaff"):
from ibstore._forcefields import _gaff
from yammbs._forcefields import _gaff

system = _gaff(
molecule=molecule,
force_field_name=input.force_field,
)

elif input.force_field.startswith("espaloma"):
from ibstore._forcefields import _espaloma
from yammbs._forcefields import _espaloma

system = _espaloma(
molecule=molecule,
Expand Down
2 changes: 1 addition & 1 deletion ibstore/_molecule.py → yammbs/_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from openff.toolkit import Molecule

from ibstore._base.array import Array
from yammbs._base.array import Array

if TYPE_CHECKING:
from geometric.molecule import Molecule as GeometricMolecule
Expand Down
4 changes: 2 additions & 2 deletions ibstore/_session.py → yammbs/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional

from ibstore._db import (
from yammbs._db import (
DB_VERSION,
DBGeneralProvenance,
DBInformation,
Expand All @@ -15,7 +15,7 @@
if TYPE_CHECKING:
from sqlalchemy.orm import Session

from ibstore.models import MMConformerRecord, MoleculeRecord, QMConformerRecord
from yammbs.models import MMConformerRecord, MoleculeRecord, QMConformerRecord


class DBQueryResult(NamedTuple):
Expand Down
16 changes: 8 additions & 8 deletions ibstore/_store.py → yammbs/_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, sessionmaker

from ibstore._db import (
from yammbs._db import (
DBBase,
DBMMConformerRecord,
DBMoleculeRecord,
DBQMConformerRecord,
)
from ibstore._session import DBSessionManager
from ibstore._types import Pathlike
from ibstore.analysis import (
from yammbs._session import DBSessionManager
from yammbs._types import Pathlike
from yammbs.analysis import (
DDE,
ICRMSD,
RMSD,
Expand All @@ -31,9 +31,9 @@
get_rmsd,
get_tfd,
)
from ibstore.cached_result import CachedResultCollection
from ibstore.exceptions import DatabaseExistsError
from ibstore.models import MMConformerRecord, MoleculeRecord, QMConformerRecord
from yammbs.cached_result import CachedResultCollection
from yammbs.exceptions import DatabaseExistsError
from yammbs.models import MMConformerRecord, MoleculeRecord, QMConformerRecord

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -482,7 +482,7 @@ def optimize_mm(
n_processes: int = 2,
chunksize=32,
):
from ibstore._minimize import _minimize_blob
from yammbs._minimize import _minimize_blob

inchi_keys = self.get_inchi_keys()

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions ibstore/_tests/conftest.py → yammbs/_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from openff.toolkit import Molecule
from openff.utilities.utilities import get_data_file_path

from ibstore._store import MoleculeStore
from ibstore.cached_result import CachedResultCollection
from yammbs import MoleculeStore
from yammbs.cached_result import CachedResultCollection


@pytest.fixture()
Expand Down Expand Up @@ -54,14 +54,14 @@ def ligand():
@pytest.fixture()
def small_collection() -> OptimizationResultCollection:
return OptimizationResultCollection.parse_file(
get_data_file_path("_tests/data/01-processed-qm-ch.json", "ibstore"),
get_data_file_path("_tests/data/01-processed-qm-ch.json", "yammbs"),
)


@pytest.fixture()
def small_cache() -> CachedResultCollection:
return CachedResultCollection.from_json(
get_data_file_path("_tests/data/tiny-opt.json", "ibstore"),
get_data_file_path("_tests/data/tiny-opt.json", "yammbs"),
)


Expand All @@ -71,7 +71,7 @@ def small_store(tmp_path) -> MoleculeStore:
# This file manually generated from data/01-processed-qm-ch.json
source_path = get_data_file_path(
"_tests/data/ch.sqlite",
package_name="ibstore",
package_name="yammbs",
)

dest_path = (tmp_path / "ch.sqlite").as_posix()
Expand All @@ -88,7 +88,7 @@ def tiny_cache() -> CachedResultCollection:
return CachedResultCollection.from_json(
get_data_file_path(
"_tests/data/tiny-opt.json",
package_name="ibstore",
package_name="yammbs",
),
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

This file is built by calling this code

``` python
```python
import logging

import click
from openff.qcsubmit.results import OptimizationResultCollection

from ibstore.cached_result import CachedResultCollection
from yammbs.cached_result import CachedResultCollection

logging.getLogger("openff").setLevel(logging.ERROR)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from openff.toolkit import Molecule

from ibstore.analysis import get_internal_coordinate_rmsds
from yammbs.analysis import get_internal_coordinate_rmsds


class TestInternalCoordinateRMSD:
Expand Down
18 changes: 18 additions & 0 deletions yammbs/_tests/unit_tests/test_cached_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy

from yammbs.cached_result import CachedResultCollection


def test_json_roundtrip(tmp_path, small_cache):
"""Test that we can round-trip a `CachedResultCollection` through JSON."""
with open(tmp_path / ".json", "w") as f:
f.write(small_cache.to_json())

new_cache = CachedResultCollection.from_json(tmp_path / ".json")

for old, new in zip(small_cache.inner, new_cache.inner):
assert old.mapped_smiles == new.mapped_smiles
assert old.inchi_key == new.inchi_key
assert old.qc_record_id == new.qc_record_id
assert old.qc_record_final_energy == new.qc_record_final_energy
assert numpy.allclose(old.coordinates, new.coordinates)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from openff.toolkit import Molecule

from ibstore._forcefields import _espaloma, _gaff, _smirnoff
from yammbs._forcefields import _espaloma, _gaff, _smirnoff


@pytest.fixture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from openff.toolkit import ForceField, Molecule
from openff.units import unit

from ibstore._minimize import MinimizationInput, _run_openmm
from ibstore._store import MoleculeStore
from ibstore.cached_result import CachedResultCollection
from yammbs import MoleculeStore
from yammbs._minimize import MinimizationInput, _run_openmm
from yammbs.cached_result import CachedResultCollection


@pytest.fixture()
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_plugin_loadable(ethane):
@pytest.mark.timeout(1)
def test_cached_force_fields_load_quickly():
"""Test that cached force fields are loaded quickly."""
from ibstore._minimize import _lazy_load_force_field
from yammbs._minimize import _lazy_load_force_field

# timeout includes the time it takes to load it the first time, but that should be << 1 second
[_lazy_load_force_field("openff-1.0.0") for _ in range(1000)]
Expand Down
Loading

0 comments on commit 6d8146c

Please sign in to comment.