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

Honeycomb and hexagonal geometries #305

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 13 additions & 7 deletions docs/src/hamiltonians.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ Stoquastic
```

## Observables
`Rimu.jl` offers two other supertypes for operators that are less
restrictive than [`AbstractHamiltonian`](@ref).
`Rimu.jl` offers two other supertypes for operators that are less
restrictive than [`AbstractHamiltonian`](@ref).
[`AbstractObservable`](@ref) and [`AbstractOperator`](@ref)s both
can represent a physical observable. Their expectation values can be sampled during a [`ProjectorMonteCarloProblem`](@ref) simulation by
passing them into a suitable [`ReplicaStrategy`](@ref), e.g.
can represent a physical observable. Their expectation values can be sampled during a [`ProjectorMonteCarloProblem`](@ref) simulation by
passing them into a suitable [`ReplicaStrategy`](@ref), e.g.
[`AllOverlaps`](@ref). Some observables are also [`AbstractHamiltonian`](@ref)s. The full type hierarchy is
```julia
AbstractHamiltonian{T} <: AbstractOperator{T} <: AbstractObservable{T}
Expand All @@ -96,13 +96,19 @@ Lattices in higher dimensions are defined here and can be passed with the keywor
`geometry` to [`HubbardRealSpace`](@ref) and [`G2RealSpace`](@ref).

```@docs
Hamiltonians.Geometry
CubicGrid
Hamiltonians.Directions
Hamiltonians.Displacements
Hamiltonians.neighbor_site
PeriodicBoundaries
HardwallBoundaries
LadderBoundaries
HoneycombLattice
HexagonalLattice
Hamiltonians.Directions
Hamiltonians.Displacements
Hamiltonians.num_dimensions
Hamiltonians.periodic_dimensions
Hamiltonians.num_neighbors
Hamiltonians.neighbor_site
```

## Index
Expand Down
2 changes: 1 addition & 1 deletion src/Hamiltonians/Hamiltonians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export G2RealCorrelator, G2RealSpace, SuperfluidCorrelator, DensityMatrixDiagona
export SingleParticleExcitation, TwoParticleExcitation, ReducedDensityMatrix
export StringCorrelator, G2MomCorrelator

export CubicGrid, PeriodicBoundaries, HardwallBoundaries, LadderBoundaries
export CubicGrid, PeriodicBoundaries, HardwallBoundaries, LadderBoundaries, HoneycombLattice, HexagonalLattice

export HOCartesianContactInteractions, HOCartesianEnergyConservedPerDim, HOCartesianCentralImpurity
export AxialAngularMomentumHO
Expand Down
13 changes: 8 additions & 5 deletions src/Hamiltonians/HubbardRealSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ is produced if `address`is incompatible with the interaction parameters `u`.

## Geometries

Implemented [`CubicGrid`](@ref)s for keyword `geometry`
Implemented [`Geometry`](@ref)s for keyword `geometry`

* [`CubicGrid`](@ref)
* [`PeriodicBoundaries`](@ref)
* [`HardwallBoundaries`](@ref)
* [`LadderBoundaries`](@ref)
* [`HoneycombLattice`](@ref)
* [`HexagonalLattice`](@ref)

Default is `geometry=PeriodicBoundaries(M,)`, i.e. a one-dimensional lattice with the
number of sites `M` inferred from the number of modes in `address`.
Expand All @@ -163,7 +166,7 @@ number of sites `M` inferred from the number of modes in `address`.
struct HubbardRealSpace{
C, # components
A<:AbstractFockAddress,
G<:CubicGrid,
G<:Geometry,
D, # dimension
# The following need to be type params.
T<:SVector{C,Float64},
Expand All @@ -181,7 +184,7 @@ end

function HubbardRealSpace(
address::AbstractFockAddress;
geometry::CubicGrid=PeriodicBoundaries((num_modes(address),)),
geometry::Geometry=PeriodicBoundaries((num_modes(address),)),
t=ones(num_components(address)),
u=ones(num_components(address), num_components(address)),
v=zeros(num_components(address), num_dimensions(geometry))
Expand Down Expand Up @@ -314,7 +317,7 @@ struct HubbardRealSpaceCompOffdiagonals{G,A} <: AbstractOffdiagonals{A,Float64}
end

function offdiagonals(h::HubbardRealSpace, comp, add)
neighbours = 2 * num_dimensions(h.geometry)
neighbours = num_neighbors(h.geometry)
return HubbardRealSpaceCompOffdiagonals(
h.geometry, add, h.t[comp], num_occupied_modes(add) * neighbours
)
Expand All @@ -323,7 +326,7 @@ end
Base.size(o::HubbardRealSpaceCompOffdiagonals) = (o.length,)

@inline function Base.getindex(o::HubbardRealSpaceCompOffdiagonals, chosen)
neighbours = 2 * num_dimensions(o.geometry)
neighbours = num_neighbors(o.geometry)
particle, neigh = fldmod1(chosen, neighbours)
src_index = find_occupied_mode(o.address, particle)
neigh = neighbor_site(o.geometry, src_index.mode, neigh)
Expand Down
Loading
Loading