pymbe

pyMBE provides tools to facilitate building up molecules with complex architectures in the Molecular Dynamics software ESPResSo. For an up-to-date API documention please check our website:

https://github.com/pymbe-dev/pymbe

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.5%) to scientific vocabulary

Keywords

hydrogels molecular-modeling monte-carlo peptides polyelectrolyte polymer-physics proteins python
Last synced: 6 months ago · JSON representation ·

Repository

pyMBE provides tools to facilitate building up molecules with complex architectures in the Molecular Dynamics software ESPResSo. For an up-to-date API documention please check our website:

Basic Info
Statistics
  • Stars: 12
  • Watchers: 4
  • Forks: 12
  • Open Issues: 13
  • Releases: 1
Topics
hydrogels molecular-modeling monte-carlo peptides polyelectrolyte polymer-physics proteins python
Created almost 2 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Authors

README.md

pyMBE logo

pyMBE: the Python-based Molecule Builder for ESPResSo

GitHub Actions codecov docs License: GPL v3 Contributor Covenant

pyMBE provides tools to facilitate building up molecules with complex architectures in the Molecular Dynamics software ESPResSo. Some examples of molecules that can be set up with pyMBE are polyelectrolytes, hydrogels, peptides and globular proteins. pyMBE bookkeeps all the information about the molecule topology, permitting to link each particle to its corresponding residue and molecule. pyMBE uses the Pint library to enable input parameters in any arbitrary unit system, which is later transformed in the reduced unit system used in ESPResSo.

An up-to-date documentation of all methods of the library can be found here and in the source code.

Dependencies

Version requirements are documented in requirements.txt.

Contents

  • pyMBE/: source code of pyMBE
  • pyMBE/parameters/: folder with various sets of parameters from previous works.
  • figs/: folder with various images used in the tutorials of pyMBE.
  • maintainer/: folder with various scripts used by the maintainers.
  • samples/: folder with various sample scripts showcasing how to use pyMBE to setup different systems.
  • testsuite/: folder with several test scripts and data for continous integration of the library.
  • tutorials/: folder with the available tutorials on pyMBE.
  • visualization/: folder with helper scripts to aid the visualization of vtf trajectories from constant pH and Grand reaction simulations with VMD.
  • AUTHORS.md: list of authors and contributors of pyMBE.
  • CONTRIBUTING.md: rules on how to contribute to pyMBE.
  • LICENSE.txt: license of pyMBE.
  • requirements.txt: list of required libraries to use pyMBE.

Usage

Set up the pyMBE virtual environment

To use pyMBE in your simulations, first clone this repository locally:

sh git clone git@github.com: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. 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 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, 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 # 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 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.

The pyMBE virtual environment can be deactivated at any moment as follows:

sh deactivate

Cluster users who rely on module files to load dependencies should opt for the following alternative:

sh 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 python3 -m pip install -r requirements.txt deactivate module purge

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:

sh $ source pymbe/bin/activate (pymbe) $ python3 -c "import espressomd.version; print(espressomd.version.friendly())" 4.2 (pymbe) $ python3 -c "import pyMBE; print(pyMBE.__file__)" /home/user/Documents/pyMBE/pyMBE/__init__.py $ deactivate

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" "ipympl>=0.9.3" python3 -m ipykernel install --user --name=pyMBE deactivate

Please be aware the pyMBE kernel will be registered outside the environment, typically in your home folder. You can later inspect the list of registered kernels and delete unwanted ones with the following commands:

sh jupyter kernelspec list jupyter kernelspec uninstall pymbe

The JupyterLab main menu will now show a new Python kernel called "pyMBE" that uses the virtual environment.

Run simulation scripts

You can run the branched polyampholyte sample with the following commands:

sh source pymbe/bin/activate 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 tutorials

You can run the interactive tutorials with the following commands:

sh source pymbe/bin/activate 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.

Run the testsuite

To make sure your code is valid, please run the testsuite before submitting your contribution:

sh source pymbe/bin/activate make tests -j4 deactivate

Here, -j4 instructs CTest to run the test cases in parallel using 4 CPU cores. This number can be adjusted depending on your hardware specifications. You can use make unit_tests -j4 to run the subset of fast tests, but keep in mind those won't be able to detect more serious bugs that only manifest themselves in long simulations. You can also run individual test cases directly, for example with python3 testsuite/parameter_test.py.

When contributing new features, consider adding a unit test in the testsuite/ folder and a corresponding line in the testsuite/CTestTestfile.cmake file.

Every contribution is automatically tested in CI using EESSI (https://www.eessi.io) and the EESSI GitHub Action.

References

Check out the corresponding paper to learn more about pyMBE. If you use pyMBE in your research, please cite our paper:

bibtex @article{beyer2024pymbe, author = {Beyer, David and Torres, Paola B. and Pineda, Sebastian P. and Narambuena, Claudio F. and Grad, Jean-No{\"e}l and Ko{\v{s}}ovan, Peter and Blanco, Pablo M.}, title = {{pyMBE}: The {P}ython-based molecule builder for {ESPResSo}}, journal = {The Journal of Chemical Physics}, volume = {161}, number = {2}, pages = {022502}, year = {2024}, month = jul, issn = {0021-9606}, doi = {10.1063/5.0216389}, }

When using a released version of pyMBE, we recommend citing the corresponding Zenodo record in addition to the pyMBE paper, for example: "We set up our coarse-grained models using pyMBE v0.8.0 \cite{beyer2024pymbe,zenodo2024pymbe}".

Please also make sure to properly cite the original authors if you use the resources provided in the pyMBE/parameters/ folder. The relevant references are provided as metadata in the corresponding files.

Contributing

See CONTRIBUTING.md to discover the different ways you can contribute to pyMBE and find our authorship policy and code of conduct.

License

Copyright (C) 2023-2025 pyMBE-dev team

pyMBE 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.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Owner

  • Name: pyMBE-dev
  • Login: pyMBE-dev
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it using the metadata from this file."
title: pyMBE
type: software
version: 0.8.0
authors:
  - given-names: David
    family-names: Beyer
    affiliation: Institute for Computational Physics, University of Stuttgart, Stuttgart, Germany
    orcid: "https://orcid.org/0000-0001-6066-8043"
  - given-names: Paola B.
    family-names: Torres
    affiliation: Grupo de Bionanotecnologia y Sistemas Complejos. Infap-CONICET & Facultad Regional San Rafael, Universidad Tecnológica Nacional, San Rafael, Argentina
    orcid: "https://orcid.org/0000-0001-9335-8367"
  - given-names: Sebastian P.
    family-names: Pineda
    affiliation: Department of Physical and Macromolecular Chemistry, Charles University, Prague, Czech Republic
    orcid: "https://orcid.org/0000-0001-8270-2476"
  - given-names: Claudio F.
    family-names: Narambuena
    affiliation: Grupo de Bionanotecnologia y Sistemas Complejos. Infap-CONICET & Facultad Regional San Rafael, Universidad Tecnológica Nacional, San Rafael, Argentina
    orcid: "https://orcid.org/0000-0003-3862-6642"
  - given-names: Jean-Noël
    family-names: Grad
    affiliation: Institute for Computational Physics, University of Stuttgart, Stuttgart, Germany
    orcid: "https://orcid.org/0000-0002-5821-4912"
  - given-names: Peter
    family-names: Košovan
    affiliation: Department of Physical and Macromolecular Chemistry, Charles University, Prague, Czech Republic
    orcid: "https://orcid.org/0000-0002-6708-3344"
  - given-names: Pablo M.
    family-names: Blanco
    affiliation: Department of Physics, NTNU - Norwegian University of Science and Technology, Trondheim, Norway
    orcid: "https://orcid.org/0000-0002-7603-8617"
identifiers:
  - type: doi
    value: 10.1063/5.0216389
    description: The software paper
repository-code: "https://github.com/pyMBE-dev/pyMBE"
keywords:
  - molecule builder
  - coarse-grained molecular modelling
  - constant pH simulation
  - Reaction ensemble Monte Carlo
  - charge regulation
  - pKa
  - protein
  - peptide
license: GPL-3.0-or-later
preferred-citation:
  authors:
    - given-names: David
      family-names: Beyer
    - given-names: Paola B.
      family-names: Torres
    - given-names: Sebastian P.
      family-names: Pineda
    - given-names: Claudio F.
      family-names: Narambuena
    - given-names: Jean-Noël
      family-names: Grad
    - given-names: Peter
      family-names: Košovan
    - given-names: Pablo M.
      family-names: Blanco
  doi: 10.1063/5.0216389
  type: article
  journal: "The Journal of Chemical Physics"
  title: "pyMBE: The Python-based molecule builder for ESPResSo"
  year: 2024
  month: 7
  volume: 161
  issue: 2
  issue-title: "Special Collection: Modular and Interoperable Software for Chemical Physics"
  pages: 022502
  publisher:
    name: "AIP Publishing"
references:
  - authors:
      - family-names: Beyer
        given-names: David
        orcid: "https://orcid.org/0000-0001-6066-8043"
      - family-names: Torres
        given-names: Paola B.
        orcid: "https://orcid.org/0000-0001-9335-8367"
      - family-names: Pineda
        given-names: Sebastian P.
        orcid: "https://orcid.org/0000-0001-8270-2476"
      - family-names: Narambuena
        given-names: Claudio F.
        orcid: "https://orcid.org/0000-0003-3862-6642"
      - family-names: Grad
        given-names: Jean-Noël
        orcid: "https://orcid.org/0000-0002-5821-4912"
      - family-names: Košovan
        given-names: Peter
        orcid: "https://orcid.org/0000-0002-6708-3344"
      - family-names: Blanco
        given-names: Pablo M.
        orcid: "https://orcid.org/0000-0002-7603-8617"
    doi: 10.1063/5.0216389
    type: article
    journal: "The Journal of Chemical Physics"
    title: "pyMBE: The Python-based molecule builder for ESPResSo"
    year: 2024
    month: 7
    volume: 161
    issue: 2
    issue-title: "Special Collection: Modular and Interoperable Software for Chemical Physics"
    pages: 022502
    publisher:
      name: "AIP Publishing"
  - authors:
      - family-names: Beyer
        given-names: David
        orcid: "https://orcid.org/0000-0001-6066-8043"
      - family-names: Torres
        given-names: Paola B.
        orcid: "https://orcid.org/0000-0001-9335-8367"
      - family-names: Pineda
        given-names: Sebastian P.
        orcid: "https://orcid.org/0000-0001-8270-2476"
      - family-names: Narambuena
        given-names: Claudio F.
        orcid: "https://orcid.org/0000-0003-3862-6642"
      - family-names: Grad
        given-names: Jean-Noël
        orcid: "https://orcid.org/0000-0002-5821-4912"
      - family-names: Košovan
        given-names: Peter
        orcid: "https://orcid.org/0000-0002-6708-3344"
      - family-names: Blanco
        given-names: Pablo M.
        orcid: "https://orcid.org/0000-0002-7603-8617"
    doi: 10.5281/zenodo.12102635
    type: software
    version: 0.8.0
    title: pyMBE
    date-released: "2024-06-18"
    license:
    - GPL-3.0-or-later

GitHub Events

Total
  • Issues event: 17
  • Watch event: 6
  • Delete event: 1
  • Issue comment event: 39
  • Push event: 26
  • Gollum event: 4
  • Pull request review comment event: 55
  • Pull request event: 61
  • Pull request review event: 109
  • Fork event: 5
Last Year
  • Issues event: 17
  • Watch event: 6
  • Delete event: 1
  • Issue comment event: 39
  • Push event: 26
  • Gollum event: 4
  • Pull request review comment event: 55
  • Pull request event: 61
  • Pull request review event: 109
  • Fork event: 5

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 33
  • Total pull requests: 69
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 8 days
  • Total issue authors: 7
  • Total pull request authors: 10
  • Average comments per issue: 1.06
  • Average comments per pull request: 1.19
  • Merged pull requests: 52
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 8
  • Pull requests: 25
  • Average time to close issues: 2 months
  • Average time to close pull requests: 14 days
  • Issue authors: 4
  • Pull request authors: 8
  • Average comments per issue: 1.25
  • Average comments per pull request: 0.44
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pm-blanco (12)
  • jngrad (7)
  • davidbbeyer (6)
  • Zitzeronion (3)
  • kosovan (2)
  • mariusaarsten (1)
  • paobtorres (1)
Pull Request Authors
  • pm-blanco (22)
  • jngrad (13)
  • davidbbeyer (11)
  • paobtorres (8)
  • Zitzeronion (6)
  • 1234somesh (6)
  • pinedaps (4)
  • mariusaarsten (3)
  • kosovan (2)
  • TommyTraan (1)
Top Labels
Issue Labels
bug (7) code quality (7) enhancement (5) good first issue (4) documentation (3) ci-improvement (1)
Pull Request Labels
code quality (22) ci-improvement (18) bug (13) documentation (6) enhancement (5) community (2) good first issue (2)

Dependencies

.github/workflows/testsuite.yml actions
  • actions/checkout main composite
  • eessi/github-action-eessi v3 composite
requirements.txt pypi
  • biopandas ==0.5.1.dev0
  • matplotlib *
  • numpy >=1.23
  • pandas >=1.5.3
  • pint >=0.20.01
  • pint-pandas >=0.3
  • scipy *
  • tqdm *
.github/workflows/deploy.yml actions
  • actions/deploy-pages v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-pages-artifact v3 composite
.github/actions/dependencies/action.yml actions
.github/workflows/samples.yml actions
  • ./.github/actions/dependencies * composite
  • actions/checkout main composite
  • eessi/github-action-eessi v3 composite