Comments (4)
Actually, it might be easier than we said. It might be possible to support a neighbors
kwarg in SiteSelector
s.
Currently, a s::SiteSelector
undergoes a resolve
process that combines s
with a Lattice
to find out the indices of sublattices passed by name. That produces a rs::ResolvedSelector{<:SiteSelector}
that bundles the lattice with it, which is needed to compute in((siteindices, dns), rs)
. What we could do is generalize ResolvedSelector
to bundle either a lattice or a Hamiltonian, so that neighbors = not(1)
could work (using the Hamiltonian's connectivity) as long as we have bundled a Hamiltonian, not a Lattice (i.e. as long as the selector was passed to a unitcell(h::Hamiltonian,...)
instead of a unitcell(l::Lattice,...)
).
EDIT: when working with a Lattice
I would say neighbors
should never restrict the selector, regardless of its value.
EDIT2: Actually, it might even be better to emit an error if the user specifies any neighbors
in a selector when using it with a Lattice instead of a Hamiltonian.
from quantica.jl.
Upon further reflection I'm starting to think that your original proposal (i.e. have neighbors
be a kwarg specific to unitcell(::Hamiltonian,...;...)
) is actually best. The very fact that putting neighbors
into SiteSelector
s forces the feature to work only in certain cases is a strong hint of a wrong design. SiteSelector
s should select only based on properties of sites, i.e. their position and sublattice, nothing else. Given that SiteSelector
s drive so much functionality throughout Quantica, their behaviour should remain highly composable, so exceptions are bad.
Note that the method unitcell(::Hamiltonian,...)
already has a specific kwarg (modifiers
) that is not present in any other unitcell
method (because it only makes sense when transforming a Hamiltonian). Adding neighbors
also as an additional kwarg, as @fernandopenaranda suggests, would keep this functionality localized to where it makes sense.
from quantica.jl.
It turns out this does not always have the solution one might expect.
If I say, unitcell(h, neighbors = not(1))
in a 2D lattice, this has a well defined solution, since removing a dangling site does not produce (typically) another dangling site (unless there is an open 1D subchain in the lattice). However, if I say unitcell(h, neighbors = not(2))
in a 2D lattice, for example, each 2-neighbor site removed will often produce new sites with 2 neighbors. So solving this in general, as posed, requires some iterative passes over the lattice, removing matching sites on each pass. The end result, doing it this way, is unique, but is probably difficult to predict. However, since the code for neighbors = not(1)
and the general neighbors = ...
is very similar, it makes sense to support the full range of possibilities (not just a removedanglingbonds = true
)
from quantica.jl.
I concluded that having arbitrarily complex neighbors
values (like neighbors = (1, not(2), 4:6)
) was pointless, since the resulting lattice is impossible to anticipate in practice. The PR #131 focuses on just reducing the number of dangling sites on surfaces, so it just accepts a mincoordination::Int
kwarg. While simpler, this is still more powerful than simply neighbors = not(1)
, and I expect it covers better the typical usecase. If somebody needs something more general than #131 do reopen this issue or open a new one.
from quantica.jl.
Related Issues (20)
- Support Dirac points in bandstructures HOT 2
- Wrong band topology around high-symmetry points
- Encode eigenstate information in vlplot(::Bandstructure)
- Unexpected behaviour in Bandstructure indexing syntax HOT 1
- Visualize local density of states in semi-infinite systems
- plot(::Bandstructure) fails with latest GLMakie
- Misleading documentation of `bravais` HOT 2
- `hamiltonian` ignores some hopping terms HOT 9
- lack of documentation on hamiltonian algebra
- `setindex!` for multisite/multiorbital models HOT 8
- "Unexpected band connectivity" warning in massless Dirac equation HOT 4
- `vlplot(::Bandstruture)` only works for 1D bandstrutures HOT 1
- Design of Hamiltonian slices HOT 4
- Proposal: `Flat` wrapper
- vlplot(h, psi) fails for eltype(psi) = SVector{N,Float64}
- Roadmap towards v1.0
- Design: GreenFunctions and EffectiveHamiltonians HOT 4
- Add support for `qplot(g(; params...))` analogous to `qplot(h(; params))` HOT 1
- wrap and supercell of a ParametricHamiltonian should commute with application of modifiers HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantica.jl.