I was coding along for the Pennylane Variational Quantum Eigensolver Video: https://www.youtube.com/watch?v=qiRtUUZ5s9s
# Put code here
# Importing all required libraries
import pennylane as qml
from pennylane import numpy as np
from pennylane import qchem
print("PennyLane version:", qml.__version__)
print("NumPy version:", np.__version__)
# Define Molecule in an Array
symbols = ["H", "H", "H"]
# Specify the Geometry of the Molecule
coordinates_without_sorting = np.array([[0.0102, 0.0442, 0.0],
[0.9867, 1.6303, 0.0],
[1.8720, -0.0085, 0.0]])
# Sort the coordinates if needed (e.g., sort within each axis separately)
coordinates = np.sort(coordinates_without_sorting, axis=0)
# Find the Hamiltonian and number of qubits
hamiltonian, qubits = qchem.molecular_hamiltonian(symbols, coordinates, charge=1)
# Print the number of qubits required to calculate the Hamiltonian
print(qubits)
# Use Hartree-Fock approximation
hf = qchem.hf_state(electrons=2, orbitals=6)
# Print the Hartree-Fock state
print(hf)
If you want help with diagnosing an error, please put the full error message below:
# Put full error message here
Message=module 'numpy' has no attribute 'msort'
Source=C:\Users\ghosh\source\repos\Variational Quantum Eigensolver using PennyLane - QML\Variational_Quantum_Eigensolver_using_PennyLane___QML.py
StackTrace:
File "C:\Users\ghosh\source\repos\Variational Quantum Eigensolver using PennyLane - QML\Variational_Quantum_Eigensolver_using_PennyLane___QML.py", line 3, in <module> (Current frame)
import pennylane as qml
AttributeError: module 'numpy' has no attribute 'msort'