3#include "./fourier_polynomial.hpp"
4#include "./superlattice.hpp"
8#include <itertools/itertools.hpp>
22namespace triqs::experimental::lattice {
42 static constexpr auto r_all = nda::range::all;
44 void check_hoppings();
48 using eigenvectors_t = std::pair<nda::array<double, 2>, nda::array<dcomplex, 3>>;
56 tb_hk(std::vector<std::array<long, 3>> Rs, std::vector<nda::array<dcomplex, 2>>
hoppings)
78 return std::views::iota(0L,
n_R()) | std::views::transform([
this](
long i) {
return coeff_arr(i, nda::ellipsis{}); });
86 return std::views::iota(0L,
n_R()) | std::views::transform([
this](
long i) {
return coeff_arr(i, nda::ellipsis{}); });
136 nda::array<double, 2>
eigenvalues(nda::array_view<double, 2> k)
const;
186 out <<
"tb_hk consisting of " << tb.
n_R() <<
" lattice components (R)";
191 for (
auto const &[R, C] : tb.
elements()) out <<
"\n " << R <<
" : " << C;
202 [[nodiscard]]
inline static std::string
hdf5_format() {
return "tb_hk"; }
Owning container for a Fourier-series representation of a lattice function.
void h5_write_impl(h5::group g, std::string const &name, char const *format) const
HDF5 write helper for derived classes: writes R_list and coeff_arr under the given format tag.
nda::array< dcomplex, coeff_dim+1 > coeff_arr
auto const & get_R_list() const
Get the list of real-space lattice vectors.
fourier_polynomial()=default
void h5_read_impl(h5::group g, std::string const &name, char const *exp_format)
HDF5 read helper for derived classes: reads R_list and coeff_arr in place; rebuilds R_mat.
Representation of a superlattice built on top of an underlying Bravais lattice.
Tight-binding Hamiltonian on a 3D lattice.
tb_hk(fourier_polynomial< 2, 3 > fp)
Construct a tight-binding Hamiltonian from an existing matrix-valued Fourier polynomial.
auto hoppings() const
Get a lazy range over the hopping matrices, one per R-vector (const overload).
friend void h5_write(h5::group g, std::string const &name, tb_hk const &tb)
Write a tight-binding Hamiltonian to HDF5.
auto hoppings()
Get a lazy range over the hopping matrices, one per R-vector.
friend void h5_read(h5::group g, std::string const &name, tb_hk &tb)
Read a tight-binding Hamiltonian from HDF5.
static std::string hdf5_format()
Get the HDF5 format tag.
std::vector< std::array< long, 3 > > get_R_list() const
Get the list of real-space lattice vectors.
eigenvectors_t eigenvectors(nda::array_view< double, 2 > k) const
Compute the band-basis energies and eigenvectors of for a list of k-points.
auto elements() const
Get a lazy range over the (R-vector, hopping-matrix) pairs (const overload).
std::pair< nda::array< double, 2 >, nda::array< dcomplex, 3 > > eigenvectors_t
Type used for returning eigenvectors.
bool operator==(tb_hk const &tb) const
Equal-to comparison operator.
nda::array< double, 2 > eigenvalues(nda::array_view< double, 2 > k) const
Compute the band-basis energies of for a list of k-points.
tb_hk(std::vector< std::array< long, 3 > > Rs, std::vector< nda::array< dcomplex, 2 > > hoppings)
Construct a tight-binding Hamiltonian from lattice vectors and their hopping matrices.
auto elements()
Get a lazy range over the (R-vector, hopping-matrix) pairs.
long n_orbitals() const
Get the number of orbitals, i.e. the dimension of the Hamiltonian matrices.
friend std::ostream & operator<<(std::ostream &out, tb_hk const &tb)
Write a tight-binding Hamiltonian to a std::ostream.
tb_hk()
Default constructor: a single zero hopping matrix for the lattice vector at the origin.
fourier_polynomial< 2, kdim > fold(superlattice const &sl, fourier_polynomial< 2, kdim > const &fp)
Fold a Fourier polynomial defined on a lattice onto a superlattice.
std::complex< double > dcomplex
Convenience alias for std::complex<double>.
Common macros used in TRIQS.