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

Indexing and assignment for Hamiltonian #25

Merged
merged 5 commits into from
Oct 4, 2019
Merged

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Oct 4, 2019

Closes #24
Implements a variant of #22 (comment)

With this we can directly access the HamiltonianHarmonic matrix of h::Hamiltonian with h[n1, n2,...] where the n tuple is an integer cell distance (Harmonic vector, called dn in ELSA)

To add new (empty) harmonics do push!(h, dn). If it is already present, h will not be modified. (dn can be a tuple, a splatted tuple or an SVector)

To check if a harmonic is present do isassigned(h, dn)

To delete a harmonic do deleteat!(h, dn)

To assign an element i,j in harmonic dn do h[dn][i,j] = value

Broadcasting is allowed, so that h[dn...][is, js] .= value_matrix, to enable bulk assignment without intermediate allocations (at least if h is dense - a sparse matrix will typically require internal reshuffling to insert new elements).

@pablosanjose pablosanjose merged commit 1554b8b into master Oct 4, 2019
@pablosanjose pablosanjose deleted the ham_indexing branch October 4, 2019 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wannier90 interface
1 participant