Skip to content

Optimization - #1

Open
Ajax23 wants to merge 19 commits into
mainfrom
optimization
Open

Optimization#1
Ajax23 wants to merge 19 commits into
mainfrom
optimization

Conversation

@Ajax23

@Ajax23 Ajax23 commented Jul 4, 2026

Copy link
Copy Markdown

v1.0.0

Code quality

  • construct.py — extracted _write_positions(path, positions) helper: writes an (N, 3) NumPy position array to a GROMACS position file, replacing repeated inline loops; used for all molecule-insertion position files
  • construct.py — extracted _gmx_insert_cmd(folder_gro, file_box, mol, nmol, dr, pos_file) helper: centralises GROMACS insert-molecules command construction with optional -dr and -ip flags, eliminating duplicated string-building across pore/box/slit code paths
  • actuate.py — shared folder/file path constants (_gro/, _top/, _mdp/, box.gro, topol.top, index.ndx) extracted from local variables in each method to instance attributes on Actuate.__init__; both _equilibration and _simulation methods now reference self._folder_* / self._file_*
  • actuate.py — removed unused from re import A import
  • simulate.py — Jinja2 template rendering for analysis scripts (auto_dens.py / auto_dens_box.py) refactored: molecule metadata collected into a single jinja2_dict loop; has_fill flag derived once instead of re-evaluated; template selection unified in a single branch
  • Template scripts auto_dens.py and auto_dens_box.py trimmed; sort.py template removed (dead code)
  • tests/data/forhlr.sh — GROMACS module updated from 2016.5 to 2024.3; #SBATCH --gres line added for GPU node support

Tests

  • Converted tests/test_simple.py from unittest to pytest
  • Split into test_unit.py (fast, no file I/O) and test_integration.py (full output generation)
  • test_unit.py — new unit tests: Box getter/setter round-trips, add_mol validation, add_topol all types, Construct._write_positions byte-level output, Construct._gmx_insert_cmd all flag combinations

Documentation

  • RST source files migrated to MyST Markdown; Sphinx theme updated to furo; API docs via sphinx-autoapi
  • Docs source moved from docsrc/ to docs/; previous built HTML preserved at docs/v_old/
  • Copyright year updated to 2026; DESIGN.md added documenting the yellow/amber color palette

CI / tooling

  • GitHub Actions: added ruff linting workflow (lint.yml)
  • GitHub Actions: added pip-audit security scan workflow (security.yml)
  • CI matrix updated: Python 3.12–3.13; python_requires bumped to >=3.12
  • Migrated from setup.py + MANIFEST.in to a single pyproject.toml (PEP 517/621); [tool.ruff] config added
  • CI migrated from pip to uv (astral-sh/setup-uv@v5); requirements.txt removed (deps resolved via pyproject.toml)

Administrative

  • pyproject.toml: version 1.0.0, requires-python = ">=3.12", author email updated, jinja2 unpinned; [project.optional-dependencies] dev group added (pytest, pytest-cov)
  • README: updated image paths, Python version, PyPI badge, testing and installation instructions

Ajax23 added 13 commits June 29, 2026 16:47
Code quality:
- construct.py: extracted _write_positions helper (NumPy array → GROMACS position
  file) and _gmx_insert_cmd helper (centralises insert-molecules command building
  with optional -dr/-ip flags), replacing duplicated inline logic
- actuate.py: shared folder/file path constants extracted from method-local
  variables to Actuate instance attributes; removes unused 're.A' import
- simulate.py: Jinja2 analysis-script rendering refactored — single mol-metadata
  loop, has_fill derived once, template selection unified
- Template scripts trimmed; dead sort.py template removed
- tests/data/forhlr.sh: GROMACS module updated to 2024.3; GPU gres line added

Tests:
- Migrated test_simple.py (unittest) to pytest; split into test_unit.py and
  test_integration.py; new unit tests for Box API, Construct helpers

Documentation:
- docsrc/ RST sources migrated to MyST Markdown under docs/
- Sphinx theme updated to furo; sphinx-autoapi for API docs
- Built HTML preserved under docs/v_old/

CI / tooling:
- Added ruff lint and pip-audit security workflows
- CI matrix extended to Python 3.10–3.13

Administrative:
- setup.py: version 1.0.0, python_requires >=3.10, jinja2 unpinned
Drop Python 3.10 and 3.11 from CI matrix and classifiers; raise
python_requires to >=3.12 in setup.py; update README and changelog.
Replace setup.py and MANIFEST.in with a single pyproject.toml;
package-data absorbed into [tool.setuptools.package-data].
Switch all workflows from pip to uv (astral-sh/setup-uv@v5) for
faster installs; remove requirements.txt (deps now declared solely in
pyproject.toml); add explicit [tool.ruff] config to pyproject.toml.
Declare pytest and pytest-cov under [project.optional-dependencies] dev
so the full test environment is installed with: pip install -e ".[dev]"
CI updated to use the same extras group.
Replace manual venv setup with the dev install step so the README
reflects the current pyproject.toml optional-dependencies setup.
Administrative section now reflects pyproject.toml and the new
[project.optional-dependencies] dev group.
- Replace mutable defaults (area=[], box=[], kwargs_gmx={}) in add_mol
  with None sentinels to prevent cross-call state sharing
- Modernize super(Benchmark, self).__init__() to bare super().__init__()
- Add encoding="utf-8" to all text-mode open() calls in analyze.py and
  construct.py for cross-platform correctness
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@Ajax23
Ajax23 requested a review from marc310896 July 4, 2026 15:00
Ajax23 added 4 commits July 11, 2026 16:22
- Remove tracked docs/v_old/ build snapshot (233 files); users should
  install the matching package version to get old docs
- Remove cp -r v_old post-build hook from docs/Makefile
- Remove v_old copy step from CI workflow
- Enable MyST colon_fence extension so :::directives render correctly
- Add _templates/base.html to default furo theme to light mode
- Add custom style.css with brand colours (#c8860a) and dark-mode image
  fix (white background on transparent plots)
- Wire templates_path, html_css_files, and myst_enable_extensions into conf.py
- Clean up index.md: remove logo figure, remove v_old note, fix
  autoapi/index.html internal link suffix
- Add docs/autoapi/ and docs/generated/ to .gitignore
- Convert docs/pics/pore_il.pdf and 2phase_il.pdf to SVG so images
  render in browsers (PDF is not supported as an <img> src in HTML)
- Update simulation_complex.md and simulation_2ph.md figure directives
  to reference .svg files
- Remove explicit width/height="100%" from logo_text.svg so furo can
  scale it by viewBox aspect ratio without clipping the top
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.

2 participants