diff --git a/Makefile b/Makefile index 111b741..890b617 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: Makefile setup-docs preview docs clear-docs watch test: - pytest tests --cov=gmx_top4py --cov-report=term-missing + pytest tests --cov=gmxtop --cov-report=term-missing format: black src tests @@ -11,6 +11,19 @@ venv: uv sync source .venv/bin/activate +failing: + echo None + +package: + rm -r dist + python -m build + +testpypi: + python -m twine upload --repository testpypi dist/* + +pypi: + python -m twine upload dist/* + # Write explicitly all dependencies to a requirements_explicit.txt file # requirements: # source .venv/bin/activate diff --git a/README.md b/README.md index 88f6868..3911e90 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# gmx-top4py +# gmxtop

Code style: black @@ -6,36 +6,31 @@ GROMACS topology files for python -**!!!!!!!!!!!!!!!!!!!!!! DEPRECATED !!!!!!!!!!!!!!!!!!!!!!!!
-This projected has been renamed to gmxtop.
-Please use `pip install gmxtop` instead.
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!**
- ## Description -The `gmx-top4py` project provides a python interface to +The `gmxtop` project provides a python interface to * read and write toplogy and force field information from GROMACS-type top-files * alter force field parameters -The `gmx-top4py` project derives this functionality from the [kimmdy](https://github.com/graeter-group/kimmdy) project, originally developed by the graeter-group, and includes only minor modifications to parts of the original code to operate independently. -The `kimmdy` project is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) and, as a derivative work, the `gmx-top4py` project is distributed under the same license. See [LICENSE](./LICENSE) for details. +The `gmxtop` project derives this functionality from the [kimmdy](https://github.com/graeter-group/kimmdy) project, originally developed by the graeter-group, and includes only minor modifications to parts of the original code to operate independently. +The `kimmdy` project is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) and, as a derivative work, the `gmxtop` project is distributed under the same license. See [LICENSE](./LICENSE) for details. ## Tutorials The following tutorials are avaiable as Google Colab notebooks and hence do not require a local installation: -* [Basic tutorial](https://colab.research.google.com/drive/19zjIw2H5O6InLDQWLXEvrwrZ5w0AL7i1?usp=sharing) - Basic accessing of topology information with gmx-top4py -* [Advanced tutorial](https://colab.research.google.com/drive/1uWgji2O1N4PnxnYpGc1yV68Qzm-PfVX1?usp=sharing) - Advanded accessing of topology information with gmx-top4py -* [Force field parameter tutorial](https://colab.research.google.com/drive/1YOPPkCDudqSwd2QV0P7qEcd-1bogrvtY?usp=sharing) - Adapting force field parameters with gmx-top4py +* [Basic tutorial](https://colab.research.google.com/drive/19zjIw2H5O6InLDQWLXEvrwrZ5w0AL7i1?usp=sharing) - Basic accessing of topology information with gmxtop +* [Advanced tutorial](https://colab.research.google.com/drive/1uWgji2O1N4PnxnYpGc1yV68Qzm-PfVX1?usp=sharing) - Advanded accessing of topology information with gmxtop +* [Force field parameter tutorial](https://colab.research.google.com/drive/1YOPPkCDudqSwd2QV0P7qEcd-1bogrvtY?usp=sharing) - Adapting force field parameters with gmxtop ## Installation ### From PyPI ```bash -pip install gmx-top4py +pip install gmxtop ``` ### From source via uv Clone repository and move into ```bash -git clone git@github.com:graeter-group/gmx-top4py.git -cd gmx-top4py +git clone git@github.com:graeter-group/gmxtop.git +cd gmxtop ``` Install repository ```bash @@ -53,13 +48,13 @@ pytest tests ### From source via conda and pip Clone repository and move into ```bash -git clone git@github.com:graeter-group/gmx-top4py.git -cd gmx-top4py +git clone git@github.com:graeter-group/gmxtop.git +cd gmxtop ``` Install repository into conda environment ```bash -conda create -n gmx-top4py python -y -conda activate gmx-top4py +conda create -n gmxtop python -y +conda activate gmxtop pip install -e '.[dev]' # install with dev dependencies ``` Verify install by running the tests diff --git a/examples/advanced/advanced.py b/examples/advanced/advanced.py index d5ebc23..5f6acf5 100644 --- a/examples/advanced/advanced.py +++ b/examples/advanced/advanced.py @@ -1,7 +1,7 @@ # %% -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -25,9 +25,9 @@ from pathlib import Path from copy import deepcopy -from gmx_top4py.topology.topology import Topology -from gmx_top4py.parsing import read_top, write_top -from gmx_top4py.topology.utils import get_is_selected_moleculetype_f +from gmxtop.topology.topology import Topology +from gmxtop.parsing import read_top, write_top +from gmxtop.topology.utils import get_is_selected_moleculetype_f # %% [markdown] # # 1. Reading a topology file # Internally, the `Topology.from_path` class method uses the `read_top` function to parse the topology file into a dictionary, and then creates an instance of the `Topology` object from that dictionary.
diff --git a/examples/basic/basic.py b/examples/basic/basic.py index 1e64c7c..4be5f97 100644 --- a/examples/basic/basic.py +++ b/examples/basic/basic.py @@ -1,7 +1,7 @@ # %% -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -24,7 +24,7 @@ # along with this program. If not, see . from pathlib import Path -from gmx_top4py.topology.topology import Topology +from gmxtop.topology.topology import Topology # %% [markdown] # # 1. Reading a topology file # Let's read the GROMACS topology file 'urea.top' into a `Topology` object. diff --git a/examples/ff_params/ff_params.py b/examples/ff_params/ff_params.py index d61263b..6645684 100644 --- a/examples/ff_params/ff_params.py +++ b/examples/ff_params/ff_params.py @@ -1,7 +1,7 @@ # %% -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -25,13 +25,13 @@ from pathlib import Path from copy import deepcopy -from gmx_top4py.topology.topology import Topology -from gmx_top4py.parsing import read_top -from gmx_top4py.parameterizing import Parameterizer -from gmx_top4py.topology.atomic import Dihedral +from gmxtop.topology.topology import Topology +from gmxtop.parsing import read_top +from gmxtop.parameterizing import Parameterizer +from gmxtop.topology.atomic import Dihedral # %% [markdown] # # Manipulation of force field parameters -# In this example, we demonstrate how to manipulate force field parameters in a topology file using gmx-top4py. +# In this example, we demonstrate how to manipulate force field parameters in a topology file using gmxtop. # We will use a topology file for a hexamer of alanine ('hexala.top') parameterized with the 'amber99sb-star-ildnp.ff' force field. # %% [markdown] diff --git a/pyproject.toml b/pyproject.toml index 0339ff9..beb8e9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,9 +3,9 @@ requires = ["setuptools>=61.2"] build-backend = "setuptools.build_meta" [project] -name = "gmx-top4py" -version = "0.1.5" -description = "A Python library to parse GROMACS topology files and alter associated force fields parameters." +name = "gmxtop" +version = "0.0.1" +description = "Read and write GROMACS topology files and alter associated force fields parameters." license-files = ["LICEN[CS]E*"] authors = [{ name = "graeter-group"}] classifiers = [ @@ -25,14 +25,14 @@ package-dir = { "" = "src" } include-package-data = true [tool.setuptools.package-data] -"gmx_top4py" = [ "py.typed" ] +"gmxtop" = [ "py.typed" ] [tool.setuptools.packages.find] where=["src"] namespaces = false [tool.uv.sources] -"gmx_top4py" = { workspace = true } +"gmxtop" = { workspace = true } [project.optional-dependencies] dev = [ diff --git a/src/gmx_top4py/__init__.py b/src/gmx_top4py/__init__.py deleted file mode 100644 index a530390..0000000 --- a/src/gmx_top4py/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Welcome to gmx-top4py! -""" - -from __future__ import annotations -import warnings - -warnings.simplefilter("once", DeprecationWarning) -warnings.warn( - "gmx-top4py has been renamed to gmxtop. Use 'pip install gmxtop'.", - DeprecationWarning, -) diff --git a/src/gmxtop/__init__.py b/src/gmxtop/__init__.py new file mode 100644 index 0000000..3c4ab8c --- /dev/null +++ b/src/gmxtop/__init__.py @@ -0,0 +1,29 @@ +# This file is part of the gmxtop project. +# +# The gmxtop project is based on or includes code from: +# kimmdy (https://github.com/graeter-group/kimmdy/tree/main) +# Copyright (C) graeter-group +# Licensed under the GNU General Public License v3.0 (GPLv3). +# +# Modifications and additional code: +# Copyright (C) 2025 graeter-group +# Licensed under the GNU General Public License v3.0 (GPLv3). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Welcome to gmxtop! +""" + +from __future__ import annotations diff --git a/src/gmx_top4py/constants.py b/src/gmxtop/constants.py similarity index 96% rename from src/gmx_top4py/constants.py rename to src/gmxtop/constants.py index 23faefb..704b5b4 100644 --- a/src/gmx_top4py/constants.py +++ b/src/gmxtop/constants.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -23,7 +23,7 @@ # along with this program. If not, see . """ -Constants used throughout gmx-top4py. +Constants used throughout gmxtop. """ ATOM_ID_FIELDS = { diff --git a/src/gmx_top4py/parameterizing.py b/src/gmxtop/parameterizing.py similarity index 91% rename from src/gmx_top4py/parameterizing.py rename to src/gmxtop/parameterizing.py index e6b721d..32e7fb8 100644 --- a/src/gmx_top4py/parameterizing.py +++ b/src/gmxtop/parameterizing.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -30,7 +30,7 @@ from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: - from gmx_top4py.topology.topology import Topology + from gmxtop.topology.topology import Topology class Parameterizer(ABC): diff --git a/src/gmx_top4py/parsing.py b/src/gmxtop/parsing.py similarity index 98% rename from src/gmx_top4py/parsing.py rename to src/gmxtop/parsing.py index b3452a0..e678740 100644 --- a/src/gmx_top4py/parsing.py +++ b/src/gmxtop/parsing.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -36,11 +36,11 @@ from typing import Optional, TypeAlias, TypedDict, Union import numpy as np -from gmx_top4py.utils import get_gmx_dir +from gmxtop.utils import get_gmx_dir logger = logging.getLogger(__name__) TopologyDict = dict -"""A raw representation of a topology file returned by [](`~gmx-top4py.parsing.read_top`). +"""A raw representation of a topology file returned by [](`~gmxtop.parsing.read_top`). """ diff --git a/src/gmx_top4py/topology/atomic.py b/src/gmxtop/topology/atomic.py similarity index 99% rename from src/gmx_top4py/topology/atomic.py rename to src/gmxtop/topology/atomic.py index d278655..56830e3 100644 --- a/src/gmx_top4py/topology/atomic.py +++ b/src/gmxtop/topology/atomic.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -32,8 +32,8 @@ from dataclasses import dataclass, field from typing import Optional, Union -from gmx_top4py.constants import FFFUNC -from gmx_top4py.utils import field_or_none +from gmxtop.constants import FFFUNC +from gmxtop.utils import field_or_none logger = logging.getLogger(__name__) diff --git a/src/gmx_top4py/topology/ff.py b/src/gmxtop/topology/ff.py similarity index 95% rename from src/gmx_top4py/topology/ff.py rename to src/gmxtop/topology/ff.py index 3e1f392..12439dc 100644 --- a/src/gmx_top4py/topology/ff.py +++ b/src/gmxtop/topology/ff.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -29,9 +29,9 @@ from pathlib import Path from typing import Optional -from gmx_top4py.constants import FFFUNC -from gmx_top4py.parsing import read_top -from gmx_top4py.topology.atomic import ( +from gmxtop.constants import FFFUNC +from gmxtop.parsing import read_top +from gmxtop.topology.atomic import ( AngleId, AngleType, AtomId, @@ -44,8 +44,8 @@ ProperDihedralId, ResidueType, ) -from gmx_top4py.topology.utils import get_top_section -from gmx_top4py.utils import get_gmx_dir +from gmxtop.topology.utils import get_top_section +from gmxtop.utils import get_gmx_dir logger = logging.getLogger(__name__) diff --git a/src/gmx_top4py/topology/topology.py b/src/gmxtop/topology/topology.py similarity index 99% rename from src/gmx_top4py/topology/topology.py rename to src/gmxtop/topology/topology.py index 9e2dbc1..f108a00 100644 --- a/src/gmx_top4py/topology/topology.py +++ b/src/gmxtop/topology/topology.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -30,16 +30,16 @@ # from kimmdy.recipe import RecipeStep, Bind, Break -from gmx_top4py.constants import ( +from gmxtop.constants import ( ATOM_ID_FIELDS, ATOMTYPE_BONDORDER_FLAT, FFFUNC, RESNR_ID_FIELDS, ) -from gmx_top4py.parsing import TopologyDict, empty_section, read_top, write_top -from gmx_top4py.parameterizing import BasicParameterizer, Parameterizer +from gmxtop.parsing import TopologyDict, empty_section, read_top, write_top +from gmxtop.parameterizing import BasicParameterizer, Parameterizer -from gmx_top4py.topology.atomic import ( +from gmxtop.topology.atomic import ( Angle, Atom, Bond, @@ -55,8 +55,8 @@ ResidueType, Settle, ) -from gmx_top4py.topology.ff import FF -from gmx_top4py.topology.utils import ( +from gmxtop.topology.ff import FF +from gmxtop.topology.utils import ( attributes_to_list, get_moleculetype_atomics, get_moleculetype_header, @@ -67,9 +67,9 @@ is_not_solvent_or_ion, set_top_section, ) -from gmx_top4py.utils import TopologyAtomAddress +from gmxtop.utils import TopologyAtomAddress -logger = logging.getLogger("gmx_top4py.topology") +logger = logging.getLogger("gmxtop.topology") class MoleculeType: @@ -749,7 +749,7 @@ class Topology: ---------- top A dictionary containing the parsed topology data, produced by - [](`gmx_top4py.parsing.read_top`) + [](`gmxtop.parsing.read_top`) parametrizer The parametrizer to use when reparametrizing the topology. is_selected_moleculetype_f diff --git a/src/gmx_top4py/topology/utils.py b/src/gmxtop/topology/utils.py similarity index 97% rename from src/gmx_top4py/topology/utils.py rename to src/gmxtop/topology/utils.py index 4adbdfb..feb2b11 100644 --- a/src/gmx_top4py/topology/utils.py +++ b/src/gmxtop/topology/utils.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -29,13 +29,13 @@ from itertools import permutations from typing import TYPE_CHECKING, Any, Callable, Optional -from gmx_top4py.constants import ION_NAMES, SOLVENT_NAMES -from gmx_top4py.topology.atomic import AtomId, MoleculeTypeHeader +from gmxtop.constants import ION_NAMES, SOLVENT_NAMES +from gmxtop.topology.atomic import AtomId, MoleculeTypeHeader if TYPE_CHECKING: # from config import Config - from gmx_top4py.topology.atomic import Atom, AtomicType, AtomicTypes - from gmx_top4py.topology.topology import Topology + from gmxtop.topology.atomic import Atom, AtomicType, AtomicTypes + from gmxtop.topology.topology import Topology logger = logging.getLogger(__name__) diff --git a/src/gmx_top4py/utils.py b/src/gmxtop/utils.py similarity index 96% rename from src/gmx_top4py/utils.py rename to src/gmxtop/utils.py index b59c723..f626593 100644 --- a/src/gmx_top4py/utils.py +++ b/src/gmxtop/utils.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). diff --git a/tests/conftest.py b/tests/conftest.py index e0d963d..478d984 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 810477f..32adf1b 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -30,9 +30,9 @@ from hypothesis import HealthCheck, given, settings from hypothesis import strategies as st -from gmx_top4py.parsing import read_top, write_top -from gmx_top4py.constants import AA3 -from gmx_top4py.utils import get_gmx_dir +from gmxtop.parsing import read_top, write_top +from gmxtop.constants import AA3 +from gmxtop.utils import get_gmx_dir ## test topology parser diff --git a/tests/test_topology.py b/tests/test_topology.py index f15b84e..17d9cf6 100644 --- a/tests/test_topology.py +++ b/tests/test_topology.py @@ -1,6 +1,6 @@ -# This file is part of the gmx-top4py project. +# This file is part of the gmxtop project. # -# The gmx-top4py project is based on or includes code from: +# The gmxtop project is based on or includes code from: # kimmdy (https://github.com/graeter-group/kimmdy/tree/main) # Copyright (C) graeter-group # Licensed under the GNU General Public License v3.0 (GPLv3). @@ -31,16 +31,16 @@ from hypothesis import HealthCheck, Phase, given, settings from hypothesis import strategies as st -from gmx_top4py.topology.atomic import * -from gmx_top4py.utils import get_gmx_dir -from gmx_top4py.parsing import TopologyDict, read_top -from gmx_top4py.topology.utils import ( +from gmxtop.topology.atomic import * +from gmxtop.utils import get_gmx_dir +from gmxtop.parsing import TopologyDict, read_top +from gmxtop.topology.utils import ( get_residue_by_bonding, match_atomic_item_to_atomic_type, get_protein_section, get_selected_section, ) -from gmx_top4py.topology.topology import Topology +from gmxtop.topology.topology import Topology @pytest.fixture(scope="module")