diff --git a/qiskit_addon_dice_solver/dice_solver.py b/qiskit_addon_dice_solver/dice_solver.py index 1f3cd1e..95510a6 100644 --- a/qiskit_addon_dice_solver/dice_solver.py +++ b/qiskit_addon_dice_solver/dice_solver.py @@ -174,6 +174,7 @@ def solve_fermion( hcore: np.ndarray, eri: np.ndarray, *, + open_shell: bool = False, mpirun_options: Sequence[str] | str | None = None, temp_dir: str | Path | None = None, clean_temp_dir: bool = True, @@ -199,11 +200,6 @@ def solve_fermion( For more information on the ``mpirun`` command line options, refer to the `man page `_. - .. note:: - - Only closed-shell systems are supported. The particle number for both - spin-up and spin-down determinants is expected to be equal. - .. note:: Determinants are interpreted by the ``Dice`` command line application as 5-byte unsigned integers; therefore, only systems @@ -218,6 +214,10 @@ def solve_fermion( is the number of qubits. hcore: Core Hamiltonian matrix representing single-electron integrals eri: Electronic repulsion integrals representing two-electron integrals + open_shell: A flag specifying whether configurations from the left and right + halves of the bitstrings should be kept separate. If ``False``, CI strings + from the left and right halves of the bitstrings are combined into a single + set of unique configurations and used for both the alpha and beta subspaces. mpirun_options: Options controlling the CPU resource allocation for the ``Dice`` command line application. These command-line options will be passed directly to the ``mpirun`` command line application during invocation of ``Dice``. These may be formatted as a ``Sequence`` of strings or a single string. If a ``Sequence``, @@ -236,7 +236,7 @@ def solve_fermion( - Approximate ground state from SCI - Average orbital occupancy """ - ci_strs = bitstring_matrix_to_ci_strs(bitstring_matrix) + ci_strs = bitstring_matrix_to_ci_strs(bitstring_matrix, open_shell=open_shell) num_up = format(ci_strs[0][0], "b").count("1") num_dn = format(ci_strs[1][0], "b").count("1") e_dice, sci_state, avg_occupancies = solve_hci( diff --git a/releasenotes/notes/open-shell-7ce25a8ae730f144.yaml b/releasenotes/notes/open-shell-7ce25a8ae730f144.yaml new file mode 100644 index 0000000..0d88b8e --- /dev/null +++ b/releasenotes/notes/open-shell-7ce25a8ae730f144.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Open shell systems are now supported in :func:`qiskit_addon_dice_solver.solve_fermion` by setting the ``open_shell`` keyword argument to ``True``. If set to ``True``, the left and right halves of the input bitstrings may contain different hamming weights.