Skip to content

Unify PySCF and GPU4PySCF nuclear-gradient computation - #131

Merged
Jens (JensWehner) merged 6 commits into
mainfrom
refactor/unify-gradient-core
Sep 4, 2026
Merged

Jens (JensWehner) merged 6 commits into
mainfrom
refactor/unify-gradient-core

Conversation

@JensWehner

@JensWehner Jens (JensWehner) commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
  • Add a shared feature_derivatives() implementation based on torch.autograd.grad().
  • Add grid_derivative_block() to centralize slicing of grid-resolved derivatives.
    • Handles point-first layouts for grid coordinates and weights.
    • Handles point-last layouts for density, density gradient, and kinetic density.
  • Add contract_veff_block() for the shared AO/XC derivative contractions.
    • Documents PySCF’s packed AO derivative layout.
    • Shares density, gradient, and kinetic-energy contractions between CPU and GPU paths.
  • Add focused tests for feature differentiation, grid-block slicing, and effective-potential contraction against hardcoded reference values.
  • Update the supported Pixi version from 0.75 to 0.78 and refresh the lockfile.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Unifies CPU and GPU nuclear-gradient calculations through shared PyTorch utilities and updates Pixi tooling.

Changes:

  • Adds shared feature differentiation, grid slicing, and AO/XC contraction helpers.
  • Refactors PySCF and GPU4PySCF gradient adapters to use shared logic.
  • Adds focused tests and upgrades Pixi to 0.78.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
skala/src/skala/pyscf/gradient_core.py Adds shared gradient operations.
skala/src/skala/pyscf/gradients.py Adopts shared CPU gradient logic.
skala/src/skala/gpu4pyscf/gradients.py Adopts shared GPU gradient logic.
skala/tests/test_gradient_core.py Tests shared gradient operations.
pixi.toml Requires Pixi 0.78.
pixi.lock Refreshes platform identifiers.
.github/workflows/skala-test.yml Updates Pixi in runtime CI.
.github/workflows/pypi.yml Updates Pixi in release CI.
.github/workflows/model-test.yml Updates Pixi in model tests.
.github/workflows/model-examples.yml Updates Pixi in model examples.
.github/workflows/model-benchmark.yml Updates Pixi in benchmarks.
.github/workflows/lint.yml Updates Pixi in lint CI.
.github/workflows/gauxc-test.yml Updates Pixi in GauXC tests.
.github/workflows/examples.yml Updates Pixi in example CI.
.github/workflows/docs.yml Updates Pixi in documentation CI.
.github/workflows/benchmark-test.yml Updates Pixi in benchmark tests.

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

Comment thread .github/workflows/skala-test.yml Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread skala/src/skala/pyscf/gradient_core.py Outdated
Comment thread pixi.toml
Co-authored-by: Thijs Vogels <840825+tvogels@users.noreply.github.com>
@JensWehner
Jens (JensWehner) merged commit 5479438 into main Sep 4, 2026
64 of 67 checks passed
@JensWehner
Jens (JensWehner) deleted the refactor/unify-gradient-core branch September 4, 2026 08:37
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