Skip to content

Three-way Merge between pele-python's old main branch and the current branch - #52

Merged
spraharsh merged 29 commits into
masterfrom
graft-pele-python
Sep 28, 2026
Merged

spraharsh merged 29 commits into
masterfrom
graft-pele-python

Conversation

@spraharsh

@spraharsh spraharsh commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Goals

Editing this for clarity because this is a fairly involved merge. The goal of this merge is to merge the divergent branches of pele into a working version that passes all tests. and make sure everyone's commits are reflected on the final version. The fork happened between the 2 diverging branches happened in 2019, and the only new changes on pele-python came in 2025 that have now been merged into this

Description

The merge was done by

  1. Forking the martiniani-lab branch, and merging it with pele-python's old branch, giving precedence to the martiniani-lab one in case of conflicts

  2. Patching the GUI and lammps changes along with any extra issues that came along. I verified that the gui works

  3. Submitting a PR back to the martininiani-lab branch

afaik all functionality has been preserved and all tests pass (both python and C++). I checked the GUI works properly with the PyQT5 update. Lammps tests pass and are covered (which is a very cool addition thanks to @farrelljd)

farrelljd and others added 24 commits October 15, 2025 08:11
* replaces numpy.distutils-reliant build system with meson build system

* updates broken and deprecated API calls

* changes the default Cython version and language level to 3

* replaces PyQT4 with PyQT5

* generates .py and resource files made with PyQT tools at build time

* adds pyproject.toml and environment.yml to help pip and conda manage dependencies

* ensures ALL (but one) unittests pass without warnings (but two)
- configured the installation of headers (including some .pxd files)
- added pele.get_include() function

together making building new cpp potentials against pele easier
- added meson build system for compiled potentials, gui source generation

couldn't figure out how to build the fortran_iso_c_bindings example with meson
LAMMPSPotential is a pure python potential class that uses the LAMMPS python API to compute energies and gradients using the run command. Requires LAMMPS at runtime.

LAMMPSPotentialCPP extends the LAMMPS library at the c++ level and subclasses the pele BasePotential c++ class. It is typically much faster than the pure python version. Requires LAMMPS at build and run time.
…ork)

Brings in the pele-python history since the two repositories diverged in
2019 (7da72ba), including farrelljd's Python 3 / NumPy / SciPy /
SQLAlchemy / NetworkX updates, the PyQt5 port of the GUI and the LAMMPS
interface, with their original commits.

Conflict resolution:
- Build system and source layout: this repository's (top-level meson.build,
  C++ in source/). pele-python's per-directory meson.build files, its move of
  source/ into pele/include and pele/sources, its CI workflow and
  environment.yml are not taken. The LAMMPS sources stay where pele-python put
  them for now.
- GUI (pele/gui, examples/gui): pele-python's PyQt5 port, without its
  meson.build files.
- Everything else: this repository's version where both sides changed the same
  lines, pele-python's changes elsewhere. optim_compatibility.py keeps only the
  engine.execute -> session.execute fix; database.py and README.rst stay as
  they were here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of pele-python took its PyQt5 port of pele/gui wholesale. This
reapplies this fork's own changes to those files as a three-way merge (base:
pele-python c3cfa05c; ours: this fork; theirs: farrelljd's port). Before
merging, the base and his versions were normalized with the tools this fork
applied to these files (pyupgrade --py3-plus, black 22.10 -l 80), so
formatting-only differences do not conflict.

Conflicts, resolved:
- connect_all.py: time.process_time() (this fork; time.clock was removed in
  Python 3.8)
- dlg_params.py: QtWidgets.QMenu and hasattr(..., "items") (his; "iteritems"
  is Python 2)
- graph_viewer.py: iterate graph.degree() directly (his; networkx >= 2
  DegreeView has no .items())
- normalmode_browser.py: formatting only (this fork)
- pymolwidget/pymolwidget.py: this fork's explicit imports, from PyQt5 instead
  of PyQt4

__init__.py and pymol_viewer.py keep this fork's versions. pele/gui/nebdlg.py
stays deleted, as in this fork (unused). savenlowest.py gets his binary-mode
pickle fix, which the merge dropped in a conflicting hunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
farrelljd's port removed the generated pele/gui *_ui.py and resources_rc.py files. Generate them at build time with pyuic5/pyrcc5 (from PyQt5) and install them into the package, behind a new 'gui' feature option (auto: built when the tools are found).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5f42838)
np.random.random_integers(0, 1) was inclusive of 1; its replacement
np.random.randint(0, 1) always returns 0, so every edge got phase 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pele-python keeps its C++ in pele/include and pele/sources; this repository
keeps it in source/. Files moved unchanged: lammps_pele.h becomes
source/pele/lammps_pele.hpp (this repository's header suffix), and the
vendored LAMMPS/nlohmann JSON headers go to source/lammps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapt farrelljd's LAMMPS interface from pele-python to this repository:

- LAMMPSPotential overrides this repository's BasePotential signatures
  (const Array<double>& coordinates, Array<double>& gradient).
- meson.build builds pele.potentials.lammps_pele_cython against the liblammps
  shipped in the lammps Python package, behind a 'lammps' feature option (auto:
  built when lammps and mpi.h are found).
- pele.potentials exports LAMMPSPotential and have_lammps, using the compiled
  version when it is built and the pure Python one otherwise;
  pele.systems exports AtomicClusterLAMMPS.
- Export modifiedfire_cpp from pele.optimize, which AtomicClusterLAMMPS uses.
- The LAMMPS energy tests compare with pele's LJ to 10 decimal places instead
  of exactly; they differed by one ulp after minimization.
- pyproject: a 'lammps' extra; README: how to install it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spraharsh spraharsh mentioned this pull request Sep 28, 2026
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.33333% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pele/potentials/__init__.py 55.55% 4 Missing ⚠️
pele/potentials/lammps_potential_python.py 90.47% 1 Missing and 1 partial ⚠️
pele/systems/__init__.py 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@spraharsh spraharsh closed this Sep 28, 2026
@spraharsh

Copy link
Copy Markdown
Collaborator Author

Closed in favor of a three-way merge

@spraharsh spraharsh reopened this Sep 28, 2026
spraharsh and others added 3 commits September 28, 2026 00:37
- The python jobs pip install lammps[mpi], so the compiled LAMMPS potential is
  built and the LAMMPS tests run instead of being skipped.
- Run the LAMMPS potential tests against the pure Python fallback as well as
  the exported (compiled) class.
- SaveN.load was a classmethod without cls, so it raised TypeError; fix it,
  close the pickle files, and test save/load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spraharsh spraharsh changed the title Merge pele-python (farrelljd's modernisation, PyQt5 GUI, LAMMPS) and fix the GUI Three-way Merge between pele-python's old main branch and the current branch Sep 28, 2026
@spraharsh
spraharsh requested a lite review from Copilot September 28, 2026 06:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical LAMMPS, GUI worker, and example-runner issues remain unresolved.

Review effort: Lite
Findings: 5 High severity

Open (5)
What changed in this PR

This PR merges divergent Pele branches, modernizes the GUI to PyQt5, adds optional LAMMPS support, and updates compatibility fixes and tests.

Changes:

  • Adds compiled and Python LAMMPS potentials and systems.
  • Migrates GUI components and generated forms to PyQt5.
  • Expands regression tests, examples, and CI/build configuration.
File Description
source/​pele/​lammps_pele.hpp Declares the compiled LAMMPS adapter.
source/​lammps/​nlohmann/​json_fwd.hpp Adds JSON forward declarations.
source/​lammps/​json_fwd.h Exposes LAMMPS JSON types.
source/​lammps_pele.cpp Implements LAMMPS evaluation; sorting and MPI correctness issues remain.
README.rst Documents GUI and LAMMPS installation.
pyproject.toml Adds optional dependencies; isolated-build dependency handling needs correction.
pele/​utils/​tests/​test_disconnectivity_graph.py Configures headless plotting tests.
pele/​utils/​optim_compatibility.py Updates SQLAlchemy compatibility.
pele/​thermodynamics/​_utils.py Supports minima-only calculations.
pele/​thermodynamics/​_normalmodes.py Removes debug output.
pele/​systems/​tests/​test_lammps_atomic_cluster.py Tests the LAMMPS cluster system.
pele/​systems/​lammps_atomic_cluster.py Adds LAMMPS-backed atomic clusters.
pele/​systems/​__init__.py Exports optional LAMMPS support.
pele/​storage/​tests/​test_savenlowest.py Tests SaveN persistence.
pele/​storage/​savenlowest.py Fixes binary pickle persistence.
pele/​rates/​tests/​test_linalg.py Tests repeated rate calculations.
pele/​rates/​_rates.py Tracks solver initialization.
pele/​potentials/​xyspin.py Updates deprecated NumPy randomness.
pele/​potentials/​tests/​test_lammps_potential.py Tests LAMMPS potential implementations.
pele/​potentials/​tests/​test_hs_wca_cpp.py Updates Python 3 compatibility.
pele/​potentials/​lammps_potential_python.py Adds the Python fallback; atom sorting can corrupt gradient ordering.
pele/​potentials/​lammps_pele_cython.pyx Adds the compiled Python wrapper.
pele/​potentials/​fortran/​morse.f90 Initializes the Morse cutoff shift.
pele/​potentials/​__init__.py Detects and exports LAMMPS support.
pele/​optimize/​_quench.py Exports modified FIRE.
pele/​optimize/​_modified_fire_cpp.pxd Removes an unused import.
pele/​mindist/​backward_compatibility.py Updates Python 3 iteration syntax.
pele/​landscape/​tests/​test_connect_manager.py Tests connection-pair exhaustion.
pele/​landscape/​connect_manager.py Adds deterministic pair fallback selection.
pele/​gui/​ui/​ui_takestep_explorer.ui Updates PyQt5 widget metadata.
pele/​gui/​ui/​ui_takestep_explorer.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​ui_normalmode_explorer.ui Updates PyQt5 metadata.
pele/​gui/​ui/​ui_normalmode_explorer.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​ui_neb_explorer.ui Updates resource metadata.
pele/​gui/​ui/​ui_neb_explorer.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​show3d_with_slider_ui.ui Updates PyQt5 widget metadata.
pele/​gui/​ui/​show3d_with_slider_ui.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​rate_gui.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​nebbrowser.ui Updates PyQt5 metadata.
pele/​gui/​ui/​nebbrowser.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​mplwidget.py Migrates Matplotlib Qt integration.
pele/​gui/​ui/​graph_view_ui.ui Updates PyQt5 metadata.
pele/​gui/​ui/​graph_view_ui.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​dgraph_dlg.py Migrates disconnectivity graph dialogs.
pele/​gui/​ui/​dgraph_browser.ui Updates PyQt5 metadata.
pele/​gui/​ui/​dgraph_browser.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​cv_viewer_ui.ui Updates layout and PyQt5 metadata.
pele/​gui/​ui/​cv_viewer_ui.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui/​connect_run_ui.ui Updates PyQt5 widget metadata.
pele/​gui/​ui/​connect_run_ui.py Removes obsolete generated PyQt4 code.
pele/​gui/​ui_params.py Removes obsolete generated PyQt4 code.
pele/​gui/​tests/​test_workers.py Adds worker lifecycle tests.
pele/​gui/​tests/​test_viewers.py Adds viewer regression tests.
pele/​gui/​tests/​test_main.py Adds main-window regression tests.
pele/​gui/​tests/​conftest.py Configures headless Qt tests.
pele/​gui/​takestep_explorer.py Migrates the take-step explorer.
pele/​gui/​show3d.py Migrates the OpenGL viewer.
pele/​gui/​show3d_with_slider.py Improves animation handling.
pele/​gui/​README Updates GUI build instructions.
pele/​gui/​pymolwidget/​pymolwidget.py Migrates the PyMOL widget.
pele/​gui/​normalmode_browser.py Migrates the normal-mode browser.
pele/​gui/​neb_explorer.py Migrates the NEB explorer.
pele/​gui/​MainWindow.ui Updates custom-widget metadata.
pele/​gui/​graph_viewer.py Migrates graph viewing APIs.
pele/​gui/​double_ended_connect_runner.py Improves worker lifecycle handling.
pele/​gui/​dlg_params.py Migrates parameter dialogs.
pele/​gui/​connect_run_dlg.py Migrates connection-run dialogs.
pele/​gui/​connect_explorer_ui.ui Updates PyQt5 metadata.
pele/​gui/​connect_explorer_ui.py Removes obsolete generated PyQt4 code.
pele/​gui/​connect_explorer_dlg.py Migrates the connection explorer.
pele/​gui/​connect_all.py Improves connection lifecycle handling.
pele/​gui/​bhrunner.py Improves basin-hopping worker handling.
pele/​gui/​_rate_gui.py Adds rate validation and cancellation.
pele/​gui/​_list_views.py Updates Qt models and selection handling.
pele/​gui/​_cv_viewer.py Adds viewer worker handling; result-queue liveness logic can drop successful results.
pele/​angleaxis/​rigidbody.py Escapes LaTeX backslashes.
pele/​angleaxis/​aatopology.py Updates legacy Python syntax.
meson.options Adds GUI and LAMMPS build options.
meson.build Builds LAMMPS support and generated GUI forms.
examples/​new_potential/​fortran_potential/​mypotential.py Fixes relative extension imports.
examples/​new_potential/​fortran_iso_c_bindings/​mypotential.pyx Uses integer division for atom counts.
examples/​new_potential/​fortran_iso_c_bindings/​Makefile Updates compiler flags.
examples/​new_potential/​cython_potential/​mypotential.pyx Uses explicit double types.
examples/​new_potential/​cpp_potential/​mypotential.pyx Simplifies the Cython example.
examples/​new_potential/​c_potential/​mypotential.pyx Removes obsolete build documentation.
examples/​gui/​ljsystem.py Migrates the GUI example to PyQt5.
examples/​gui/​lammps_ljsystem.py Adds a LAMMPS GUI example; input path is not script-relative.
examples/​gui/​lammps_ljsystem.in Adds LAMMPS LJ configuration.
examples/​gui/​lammps_bljsystem.py Adds a binary LAMMPS GUI example; input path is not script-relative.
examples/​gui/​lammps_bljsystem.in Adds binary LAMMPS configuration.
examples/​gui/​bljsystem.py Migrates the BLJ example to PyQt5.
examples/​gui/​_blj_dialog.py Regenerates the BLJ dialog.
examples/​_run_all_examples.sh Runs examples; including interactive GUI examples can block or fail headless execution.
.gitignore Updates generated-file handling.
.github/​workflows/​test.yml Installs LAMMPS in CI.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/_run_all_examples.sh Resolved
Comment thread pele/gui/_cv_viewer.py Resolved
Comment thread source/lammps_pele.cpp Resolved
Comment thread source/lammps_pele.cpp Resolved
…xamples

- LAMMPS potentials (compiled and Python) turn off LAMMPS's spatial atom
  sorting, which reordered atoms during run 0 so the returned gradient no
  longer matched the input coordinates, and reject multi-rank MPI runs, where
  each rank holds only its own atoms. Both go through prepare_lammps().
- GetThermodynamicInfoParallelQT.poll: a worker's last result can arrive
  between the empty() check and the liveness check; check the queue again
  before reporting a lost result.
- _run_all_examples.sh no longer runs the interactive GUI examples.
- The LAMMPS GUI examples read their .in file from the script's directory.
- Tests: gradient vs numerical gradient with LAMMPS's default sorting, and the
  worker race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spraharsh
spraharsh merged commit a0bb865 into master Sep 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants