diff --git a/README.md b/README.md index e178995..9f35861 100644 --- a/README.md +++ b/README.md @@ -30,24 +30,9 @@ By enabling precise volume and flexibility measurements, POVME has become an ess - Supporting virtual screening and druggability predictions. - Comparing conformational ensembles from molecular dynamics simulations. -## Development - -We use [pixi](https://pixi.sh/latest/) to manage Python environments and simplify the developer workflow. -Once you have [pixi](https://pixi.sh/latest/) installed, move into `POVME` directory (e.g., `cd POVME`) and install the environment using the command - -```bash -pixi install -``` - -Now you can activate the new virtual environment using - -```sh -pixi shell -e dev -``` - ## Installation -### Development +### Latest development version To install the latest development version of `povme`, follow these steps. @@ -63,15 +48,21 @@ Navigate into the cloned directory. cd POVME ``` -Install the development version using `pip`. +Install the latest version using `pixi`. ```bash -pip install . +pixi install ``` -This will install `povme` along with all required dependencies into your current Python environment. +This will install `povme` along with all required dependencies into a virtual environment. + +To use `povme`, activate the environment and run: -### Tagged +```bash +pixi shell +``` + +### Tagged version To install a specific version of `povme`, such as `v2.2.2`, follow these steps. @@ -83,14 +74,42 @@ cd POVME git checkout v2.2.2 ``` -Install the tagged version using `pip`. +Ensure your environment includes the required dependencies. If not, please run the following: ```bash -pip install . +conda create -n povme python=3.11 numpy=1.23 scipy=1.10 +conda activate povme ``` This will install the specified version of `povme` and its dependencies into your current Python environment. +You can use `povme` as follows: + +```bash +python3 POVME2.py your_input.init +``` + +You can also check your installation is valid by running: + +```bash +python3 POVME2.py --test +``` + +## Development + +We use [pixi](https://pixi.sh/latest/) to manage Python environments and simplify the developer workflow. +Once you have [pixi](https://pixi.sh/latest/) installed, move into the `POVME` directory (e.g., `cd POVME`) and install the environment using the command: + +```bash +pixi install +``` + +Now you can activate the development virtual environment using: + +```sh +pixi shell -e dev +``` + ## Cite If you use POVME in your work, please cite: @@ -106,4 +125,4 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY 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/](https://www.gnu.org/licenses/). +If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/). \ No newline at end of file diff --git a/pixi.lock b/pixi.lock index 4f8229d..5fe05a2 100644 --- a/pixi.lock +++ b/pixi.lock @@ -5,8 +5,6 @@ environments: - url: https://conda.anaconda.org/conda-forge/ indexes: - https://pypi.org/simple - options: - pypi-prerelease-mode: if-necessary-or-explicit packages: linux-64: - conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 @@ -183,8 +181,6 @@ environments: - url: https://conda.anaconda.org/conda-forge/ indexes: - https://pypi.org/simple - options: - pypi-prerelease-mode: if-necessary-or-explicit packages: linux-64: - conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 @@ -587,8 +583,6 @@ environments: - url: https://conda.anaconda.org/conda-forge/ indexes: - https://pypi.org/simple - options: - pypi-prerelease-mode: if-necessary-or-explicit packages: linux-64: - conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 @@ -3867,6 +3861,7 @@ packages: - ray>=2.38.0,<3 - pymolecule @ git+https://github.com/durrantlab/pymolecule requires_python: '>=3.10,<3.13' + editable: true - conda: https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.36-pyha770c72_0.conda sha256: 6bd3626799c9467d7aa8ed5f95043e4cea614a1329580980ddcf40cfed3ee860 md5: 4d79ec192e0bfd530a254006d123b9a6 diff --git a/povme/parallel.py b/povme/parallel.py index b1fdf64..69c4fa7 100644 --- a/povme/parallel.py +++ b/povme/parallel.py @@ -72,8 +72,8 @@ def save_results(results, **kwargs): """ from abc import ABC, abstractmethod -from collections.abc import Callable -from typing import Any, Generator +from collections.abc import Callable, Generator +from typing import Any import ray from loguru import logger @@ -126,6 +126,10 @@ def __init__( self.n_cores = ( n_cores if n_cores > 0 else int(ray.available_resources().get("CPU", 1)) ) + if not use_ray and n_cores > 1: + logger.warning( + "n_cores > 1 but use_ray is False. Running tasks sequentially." + ) """ The number of parallel tasks to run. If set to `-1` or any value less than or equal to `0`, all available CPU cores are utilized. diff --git a/povme/pocket/volume.py b/povme/pocket/volume.py index 07035ee..50cf578 100644 --- a/povme/pocket/volume.py +++ b/povme/pocket/volume.py @@ -14,8 +14,9 @@ import os import sys import time +from collections.abc import Generator from io import StringIO -from typing import Any, Generator +from typing import Any import numpy as np from loguru import logger diff --git a/tests/conftest.py b/tests/conftest.py index d3c5151..b50b730 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,6 +34,14 @@ def turn_on_logging(): enable_logging(10) +@pytest.fixture(autouse=True) +def shutdown_ray_after_test(): + """Ensure Ray is shut down after each test to prevent deadlocks.""" + yield + if HAS_RAY and ray.is_initialized(): + ray.shutdown() + + @pytest.fixture def path_4nss_config(): return os.path.join(TEST_DIR, "files/4nss/povme.yml")