Ive been trying to solve this issue but this line is causing me trouble
from qiskit.chemistry.core import Hamiltonian, TransformationType
I know that i have to use qiskit nature instead of qiskit chemistry but i dont know to what i have to migrade to for "Hamiltonian" and "TransformationType".
import numpy as np
from qiskit import QuantumCircuit, Aer
from qiskit.aqua import aqua_globals, QuantumInstance
from qiskit.aqua.algorithms import VQE
from qiskit.aqua.components.optimizers import SLSQP
from qiskit.circuit.library import TwoLocal
from qiskit.chemistry.drivers import PySCFDriver
from qiskit.chemistry.core import Hamiltonian, TransformationType
# Set the number of qubits and optimization parameters
n_qubits = 4
depth = 3
# Set up the molecule and driver
molecule = 'H .0 .0 -{0}; H .0 .0 {0}'
distance = 0.74
driver = PySCFDriver(atom=molecule.format(distance/2),
unit=TransformationType.ANGSTROM, charge=0, spin=0, basis='sto3g')
qmolecule = driver.run()
hamiltonian = qmolecule.get_molecular_hamiltonian()
# Define the ansatz circuit
ansatz = TwoLocal(n_qubits, ['ry', 'rz'], 'cz', reps=depth)
# Define the optimizer
optimizer = SLSQP(maxiter=1000)
# Define the VQE algorithm
vqe = VQE(ansatz, optimizer)
# Run the VQE algorithm
result = vqe.compute_minimum_eigenvalue(hamiltonian)
# Print the energy of the ground state
print('Ground state energy: ', result.eigenvalue.real)