-
Notifications
You must be signed in to change notification settings - Fork 8
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
bandstructure(::Function) #17
Conversation
@pablosanjose, If I understand correctly |
Good point. One just builds the mesh directly. For example
We might want to improve the interface here, so that |
(Opened #20 to track the issue of the ranges) |
Moving posts from #16 here:
|
This comment demanded a rethink of the |
Exploration of syntax for doing a bandstructure cut:
The second relies on definitions of Possibilities:
This requires some critical and careful thinking... Opinions welcome! EDIT: another possibility for lifting that keeps the
|
I am not sure what would be preferable. I don't see any clear advantage of one over the other. Besides syntax, when making the choice, we should also have in mind which of the forms would be more readily parallelized over the mesh. But I think that both forms are as easy to distribute. So probably expose only the first one since it is the current form? |
I think I'll go with option 1 for the moment, as it offers the most flexibility (who knows what the user might need to do at some point). Now that #27 and #25 are merged the road is open to specializing |
Parallelization would be equally feasible with both approaches. It is indeed an important issue I haven't yet thought much about. |
This refactors the way
bandstructure
works. The API has now two available methods,bandstructure(::Hamiltonian)
(as before) and a newbandstructure(::Function)
. The core algorithm is based on the second form. It now takes a functionmatrixf::Function -> AbstractMatrix
and a mesh over its argument space. The methodbandstructure(h::Hamiltonian,...)
still exists but essentially just builds a functionmatrixf = ϕs -> bloch!(similarmatrix(h, method), h, ϕs
that then gets passed to the::Function
method.This change allows several things. First, it allows passing things to
bandstructure
that are more general than mereHamiltonian
s. One important example isParametricHamiltonian
s, for exampleThe number of arguments of
hf
above is specified by the length of the tuplenpoints
, which is compulsory in thebandstructure(::Function)
form. (Note the need to makehp
const at the global scope to makehf
type stable, although it is not necessary if this code is inside a function)Another advantage is that it allows an easy way to perform bandstructure cuts of a given
Hamiltonian
, for exampleIn this way, we don't need to define 1D cuts for a 2D mesh, we just create a 1D mesh for the
x
argument that implements the cut.CC: @BacAmorim, @fernandopenaranda