6

I'm a beginner with Qiskit and the Python language at all.

Here is my question: One of the VQE function arguments is qubit operator (qubitOp). I saw some examples where the qubitOp object was produced by some already existing Qiskit module.

For example, in the following fragment:

qubitOp, offset = max_cut.get_max_cut_qubitops(w)

qubitOp is an Ising Hamiltonian produced from the connection weights matrix.

But how can I define the qubitOp entirely by myself, from the very beginning? (My actual goal is to enrich the Ising Hamiltonian with spin's interactions with the external magnetic field). Thanks!

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112

1 Answers1

5

The question refers to the VQE, so let's start with this and Max_Cut; they can be built on the VQE. There used to be a vqe.ipynp but I can't find, look for an example.

The VQE algorithm doesn't need much input. You can fill it with the paulis_dict. This could be a simple Z gate for finding the eigenvalues= -1.

pauli_dict = {
    'paulis': [{"coeff": {"imag": 0.0, "real": 1}, "label": "Z"}]
}

qubitOp = Operator.load_from_dict(pauli_dict)
print(qubitOp)

I will publish my VQE test on github soon. I want to compare Rigetti and IBM VQE.

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112
Bram
  • 645
  • 4
  • 10