Skip to content

Commit efce8e4

Browse files
pm-blancopmblanco
andauthored
Replace the pyMBE Pandas dataframe for a canonical pyMBE database (#147)
* first draft * Database with reactions and states disentangled * first complete draft of the database for particles * add all pmb_types * clean up and document storage code * start refactoring pyMBE to use the new database * updated residue and bond management in pyMBE * finish refactoring of residues, molecules and peptides * updated create_protein * refactor hydrogels * update delete methods to work with the new database * fix added_salt and counterion methods and get_id_map * update methods to work with the new database * fix test for define and create molecules * modernize molecule tests, start cleaning lj tests * implement lj templates, fix tests * add demo, add functions to load/save the database to the pyMBE API * fix unit test * fix bug in create_counterions, fix unittest * update copyright * disentagle particle states from particle templates * fix wrong handling of espresso types and acidity test * fix molecule position test * fix test * fix seed test and load_interaction_parameters * add metadata management, small cleanup * clean up gcmc functional test * fix bugs in setup bond, fix unittest * fix net charge test * fix parameter test * fix HH functions and tests, improve the functionality of calculate_net_charge for hydrogels, fix related bugs * start refactoring protein unit test * fix protein framework and unit test * adapt cpH method * adapt reaction methods to the new database, fix docs * standarize docs * clean up repo, fix bug in setup of rigid object * increase coverage * improve coverage, clean docs * add missing test * increase coverage manager io, fix bug in lj * remove dead ends in database io * improve docs * increase coverage of the database manager * reach full coverage * solve issues detected by pylint * fix bug * solve dependency issues on the CI * fix new bug in unit test * lower requierements for pydantic to comply with current EESSI * fix hydrogel matplotlib representation, fix bug in collect_particle_templates with nested residues, continue refactoring samples * fix general samples * all functional tests run now, started fixing the tutorial * clean up tutorial * update changelog * adress review comments by sebas and somesh * fix affiliations * update changelog * address ipsita comment * change behaviour of create_ methods to raise a ValueError if no template is found * fix missing commit number in changelog --------- Co-authored-by: pmblanco <pablomiguel.blanco@udl.cat> Co-authored-by: Pablo <pablb.ntnu.no>
1 parent bde39e0 commit efce8e4

78 files changed

Lines changed: 13161 additions & 6947 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AUTHORS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ The following people have contributed to pyMBE (Github username, Name, current a
55
## Admins
66
- jngrad, Jean-Noël Grad (University of Stuttgart, Germany)
77
- kosovan, Peter Košovan (Charles University, Czech Republic)
8-
- pm-blanco, Pablo M. Blanco (Norwegian University of Science and Technology, Norway)
8+
- pm-blanco, Pablo M. Blanco (University of Lleida, Spain)
99

1010
## Tier-0 Contributors
1111
- davidbbeyer, David Beyer (University of Stuttgart, Germany)
1212
- paobtorres, Paola B. Torres (Universidad Tecnológica Nacional, Argentina)
13-
- pinedaps, Sebastian P. Pineda (Charles University, Czech Republic)
13+
- pinedaps, Sebastian P. Pineda (University of Lund, Sweden)
1414
- 1234somesh, Somesh Kurahatti (University of Stuttgart, Germany)
1515

1616
## Tier-1 Contributors

CHANGELOG.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Changed
11-
- Methods that interact directly with the pyMBE dataframe are now private and stored in a dedicated module in `storage/df_management`. These methods also have been refactored to be stateless methods, i.e. making it impossible for them to change behavior during the pyMBE object lifetime or for the user to change the pyMBE dataframe unless explicitely calling them. This includes the methods: `add_bond_in_df`, `add_value_to_df`, `assign_molecule_id`, `check_if_df_cell_has_a_value`, `check_if_name_is_defined_in_df`, `check_if_multiple_pmb_types_for_name`, `clean_df_row`, `clean_ids_in_df_row`, `copy_df_entry`, `create_variable_with_units`, `convert_columns_to_original_format`, `convert_str_to_bond_object`, `delete_entries_in_df`, `find_bond_key`, `setup_df`. (#145)
12-
- `define_particle_entry_in_df` is now a private method in pyMBE, as it is a convenience method for internal use. (#145)
13-
- The custom `NumpyEncoder` is now a private class in the private module `storage/df_management` because it is only internally used in pyMBE for serialization/deserialization. (#145)
10+
## Added
11+
- Introduced a canonical pyMBE database backend replacing the previous monolithic Pandas DataFrame storage approach. This lays the foundation for more robust, extensible, and normalized data handling across pyMBE. (#147)
12+
- Added support to define reaction templates in the pyMBE database. (#147)
13+
- Utility functions to cast information about templates and instances in the pyMBE database into pandas dataframe `pmb.get_templates_df`, `pmb.get_instances_df` and `pmb.get_reactions_df`. (#147)
14+
- Utility functions to load and save the new database via the pyMBE API, `pmb.save_database` and `pmb.load_database`. (#147)
15+
- Added functions to define particle states: `pmb.define_particle_states` and `pmb.define_monoprototic_particle_states`. (#147)
16+
- Added utility functions in `lib/handy_functions` to define residue and particle templates for aminoacids en peptides and residues: `define_protein_AA_particles`, `define_protein_AA_residues` and `define_peptide_AA_residues`. (#147)
17+
18+
## Changed
19+
- Create methods (`create_particle`, `create_residue`, `create_molecule`, `create_protein`, `create_hydrogel`) now raise a ValueError if no template is found for an input `name` instead than a warning. (#147)
20+
- Refactored core modules to use the new database schema based on templates and instances for particles, residues, molecules, hydrogels, proteins and peptides. (#147)
21+
- Particle states now are independent templates and are now disentangled from particle templates. (#147)
22+
- Pka values are now stored as part of chemical reactions and no longer an attribute of particle templates. (#147)
23+
- Amino acid residue templates are no longer defined internally in `define_peptide` and `define_protein`. Those definitions are now exposed to the user. (#147)
24+
- Molecule templates now need to be defined to be used as templates for hydrogel chains in hydrogels. (#147)
25+
26+
## Fixed
27+
- Wrong handling of units in `get_radius_map` when the `dimensionless` argument was triggered. (#147)
28+
- Utility methods `get_particle_id_map`, `calculate_HH`, `calculate_net_charge`, `center_object_in_simulation_box` now support all template types in pyMBE, including hydrogels. Some of these methods have been renamed to expose directly in the API this change in behavior. (#147)
29+
30+
31+
### Removed
32+
- Methods that interact directly with the pyMBE dataframe. These methods have been replaced by private methods that instead interact with the new canonical pyMBE database in (`pyMBE/storage/manager`). This includes the methods: `add_bond_in_df`, `add_value_to_df`, `assign_molecule_id`, `check_if_df_cell_has_a_value`, `check_if_name_is_defined_in_df`, `check_if_multiple_pmb_types_for_name`, `clean_df_row`, `clean_ids_in_df_row`, `copy_df_entry`, `create_variable_with_units`, `convert_columns_to_original_format`, `convert_str_to_bond_object`, `delete_entries_in_df`, `find_bond_key`, `setup_df`, `define_particle_entry_in_df`, custom `NumpyEncoder`. (#145,#147)
33+
- Method `add_bonds_to_espresso` has been removed from the API. pyMBE now adds bonds internally to ESPResSo when molecule instances are created into ESPResSo. (#147)
34+
- Tutorial `lattice_builder.ipynb` has been removed because its content is redundant with sample script `build_hydrogel.py`. (#147)
35+
1436

1537
## [1.0.0] - 2025-10-08
1638

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ New developers are welcome to contribute to extend the functionalities of the py
1111
To contribute to the pyMBE module, first one needs to be added as a member of this GitHub repository.
1212

1313
If you want to contribute to the development of the pyMBE module,
14-
please contact Dr. Pablo M. Blanco (<pablb@ntnu.no>).
14+
please contact Dr. Pablo M. Blanco ([@pm-blanco](https://github.com/pm-blanco)).
1515

1616
## Authorship and contributorship policy
1717
For more information on our authorship and contributorship policy,

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ If you use pyMBE in your research, please cite our paper:
232232

233233
When using a released version of pyMBE, we recommend citing the corresponding
234234
[Zenodo record](https://doi.org/10.5281/zenodo.12102634) in addition to the pyMBE paper,
235-
for example: "We set up our coarse-grained models using pyMBE v0.8.0
235+
for example: "We set up our coarse-grained models using pyMBE v1.0.0
236236
\cite{beyer2024pymbe,zenodo2024pymbe}".
237237

238238
Please also make sure to properly cite the original authors if you use the resources provided in the `pyMBE/parameters/` folder.
@@ -247,7 +247,7 @@ contribute to pyMBE and find our authorship policy and code of conduct.
247247

248248
## License
249249

250-
Copyright (C) 2023-2025 pyMBE-dev team
250+
Copyright (C) 2023-2026 pyMBE-dev team
251251

252252
pyMBE is free software: you can redistribute it and/or modify it
253253
under the terms of the GNU General Public License as published by

0 commit comments

Comments
 (0)