Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build spin hamiltonians #1230

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1a9d3ae
Merge branch 'master' into dev
actions-user Sep 5, 2024
2bfd14f
Merge branch 'master' into dev
actions-user Sep 9, 2024
838b668
Merge branch 'master' into dev
actions-user Sep 10, 2024
5d0ad9b
Merge branch 'master' into dev
actions-user Sep 10, 2024
e2ed3dd
Merge branch 'master' into dev
actions-user Sep 13, 2024
7ffeaf3
Merge branch 'master' into dev
actions-user Sep 16, 2024
f3831d0
Merge branch 'master' into dev
actions-user Sep 16, 2024
1d8bb22
Merge branch 'master' into dev
actions-user Sep 18, 2024
9994cd5
Merge branch 'master' into dev
actions-user Sep 18, 2024
31148a6
Merge branch 'master' into dev
actions-user Sep 19, 2024
fb0658d
Merge branch 'master' into dev
actions-user Sep 20, 2024
a2d55d8
Merge branch 'master' into dev
actions-user Sep 24, 2024
2adb533
Merge branch 'master' into dev
actions-user Sep 26, 2024
1059369
Merge branch 'master' into dev
actions-user Oct 1, 2024
f22b7a7
Merge branch 'master' into dev
actions-user Oct 1, 2024
3d02a26
Remove code being deprecated in v0.39 (#1220)
mudit2812 Oct 3, 2024
31c7999
add first version
soranjh Oct 4, 2024
ea59037
Merge branch 'master' into dev
actions-user Oct 4, 2024
624a1b3
Merge branch 'master' into dev
actions-user Oct 7, 2024
e2398df
add section for customized ham
soranjh Oct 7, 2024
3d7b93a
update plot function
soranjh Oct 7, 2024
03dc559
Merge `master` into `dev` (#1236)
Mandrenkov Oct 9, 2024
ac333d4
Merge branch 'master' into dev
actions-user Oct 9, 2024
b62709f
add conclusions
soranjh Oct 9, 2024
f9d66d9
add refs
soranjh Oct 9, 2024
c1f66d4
Merge branch 'master' into dev
actions-user Oct 11, 2024
e5033f8
Fix nightly merge failure (#1239)
doctorperceptron Oct 11, 2024
b6a17a1
Merge master into dev (#1243)
mudit2812 Oct 18, 2024
6ee9d6e
Merge `master` into `dev` October 24, 2024 (#1247)
mudit2812 Oct 24, 2024
a851fe8
Merge branch 'master' into dev
actions-user Oct 25, 2024
1d91676
add review comments
soranjh Oct 28, 2024
a03b4c7
Merge branch 'master' into dev
actions-user Oct 28, 2024
abbb9d5
add review comments
soranjh Oct 28, 2024
e54a88a
[skip ci] update jason
soranjh Oct 28, 2024
defb451
Apply suggestions from code review
soranjh Oct 28, 2024
558010e
Merge branch 'master' into dev
actions-user Oct 28, 2024
aa83ea9
[skip ci] explain lattice elements
soranjh Oct 28, 2024
a235004
Use noise models in mitigation demos (#1231)
obliviateandsurrender Oct 30, 2024
cd09cba
add new lattices
soranjh Oct 30, 2024
f095b50
correct typos
soranjh Oct 30, 2024
9cd9d67
Small fixes to some demos during feature freeze for PL 0.39 (#1252)
PietropaoloFrisoni Oct 30, 2024
710ab3a
correct equation
soranjh Oct 30, 2024
dc308fd
correct typo
soranjh Oct 30, 2024
da0df43
Apply suggestions from code review
soranjh Oct 30, 2024
12a742d
added images
ikurecic Oct 31, 2024
734d202
ogthumbnail in body
ikurecic Oct 31, 2024
85441e8
add all ham examples
soranjh Oct 31, 2024
4037705
correct rendering
soranjh Oct 31, 2024
9ed8682
correct math
soranjh Oct 31, 2024
273c237
Apply suggestions from code review
soranjh Oct 31, 2024
6e38c87
minor corrections
soranjh Oct 31, 2024
ac15983
sync with remote
soranjh Oct 31, 2024
1c54291
Apply suggestions from code review
soranjh Nov 1, 2024
7ebfb69
add review comments
soranjh Nov 1, 2024
c68e961
Apply suggestions from code review
soranjh Nov 4, 2024
ced297a
add review comments
soranjh Nov 4, 2024
e4c10ee
adding diksha's username
ikurecic Nov 4, 2024
0d75112
add review comments
soranjh Nov 4, 2024
33da1e7
Merge branch 'dev' into spin_hamiltonian
ikurecic Nov 4, 2024
d401b89
Apply suggestions from code review
soranjh Nov 4, 2024
7b8a5f7
add review comments
soranjh Nov 4, 2024
5a48234
plot lattice and update conclusion
soranjh Nov 5, 2024
448df3a
update print
soranjh Nov 6, 2024
dbdd7e6
update ref
soranjh Nov 6, 2024
19dd7c6
Merge branch 'master' into spin_hamiltonian
soranjh Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demonstrations/tutorial_how_to_spin_hamiltonian.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"title": "How to build spin Hamiltonians",
"authors": [
{
"username": "dikshadhawan"
"username": "diksha_dhawan"
ikurecic marked this conversation as resolved.
Show resolved Hide resolved
},
{
"username": "soran"
}
],
"dateOfPublication": "2024-10-28T00:00:00+00:00",
"dateOfLastModification": "2024-10-28T00:00:00+00:00",
"dateOfPublication": "2024-11-04T00:00:00+00:00",
"dateOfLastModification": "2024-11-04T00:00:00+00:00",
"categories": [
"Getting Started",
"How-to"
Expand Down
26 changes: 14 additions & 12 deletions demonstrations/tutorial_how_to_spin_hamiltonian.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
r"""How to build spin Hamiltonians
==================================
Systems of interacting spins provide simple but powerful models for studying problems in physics,
chemistry, and quantum computing. PennyLane provides a comprehensive set of tools that enables users
chemistry, and quantum computing. PennyLane offers a comprehensive set of tools that enables users
to intuitively construct a broad range of spin Hamiltonians. Here we show you how to use these tools
soranjh marked this conversation as resolved.
Show resolved Hide resolved
to easily construct spin Hamiltonians for models such as the transverse-field Ising model,
Fermi-Hubbard model, Kitaev honeycomb model, and more.
to easily construct spin Hamiltonians for models such as the Fermi–Hubbard model, the Heisenberg
model, the transverse-field Ising model, Kitaev's honeycomb model, the Haldane model, the Emery
model and more!
soranjh marked this conversation as resolved.
Show resolved Hide resolved

.. figure:: ../_static/demo_thumbnails/opengraph_demo_thumbnails/OGthumbnail_how_to_build_spin_hamiltonians.png
:align: center
Expand All @@ -27,8 +28,8 @@
# Fermi–Hubbard model
# ^^^^^^^^^^^^^^^^^^^
# The `Fermi–Hubbard model Hamiltonian <https://docs.pennylane.ai/en/latest/code/api/pennylane.spin.fermi_hubbard.html>`__
# has a kinetic energy component, which is parameterized by a hopping parameter :math:`t` and a
# potential energy component parameterized by the on-site interaction strength, :math:`U`.
# has a kinetic energy component, which is parameterized by a hopping parameter :math:`t`, and a
soranjh marked this conversation as resolved.
Show resolved Hide resolved
# potential energy component which is parameterized by the on-site interaction strength, :math:`U`.
#
# .. math::
#
Expand All @@ -47,10 +48,11 @@
#
# We can also define the
# number of lattice cells we would like to include in our Hamiltonian as a list of integers for
# :math:`x, y, z` directions, depending on the lattice shape. Here we generate the Fermi-Hubbard on
# a ``square`` lattice of shape :math:`2 \times 2`. The ``square`` lattice is constructed from unit
# cells that contain only one site such that we will have :math:`2 \times 2 = 4` sites in total. We
# will provide more details on constructing lattices in the following sections.
# :math:`x, y, z` directions, depending on the lattice shape. Here we generate the Fermi–Hubbard
# Hamiltonian on a ``square`` lattice of shape :math:`2 \times 2`. The ``square`` lattice is
# constructed from unit cells that contain only one site such that we will have
# :math:`2 \times 2 = 4` sites in total. We will provide more details on constructing lattices in
# the following sections.

soranjh marked this conversation as resolved.
Show resolved Hide resolved
import pennylane as qml

Expand Down Expand Up @@ -102,7 +104,7 @@

######################################################################
# Kitaev's honeycomb model
# ^^^^^^^^^^^^^^^^^^^^^^
# ^^^^^^^^^^^^^^^^^^^^^^^^
# The `Kitaev honeycomb model Hamiltonian <https://docs.pennylane.ai/en/latest/code/api/pennylane.spin.kitaev.html>`__
# is defined on the honeycomb lattice, as
#
Expand Down Expand Up @@ -288,8 +290,8 @@ def plot(lattice, figsize=None, showlabel=True):
# customising them. The lattice can be constructed in a more flexible way that allows us to construct
# customized Hamiltonians. Let's look at an example.
#
# Adding custom edges
# ^^^^^^^^^^^^^^^^^^^
# Building anisotropic Hamiltonians
# ---------------------------------
# Now we work on a more complicated Hamiltonian to see how our existing tools allow us to build it
# intuitively. We construct the anisotropic square-trigonal [#jovanovic]_ model, where the coupling parameters
# depend on the orientation of the bonds. We can construct the Hamiltonian by building the
Expand Down
Loading