-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lift restrictions on ESPResSo/NumPy/Pandas version requirements (#106)
* Modernize samples and documentation * Add support for ESPResSo 4.2.2 and 4.3-dev
- Loading branch information
Showing
25 changed files
with
216 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,22 @@ pyMBE provides tools to facilitate building up molecules with complex architectu | |
|
||
## Dependencies | ||
|
||
- [ESPResSo](https://espressomd.org/wordpress/) =4.2.1 | ||
- [Pint](https://pint.readthedocs.io/en/stable/) >=0.20.01 | ||
- [Pandas](https://pandas.pydata.org/) >=1.5.3 | ||
- [Pint-Pandas](https://pypi.org/project/Pint-Pandas/) >=0.3 | ||
- [Numpy](https://numpy.org/) >=1.23 | ||
- [SciPy](https://scipy.org/) | ||
- [ESPResSo](https://espressomd.org/wordpress/) | ||
- [Pint](https://pint.readthedocs.io/en/stable/) | ||
- [Pandas](https://pandas.pydata.org/) | ||
- [Pint-Pandas](https://pypi.org/project/Pint-Pandas/) | ||
- [Numpy](https://numpy.org/) | ||
- [SciPy](https://scipy.org/) | ||
- [pdoc](https://pdoc.dev/) (for building the docs) | ||
- [CMake](https://cmake.org/) (for running the testsuite) | ||
- any virtual environment manager: [venv](https://docs.python.org/3/library/venv.html), | ||
[virtualenv](https://virtualenv.pypa.io/en/latest/), | ||
[conda](https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python), | ||
[miniconda](https://docs.anaconda.com/free/miniconda), | ||
[micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html), | ||
etc. | ||
|
||
Version requirements are documented in [`requirements.txt`](requirements.txt). | ||
|
||
## Contents | ||
|
||
|
@@ -50,33 +58,42 @@ git clone [email protected]:pyMBE-dev/pyMBE.git | |
``` | ||
|
||
Please, be aware that pyMBE is intended to be a supporting tool to setup simulations with ESPResSo. | ||
Thus, for most of its functionalities ESPResSo must also be available. Following the NEP29 guidelines, we recommend the users of pyMBE to use Python3.10+ when using our module. | ||
Thus, for most of its functionalities ESPResSo must also be available. | ||
pyMBE supports ESPResSo 4.2 and ESPResSo 4.3-dev. | ||
Following the NEP29 guidelines, we recommend using Python3.10+. | ||
Both NumPy 1 and NumPy 2 are supported. | ||
|
||
The pyMBE module uses its own Python virtual enviroment to avoid incompatibility issues when loading its requirements from other libraries. | ||
The Python module [`venv`](https://docs.python.org/3/library/venv.html) is needed to set up pyMBE. | ||
If `venv` is not in the Python distribution of the user, the user will need to first install 'venv' before setting up pyMBE. | ||
For Ubuntu users, this can be done as follows: | ||
The pyMBE module needs a Python virtual environment to avoid compatibility issues with its dependencies. | ||
Any virtual environment manager should work, but this readme will use `venv`, which can be installed on Ubuntu as follows: | ||
|
||
```sh | ||
sudo apt install python3-venv | ||
``` | ||
|
||
To set up pyMBE, the users need to install its virtual environment, install its Python dependencies and configure the path to the ESPResSo build folder as follows: | ||
To set up pyMBE, users need to configure a virtual environment. This is achieved by installing the Python dependencies and setting the path to the ESPResSo build folder, as follows: | ||
|
||
```sh | ||
python3 -m venv pymbe # creates a local folder named pymbe, which contains the virtual environment | ||
source pymbe/bin/activate # activates the pymbe venv | ||
python3 maintainer/configure_venv.py --espresso_path=/home/user/espresso/build # please, adapt the espresso path accordingly | ||
python3 -m pip install -r requirements.txt | ||
python3 simulation_script.py # run the espresso simulation script | ||
python3 -m venv pymbe # create a local folder named pymbe containing the environment files | ||
source pymbe/bin/activate # activate the virtual environment | ||
python3 -m pip install -r requirements.txt "numpy<2.0" "pandas<2.0" | ||
python3 maintainer/configure_venv.py --espresso_path=/home/user/espresso/build # please adapt the espresso path accordingly | ||
python3 simulation_script.py # run a simulation script | ||
deactivate # deactivate the virtual environment | ||
``` | ||
|
||
NumPy 2 users should adapt the pip command as follows: | ||
|
||
```sh | ||
python3 -m pip install -r requirements.txt "numpy>=2.1" "pandas>=2.0" | ||
``` | ||
|
||
We highlight that the path `/home/user/espresso/build` is just an example of a possible path to the ESPResSo build folder. | ||
The user should change this path to match the local absolute path were ESPResSo was installed. | ||
The user should change this path to match the local absolute path where ESPResSo was built. | ||
Also, ESPResSo must be built with the same NumPy version as the one installed in the environment to avoid API version mismatch. | ||
For more details on how to install ESPResSo, please consult the [ESPResSo installation guide](https://espressomd.github.io/doc4.2.2/installation.html). | ||
|
||
The pyMBE virtual enviroment can be deactivated at any moment: | ||
The pyMBE virtual environment can be deactivated at any moment as follows: | ||
|
||
```sh | ||
deactivate | ||
``` | ||
|
@@ -85,7 +102,7 @@ Cluster users who rely on module files to load dependencies should opt for the | |
following alternative: | ||
|
||
```sh | ||
module load ESPResSo/4.2.1-foss-2022a # adapt module name | ||
module load ESPResSo/4.2.2-foss-2023a # adapt release if needed | ||
python3 -m venv --system-site-packages pymbe | ||
source pymbe/bin/activate | ||
python3 maintainer/configure_venv.py | ||
|
@@ -94,7 +111,7 @@ deactivate | |
module purge | ||
``` | ||
|
||
We highlight that the module files need to be loaded before every activation | ||
Please note the module files need to be loaded before every activation | ||
of the virtual environment. | ||
|
||
Now you can use pyMBE and ESPResSo by activating the virtual environment: | ||
|
@@ -108,11 +125,11 @@ $ source pymbe/bin/activate | |
$ deactivate | ||
``` | ||
|
||
To use pyMBE in JupyterLab, register the virtual environment in a new kernel: | ||
To use pyMBE in JupyterLab, install extra dependencies and register the virtual environment in a new kernel: | ||
|
||
```sh | ||
source pymbe/bin/activate | ||
python3 -m pip install ipykernel "jupyterlab>=4.0.8" "PyOpenGL>=3.1.5" | ||
python3 -m pip install ipykernel "jupyterlab>=4.0.8" "PyOpenGL>=3.1.5" "ipympl>=0.9.3" | ||
python3 -m ipykernel install --user --name=pyMBE | ||
deactivate | ||
``` | ||
|
@@ -129,24 +146,30 @@ jupyter kernelspec uninstall pymbe | |
The JupyterLab main menu will now show a new Python kernel called "pyMBE" | ||
that uses the virtual environment. | ||
|
||
### Use pyMBE in your simulation scripts | ||
### Run simulation scripts | ||
|
||
You can run the branched polyampholyte sample with the following commands: | ||
|
||
```sh | ||
source pymbe/bin/activate | ||
python3 samples/peptide.py | ||
python3 samples/branched_polyampholyte.py --pH 6 | ||
python3 samples/analyze_time_series.py --data_folder samples/time_series/branched_polyampholyte | ||
python3 samples/plot_branched_polyampholyte.py | ||
deactivate | ||
``` | ||
|
||
### Run the tutorial of pyMBE | ||
### Run tutorials | ||
|
||
You can run the interactive tutorial of pyMBE with the command: | ||
You can run the interactive tutorials with the following commands: | ||
|
||
```sh | ||
source pymbe/bin/activate | ||
jupyter-lab tutorials/pyMBE_tutorial.ipynb | ||
jupyter-lab | ||
deactivate | ||
``` | ||
|
||
In the Jupyter interface, open the `tutorials` folder and then the `pyMBE_tutorial` file. | ||
It will guide you through the creation of polyelectrolytes with pyMBE. | ||
Be sure to use the pyMBE kernel instead of the default Python3 kernel. | ||
The currently active kernel is usually displayed in the top right corner of the notebook. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
numpy>=1.23,<2.0 | ||
numpy>=1.23 | ||
pandas>=1.5.3 | ||
pint>=0.20.01 | ||
pint-pandas>=0.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.