diff --git a/tangelo/toolboxes/ansatz_generator/hea.py b/tangelo/toolboxes/ansatz_generator/hea.py index f203369b9..83f94dbe6 100644 --- a/tangelo/toolboxes/ansatz_generator/hea.py +++ b/tangelo/toolboxes/ansatz_generator/hea.py @@ -52,8 +52,10 @@ def __init__(self, molecule=None, mapping="jw", up_then_down=False, n_layers=2, rot_type="euler", n_qubits=None, n_electrons=None, reference_state="HF"): - if not (bool(molecule) ^ (bool(n_qubits) and (bool(n_electrons) | reference_state == "zero"))): - raise ValueError(f"A molecule OR qubit + electrons number must be provided when instantiating the HEA.") + if not (bool(molecule) ^ (bool(n_qubits) and (bool(n_electrons) | (reference_state == "zero")))): + raise ValueError(f"A molecule OR qubit + electrons number must be " + "provided when instantiating the HEA with the HF reference state. " + "For reference_state='zero', only the number of qubits is needed.") if n_qubits: self.n_qubits = n_qubits