Support negative spin projections in make_hartree_fock_occupation

Open Beginner friendly
#77 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 8 days

@Schrodingerscat07 is already working on this.

Since Nov 14, 2026.

  • #106 by @Schrodingerscat07 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start at stateprep.make_hartree_fock_occupation, the function named in the example, and inspect its input validation and occupation convention. Reproduce the call with spin=-1; done means it returns [1] for this input while preserving the stated interleaved alpha/beta convention.

Written by the indexing model from the issue text.

Description

Versions: cudaq-algorithms==0.1.0, cudaq==0.16.0

from cudaq_algorithms import stateprep

stateprep.make_hartree_fock_occupation(2, 1, spin=-1)

Actual error:

ValueError: spin must be a non-negative integer

Requested behavior: support signed spin = N_alpha - N_beta, consistent with PySCF. This input represents one beta electron and should return [1] under the interleaved alpha/beta convention.

Dominant language
Python
Stars
19
Forks
18
Avg merge
5d 18h
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/cudaq-algorithms

All issues in NVIDIA/cudaq-algorithms

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.