ITADN
GQCG/GQCP/Issues

Missing python bindings for SpinResolved1DM_cd

#1089OpenThiboVE 创建于 2025-10-01
bug
T
ThiboVEcommented
**Describe the bug** Unable to request the alpha and beta components of "gqcpy.gqcpy.SpinResolved1DM_cd" through the python bindings **To Reproduce** 1. set up a complex UHF calculation 2. retreive the density matrices from the calculation environment 3. try to obtain either the alpha or beta component of that density matrix **Expected behavior** `Simple1DM` and `BasisTransformable` APIs should be exposed to the py_SpinResolved1DMComponent_cd class **Screenshots and logs** <img width="1060" height="488" alt="Image" src="https://github.com/user-attachments/assets/ca984bb3-4799-4203-94c9-d22c98d93e13" /> **Operating system** - OS: Windows - Version 11 **Additional context** I propose changing the 'SpinResolved1DMComponent_bindings.cpp' file to the following: ```C #include "DensityMatrix/SpinResolved1DMComponent.hpp" #include "Utilities/complex.hpp" #include "gqcpy/include/interfaces.hpp" #include <pybind11/pybind11.h> namespace gqcpy { // Provide some shortcuts for frequent namespaces. namespace py = pybind11; using namespace GQCP; /** * Register `SpinResolved1DMComponent_d` and `SpinResolved1DMComponent_cd` to the gqcpy module and expose a part of their C++ interface to Python. * * @param module The Pybind11 module in which `SpinResolved1DMComponent_d` and `SpinResolved1DMComponent_cd` should be registered. */ void bindSpinResolved1DMComponent(py::module& module) { // Define the Python class for the real `SpinResolved1DMComponent`. py::class_<SpinResolved1DMComponent<double>> py_SpinResolved1DMComponent_d {module, "SpinResolved1DMComponent_d", "One of the spin components of a real `SpinResolved1DM`."}; // Expose the `Simple1DM` API to the Python class; bindSimple1DMInterface(py_SpinResolved1DMComponent_d); // Expose the `BasisTransformable` API to the Python class. bindBasisTransformableInterface(py_SpinResolved1DMComponent_d); // Define the Python class for the complex `SpinResolved1DMComponent`. py::class_<SpinResolved1DMComponent<complex>> py_SpinResolved1DMComponent_cd {module, "SpinResolved1DMComponent_cd", "One of the spin components of a complex `SpinResolved1DM`."}; // Expose the `Simple1DM` API to the Python class; bindSimple1DMInterface(py_SpinResolved1DMComponent_cd); // Expose the `BasisTransformable` API to the Python class. bindBasisTransformableInterface(py_SpinResolved1DMComponent_cd); } } // namespace gqcpy ```
0 条评论