Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support open shell systems in solve_fermion #45

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions qiskit_addon_dice_solver/dice_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -199,11 +200,6 @@ def solve_fermion(

For more information on the ``mpirun`` command line options, refer to the `man page <https://www.open-mpi.org/doc/current/man1/mpirun.1.php>`_.

.. 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
Expand All @@ -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``,
Expand All @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/open-shell-7ce25a8ae730f144.yaml
Original file line number Diff line number Diff line change
@@ -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.
Loading