/*******************************************************************************
*
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
*
* Copyright (C) 2011-2014 by M. Ferrero, O. Parcollet
*
* TRIQS is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* TRIQS. If not, see .
*
******************************************************************************/
#pragma once
#include
#include
#include
namespace triqs {
namespace lattice {
using r_t = arrays::vector;
using k_t = arrays::vector;
using dcomplex = std::complex;
using arrays::matrix;
using arrays::array;
using arrays::range;
// --------------------------------------------------------
class bravais_lattice {
public:
using point_t = std::vector; // domain concept. PUT on STACK
bravais_lattice(matrix const& units, std::vector atom_orb_pos, std::vector atom_orb_name);
bravais_lattice(matrix const& units, std::vector atom_orb_pos)
: bravais_lattice(units, atom_orb_pos, std::vector(atom_orb_pos.size(), "")) {}
bravais_lattice(matrix const& units) : bravais_lattice(units, std::vector{{0, 0, 0}}) {}
bravais_lattice() : bravais_lattice(arrays::make_unit_matrix(3)) {}
int n_orbitals() const { return atom_orb_name.size(); }
arrays::matrix_const_view units() const { return units_; }
int dim() const { return dim_; }
/// Transform into real coordinates.
template r_t lattice_to_real_coordinates(R const& x) const {
r_t res(3);
res() = 0;
for (int i = 0; i < dim_; i++) res += x(i) * units_(i, range{});
return res;
}
/// Write into HDF5
friend void h5_write(h5::group fg, std::string subgroup_name, bravais_lattice const& bl);
/// Read from HDF5
friend void h5_read(h5::group fg, std::string subgroup_name, bravais_lattice& bl);
// BOOST Serialization
friend class boost::serialization::access;
template void serialize(Archive& ar, const unsigned int version) {
ar& boost::serialization::make_nvp("units", units_);
ar& boost::serialization::make_nvp("atom_orb_pos", atom_orb_pos);
ar& boost::serialization::make_nvp("atom_orb_name", atom_orb_name);
}
private:
matrix units_;
std::vector atom_orb_pos; // atom_orb_pos[i] = position of ith atoms/orbitals in the unit cell
std::vector atom_orb_name; // names of these atoms/orbitals.
int dim_;
};
}
}