I am using the Pennylane notebook on the Xanadu website.
I am having trouble with the read_structure function used to import the molecular structure into the Hamiltonian for VQE. It looks like I have to physically have the .xyz files stored somewhere on my device, but I’m not sure where people go to find such files and I don’t want to download something sketchy from the web.
Where does Xanadu recommend downloading a library of basic molecular xyz files from to use in read_structure?
Here is my code:
import pennylane as qml
import numpy as np
from pennylane import qchem
symbols, coordinates = qchem.read_structure("h2o.xyz")
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
/tmp/ipykernel_51/752628394.py in <cell line: 1>()
----> 1 symbols, coordinates = qchem.read_structure('h2o.xyz')
/opt/conda/envs/pennylane/lib/python3.9/site-packages/pennylane/qchem/structure.py in read_structure(filepath, outpath)
55 file_out = os.path.join(outpath, "structure.xyz")
56
---> 57 copyfile(file_in, file_out)
58
59 symbols = []
/opt/conda/envs/pennylane/lib/python3.9/shutil.py in copyfile(src, dst, follow_symlinks)
262 os.symlink(os.readlink(src), dst)
263 else:
--> 264 with open(src, 'rb') as fsrc:
265 try:
266 with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'h2o.xyz'
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about()
.
qml.about()
Name: PennyLane
Version: 0.28.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.
Author:
Author-email:
License: Apache License 2.0
Location: /opt/conda/envs/pennylane/lib/python3.9/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, retworkx, scipy, semantic-version, toml
Required-by: PennyLane-Cirq, PennyLane-Lightning, PennyLane-qiskit, pennylane-qulacs, PennyLane-SF
Platform info: Linux-5.4.209-116.367.amzn2.x86_64-x86_64-with-glibc2.31
Python version: 3.9.15
Numpy version: 1.23.5
Scipy version: 1.10.0
Installed devices:
- default.gaussian (PennyLane-0.28.0)
- default.mixed (PennyLane-0.28.0)
- default.qubit (PennyLane-0.28.0)
- default.qubit.autograd (PennyLane-0.28.0)
- default.qubit.jax (PennyLane-0.28.0)
- default.qubit.tf (PennyLane-0.28.0)
- default.qubit.torch (PennyLane-0.28.0)
- default.qutrit (PennyLane-0.28.0)
- null.qubit (PennyLane-0.28.0)
- cirq.mixedsimulator (PennyLane-Cirq-0.28.0)
- cirq.pasqal (PennyLane-Cirq-0.28.0)
- cirq.qsim (PennyLane-Cirq-0.28.0)
- cirq.qsimh (PennyLane-Cirq-0.28.0)
- cirq.simulator (PennyLane-Cirq-0.28.0)
- lightning.qubit (PennyLane-Lightning-0.28.2)
- strawberryfields.fock (PennyLane-SF-0.20.1)
- strawberryfields.gaussian (PennyLane-SF-0.20.1)
- strawberryfields.gbs (PennyLane-SF-0.20.1)
- strawberryfields.remote (PennyLane-SF-0.20.1)
- strawberryfields.tf (PennyLane-SF-0.20.1)
- qiskit.aer (PennyLane-qiskit-0.28.0)
- qiskit.basicaer (PennyLane-qiskit-0.28.0)
- qiskit.ibmq (PennyLane-qiskit-0.28.0)
- qiskit.ibmq.circuit_runner (PennyLane-qiskit-0.28.0)
- qiskit.ibmq.sampler (PennyLane-qiskit-0.28.0)
- qulacs.simulator (pennylane-qulacs-0.28.0)