Conversation
commit 613c3f2 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Mon Dec 15 09:54:19 2025 +0000 linting commit f27005f Author: Jan Unsleber <18538155+nabbelbabbel@users.noreply.github.com> Date: Mon Dec 15 10:47:53 2025 +0100 Update cpp/src/qdk/chemistry/data/wavefunction_containers/mp2.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> commit 8670453 Merge: 42cbe5c ed3dba3 Author: Jan Unsleber <18538155+nabbelbabbel@users.noreply.github.com> Date: Mon Dec 15 10:42:57 2025 +0100 Merge branch 'main' into jpu/ci-coeffs-from-amplitudes commit 42cbe5c Author: Jan Unsleber <janunsleber@microsoft.com> Date: Thu Dec 11 01:53:08 2025 +0000 docs commit 5f9d3c3 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Wed Dec 10 18:39:48 2025 +0000 fix tests commit 5606c62 Merge: 6f0112a ceb8ee9 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Wed Dec 10 11:35:13 2025 +0000 Merge remote-tracking branch 'origin/main' into jpu/ci-coeffs-from-amplitudes commit 6f0112a Author: Jan Unsleber <janunsleber@microsoft.com> Date: Tue Dec 9 17:02:48 2025 +0000 remove bindings of removed ctor commit c04c2d5 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Tue Dec 9 12:52:27 2025 +0000 add bra to dyn correl algorithm commit be995e1 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Tue Dec 9 10:00:38 2025 +0000 save commit dfa2c23 Author: Jan Unsleber <18538155+nabbelbabbel@users.noreply.github.com> Date: Mon Dec 8 15:11:19 2025 +0100 Update cpp/tests/test_mp2.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> commit bdb54af Author: Jan Unsleber <18538155+nabbelbabbel@users.noreply.github.com> Date: Mon Dec 8 15:11:03 2025 +0100 Update cpp/include/qdk/chemistry/data/wavefunction_containers/cc.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> commit ae086c3 Author: Jan Unsleber <janunsleber@microsoft.com> Date: Fri Dec 5 15:48:08 2025 +0000 cleaning commit 3c6416d Author: Jan Unsleber <janunsleber@microsoft.com> Date: Fri Dec 5 14:23:26 2025 +0000 add rdm computation commit 0aa60bd Author: Jan Unsleber <janunsleber@microsoft.com> Date: Thu Dec 4 21:56:37 2025 +0000 add ci coeffs from aplitudes
There was a problem hiding this comment.
Pull request overview
This PR adds CI (Configuration Interaction) coefficient generation functionality for Coupled Cluster (CC) and MP2 methods, enabling these wavefunction containers to provide determinant expansions and coefficients on demand through lazy evaluation.
Key changes:
- Modified dynamical correlation calculators to return a 3-tuple (energy, ket_wavefunction, optional_bra_wavefunction) instead of a 2-tuple
- Implemented CI expansion generation from CC/MP2 amplitudes by truncating the exponential ansatz at 4th order
- Added lazy RDM computation for MP2 from CI coefficients using MACIS utilities
- Added support for computing bra (lambda) wavefunctions in PySCF CC calculator
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tests/test_pyscf_plugin.py | Updated test calls to handle new 3-tuple return signature |
| python/tests/test_mp2.py | Updated test calls to handle new 3-tuple return signature |
| python/tests/test_algorithms.py | Updated mock calculator and tests for new 3-tuple return signature |
| python/src/qdk_chemistry/plugins/pyscf/coupled_cluster.py | Added compute_bra setting and lambda amplitude computation support |
| python/src/pybind11/data/wavefunction.cpp | Removed deprecated CC container constructors with RDM parameters |
| python/src/pybind11/algorithms/dynamical_correlation_calculator.cpp | Updated return type to 3-tuple with optional bra wavefunction |
| docs/source/_static/examples/python/dynamical_correlation.py | Updated example to use new 3-tuple return signature |
| cpp/tests/test_wfn_cc.cpp | Added comprehensive tests for CI coefficient generation and RDM requirements |
| cpp/tests/test_mp2.cpp | Added tests for CI expansion, lazy RDM computation, and consistency checks |
| cpp/tests/test_hamiltonian.cpp | Updated test calls to handle new 3-tuple return signature |
| cpp/tests/test_coupled_cluster_calculator.cpp | Updated mock and tests for new return type |
| cpp/src/qdk/chemistry/data/wavefunction_containers/mp2.cpp | Implemented CI expansion and lazy RDM computation from amplitudes |
| cpp/src/qdk/chemistry/data/wavefunction_containers/cc.cpp | Implemented CI expansion up to 4th order; RDMs now require lambda amplitudes |
| cpp/src/qdk/chemistry/data/wavefunction.cpp | Added consolidate_determinants utility to merge duplicate determinants |
| cpp/src/qdk/chemistry/algorithms/microsoft/mp2.hpp | Updated return type signature |
| cpp/src/qdk/chemistry/algorithms/microsoft/mp2.cpp | Changed to return DynamicalCorrelationResult tuple |
| cpp/include/qdk/chemistry/data/wavefunction_containers/mp2.hpp | Added methods for CI expansion and lazy RDM computation |
| cpp/include/qdk/chemistry/data/wavefunction_containers/cc.hpp | Added CI expansion methods; removed RDM-accepting constructors |
| cpp/include/qdk/chemistry/data/wavefunction.hpp | Added consolidate_determinants template function declaration |
| cpp/include/qdk/chemistry/algorithms/dynamical_correlation_calculator.hpp | Defined DynamicalCorrelationResult type alias for 3-tuple return |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Coverage Summary
Detailed Coverage ReportsC++ Coverage DetailsPython Coverage DetailsPybind11 Coverage Details |
Co-authored-by: David Williams-Young <davidwillia@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
python/src/pybind11/data/wavefunction.cpp:1077
- The removed Python binding constructor appears to accept RDMs as optional parameters. However, based on the changes to the C++ code, RDMs are no longer stored in CoupledClusterContainer constructors - they should be computed lazily or require the adjoint wavefunction. This removal is correct given the new architecture, but verify that no existing code depends on this constructor signature.
.def("get_wavefunction", &CoupledClusterContainer::get_wavefunction,
R"(
Get reference to Wavefunction.
Returns:
Wavefunction: Shared pointer to Wavefunction
Examples:
>>> wfn = cc_container.get_wavefunction()
)",
py::return_value_policy::reference_internal)
.def(
"get_t1_amplitudes",
[](const CoupledClusterContainer& self) {
const auto& [t1_aa, t1_bb] = self.get_t1_amplitudes();
return py::make_tuple(variant_to_python(t1_aa),
variant_to_python(t1_bb));
},
R"(
Get T1 amplitudes. In restricted CC, both T1 amplitudes will be identical.
Returns:
tuple: Pair of (alpha, beta) T1 amplitudes
Examples:
>>> t1_aa, t1_bb = cc_container.get_t1_amplitudes()
)")
.def(
"get_t2_amplitudes",
[](const CoupledClusterContainer& self) {
const auto& [t2_abab, t2_aaaa, t2_bbbb] = self.get_t2_amplitudes();
return py::make_tuple(variant_to_python(t2_abab),
variant_to_python(t2_aaaa),
variant_to_python(t2_bbbb));
},
R"(
Get T2 amplitudes. In restricted CC, only the alpha-beta T2 amplitudes will be used.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.