Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a first step towards addressing #4
Here we split (internally) the process of building a Hamiltonian, which was formerly a single step
hamiltonian(lattice, model; orbitals)
, to a multistep process:b = builder(lattice; orbitals)
(of typeParametricHamiltonianBuilder
),add!(b, model)
, and finallyhamiltonian(b)
. We can also dopush!(b, modifiers...)
to injectModifiers
into the builder before assembly into a Hamiltonian.These
builder
andadd!
functions are unexported for the moment, and meant to be used internally only.add!
also has a methodadd!(b, value, ::CellSites, ::CellSites)
to add a single or a group of values to a Hamiltonian build before assembly. This is not exported for a good reason: we don't do matrix-size checks of value for performance reasons here. Hence, improper use in inhomogeneous multiorbital cases could in principle lead to malformed block elements (i.e. with nonzeros out of place).The advantage of this refactor is that we can now envision making a Wannierization object that wraps two builders that are populated as the wannier90 file is read, one for the Hamiltonian and another for the position matrix elements. Then, it becomes possible to combine the hamiltonian builder inside this object with other models (even parametric models) so that we can mix Wannier90 presents with flexible parametric models and modifiers.