Draft: add support for nanoparticle models#148
Open
pm-blanco wants to merge 10 commits into
Open
Conversation
4 tasks
pm-blanco
pushed a commit
to pm-blanco/pyMBE
that referenced
this pull request
Mar 20, 2026
pm-blanco
pushed a commit
to pm-blanco/pyMBE
that referenced
this pull request
Mar 20, 2026
bbf058b to
cbe3eeb
Compare
Co-authored-by: Sebastian Pineda <sebastian.pineda_pineda@chem.lu.se>
961cc15 to
a3b10df
Compare
Co-authored-by: pm-blanco<pablomiguel.blanco@udl.cat>
Co-authored-by: pm-blanco<pablomiguel.blanco@udl.cat>
…lt concentration Gradually grows the LJ offset of the nanoparticle core from zero to its Lorentz-Berthelot target value, relaxing the system after each increment. This prevents hard overlaps between the nanoparticle core and salt ions that arise when the full offset is applied immediately at high salt concentrations. Ion sigma and epsilon are now handled consistently through a general variable instead of being hardcoded in each particle definition. Also fixes a pre-existing bug where the Langevin thermostat was left OFF before the production MD loop. Unit tests for the new function are added to nanoparticle_unit_tests.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
thermostat.kT is not available in all ESPResSo versions; replace with thermostat.langevin.is_active which is stable across versions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…; rename template file Refactor the nanoparticle site definition from a float fraction to an integer count per patch, making the physical meaning more explicit and avoiding implicit conversions. The real fraction of primary sites is now a computed output shown by print_nanoparticle_properties() rather than an input parameter. Rename storage/templates/nanoparticle.py to patchy_nanoparticle.py to better reflect the patchy nanoparticle model. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Store angle_between_patches in NanoparticleTemplate so it is part of the nanoparticle definition rather than a creation-time argument. create_nanoparticle now reads it from the template. The property is included in calculate_nanoparticle_properties only when number_of_patches == 2; for more than two patches the angle is irrelevant as patch centres are distributed at regular polyhedron vertices. This behaviour is documented in the sample script and covered by three new unit tests. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
The test verified that relax_nanoparticle_overlaps leaves the thermostat off, which is a contract of relax_espresso_system rather than of the nanoparticle function itself. The ESPResSo thermostat API differs across versions, making a portable assertion impossible. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #144
Added
NanoparticleTemplateandNanoparticleInstance.pmb.define_nanoparticleandpmb.create_nanoparticleto define and build nanoparticles with configurable core particles and surface site composition.pyMBE.lib.nanoparticle_toolsfor spherical site distribution, patch construction, and overlap checks.samples/nanoparticles_grxmc.pyto demonstrate nanoparticle setup and simulation workflows.testsuite/nanoparticle_unit_tests.py) and coverage for nanoparticle-related code paths.Changed
pmb.create_nanoparticle.Fixed