30#include <fmt/ranges.h>
38namespace triqs::lattice {
46 using k_t = nda::vector<double>;
85 [[nodiscard]] C2PY_IGNORE
bool contains(
k_t const &)
const {
return true; }
88 [[nodiscard]]
auto const &
lattice()
const {
return lattice_; }
94 [[nodiscard]]
auto ndim()
const {
return lattice_.ndim(); }
119 return nda::transpose(k_units_)(nda::range::all, nda::range(
ndim())) * nda::basic_array_view{v}(nda::range(
ndim()));
133 return nda::transpose(k_units_inv_)(nda::range::all, nda::range(
ndim())) * nda::basic_array_view{v_tilde}(nda::range(
ndim()));
150 auto str = fmt::format(
"Brillouin zone in {} dimensions:\n", bz.
ndim());
151 str += fmt::format(
" Basis vectors: {}\n",
152 std::views::transform(nda::range(bz.
ndim()), [&bz](
int i) { return bz.units()(i, nda::range(bz.ndim())); }));
160 void serialize(
auto &ar)
const { ar & lattice_ & k_units_ & k_units_inv_; }
166 void deserialize(
auto &ar) { ar & lattice_ & k_units_ & k_units_inv_; }
169 [[nodiscard]]
static std::string
hdf5_format() {
return "brillouin_zone"; }
191 matrix_t k_units_ = matrix_t::zeros(3, 3);
192 matrix_t k_units_inv_ = matrix_t::zeros(3, 3);
Provides a Bravais lattice class.
k_t value_t
Value type of a Brillouin Zone.
k_t real_to_lattice_coordinates(K const &v_tilde) const
Transform a vector from the standard basis to the reciprocal lattice basis .
auto const & lattice() const
Get the underlying Bravais lattice.
friend void h5_write(h5::group g, std::string const &name, brillouin_zone const &bz)
Write a triqs::lattice::brillouin_zone to HDF5.
friend void h5_read(h5::group g, std::string const &name, brillouin_zone &bz)
Read a triqs::lattice::brillouin_zone from HDF5.
friend std::ostream & operator<<(std::ostream &sout, brillouin_zone const &bz)
Write a triqs::lattice::brillouin_zone to a std::ostream.
brillouin_zone()
Construct a Brillouin zone for a simple cubic lattice with lattice constant .
static std::string hdf5_format()
Get the HDF5 format tag.
matrix_t const & reciprocal_matrix() const
Get the matrix containing the reciprocal basis vectors as its rows.
void serialize(auto &ar) const
Serialize the Brillouin zone to a generic archive.
void deserialize(auto &ar)
Deserialize the Brillouin from a generic archive.
bool operator==(brillouin_zone const &bz) const
Equal-to comparison operator.
k_t lattice_to_real_coordinates(K const &v) const
Transform a vector from the reciprocal lattice basis to the standard basis .
bool contains(k_t const &) const
Check if a given vector is part of the domain.
matrix_t const & reciprocal_matrix_inv() const
Get the inverse matrix .
auto ndim() const
Get the number of dimensions of the underlying Bravais lattice.
matrix_t const & units() const
Get the matrix containing the reciprocal basis vectors as its rows.
nda::vector< double > k_t
Reciprocal space vector type.
nda::matrix< double > matrix_t
Matrix type for transformations involving real and reciprocal space vectors.
Common macros used in TRIQS.