Skip to content

Commit

Permalink
fix for CellOrbitals(:) slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosanjose committed Dec 5, 2024
1 parent 8c3da50 commit 8b0d1da
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/slices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ sites_to_orbs(c::SparseIndices{<:Any,<:Hamiltonian}, _) = c
# unused
# sites_to_orbs_nogroups(cs::CellOrbitals, _) = cs

## CellOrbitals{L,Colon} -> CellOrbitals with collected indices

sites_to_orbs(cs::CellOrbitals{<:Any,Colon}, g) =
sites_to_orbs_nogroups(sites(cell(cs), :), g)

## DiagIndices -> DiagIndices

function sites_to_orbs(d::DiagIndices, g)
Expand Down Expand Up @@ -403,14 +408,13 @@ end

## convert CellSites -> CellOrbitalsGrouped

sites_to_orbs(c::CellSites, g, ker...) =
sites_to_orbs(sanitize_cellindices(c, g), blockstructure(g), ker...)
sites_to_orbs(c::CellSites, g) =
sites_to_orbs(sanitize_cellindices(c, g), blockstructure(g))

function sites_to_orbs(cs::CellSites, os::OrbitalBlockStructure, ker...)
os´ = maybe_scalarize(os, ker...)
function sites_to_orbs(cs::CellSites, os::OrbitalBlockStructure)
sites = siteindices(cs)
groups = _groups(sites, os´) # sites, orbranges
orbinds = _orbinds(sites, groups, os´)
groups = _groups(sites, os) # sites, orbranges
orbinds = _orbinds(sites, groups, os)
return CellOrbitalsGrouped(cell(cs), orbinds, Dictionary(groups...))
end

Expand Down

0 comments on commit 8b0d1da

Please sign in to comment.