fix the interface for pyscf plugin. - #215
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets the PySCF plugin integration by adjusting how the solver extracts energies from QMP checkpoint data and by updating packaging metadata to include PySCF as a dependency.
Changes:
- Pass the constructed
modelinto_extract_energy()and extend_extract_energy()to optionally recompute energies from the saved(configs, psi)pool. - Add
pyscf>=2.12.1to project dependencies and updateuv.lockaccordingly. - Update the lockfile to include additional resolved wheels/metadata.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
qmp/plugins/pyscf.py |
Changes energy extraction behavior for the PySCF-facing solver. |
pyproject.toml |
Adds PySCF as a required dependency (while still keeping an optional extra). |
uv.lock |
Updates lock data to reflect dependency changes (incl. PySCF and new torch wheels). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+503
to
+514
| # Try to compute energy from the pool (configs, psi) if model is available | ||
| pool = haar_data.get("pool") | ||
| if pool is not None and model is not None: | ||
| configs, psi = pool | ||
| if configs is not None and psi is not None: | ||
| # Compute expectation value <psi|H|psi> / <psi|psi> | ||
| h_psi = model.apply_within(configs, psi, configs) | ||
| energy = ((psi.conj() @ h_psi) / (psi.conj() @ psi)).real | ||
| if hasattr(energy, "item"): | ||
| return float(energy.item()) | ||
| return float(energy) | ||
|
|
Comment on lines
+508
to
+510
| # Compute expectation value <psi|H|psi> / <psi|psi> | ||
| h_psi = model.apply_within(configs, psi, configs) | ||
| energy = ((psi.conj() @ h_psi) / (psi.conj() @ psi)).real |
Comment on lines
16
to
20
| "openfermion>=1.7.1", | ||
| "tensorboard>=2.20.0", | ||
| "dacite>=1.9.2", | ||
| "pyscf>=2.12.1", | ||
| ] |
| # results is list[(energy_tensor, configs, psi)]; index 0 is ground state. | ||
| energy_val = results[0][0] | ||
| if hasattr(energy_val, "item"): | ||
| return float(energy_val.item()) |
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.
No description provided.