Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
annamariadziubyna committed Nov 23, 2023
1 parent a1aaf23 commit 0eb5aac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
3 changes: 1 addition & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Library

---

```@meta
CurrentModule = SpinGlassNetworks
```
Expand Down Expand Up @@ -64,4 +62,5 @@ select_numstate_best
## Auxiliary Functions
```@docs
zephyr_to_linear
load_openGM
```
12 changes: 1 addition & 11 deletions docs/src/clh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ A clustered Hamiltonian is a graphical representation that allows for a convenie

The concept of a clustered Hamiltonian within `SpinGlassNetworks.jl` introduces a powerful mechanism for organizing spins into desired geometries, facilitating a structured approach to modeling complex spin systems. Analogous to a factor graph, the clustered Hamiltonian involves nodes that represent tensors within the underlying network. The edges connecting these nodes in the clustered Hamiltonian correspond to the indices shared between the respective tensors in the tensor network.

The Ising problem in translates to:
$$ H(\conf{x}{\Nbar}) = \sum_{\langle m,n\rangle \in \mathcal{F}} E_{x_m x_n} + \sum_{n=1}^{\Nbar} E_{x_n} $$
$\mathcal{F}$ forms a 2D graph, see the figure below, where we indicate nearest-neighbour interactions with blue lines, and diagonal connections with green lines.
Each $x_n$ takes $d$ values with $d=2^4$ for square diagonal, $d=2^{24}$ for Pegasus and $2^{16}$ for Zephyr geometry.
$E_{x_n}$ is an intra--node energy of the corresponding binary-variables configuration, and $E_{x_n x_m}$ is inter--node energy.

```@raw html
<img src="../images/clh.pdf" width="200%" class="center"/>
```

```@docs
clustered_hamiltonian
```
Expand All @@ -26,7 +16,7 @@ using SpinGlassNetworks
instance = "$(@__DIR__)/../../src/instances/square_diagonal/5x5/diagonal.txt"
ig = ising_graph(instance)
# Create clustered Hamiltonian.
# Create clustered Hamiltonian
cl_h = clustered_hamiltonian(
ig,
cluster_assignment_rule = super_square_lattice((5,5,4))
Expand Down
10 changes: 3 additions & 7 deletions docs/src/ising.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

The Ising model is a mathematical model used to describe the behavior of interacting particles, such as atoms or molecules, in a magnetic field. In the Ising model, each particle is represented as a binary variable $s_i$ that can take on the values of either +1 or -1. The total energy of the system is given by the Hamiltonian:

$$H = \sum_{(i,j) \in \mathcal{E}} J_{ij} s_i s_j + \sum_{i} h_i s_i$$
$H = \sum_{(i,j) \in \mathcal{E}} J_{ij} s_i s_j + \sum_{i} h_i s_i$

where $J_{ij}$ is the coupling constant between particles $i$ and $j$, $h_i$ is the external magnetic field at particle $i$, and the sum is taken over all pairs of particles and all particles in the system $\mathcal{E}$, respectively.

In `SpinGlassPEPS.jl` package, an ising graph can be created using the command `ising_graph`.
In `SpinGlassPEPS.jl` package, an Ising graph can be created using the command `ising_graph`.
```@docs
ising_graph
```

## Simple example
In this simple example below we show how to create ising_graph of a instance given as txt file in a format (i, j, Jij). The resulting graph has vertices (black circles) corresponding to positions of spins in the system and edges defining coupling strength between spins. Each vertex contains information about local field.
In this simple example below we show how to create Ising graph of a instance given as txt file in a format (i, j, Jij). The resulting graph has vertices (black circles) corresponding to positions of spins in the system and edges defining coupling strength between spins. Each vertex contains information about local field.

```@example
using SpinGlassNetworks
Expand All @@ -22,8 +22,4 @@ ig = ising_graph(instance)
# View graph properties
@show biases(ig), couplings(ig)
```

```@raw html
<img src="../images/sd_ising.pdf" width="200%" class="center"/>
```
2 changes: 1 addition & 1 deletion docs/src/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

A [Julia](http://julialang.org) package for building and interacting with Ising spin glass models in context of tensor networks. Part of [SpinGlassPEPS](https://github.com/euro-hpc-pl/SpinGlassPEPS.jl) package.

The contents of our package are richly illustrated through comprehensive examples, showcasing the practical utilization of key functions. Specifically, the 'ising_graph' function is highlighted, demonstrating its capacity to generate Ising model graphs—a fundamental step in modeling spin systems. Additionally, the 'clustered_hamiltonian' function is presented as a pivotal tool for converting Ising graphs into clustered Hamiltonians. The package delves into various lattice geometries, providing insights into constructing diverse structures such as the super_square_lattice, pegasus lattice, and zephyr lattice. Moreover, the documentation outlines methods for local dimensional reduction, shedding light on techniques to streamline computations and enhance the efficiency of spin system simulations.
The contents of our package are richly illustrated through comprehensive examples, showcasing the practical utilization of key functions. Specifically, the `ising_graph` function is highlighted, demonstrating its capacity to generate Ising model graphs—a fundamental step in modeling spin systems. Additionally, the `clustered_hamiltonian` function is presented as a pivotal tool for converting Ising graphs into clustered Hamiltonians. The package delves into various lattice geometries, providing insights into constructing diverse structures such as the `super_square_lattice`, `pegasus_lattice`, and `zephyr-lattice`. Moreover, the documentation outlines methods for local dimensional reduction, shedding light on techniques to streamline computations and enhance the efficiency of spin system simulations.

0 comments on commit 0eb5aac

Please sign in to comment.