1
$\begingroup$

I want to derive the Hamiltonian of the ion molecule $H_2^+$ by making use of Jordan-Wigner map. Thus, I used qiskit nature. I wrote down the same command given in qiskit nature. The only difference is that I changed the charge number from 0 to 1. Then it generates following error message

  Input In [6] in <cell line: 2>
    second_q_op = es_problem.second_q_ops()
  File /opt/conda/lib/python3.8/site-packages/qiskit_nature/problems/second_quantization/electronic/electronic_structure_problem.py:94 in second_q_ops
    driver_result = self.driver.run()
  File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/electronic_structure_molecule_driver.py:179 in run
    return driver.run()
  File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/pyscfd/pyscfdriver.py:410 in run
    self._build_molecule()
  File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/pyscfd/pyscfdriver.py:460 in _build_molecule
    raise QiskitNatureError("Failed to build the PySCF Molecule object.") from exc
QiskitNatureError: 'Failed to build the PySCF Molecule object.'

Use %tb to get the full traceback."

If you know any method to fix it, please teach me. Thank you for your time.

$\endgroup$

1 Answer 1

2
$\begingroup$

This error is telling you, that the construction of the molecule within PySCF (the classical computing backend used to perform the initial HF calculation) is failing. The reason for this, is that by adding a charge to your system, the multiplicity of your molecule no longer matches the number of electrons.

Long story short, you need to specify the correct multiplicity (spin) of your molecule:

mol = Molecule(
    [("H", [0.0, 0.0, 0.0]), ("H", [0.0, 0.0, 0.735])],
    charge=1,
    multiplicity=2,  # == 2*spin + 1
)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.