From c5502027a68b3162e9644591cbd9386570cd043e Mon Sep 17 00:00:00 2001 From: abhirup-m Date: Sun, 28 Jul 2024 22:18:47 +0530 Subject: [PATCH] added workflow for building docs --- docs/build/.documenter-siteinfo.json | 2 +- docs/build/base/index.html | 12 ++++++------ docs/build/correlations/index.html | 14 +++++++------- docs/build/eigen/index.html | 8 ++++---- docs/build/index.html | 2 +- docs/build/quickstart/index.html | 2 +- docs/build/theory/index.html | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/build/.documenter-siteinfo.json b/docs/build/.documenter-siteinfo.json index 61a35d8..fd55d08 100644 --- a/docs/build/.documenter-siteinfo.json +++ b/docs/build/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-28T19:29:33","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-28T22:15:51","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/docs/build/base/index.html b/docs/build/base/index.html index 1f6144e..0018477 100644 --- a/docs/build/base/index.html +++ b/docs/build/base/index.html @@ -13,14 +13,14 @@ julia> BasisStates(4, [2], [0], x->sum(x[1:2])==1) 2-element Vector{Dict{BitVector, Float64}}: Dict([0, 1, 1, 0] => 1.0) - Dict([1, 0, 0, 1] => 1.0)source
fermions.TransformBitMethod
TransformBit(qubit, operator)

Apply the single qubit operator ('n', 'h', '+' or '-') on a single fock state.

Examples

julia> TransformBit(Bool(0), '+')
+ Dict([1, 0, 0, 1] => 1.0)
source
fermions.TransformBitMethod
TransformBit(qubit, operator)

Apply the single qubit operator ('n', 'h', '+' or '-') on a single fock state.

Examples

julia> TransformBit(Bool(0), '+')
 (1, 1)
 
 julia> TransformBit(Bool(1), 'h')
 (1, 0)
 
 julia> TransformBit(Bool(1), '-')
-(0, 1)
source
fermions.ApplyOperatorChunkMethod
ApplyOperatorChunk(opType, opMembers, opStrength, incomingState; tolerance)

Apply a single tensor product operator chunk (for eg., c^†1 c2 or n1 c^†3 c_4) on a general state and return the new state.

Examples

julia> state = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
+(0, 1)
source
fermions.ApplyOperatorChunkMethod
ApplyOperatorChunk(opType, opMembers, opStrength, incomingState; tolerance)

Apply a single tensor product operator chunk (for eg., c^†1 c2 or n1 c^†3 c_4) on a general state and return the new state.

Examples

julia> state = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => 1.0
   [0, 1] => -0.5
@@ -30,7 +30,7 @@
 
 julia> ApplyOperatorChunk(opType, opMembers, opStrength, state)
 Dict{BitVector, Float64} with 1 entry:
-  [1, 0] => -0.05
source
fermions.ApplyOperatorMethod
ApplyOperator(operator, incomingState; tolerance)

Extends ApplyOperatorChunk() by applying a more general operator (consisting of multiple operator chunks) on a general state.

Examples

julia> state = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
+  [1, 0] => -0.05
source
fermions.ApplyOperatorMethod
ApplyOperator(operator, incomingState; tolerance)

Extends ApplyOperatorChunk() by applying a more general operator (consisting of multiple operator chunks) on a general state.

Examples

julia> state = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => 1.0
   [0, 1] => -0.5
@@ -43,7 +43,7 @@
 julia> ApplyOperator(operator, state)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => -0.05
-  [0, 1] => -0.5
source
fermions.OperatorMatrixMethod
OperatorMatrix(basisStates, operator)

Return the matrix representation of the operator in the given basis.

Examples

julia> basis = BasisStates(2)
+  [0, 1] => -0.5
source
fermions.OperatorMatrixMethod
OperatorMatrix(basisStates, operator)

Return the matrix representation of the operator in the given basis.

Examples

julia> basis = BasisStates(2)
 4-element Vector{Dict{BitVector, Float64}}:
  Dict([0, 0] => 1.0)
  Dict([0, 1] => 1.0)
@@ -60,7 +60,7 @@
  0.0   0.0  0.0   0.0
  0.0  -1.0  0.0   0.0
  0.0   0.5  0.0   0.0
- 0.0   0.0  0.0  -1.0
source
fermions.StateOverlapMethod
StateOverlap(state1, state2)

Compute the inner product ⟨state1|state2⟩.

Examples

julia> state1 = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
+ 0.0   0.0  0.0  -1.0
source
fermions.StateOverlapMethod
StateOverlap(state1, state2)

Compute the inner product ⟨state1|state2⟩.

Examples

julia> state1 = Dict(Bool.([1, 0]) => 1.0, Bool.([0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => 1.0
   [0, 1] => -0.5
@@ -71,4 +71,4 @@
   [0, 1] => 0.5
 
 julia> StateOverlap(state1, state2)
--0.25
source
+-0.25source diff --git a/docs/build/correlations/index.html b/docs/build/correlations/index.html index 4a2a9b3..887e0a9 100644 --- a/docs/build/correlations/index.html +++ b/docs/build/correlations/index.html @@ -9,7 +9,7 @@ ("+-", [1, 2], 1.0) julia> GenCorrelation(state, operator) --0.5source
fermions.ReducedDMMethod
reducedDM(state, reducingIndices)

Reduce the density matrix |state⟩⟨state| by tracing over the indices not specified in reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0]) => 0.5, Bool.([0, 1]) => -0.5)
+-0.5
source
fermions.ReducedDMMethod
reducedDM(state, reducingIndices)

Reduce the density matrix |state⟩⟨state| by tracing over the indices not specified in reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0]) => 0.5, Bool.([0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => 0.5
   [0, 1] => -0.5
@@ -17,25 +17,25 @@
 julia> reducedDM(state, [1])
 2×2 Matrix{Float64}:
  0.5  0.0
- 0.0  0.5
source
fermions.VonNEntropyMethod
VonNEntropy(state, reducingIndices)

Calculate entanglement entropy of the subsystem defined by reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0]) => 0.5, Bool.([0, 1]) => -0.5)
+ 0.0  0.5
source
fermions.VonNEntropyMethod
VonNEntropy(state, reducingIndices)

Calculate entanglement entropy of the subsystem defined by reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0]) => 0.5, Bool.([0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => 0.5
   [0, 1] => -0.5
 
 julia> VonNEntropy(state, [1])
-0.6931471805599453
source
fermions.MutInfoMethod
MutInfo(state, reducingIndices)

Calculate mutual information between the subsystems defined by the tuple reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0, 1]) => 0.5, Bool.([0, 1, 0]) => -0.5)
+0.6931471805599453
source
fermions.MutInfoMethod
MutInfo(state, reducingIndices)

Calculate mutual information between the subsystems defined by the tuple reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0, 1]) => 0.5, Bool.([0, 1, 0]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [0, 1, 0] => -0.5
   [1, 0, 1] => 0.5
 
 julia> MutInfo(state, ([1], [2]))
-0.6931471805599453
source
fermions.TripartiteInfoMethod
TripartiteInfo(state, reducingIndices)

Calculate tripartite information between the subsystems defined by the 3-tuple reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0, 1, 0]) => 0.5, Bool.([0, 1, 0, 1]) => -0.5)
+0.6931471805599453
source
fermions.TripartiteInfoMethod
TripartiteInfo(state, reducingIndices)

Calculate tripartite information between the subsystems defined by the 3-tuple reducingIndices.

Examples

julia> state = Dict(Bool.([1, 0, 1, 0]) => 0.5, Bool.([0, 1, 0, 1]) => -0.5)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0, 1, 0] => 0.5
   [0, 1, 0, 1] => -0.5
 
 julia> TripartiteInfo(state, ([1], [2], [3]))
-0.6931471805599453
source
fermions.ThermalAverageMethod
ThermalAverage(eigenStates, eigenVals, operator, invTemp)

Calculate the canonical ensemble average of operator at the given inverse temperature for the given spectrum.

Examples

julia> basis = BasisStates(2)
+0.6931471805599453
source
fermions.ThermalAverageMethod
ThermalAverage(eigenStates, eigenVals, operator, invTemp)

Calculate the canonical ensemble average of operator at the given inverse temperature for the given spectrum.

Examples

julia> basis = BasisStates(2)
 4-element Vector{Dict{BitVector, Float64}}:
  Dict([0, 0] => 1.0)
  Dict([0, 1] => 1.0)
@@ -61,7 +61,7 @@
  ("n", [1], 1.0)
 
 julia> ThermalAverage(basis, eigenVals, operator, 1.0)
-0.33797199716422116
source
fermions.SpecFuncMethod
SpecFunc(eigVals, eigVecs, probe, probeDiag, freqArray, broadening)

Calculate the spectral function for the excitations defined by probe and probeDiag.

Examples

julia> eigenVals = [0., 1., 1.];
+0.33797199716422116
source
fermions.SpecFuncMethod
SpecFunc(eigVals, eigVecs, probe, probeDiag, freqArray, broadening)

Calculate the spectral function for the excitations defined by probe and probeDiag.

Examples

julia> eigenVals = [0., 1., 1.];
 
 julia> eigenStates = Dict{BitVector, Float64}[Dict([1, 0] => 1.0, [0, 1] => 1.0), Dict([1, 1] => 1.0), Dict([0, 0] => 1.0)]
 3-element Vector{Dict{BitVector, Float64}}:
@@ -86,4 +86,4 @@
  0.09351894323911442
  0.8057354340607891
  0.03392067328129922
- 0.011110098865559272
source
fermions.SpecFuncMethod
SpecFunc(eigVals, eigVecs, probe, probeDiag, freqArray, broadening, symmetries)

Extends SpecFunc() by making use of symmetries.

Examples

julia> SpecFunc(eigenVals, eigenStates, probe, probeDag, freqArray, 1e-2, ['N'])
source
+ 0.011110098865559272source
fermions.SpecFuncMethod
SpecFunc(eigVals, eigVecs, probe, probeDiag, freqArray, broadening, symmetries)

Extends SpecFunc() by making use of symmetries.

Examples

julia> SpecFunc(eigenVals, eigenStates, probe, probeDag, freqArray, 1e-2, ['N'])
source
diff --git a/docs/build/eigen/index.html b/docs/build/eigen/index.html index 1f7e837..9ca260f 100644 --- a/docs/build/eigen/index.html +++ b/docs/build/eigen/index.html @@ -12,7 +12,7 @@ (1, -1) => [Dict([0, 1]=>1.0)] (1, 1) => [Dict([1, 0]=>1.0)] (2, 0) => [Dict([1, 1]=>1.0)] -source
fermions.TransformStateMethod
TransformState(vector, basisStates)

Given a basis {Bi} and a vector {ci}, return the basis representation Σi ci B_i of the vector

Examples

julia> basis = BasisStates(2)
+
source
fermions.TransformStateMethod
TransformState(vector, basisStates)

Given a basis {Bi} and a vector {ci}, return the basis representation Σi ci B_i of the vector

Examples

julia> basis = BasisStates(2)
 4-element Vector{Dict{BitVector, Float64}}:
  Dict([0, 0] => 1.0)
  Dict([0, 1] => 1.0)
@@ -24,7 +24,7 @@
 julia> TransformState(vector, basis)
 Dict{BitVector, Float64} with 2 entries:
   [1, 0] => -0.5
-  [0, 1] => 0.5
source
fermions.SpectrumMethod
Spectrum(operator, basisStates)

Return eigenvalues and eigenvectors of the hermitian operator in the subspace defined by the basis.

Examples

julia> basis = BasisStates(2)
+  [0, 1] => 0.5
source
fermions.SpectrumMethod
Spectrum(operator, basisStates)

Return eigenvalues and eigenvectors of the hermitian operator in the subspace defined by the basis.

Examples

julia> basis = BasisStates(2)
 4-element Vector{Dict{BitVector, Float64}}:
  Dict([0, 0] => 1.0)
  Dict([0, 1] => 1.0)
@@ -50,7 +50,7 @@
  Dict([1, 0] => -0.7071067811865475, [0, 1] => 0.7071067811865477)
  Dict([0, 0] => 1.0)
  Dict([1, 1] => 1.0)
- Dict([1, 0] => 0.7071067811865477, [0, 1] => 0.7071067811865475)
source
fermions.SpectrumMethod
Spectrum(operator, basisStates)

Extends Spectrum() by making use of symmetries.

Examples

julia> basis = BasisStates(2)
+ Dict([1, 0] => 0.7071067811865477, [0, 1] => 0.7071067811865475)
source
fermions.SpectrumMethod
Spectrum(operator, basisStates)

Extends Spectrum() by making use of symmetries.

Examples

julia> basis = BasisStates(2)
 4-element Vector{Dict{BitVector, Float64}}:
  Dict([0, 0] => 1.0)
  Dict([0, 1] => 1.0)
@@ -68,4 +68,4 @@
 Dict{Tuple{Int64}, Vector{Dict{BitVector, Float64}}} with 3 entries:
   (0,) => [Dict([0, 0]=>1.0)]
   (2,) => [Dict([1, 1]=>1.0)]
-  (1,) => [Dict([1, 0]=>0.707107, [0, 1]=>-0.707107), Dict([1, 0]=>0.707107, [0, 1]=>0.707107)]
source
+ (1,) => [Dict([1, 0]=>0.707107, [0, 1]=>-0.707107), Dict([1, 0]=>0.707107, [0, 1]=>0.707107)]source diff --git a/docs/build/index.html b/docs/build/index.html index 1dff0b3..8bef5b2 100644 --- a/docs/build/index.html +++ b/docs/build/index.html @@ -1,2 +1,2 @@ -Fermions.jl · Fermions.jl

Fermions.jl

A Toolkit for Working with Models of Interacting Electrons

Fermions.jl is a toolkit for designing and analysing second-quantised many-particle Hamiltonians of electrons, potentially interacting with each other. The main point in designing this library is to abstract away the detailed task of writing matrices for many-body Hamiltonians and operators (for correlations functions) with large Hilbert spaces; all operators (including Hamiltonians) can be specified using predefined symbols, and the library then provides functions for diagonalising such Hamiltonians and computing observables within the states. (In case you are not accustomed to using second-quantised operators, check this brief explanation.)

Neat features

  • Construct many-body operators and states using simple datastructures such as dictionaries and vectors. No need to bother with complicated and abstract classes and their objects.

  • High-level of freedom in constructing fermionic Hamiltonians. All Hamiltonians that can be represented as a tensor product of 2-dimensional fermionic Fock-space operators can be modelled using fermions.jl.

  • Uses optimised algorithms that make use of symmetries of the problem. Models with total occupancy conservation and/or total magnetisation conservation can be automatically block-diagonalised.

  • Provides a wide range of inbuilt functions for calculating various quantities of physical interest, including spectral functions, static correlations and measures of entanglement. The ability to construct any general correlation function by using fermionic operators further extends the range of possibilities.

This library was borne out of a need to numerically construct and solve fermionic Hamiltonians in the course of my doctoral research. While there are similar julia libraries such as Marco-Di-Tullio/Fermionic.jl and qojulia/QuantumOptics.jl, fermions.jl is much more intuitive since it works directly on predefined basis states and allows defining arbitrary fermionic operators and quantum mechanical states. There is no need to interact with complicated and abstract classes and objects in order to use this library; everything is defined purely in terms of simple datastructures such as dictionaries, vectors and tuples. This makes the entire process transparent and intuitive.

Will this be useful for me?

You might find this library useful if you spend a lot of time studying Hamiltonian models of fermionic or spin-1/2 systems, particularly ones that cannot be solved analytically, or use a similar library in another language (QuTip in python, for example), but want to migrate to Julia. You will not find this useful if you mostly work with bosonic systems and open quantum systems, or work in the thermodynamic limit (using methods like quantum Monte Carlo, numerical RG).

Documentation Outline

Feedback and contributions are always welcome!

+Fermions.jl · Fermions.jl

Fermions.jl

A Toolkit for Working with Models of Interacting Electrons

Fermions.jl is a toolkit for designing and analysing second-quantised many-particle Hamiltonians of electrons, potentially interacting with each other. The main point in designing this library is to abstract away the detailed task of writing matrices for many-body Hamiltonians and operators (for correlations functions) with large Hilbert spaces; all operators (including Hamiltonians) can be specified using predefined symbols, and the library then provides functions for diagonalising such Hamiltonians and computing observables within the states. (In case you are not accustomed to using second-quantised operators, check this brief explanation.)

Neat features

  • Construct many-body operators and states using simple datastructures such as dictionaries and vectors. No need to bother with complicated and abstract classes and their objects.

  • High-level of freedom in constructing fermionic Hamiltonians. All Hamiltonians that can be represented as a tensor product of 2-dimensional fermionic Fock-space operators can be modelled using fermions.jl.

  • Uses optimised algorithms that make use of symmetries of the problem. Models with total occupancy conservation and/or total magnetisation conservation can be automatically block-diagonalised.

  • Provides a wide range of inbuilt functions for calculating various quantities of physical interest, including spectral functions, static correlations and measures of entanglement. The ability to construct any general correlation function by using fermionic operators further extends the range of possibilities.

This library was borne out of a need to numerically construct and solve fermionic Hamiltonians in the course of my doctoral research. While there are similar julia libraries such as Marco-Di-Tullio/Fermionic.jl and qojulia/QuantumOptics.jl, fermions.jl is much more intuitive since it works directly on predefined basis states and allows defining arbitrary fermionic operators and quantum mechanical states. There is no need to interact with complicated and abstract classes and objects in order to use this library; everything is defined purely in terms of simple datastructures such as dictionaries, vectors and tuples. This makes the entire process transparent and intuitive.

Will this be useful for me?

You might find this library useful if you spend a lot of time studying Hamiltonian models of fermionic or spin-1/2 systems, particularly ones that cannot be solved analytically, or use a similar library in another language (QuTip in python, for example), but want to migrate to Julia. You will not find this useful if you mostly work with bosonic systems and open quantum systems, or work in the thermodynamic limit (using methods like quantum Monte Carlo, numerical RG).

Documentation Outline

Feedback and contributions are always welcome!

diff --git a/docs/build/quickstart/index.html b/docs/build/quickstart/index.html index 4316179..0b0557a 100644 --- a/docs/build/quickstart/index.html +++ b/docs/build/quickstart/index.html @@ -99,4 +99,4 @@ p = Plots.plot(freqArr, specfunc, thickness_scaling=1.5, linewidth=2, legend=false, xlabel="frequency \$\\omega\$", ylabel="spectral function\$", margin=-2mm) -display(p)

+display(p)

diff --git a/docs/build/theory/index.html b/docs/build/theory/index.html index 088f757..e859142 100644 --- a/docs/build/theory/index.html +++ b/docs/build/theory/index.html @@ -1,2 +1,2 @@ -Theoretical Background - Fermions, Symmetries and Second Quantisation · Fermions.jl

Theoretical Background - Fermions, Symmetries and Second Quantisation

This page lays out some of the theoretical details that have been utilised while developing this toolkit. All these ideas are very rudimentary from the perspective of practising condensed matter physicists, so this section is mostly for the sake of completeness.

A Brief explanation of second-quantised operators

The entire library is built on the idea of using second-quantisation to study many-body Hamiltonians, so a discussion of that is certainly pertinent. Second quantised operators are a convenient way of writing many-body Hamiltonians. This library is only concerned with electrons; these are particles whose states must be antisymmetric with respect to an exchange of the particles. For example, a state of electrons at positions 1 and 2 has to be $|1,2\rangle - |2, 1\rangle$. In order to avoid this clumsy notation, we introduce creation and annihilation operators $c^\dagger_\nu$ and $c_\nu$, which carry the property of antisymmetry within themselves. The two operators, respectively, create and annihilate an electron in the state described by the quantum number $\nu$, which can be the position or momentum, among others; they satisfy $c_1 c_2 = -c_2 c_1$, allowing us to write the above complicated state simply as $c^\dagger_1 c^\dagger_2|0\rangle$.

As an example, we wish to design the Hamiltonian of a single electron hopping across a 1D chain of lattice sites labelled as $i=1$, $i=2$, $i=3$ and so on. The system is such that the electron can only hop on to the nearest-neighbour sites starting from any given site: $i\to i+1$, $i\to i-1$. In order to hop from, say, $i=1$ to $i=2$, the electron must first be annihilated at the site $i=1$ and then created at $i=2$. The creation process is represented by the operator $c^\dagger_1$ (1 representing the site index of the location of the operation), while the annihilation process is represented by $c_2$, the total process being the product of both process: $c^\dagger_1 c_2$. Of course, the opposite process can also happen - the electron can also hop from $i=2$ to $i=1$, so that the total second-quantised Hamiltonian for the dynamics involving sites 1 and 2 is

\[c^\dagger_1 c_2 + c^\dagger_2 c_1~.\]

Now, the indices 1 and 2 can be represented by any consecutive indices $i$ and $i+1$, leading to the so-called tight-binding Hamiltonian in 1-dimensions:

\[H_\mathrm{TB} = \sum_{i} \left(c^\dagger_i c_{i+1} + c^\dagger_{i+1} c_i\right)\]

+Theoretical Background - Fermions, Symmetries and Second Quantisation · Fermions.jl

Theoretical Background - Fermions, Symmetries and Second Quantisation

This page lays out some of the theoretical details that have been utilised while developing this toolkit. All these ideas are very rudimentary from the perspective of practising condensed matter physicists, so this section is mostly for the sake of completeness.

A Brief explanation of second-quantised operators

The entire library is built on the idea of using second-quantisation to study many-body Hamiltonians, so a discussion of that is certainly pertinent. Second quantised operators are a convenient way of writing many-body Hamiltonians. This library is only concerned with electrons; these are particles whose states must be antisymmetric with respect to an exchange of the particles. For example, a state of electrons at positions 1 and 2 has to be $|1,2\rangle - |2, 1\rangle$. In order to avoid this clumsy notation, we introduce creation and annihilation operators $c^\dagger_\nu$ and $c_\nu$, which carry the property of antisymmetry within themselves. The two operators, respectively, create and annihilate an electron in the state described by the quantum number $\nu$, which can be the position or momentum, among others; they satisfy $c_1 c_2 = -c_2 c_1$, allowing us to write the above complicated state simply as $c^\dagger_1 c^\dagger_2|0\rangle$.

As an example, we wish to design the Hamiltonian of a single electron hopping across a 1D chain of lattice sites labelled as $i=1$, $i=2$, $i=3$ and so on. The system is such that the electron can only hop on to the nearest-neighbour sites starting from any given site: $i\to i+1$, $i\to i-1$. In order to hop from, say, $i=1$ to $i=2$, the electron must first be annihilated at the site $i=1$ and then created at $i=2$. The creation process is represented by the operator $c^\dagger_1$ (1 representing the site index of the location of the operation), while the annihilation process is represented by $c_2$, the total process being the product of both process: $c^\dagger_1 c_2$. Of course, the opposite process can also happen - the electron can also hop from $i=2$ to $i=1$, so that the total second-quantised Hamiltonian for the dynamics involving sites 1 and 2 is

\[c^\dagger_1 c_2 + c^\dagger_2 c_1~.\]

Now, the indices 1 and 2 can be represented by any consecutive indices $i$ and $i+1$, leading to the so-called tight-binding Hamiltonian in 1-dimensions:

\[H_\mathrm{TB} = \sum_{i} \left(c^\dagger_i c_{i+1} + c^\dagger_{i+1} c_i\right)\]