Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 16, 2024
2 parents 7ffeaf3 + 6cb8957 commit f3831d0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
2 changes: 1 addition & 1 deletion demonstrations/tutorial_eqnn_force_field.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"dateOfPublication": "2024-03-12T00:00:00+00:00",
"dateOfLastModification": "2024-08-30T00:00:00+00:00",
"dateOfLastModification": "2024-09-16T00:00:00+00:00",
"categories": [
"Quantum Machine Learning",
"Quantum Chemistry"
Expand Down
8 changes: 6 additions & 2 deletions demonstrations/tutorial_eqnn_force_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ def vqlm(data, params):

# Initial encoding
for i in range(num_qubits):
equivariant_encoding(alphas[i, 0], jnp.asarray(data)[i % active_atoms, ...], wires=[i])
equivariant_encoding(
alphas[i, 0], jnp.asarray(data, dtype=complex)[i % active_atoms, ...], wires=[i]
)

# Reuploading model
for d in range(D):
Expand All @@ -339,7 +341,9 @@ def vqlm(data, params):
# Encoding
for i in range(num_qubits):
equivariant_encoding(
alphas[i, d + 1], jnp.asarray(data)[i % active_atoms, ...], wires=[i]
alphas[i, d + 1],
jnp.asarray(data, dtype=complex)[i % active_atoms, ...],
wires=[i],
)

return qml.expval(Observable)
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_vqe_vqd.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"dateOfPublication": "2024-08-26T00:00:00+00:00",
"dateOfLastModification": "2024-08-28T00:00:00+00:00",
"dateOfLastModification": "2024-09-16T00:00:00+00:00",
"categories": [
"Quantum Chemistry",
"How-to"
Expand Down
12 changes: 10 additions & 2 deletions demonstrations/tutorial_vqe_vqd.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@
# To implement the VQD algorithm, we first need to know the ground state of our system, and it is a breeze to use the data from `PennyLane Datasets <https://pennylane.ai/datasets/>`__ to obtain the Hamiltonian and the ground state
# of the hydrogen molecule:
#
# .. note::
#
# To improve viewability of this tutorial, we will suppress any ``ComplexWarning``'s which may be raised during optimization.
# The warnings do not impact the correctness of the results, but make it harder to view outputs.
#

import pennylane as qml
from pennylane import numpy as np
import numpy as np

import warnings
warnings.filterwarnings(action="ignore", category=np.ComplexWarning)

# Load the dataset
h2 = qml.data.load("qchem", molname="H2", bondlength=0.742, basis="STO-3G")[0]
Expand All @@ -58,7 +66,7 @@

# Obtain the ground state from the operations given by the dataset
def generate_ground_state(wires):
qml.BasisState(h2.hf_state, wires=wires)
qml.BasisState(np.array(h2.hf_state), wires=wires)

for op in h2.vqe_gates: # use the gates data from the dataset
op = qml.map_wires(op, {op.wires[i]: wires[i] for i in range(len(wires))})
Expand Down
36 changes: 18 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pennylane = "0.38.0"
pennylane-cirq = "0.36.0"
pennylane-qiskit = "0.38.0"
pennylane-qulacs = "0.36.0"
pennylane-catalyst = "0.8.0"
pennylane-catalyst = "0.8.1"
##########################################################


Expand Down

0 comments on commit f3831d0

Please sign in to comment.