From 13ab25d1ab4e995b4f97b2eb5f6955a0337a6c24 Mon Sep 17 00:00:00 2001 From: soranjh Date: Fri, 6 Jun 2025 16:59:15 -0400 Subject: [PATCH 1/8] add intro --- ...how_to_build_vibrational_hamiltonians.json | 71 +++++++++++++++++++ ...l_how_to_build_vibrational_hamiltonians.py | 60 ++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json create mode 100644 demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json new file mode 100644 index 0000000000..79292d0d01 --- /dev/null +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json @@ -0,0 +1,71 @@ +{ + "title": "How to build spin Hamiltonians", + "authors": [ + { + "username": "ddhawan" + }, + { + "username": "soran" + } + ], + "dateOfPublication": "2024-12-05T00:00:00+00:00", + "dateOfLastModification": "2024-12-06T00:00:00+00:00", + "categories": [ + "Getting Started", + "How-to" + ], + "tags": [], + "previewImages": [ + { + "type": "thumbnail", + "uri": "/_static/demo_thumbnails/regular_demo_thumbnails/thumbnail_how_to_build_spin_hamiltonians.png" + }, + { + "type": "large_thumbnail", + "uri": "/_static/demo_thumbnails/large_demo_thumbnails/thumbnail_large_how_to_build_spin_hamiltonians.png" + } + ], + "seoDescription": "Learn how to build spin Hamiltonians with PennyLane.", + "doi": "", + "references": [ + { + "id": "ashcroft", + "type": "book", + "title": "Solid State Physics", + "authors": "N. W. Ashcroft, D. N. Mermin", + "year": "1976", + "publisher": "New York: Saunders College Publishing", + "url": "https://en.wikipedia.org/wiki/Ashcroft_and_Mermin" + }, + { + "id": "jovanovic", + "type": "article", + "title": "Refraction and band isotropy in 2D square-like Archimedean photonic crystal lattices", + "authors": "D. Jovanovic, R. Gajic, K. Hingerl", + "journal": "Opt. Express", + "volume": "16", + "pages": "4048--4058", + "year": "2008", + "url": "https://opg.optica.org/oe/fulltext.cfm?uri=oe-16-6-4048&id=154856" + } + ], + "basedOnPapers": [], + "referencedByPapers": [], + "relatedContent": [ + { + "type": "demonstration", + "id": "tutorial_quantum_chemistry", + "weight": 1.0 + }, + { + "type": "demonstration", + "id": "tutorial_fermionic_operators", + "weight": 1.0 + }, + { + "type": "demonstration", + "id": "tutorial_isingmodel_PyTorch", + "weight": 1.0 + } + ] +} diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py new file mode 100644 index 0000000000..3c75658e5e --- /dev/null +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -0,0 +1,60 @@ +r"""How to build vibrational Hamiltonians +========================================= +Vibrational motions are crucially important to describe the quantum properties of molecules and +materials. Molecular vibrations can significantly affect the outcome of chemical reactions. There +are also several spectroscopy techniques that rely on the vibrational properties of molecules to +provide valuable insight to understand chemical systems and design new materials. Classical quantum +computations have been routinely implemented to describe vibrational motions of molecules. However, +efficient classical methods typically have fundamental theoretical limitations that prevent their +practical implementation for describing challenging vibrational systems. This makes quantum +algorithms an ideal choice where classical methods are not efficient or accurate. + +Quantum algorithms require a precise description of the system Hamiltonian to compute vibrational +properties. In this demo, we learn how to use PennyLane features to construct and manipulate +different representations of vibrational Hamiltonians. We also briefly discuss the implementation of +the Hamiltonian in an interesting quantum algorithm for computing the vibrational dynamics of a +molecule. + +.. figure:: ../_static/demo_thumbnails/opengraph_demo_thumbnails/OGthumbnail_how_to_build_spin_hamiltonians.png + :align: center + :width: 70% + :target: javascript:void(0) +""" + +###################################################################### +# Vibrational Hamiltonian +# ----------------------- +# A molecular vibrational Hamiltonian can be defined in terms of the kinetic energy operator of the +# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interaction between +# the nuclei as: +# +# .. math:: +# +# H = T + V. +# +# +# Christiansen representation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# The +# +# Conclusion +# ---------- +# The +# +# References +# ---------- +# +# .. [#aaa] +# +# N. W. , +# "". +# +# .. [#bbb] +# +# D. , +# "", +# 2008. +# +# About the authors +# ----------------- +# From 64563596194281744fefb0d52b78daa77307417d Mon Sep 17 00:00:00 2001 From: soranjh Date: Fri, 6 Jun 2025 17:39:42 -0400 Subject: [PATCH 2/8] add christiansen --- ...l_how_to_build_vibrational_hamiltonians.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index 3c75658e5e..83d179a1df 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -32,10 +32,27 @@ # # H = T + V. # +# The kinetic energy operator can be written in terms of position and momentum operations or bosonic +# creation and annihilation operations. The potential energy operator is usually obtained by +# expanding the molecular potential energy surface over vibrational normal coordinates. The choice +# of these operations result in several ways to represent a vibrational Hamiltonian which are +# explained in the following. We also provide PennyLane codes for creating them. # # Christiansen representation # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# The +# The Christiansen representation of the vibrational Hamiltonian is a second-quantization form for +# defining the Hamiltonian in term os bosonic creation :math:`b^{\dagger}` and annihilation +# :math:`b` operations: +# +# .. math:: +# +# H = \sum_{i}^M \sum_{k_i, l_i}^{N_i} C_{k_i, l_i}^{(i)} b_{k_i}^{\dagger} b_{l_i} + +# \sum_{i Date: Mon, 9 Jun 2025 15:22:40 -0400 Subject: [PATCH 3/8] add pes code --- ...l_how_to_build_vibrational_hamiltonians.py | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index 83d179a1df..b893dd65bf 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -34,9 +34,19 @@ # # The kinetic energy operator can be written in terms of position and momentum operations or bosonic # creation and annihilation operations. The potential energy operator is usually obtained by -# expanding the molecular potential energy surface over vibrational normal coordinates. The choice -# of these operations result in several ways to represent a vibrational Hamiltonian which are -# explained in the following. We also provide PennyLane codes for creating them. +# expanding the molecular potential energy surface over vibrational normal coordinates :math:`Q`. +# +# .. math:: +# +# V({Q}) = \sum_i V_1(Q_i) + \sum_{ij} V_2(Q_i,Q_j) + .... +# +# This is typically done by performing single-point energy calculations at small distances along the +# normal mode coordinates. Computing the energies for each mode separately provides the term +# :math:`V_1` while displacing atoms along two different modes simultaneously gives the term +# :math:`V_2` and so on. +# +# There are several ways to represent a vibrational Hamiltonian. Here we explain some of these +# representations and provide PennyLane codes for constructing them. # # Christiansen representation # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,6 +62,23 @@ # # where :math:`M` represents the number of normal modes and :math:`N` is the number of modals. The # coefficients :math:`C` represent the one-mode and two-mode integrals defined here. +# +# PennyLane provides a set of functions to construct the Christiansen Hamiltonian, either directly +# in one step or by building the Hamiltonian from its building blocks step by step. An important +# step in both methods is to construct the potential energy operator which is done based on +# single-point energy calculations along the normal modes of the molecule. The +# :func:`~.pennylane.qchem.vibrational_pes` function in PennyLane provides an convenient way to +# perform the potential energy scan by just providing minimal input. + + +import numpy as np +import pennylane as qml + +symbols = ['H', 'F'] # define atomic symbols +geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) # define atom positions +mol = qml.qchem.Molecule(symbols, geometry) # construct the molecule +pes = qml.qchem.vibrational_pes(mol) + # # # Conclusion From d497621064eae2a2440402f70a5188aa3b72679f Mon Sep 17 00:00:00 2001 From: soranjh Date: Tue, 10 Jun 2025 15:55:34 -0400 Subject: [PATCH 4/8] add hamiltonians --- ...l_how_to_build_vibrational_hamiltonians.py | 136 ++++++++++++++---- 1 file changed, 112 insertions(+), 24 deletions(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index b893dd65bf..3ab643f6b7 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -25,34 +25,32 @@ # Vibrational Hamiltonian # ----------------------- # A molecular vibrational Hamiltonian can be defined in terms of the kinetic energy operator of the -# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interaction between -# the nuclei as: +# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interaction +# between the nuclei as: # # .. math:: # # H = T + V. # -# The kinetic energy operator can be written in terms of position and momentum operations or bosonic -# creation and annihilation operations. The potential energy operator is usually obtained by -# expanding the molecular potential energy surface over vibrational normal coordinates :math:`Q`. +# The kinetic and potential energy operators can be written in terms of momentum and position +# operators, respectively. There are several ways to construct the potential energy operator which +# lead to different representation of the vibrational Hamiltonian. Here we explain some of these +# representations and provide PennyLane codes for constructing them. +# +# Christiansen representation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# The Christiansen representation of the vibrational Hamiltonian relies on the n-mode expansion of +# the potential energy surface :math:`V` over vibrational normal coordinates :math:`Q`. # # .. math:: # # V({Q}) = \sum_i V_1(Q_i) + \sum_{ij} V_2(Q_i,Q_j) + .... # -# This is typically done by performing single-point energy calculations at small distances along the -# normal mode coordinates. Computing the energies for each mode separately provides the term -# :math:`V_1` while displacing atoms along two different modes simultaneously gives the term -# :math:`V_2` and so on. +# This provides a general representation of the potential energy surface where the terms :math:`V_n` +# depend on :math:`n` vibrational mode at most. # -# There are several ways to represent a vibrational Hamiltonian. Here we explain some of these -# representations and provide PennyLane codes for constructing them. -# -# Christiansen representation -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# The Christiansen representation of the vibrational Hamiltonian is a second-quantization form for -# defining the Hamiltonian in term os bosonic creation :math:`b^{\dagger}` and annihilation -# :math:`b` operations: +# The Christiansen Hamiltonian is then constructed in second-quantization based on this potential +# energy surface and bosonic creation :math:`b^{\dagger}` and annihilation :math:`b` operations: # # .. math:: # @@ -61,25 +59,115 @@ # b_{k_i}^{\dagger} b_{k_j}^{\dagger} b_{l_i} b_{l_j}, # # where :math:`M` represents the number of normal modes and :math:`N` is the number of modals. The -# coefficients :math:`C` represent the one-mode and two-mode integrals defined here. +# coefficients :math:`C` represent n-mode integrals which depend on the :math:`n`-mode contribution +# of the potential energy, :math:`V_n`, defined above. # # PennyLane provides a set of functions to construct the Christiansen Hamiltonian, either directly # in one step or by building the Hamiltonian from its building blocks step by step. An important # step in both methods is to construct the potential energy operator which is done based on # single-point energy calculations along the normal modes of the molecule. The -# :func:`~.pennylane.qchem.vibrational_pes` function in PennyLane provides an convenient way to -# perform the potential energy scan by just providing minimal input. - +# :func:`~.pennylane.qchem.vibrational_pes` function in PennyLane provides a convenient way to +# perform the potential energy calculations for a given molecule. The calculations are typically +# done by performing single-point energy calculations at small distances along the +# normal mode coordinates. Computing the energies for each mode separately provides the term +# :math:`V_1` while displacing atoms along two different modes simultaneously gives the term +# :math:`V_2` and so on. +# +# Let's look at an example for the HF molecule. import numpy as np import pennylane as qml -symbols = ['H', 'F'] # define atomic symbols -geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) # define atom positions -mol = qml.qchem.Molecule(symbols, geometry) # construct the molecule +symbols = ['H', 'F'] +geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) +mol = qml.qchem.Molecule(symbols, geometry) pes = qml.qchem.vibrational_pes(mol) +###################################################################### +# The :func:`~.pennylane.qchem.vibrational_pes` function creates a +# :class:`~.pennylane.qchem.VibrationalPES` object that stores the potential energy surface +# and vibrational information. This object is the input for several functions that we learn about +# here. For instance, the :func:`~.pennylane.qchem.christiansen_integrals` function accepts this +# object to compute the integrals needed to construct the bosonic form of the Christiansen +# Hamiltonian defined above. + +integrals = qml.qchem.vibrational.christiansen_integrals(pes,n_states=4) +h_bosonic = qml.qchem.christiansen_bosonic(integrals[0]) +print(h_bosonic) + +###################################################################### +# The bosonic Hamiltonian constructed with :func:`~.pennylane.qchem.christiansen_bosonic` can be +# mapped to its qubit form by using the proper mapping equations defined in the +# :func:`~.pennylane.qchem.christiansen_mapping` function. + +h_qubit = qml.bose.christiansen_mapping(h_bosonic) +h_qubit + +###################################################################### +# This provides a vibrational Hamiltonian in the qubit basis that can be used in any desired quantum +# algorithm in PennyLane. +# +# Note that PennyLane also provides the :func:`~.pennylane.qchem.christiansen_hamiltonian` function +# that uses the :class:`~.pennylane.qchem.VibrationalPES` object directly and builds the qubit +# Christiansen Hamiltonian. + +h_qubit2 = qml.qchem.vibrational.christiansen_hamiltonian(pes,n_states=4) + +###################################################################### +# You can verify that the two Hamiltonians are identical. +# +# Taylor representation +# ^^^^^^^^^^^^^^^^^^^^^ +# The Taylor representation of the vibrational Hamiltonian relies on a Taylor expansion of +# the potential energy surface :math:`V` in terms of the vibrational mass-weighted normal +# coordinate operators :math:`q`. +# +# .. math:: +# +# V = V_0 + \sum_i F_i q_i + \sum_{ij} F_{ij} q_i,q_j + .... +# +# Note that the force constants :math:`F` are derivatives of the potential energy surface. # +# The Taylor Hamiltonian can then be constructed by defining the kinetic and potential energy +# components in terms of the momentum and coordinate operators. +# +# .. math:: +# +# H = \sum_{i \ge j} K_{ij} p_i p_j + \sum_{i\ge j} \Phi_{ij}^{(2)} q_i q_j + +# \sum_{i \ge j \ge k} \Phi_{ijk}^{(3)} q_i q_j q_k + ..., +# +# where the coefficients :math:`\Phi` are obtained from the force constants :math:`F` after +# rearranging the terms in the potential energy operator according to the number of different modes. +# +# The :func:`~.pennylane.qchem.taylor_coeffs` function computes the coefficients :math:`\Phi` from +# a :class:`~.pennylane.qchem.VibrationalPES` object. + +one, two = qml.qchem.taylor_coeffs(pes) + +###################################################################### +# We can then use these coefficients to construct a bosonic form of the Taylor Hamiltonian. + +h_bosonic = qml.qchem.taylor_bosonic(coeffs=[one, two], freqs=pes.freqs, uloc=pes.uloc) +print(h_bosonic) + +###################################################################### +# This bosonic Hamiltonian can be mapped to the qubit basis using mapping schemes of +# :func:`~.pennylane.bose.binary_mapping` or :func:`~.pennylane.bose.unary_mapping` functions. + +h_qubit = qml.binary_mapping(h_bosonic, n_states=4) +h_qubit + +###################################################################### +# This Hamiltonian can be used in any desired quantum algorithm in PennyLane. +# +# Note that PennyLane also provides the :func:`~.pennylane.qchem.taylor_hamiltonian` function +# that uses the :class:`~.pennylane.qchem.VibrationalPES` object directly and builds the qubit +# Taylor Hamiltonian. + +h_qubit2 = qml.qchem.vibrational.taylor_hamiltonian(pes, n_states=4) + +###################################################################### +# You can verify that the two Hamiltonians are identical. # # Conclusion # ---------- From 05408be0db3e9f10d065476850b444f48ae098eb Mon Sep 17 00:00:00 2001 From: Soran Jahangiri <40344468+soranjh@users.noreply.github.com> Date: Thu, 3 Jul 2025 09:44:00 -0400 Subject: [PATCH 5/8] Apply suggestions from code review Co-authored-by: Austin Huang Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com> --- ...how_to_build_vibrational_hamiltonians.json | 4 +-- ...l_how_to_build_vibrational_hamiltonians.py | 31 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json index 79292d0d01..66f6e3e4f1 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json @@ -1,5 +1,5 @@ { - "title": "How to build spin Hamiltonians", + "title": "How to build vibrational Hamiltonians", "authors": [ { "username": "ddhawan" @@ -25,7 +25,7 @@ "uri": "/_static/demo_thumbnails/large_demo_thumbnails/thumbnail_large_how_to_build_spin_hamiltonians.png" } ], - "seoDescription": "Learn how to build spin Hamiltonians with PennyLane.", + "seoDescription": "Learn how to build vibrational Hamiltonians with PennyLane.", "doi": "", "references": [ { diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index 3ab643f6b7..7486d0b118 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -1,12 +1,10 @@ r"""How to build vibrational Hamiltonians ========================================= -Vibrational motions are crucially important to describe the quantum properties of molecules and +Vibrational motions are crucial for describing the quantum properties of molecules and materials. Molecular vibrations can significantly affect the outcome of chemical reactions. There are also several spectroscopy techniques that rely on the vibrational properties of molecules to provide valuable insight to understand chemical systems and design new materials. Classical quantum -computations have been routinely implemented to describe vibrational motions of molecules. However, -efficient classical methods typically have fundamental theoretical limitations that prevent their -practical implementation for describing challenging vibrational systems. This makes quantum +computations have been routinely implemented to describe vibrational motions of molecules. However, for challenging vibrational systems, classical methods typically have fundamental theoretical limitations that prevent their practical implementation. This makes quantum algorithms an ideal choice where classical methods are not efficient or accurate. Quantum algorithms require a precise description of the system Hamiltonian to compute vibrational @@ -25,7 +23,7 @@ # Vibrational Hamiltonian # ----------------------- # A molecular vibrational Hamiltonian can be defined in terms of the kinetic energy operator of the -# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interaction +# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interactions # between the nuclei as: # # .. math:: @@ -34,7 +32,7 @@ # # The kinetic and potential energy operators can be written in terms of momentum and position # operators, respectively. There are several ways to construct the potential energy operator which -# lead to different representation of the vibrational Hamiltonian. Here we explain some of these +# lead to different representations of the vibrational Hamiltonian. Here we explain some of these # representations and provide PennyLane codes for constructing them. # # Christiansen representation @@ -47,10 +45,10 @@ # V({Q}) = \sum_i V_1(Q_i) + \sum_{ij} V_2(Q_i,Q_j) + .... # # This provides a general representation of the potential energy surface where the terms :math:`V_n` -# depend on :math:`n` vibrational mode at most. +# depend on :math:`n` vibrational modes at most. # # The Christiansen Hamiltonian is then constructed in second-quantization based on this potential -# energy surface and bosonic creation :math:`b^{\dagger}` and annihilation :math:`b` operations: +# energy surface in terms of bosonic creation :math:`b^{\dagger}` and annihilation :math:`b` operations: # # .. math:: # @@ -63,7 +61,7 @@ # of the potential energy, :math:`V_n`, defined above. # # PennyLane provides a set of functions to construct the Christiansen Hamiltonian, either directly -# in one step or by building the Hamiltonian from its building blocks step by step. An important +# in one step or from its building blocks step by step. An important # step in both methods is to construct the potential energy operator which is done based on # single-point energy calculations along the normal modes of the molecule. The # :func:`~.pennylane.qchem.vibrational_pes` function in PennyLane provides a convenient way to @@ -88,17 +86,16 @@ # :class:`~.pennylane.qchem.VibrationalPES` object that stores the potential energy surface # and vibrational information. This object is the input for several functions that we learn about # here. For instance, the :func:`~.pennylane.qchem.christiansen_integrals` function accepts this -# object to compute the integrals needed to construct the bosonic form of the Christiansen +# object to compute the integrals needed to construct the Christiansen # Hamiltonian defined above. -integrals = qml.qchem.vibrational.christiansen_integrals(pes,n_states=4) +integrals = qml.qchem.vibrational.christiansen_integrals(pes, n_states=4) h_bosonic = qml.qchem.christiansen_bosonic(integrals[0]) print(h_bosonic) ###################################################################### # The bosonic Hamiltonian constructed with :func:`~.pennylane.qchem.christiansen_bosonic` can be -# mapped to its qubit form by using the proper mapping equations defined in the -# :func:`~.pennylane.qchem.christiansen_mapping` function. +# mapped to its qubit form by using the :func:`~.pennylane.qchem.christiansen_mapping` function. h_qubit = qml.bose.christiansen_mapping(h_bosonic) h_qubit @@ -108,10 +105,10 @@ # algorithm in PennyLane. # # Note that PennyLane also provides the :func:`~.pennylane.qchem.christiansen_hamiltonian` function -# that uses the :class:`~.pennylane.qchem.VibrationalPES` object directly and builds the qubit -# Christiansen Hamiltonian. +# that uses the :class:`~.pennylane.qchem.VibrationalPES` object directly and builds the +# Christiansen Hamiltonian in qubit representation. -h_qubit2 = qml.qchem.vibrational.christiansen_hamiltonian(pes,n_states=4) +h_qubit2 = qml.qchem.vibrational.christiansen_hamiltonian(pes, n_states=4) ###################################################################### # You can verify that the two Hamiltonians are identical. @@ -129,7 +126,7 @@ # Note that the force constants :math:`F` are derivatives of the potential energy surface. # # The Taylor Hamiltonian can then be constructed by defining the kinetic and potential energy -# components in terms of the momentum and coordinate operators. +# components in terms of the momentum and position operators. # # .. math:: # From 1f15615e1169811fff88bacc0aa158b5ceae74cc Mon Sep 17 00:00:00 2001 From: soranjh Date: Mon, 7 Jul 2025 15:32:40 -0400 Subject: [PATCH 6/8] add conc and refs --- ...how_to_build_vibrational_hamiltonians.json | 44 ++++++------- ...l_how_to_build_vibrational_hamiltonians.py | 62 +++++++++++-------- 2 files changed, 56 insertions(+), 50 deletions(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json index 79292d0d01..06e8ebaa20 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.json @@ -4,12 +4,15 @@ { "username": "ddhawan" }, + { + "username": "austingmhuang" + }, { "username": "soran" } ], - "dateOfPublication": "2024-12-05T00:00:00+00:00", - "dateOfLastModification": "2024-12-06T00:00:00+00:00", + "dateOfPublication": "2025-07-10T00:00:00+00:00", + "dateOfLastModification": "2025-07-10T00:00:00+00:00", "categories": [ "Getting Started", "How-to" @@ -25,28 +28,26 @@ "uri": "/_static/demo_thumbnails/large_demo_thumbnails/thumbnail_large_how_to_build_spin_hamiltonians.png" } ], - "seoDescription": "Learn how to build spin Hamiltonians with PennyLane.", + "seoDescription": "Learn how to build vibrational Hamiltonians with PennyLane.", "doi": "", "references": [ { - "id": "ashcroft", - "type": "book", - "title": "Solid State Physics", - "authors": "N. W. Ashcroft, D. N. Mermin", - "year": "1976", - "publisher": "New York: Saunders College Publishing", - "url": "https://en.wikipedia.org/wiki/Ashcroft_and_Mermin" + "id": "loaiza", + "type": "article", + "title": "Simulating near-infrared spectroscopy on a quantum computer for enhanced chemical detection", + "authors": "I. Loaiza *et al.*", + "journal": "arXiv:2504.10602", + "year": "2025", + "url": "https://arxiv.org/abs/2504.10602" }, { - "id": "jovanovic", + "id": "motlagh", "type": "article", - "title": "Refraction and band isotropy in 2D square-like Archimedean photonic crystal lattices", - "authors": "D. Jovanovic, R. Gajic, K. Hingerl", - "journal": "Opt. Express", - "volume": "16", - "pages": "4048--4058", - "year": "2008", - "url": "https://opg.optica.org/oe/fulltext.cfm?uri=oe-16-6-4048&id=154856" + "title": "Quantum Algorithm for Vibronic Dynamics: Case Study on Singlet Fission Solar Cell Design", + "authors": "D. Motlagh *et al.*", + "journal": "arXiv:2411.13669", + "year": "2024", + "url": "https://arxiv.org/abs/2411.13669" } ], "basedOnPapers": [], @@ -59,12 +60,7 @@ }, { "type": "demonstration", - "id": "tutorial_fermionic_operators", - "weight": 1.0 - }, - { - "type": "demonstration", - "id": "tutorial_isingmodel_PyTorch", + "id": "tutorial_how_to_build_spin_hamiltonians", "weight": 1.0 } ] diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index 3ab643f6b7..17a2e9e5fe 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -1,9 +1,9 @@ r"""How to build vibrational Hamiltonians ========================================= Vibrational motions are crucially important to describe the quantum properties of molecules and -materials. Molecular vibrations can significantly affect the outcome of chemical reactions. There -are also several spectroscopy techniques that rely on the vibrational properties of molecules to -provide valuable insight to understand chemical systems and design new materials. Classical quantum +materials. Molecular vibrations can affect the outcome of chemical reactions and there are several +spectroscopy techniques that rely on the vibrational properties of molecules to provide valuable +insight into understanding chemical systems and processes [#loaiza]_ [#motlagh]_. Classical quantum computations have been routinely implemented to describe vibrational motions of molecules. However, efficient classical methods typically have fundamental theoretical limitations that prevent their practical implementation for describing challenging vibrational systems. This makes quantum @@ -33,9 +33,9 @@ # H = T + V. # # The kinetic and potential energy operators can be written in terms of momentum and position -# operators, respectively. There are several ways to construct the potential energy operator which -# lead to different representation of the vibrational Hamiltonian. Here we explain some of these -# representations and provide PennyLane codes for constructing them. +# operators, respectively. There are several ways to represent and construct a molecular vibrational +# Hamiltonian. Here we explain some of these representations and show how PennyLane features can be +# used to constructing the Hamiltonians. # # Christiansen representation # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,12 +44,11 @@ # # .. math:: # -# V({Q}) = \sum_i V_1(Q_i) + \sum_{ij} V_2(Q_i,Q_j) + .... +# V({Q}) = \sum_i V_1(Q_i) + \sum_{ij} V_2(Q_i,Q_j) + ..., # -# This provides a general representation of the potential energy surface where the terms :math:`V_n` -# depend on :math:`n` vibrational mode at most. +# where :math:`V_n` represents the :math:`n`-mode component of the potential energy surface. # -# The Christiansen Hamiltonian is then constructed in second-quantization based on this potential +# The Christiansen Hamiltonian is then constructed in second-quantization based on the potential # energy surface and bosonic creation :math:`b^{\dagger}` and annihilation :math:`b` operations: # # .. math:: @@ -58,13 +57,14 @@ # \sum_{i`__ in PennyLane +# provides a set of tools that can be used to construct several representations of vibrational +# Hamiltonians. Here we learned how to use these tools to build vibrational Hamiltonians +# step-by-step and also use the PennyLane built-in functions to easily construct the Hamiltonians in +# one step. The qchem module provides +# `features `__ +# for constructing a vibrational potential energy surface efficiently using parallel executor +# options. The modular design of the vibrational features also facilitate further extension of the +# tools to support building other Hamiltonian types and representations and develop novel mapping +# methods intuitively. # # References # ---------- # -# .. [#aaa] +# .. [#loaiza] # -# N. W. , -# "". +# I. Loaiza *et al.*, +# "Simulating near-infrared spectroscopy on a quantum computer for enhanced chemical detection", +# arXiv:2504.10602, 2025. # -# .. [#bbb] +# .. [#motlagh] # -# D. , -# "", -# 2008. +# D. Motlagh *et al.*, +# "Quantum Algorithm for Vibronic Dynamics: Case Study on Singlet Fission Solar Cell Design", +# arXiv:2411.13669, 2024. # # About the authors # ----------------- From d50ef961729e0897432b930d575b85bae70beac4 Mon Sep 17 00:00:00 2001 From: soranjh Date: Mon, 7 Jul 2025 15:46:30 -0400 Subject: [PATCH 7/8] update intro --- .../tutorial_how_to_build_vibrational_hamiltonians.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index c6b21216c6..29afd3f053 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -2,8 +2,8 @@ ========================================= Vibrational motions are crucial for describing the quantum properties of molecules and materials. Molecular vibrations can affect the outcome of chemical reactions and there are several -spectroscopy techniques that rely on the vibrational properties of molecules to provide valuable -insight into understanding chemical systems and processes [#loaiza]_ [#motlagh]_. Classical quantum +vibrational spectroscopy techniques that provide valuable insight into understanding chemical +systems and processes [#loaiza]_ [#motlagh]_. Classical quantum computations have been routinely implemented to describe vibrational motions of molecules. However, for challenging vibrational systems, classical methods typically have fundamental theoretical limitations that prevent their practical implementation. This makes quantum algorithms an ideal From d24b3ea145b385c7c57cb06fb6cef6c0bebb72f6 Mon Sep 17 00:00:00 2001 From: soranjh Date: Mon, 7 Jul 2025 15:48:24 -0400 Subject: [PATCH 8/8] update intro --- .../tutorial_how_to_build_vibrational_hamiltonians.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py index 29afd3f053..5f0fbb1282 100644 --- a/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py +++ b/demonstrations/tutorial_how_to_build_vibrational_hamiltonians.py @@ -25,7 +25,7 @@ # Vibrational Hamiltonian # ----------------------- # A molecular vibrational Hamiltonian can be defined in terms of the kinetic energy operator of the -# nuclei, :math:`T`, and the potential energy operator, :math:`V`, that describes the interactions +# nuclei, :math:`T`, and the potential energy operator, :math:`V`, which describes the interactions # between the nuclei as: # # .. math::