Skip to content

Commit

Permalink
Merge branch 'qrom_demo_2' of https://github.com/PennyLaneAI/qml into…
Browse files Browse the repository at this point in the history
… qrom_demo_2
  • Loading branch information
KetpuntoG committed Jul 4, 2024
2 parents 7f3f093 + 9c0d2fb commit 1875432
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ environment:
if [ '$(UPGRADE_PL)' = 'true' ]; then\
echo "Updating PennyLane and plugins to latest ... ";\
PYTHON_VENV_PATH=`$(POETRY_BIN) env info --path`;\
$$PYTHON_VENV_PATH/bin/python -m pip install --upgrade git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane;\
$$PYTHON_VENV_PATH/bin/python -m pip install --upgrade git+https://github.com/PennyLaneAI/pennylane.git@v0.37.0-rc0#egg=pennylane;\
$$PYTHON_VENV_PATH/bin/python -m pip install --upgrade git+https://github.com/PennyLaneAI/pennylane-cirq.git#egg=pennylane-cirq;\
$$PYTHON_VENV_PATH/bin/python -m pip install --upgrade git+https://github.com/PennyLaneAI/pennylane-qiskit.git#egg=pennylane-qiskit;\
$$PYTHON_VENV_PATH/bin/python -m pip install --upgrade git+https://github.com/PennyLaneAI/pennylane-qulacs.git#egg=pennylane-qulacs;\
$$PYTHON_VENV_PATH/bin/python -m pip install -i https://test.pypi.org/simple/ PennyLane-Lightning --pre --upgrade;\
$$PYTHON_VENV_PATH/bin/python -m pip install -i https://test.pypi.org/simple/ PennyLane-Catalyst==0.7.0.dev0 --upgrade;\
fi;\
fi
Binary file added _static/authors/dan_strano.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions _static/authors/dan_strano.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. bio:: Dan Strano
:photo: ../_static/authors/dan_strano.jpg

Dan Strano is a technical staff member at `Unitary Fund <https://unitary.fund>`__. Additionally, he has been the lead author of the Qrack simulator framework since 2017.
2 changes: 1 addition & 1 deletion demonstrations/tutorial_qchem_external.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"dateOfPublication": "2023-01-03T00:00:00+00:00",
"dateOfLastModification": "2024-01-01T00:00:00+00:00",
"dateOfLastModification": "2024-06-20T00:00:00+00:00",
"categories": [
"Quantum Chemistry", "Devices and Performance"
],
Expand Down
29 changes: 27 additions & 2 deletions demonstrations/tutorial_qchem_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,31 @@
##############################################################################
# You can verify that this state is a superposition of the Hartree-Fock state and a doubly-excited
# state.
#
# Converting fermionic operators
# ------------------------------
# Fermionic operators are commonly used to construct observables for molecules and spin systems.
# You can easily convert between fermionic operators created with PennyLane and OpenFermion by using
# the :func:`~.pennylane.from_openfermion` and :func:`~.pennylane.to_openfermion` functions. Let's
# look at some examples. First, we create a fermionic operator with OpenFermion and convert it to a
# PennyLane fermionic operator.

from openfermion import FermionOperator
openfermion_op = 0.5 * FermionOperator('0^ 2') + FermionOperator('0 2^')
pennylane_op = qml.from_openfermion(openfermion_op)
print(pennylane_op)

##############################################################################
# The resulting operator can be used in PennyLane like any other fermionic object. We now take this
# PennyLane fermionic operator and convert it back to an OpenFermion operator.

openfermion_op = qml.to_openfermion(pennylane_op)
print(openfermion_op)

##############################################################################
# The :func:`~.pennylane.from_openfermion` and :func:`~.pennylane.to_openfermion` functions support
# converting several operator types. You can look at the function documentations for more details
# and examples.

##############################################################################
# Conclusions
Expand All @@ -195,8 +220,8 @@
# function.
# 2. We can directly use one- and two-electron integrals from PySCF, but we need to convert the
# tensor containing the two-electron integrals from chemists' notation to physicists' notation.
# 3. We can easily convert OpenFermion operators to PennyLane operators using the
# :func:`~.pennylane.import_operator` function.
# 3. We can easily convert between OpenFermion operators and PennyLane operators using the
# :func:`~.pennylane.from_openfermion` and :func:`~.pennylane.to_openfermion` functions.
# 4. Finally, we can convert PySCF wave functions to PennyLane state vectors using the
# :func:`~.pennylane.qchem.import_state` function.
#
Expand Down

0 comments on commit 1875432

Please sign in to comment.