Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
# gmx-top4py
# gmxtop

<p align="left">
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

GROMACS topology files for python

**!!!!!!!!!!!!!!!!!!!!!! DEPRECATED !!!!!!!!!!!!!!!!!!!!!!!! <br>
This projected has been renamed to gmxtop.<br>
Please use `pip install gmxtop` instead.<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!** <br>

## 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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/advanced/advanced.py
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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. <br>
Expand Down
6 changes: 3 additions & 3 deletions examples/basic/basic.py
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -24,7 +24,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
Expand Down
14 changes: 7 additions & 7 deletions examples/ff_params/ff_params.py
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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 = [
Expand Down
12 changes: 0 additions & 12 deletions src/gmx_top4py/__init__.py

This file was deleted.

29 changes: 29 additions & 0 deletions src/gmxtop/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

"""
Welcome to gmxtop!
"""

from __future__ import annotations
6 changes: 3 additions & 3 deletions src/gmx_top4py/constants.py → src/gmxtop/constants.py
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -23,7 +23,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Constants used throughout gmx-top4py.
Constants used throughout gmxtop.
"""

ATOM_ID_FIELDS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions src/gmx_top4py/parsing.py → src/gmxtop/parsing.py
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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`).
"""


Expand Down
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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__)

Expand Down
14 changes: 7 additions & 7 deletions src/gmx_top4py/topology/ff.py → src/gmxtop/topology/ff.py
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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,
Expand All @@ -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__)

Expand Down
Loading