Skip to content

Increasing pyMBE interoperability (part I) - #151

Open
jorch28 wants to merge 87 commits into
pyMBE-dev:mainfrom
jorch28:CheckThisFeature
Open

Increasing pyMBE interoperability (part I)#151
jorch28 wants to merge 87 commits into
pyMBE-dev:mainfrom
jorch28:CheckThisFeature

Conversation

@jorch28

@jorch28 jorch28 commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Application of the strategy pattern to delegate the responsability of executing the simulation engine to a particular engine class (e.g EspressoEngine).

Added

  • EspressoEngine Class
  • EspressoSystemProtocol Class to check that an the working engine corresponds to espresso.system instance
  • reaction methods to EspressoEngine
  • handy functions to EspressoEngine
  • miscellaneous methods as (calculate_net_charge, change_volume_and_re-scale_particles,enable_motion_of_rigid_object,etc.)
  • method add_instances_to_engine to add particles, bonds and angles to Espresso

Modified

  • create_particle,create_residue, create_molecule,etc. to avoid an explicit dependence to Espresso
  • unit_tests and functional_tests accordingly so that they introduce the particles, bonds and angles before choosing espresso as the working engine. Execute pmb methods from the simulation_engine when they depend on espresso.

Fixed

In commit: 217d15a

  • class DiamondLattice. box_l=(self.mpc+1)*self.bond_l.magnitude / (np.sqrt(3)*0.25)
  • method _create_hydrogel_chain. backbone vector=vec_between_nodes / (self.lattice_builder.mpc+1)

jsd94 and others added 30 commits April 8, 2026 21:21
…le_position,inst._particle_fix to _get_instances_df method
- create_espresso_bond_instance
-_create_hydrogel_chain
- create_hydrogel
-_get_espresso_bond_instance
- create_added_salt
- create_counterions
- create_bond
-create_particle
-create_residue
-create_molecule
-create_protein
add methods to enable the decoupling:
-set_simulation_engine
-add_instances_to_engine
- algorithm to add instances to espresso system
…type in config class in order to be able to set the position as NDarrays
_create_hydrogel_chain
_delete_particles_from_engine
calculate_net_charge
center_object_simulation_box
create_counterions
create_hydrogel
create_particle
delete_instances_in_system

Add methods:
change_volume_and_rescale_particles
update_instances_ids_according_to_engine_particle_ids
…t the missing particles from pymbe DB and the particles that have not been transferred yet to espresso.

Add methods _add_bond, _add_particle,_check_particle_exists_in_espresso,_get_last_particle_id_in_espresso,update_instances_ids_according_to_engine_particles_ids
…ase_csv and _save_database_csv

Add added_to_engine for pmb_type bond in _load_database_csv and _save_database_csv.
This methods still have to pass the test due float point accuracy between save/load
…e, particle_id,position and added_to_engine.

Add pymbe type bond and allowed particle_id1,particle_id2 and added_to_engine
The main modification consists on setting as the simulation engine espresso and adding to the simulation engine the instances (particles and bonds ) to the engine. Also removing espresso as an argument from pymbe methods. Adding box_l as argument to pymbe methods
-reaction_montecarlomethods
-determine_reservoir_concentrations
Migrate methods the following methods to the manager:
-propose_unused_types
-get_lj_parameters
-get_radius_map
-_get_label_id_map
- handy functions
- reaction methods
- calculate_center_of_mass
-determine_reservoir_concentrations
-get_label_id_map
-get_lj_parameters
-get_radius_map
-propose_unused_type
jorch28 added 6 commits July 1, 2026 17:47
Add methods descriptions,remove unused import
Modify default value for fix=False. As fix=[False,False,False] is considered as a dangerous default value for pylint.
Modify if/else chain ,that raised different exceptions depending on the instantiated simulation Engine, in class pymbe_library  methods implemented by espresso by simulation_engine.method
@jorch28

jorch28 commented Jul 2, 2026

Copy link
Copy Markdown
Author

@pm-blanco @jngrad
For version ESPREesSo 5.0-dev testsuite is failing due to an error importing espressomd. In the workflow execution logs it is shown that the module espresso is not loaded. I think this happens because in the push_pull.yaml the value for the key upload artifact in jobs.ubuntu.strategy.matrix.espresso.upload_artifact=False.

For ESPREsSO 4.2.2, all tests are passing, but they last longer than 300s and the last test 26/26 is not being executed. Did this happened before?

@jngrad

jngrad commented Jul 2, 2026

Copy link
Copy Markdown
Member

There seems to be an issue with how module save handles the dev.eessi.io stack. In addition, the runner is executing actions with the wrong Node.js version. Let's drop the development stack in favor of the stable repository, and upgrade all software and operating systems. I'll open a separate PR, since it's orthogonal to this work.

@pm-blanco

Copy link
Copy Markdown
Collaborator

@jorch28 we have already updated the runner pipeline in the main pyMBE-dev repo, can you merge it here and see if now the tests pass?

@jorch28

jorch28 commented Jul 2, 2026

Copy link
Copy Markdown
Author

Now, for version 5.0.1 seems that there is no error related to import espressomd anymore. Thank you for your very fast answer! I'm going to add the method _check_bond_input to the LammpsSimulationEngine that is missing and therefore is not complying with the contract setup by the interface.
The actual problem was related to the differences between the methods and attributes from espressosystem in version 4.2.2 and version 5.0.1

@jngrad

jngrad commented Jul 16, 2026

Copy link
Copy Markdown
Member

Here is a blueprint for testing the LAMMPS engine in CI: jngrad/pyMBE@40ad03ca61. One could adapt existing test cases to run with both ESPResSo and LAMMPS (in this case, move the @ut.skipIf(not is_engine_available from above the class to above the methods), or create separate test files for each engine (I wouldn't recommend: that could lead to diverging code).

LAMMPS isn't available in foss/2025a yet.

@pm-blanco

Copy link
Copy Markdown
Collaborator

@jngrad @jorch28 I addressed all of our review comments and cleaned up a number of other pending issues I found while addressing the others. I think that now it should be close or ready to be merged, but please take a look so we can merge it ASAP. I removed the duplicated functions with the custom deprecation warnings because I do not think that makes sense to maintain an obsolete API when we are close to deploy a new release to pyMBE in any case.

pmblanco and others added 2 commits August 13, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants