20 #include <boost/mpi.hpp> 45 const Eigen::MatrixXd
dq;
71 this->spectrum[0].omega.head(3).fill(0.);
83 std::size_t
three_to_one(
const std::array<int, 3>& indices)
const {
88 return ic + nc * (ib + nb * ia);
99 std::array<int, 3> nruter;
110 return this->equivalences.size();
121 std::size_t index =
python_mod(iq, this->nqpoints);
123 return this->spectrum[index];
132 if (ic > this->equivalences.size())
133 throw value_error(
"wrong equivalence class index");
134 return this->equivalences[ic].size();
144 if (ic > this->equivalences.size())
145 throw value_error(
"wrong equivalence class index");
146 return this->equivalences[ic][0];
156 if (ic > this->equivalences.size())
157 throw value_error(
"wrong equivalence class index");
158 return this->equivalences[ic];
166 Eigen::VectorXd
get_q(std::size_t iq)
const {
167 std::size_t index =
python_mod(iq, this->nqpoints);
169 return this->cpos.col(index);
180 return (v.transpose() * this->
dq).norm() / std::sqrt(12.);
201 return this->
three_to_one({{-indices[0], -indices[1], -indices[2]}});
214 std::size_t index =
python_mod(original, this->nqpoints);
215 return this->symmetry_map[index];
226 const std::array<std::size_t, 2>& original)
const;
236 const std::array<std::size_t, 3>& original)
const;
246 std::size_t i000 = q;
249 this->
three_to_one({{indices[0], indices[1], indices[2] + 1}});
251 this->
three_to_one({{indices[0], indices[1] + 1, indices[2]}});
253 this->
three_to_one({{indices[0], indices[1] + 1, indices[2] + 1}});
255 this->
three_to_one({{indices[0] + 1, indices[1], indices[2]}});
257 this->
three_to_one({{indices[0] + 1, indices[1], indices[2] + 1}});
259 this->
three_to_one({{indices[0] + 1, indices[1] + 1, indices[2]}});
261 {{indices[0] + 1, indices[1] + 1, indices[2] + 1}});
264 std::vector<Tetrahedron> nruter;
266 nruter.emplace_back(
Tetrahedron({{i000, i001, i010, i100}}));
267 nruter.emplace_back(
Tetrahedron({{i110, i111, i100, i010}}));
268 nruter.emplace_back(
Tetrahedron({{i101, i100, i111, i001}}));
269 nruter.emplace_back(
Tetrahedron({{i011, i010, i001, i111}}));
271 nruter.emplace_back(
Tetrahedron({{i010, i100, i111, i001}}));
296 return this->symmetry_map;
308 template <
typename T>
311 const Eigen::MatrixBase<T>& x)
const 312 -> Eigen::Matrix<typename T::Scalar, Eigen::Dynamic, Eigen::Dynamic> {
313 std::size_t index =
python_mod(iq, this->nqpoints);
314 std::size_t nops = symms.
get_nsym();
316 typename T::PlainObject nruter(x);
318 std::size_t nfound = 0;
320 for (std::size_t iop = 0; iop < nops; ++iop) {
321 if (this->symmetry_map[index][2 * iop] == index) {
322 nruter += symms.
rotate_v(x, iop,
true);
332 const std::string& description,
336 const std::vector<Threeph_process>& processes,
337 const boost::mpi::communicator& comm);
339 friend std::tuple<std::string,
340 std::unique_ptr<Crystal_structure>,
341 std::unique_ptr<Symmetry_operations>,
342 std::unique_ptr<Gamma_grid>,
343 std::unique_ptr<std::vector<Threeph_process>>>
344 load_bulk_hdf5(
const char* filename,
const boost::mpi::communicator& comm);
347 Eigen::MatrixXd cpos;
349 std::vector<Spectrum_at_point> spectrum;
354 std::vector<std::vector<std::size_t>> equivalences;
357 std::vector<std::vector<std::size_t>> symmetry_map;
360 void initialize_cpos();
370 std::vector<Spectrum_at_point> compute_my_spectrum(
373 const boost::mpi::communicator& communicator);
383 std::vector<std::size_t> parentlookup;
386 void fill_parentlookup();
std::vector< Tetrahedron > get_tetrahedra(std::size_t q) const
Decompose the q-th microcell in five tetrahedra.
Definition: qpoint_grid.hpp:243
Definition: analytic1d.hpp:26
U python_mod(const T &n, const U &d)
Alternative modulus operation with a behavior similar to the % operator in Python.
Definition: utilities.hpp:292
friend void save_bulk_hdf5(const char *filename, const std::string &description, const Crystal_structure &cell, const Symmetry_operations &symmetries, const Gamma_grid &grid, const std::vector< Threeph_process > &processes, const boost::mpi::communicator &comm)
Save all relevant information about a bulk material to an HDF5 file.
Definition: bulk_hdf5.cpp:125
std::size_t get_cardinal(std::size_t ic) const
Return the cardinal of an equivalence class.
Definition: qpoint_grid.hpp:131
void enforce_asr()
Set the three lowest frequencies at Gamma to zero.
Definition: qpoint_grid.hpp:70
auto rotate_v(const Eigen::MatrixBase< T > &vector, std::size_t index, bool cartesian=false) const -> Eigen::Matrix< typename T::Scalar, Eigen::Dynamic, Eigen::Dynamic >
Rotate (but do not translate) a vector according to one of the symmetry operations.
Definition: symmetry.hpp:115
const int nb
Size of the grid along the second reciprocal axis.
Definition: qpoint_grid.hpp:37
std::size_t get_representative(std::size_t ic) const
Return a representative of an equivalence class.
Definition: qpoint_grid.hpp:143
const Eigen::MatrixXd dq
Side vectors of each element in reciprocal space.
Definition: qpoint_grid.hpp:45
std::size_t polar_opposite(std::size_t q)
Find the index of the polar opposite q point.
Definition: qpoint_grid.hpp:198
Exception related to the parameters passed to a function.
Definition: exceptions.hpp:33
friend std::tuple< std::string, std::unique_ptr< Crystal_structure >, std::unique_ptr< Symmetry_operations >, std::unique_ptr< Gamma_grid >, std::unique_ptr< std::vector< Threeph_process > > > load_bulk_hdf5(const char *filename, const boost::mpi::communicator &comm)
Reconstruct all data structures from a file saved with save_bulk_hdf5().
Definition: bulk_hdf5.cpp:442
Hold information about the harmonic interactions between atoms.
Definition: structures.hpp:233
std::size_t getSymIdxToParent(std::size_t iq) const
Definition: qpoint_grid.cpp:276
Code related to the dynamical matrix.
Hold information about the polarization properties of the structure.
Definition: structures.hpp:272
std::vector< std::array< std::size_t, 2 > > equivalent_qpairs(const std::array< std::size_t, 2 > &original) const
Find all q-point pairs equivalent to the input.
Definition: qpoint_grid.cpp:312
Eigen::VectorXd get_q(std::size_t iq) const
Return the Cartesian coordinates of a q point.
Definition: qpoint_grid.hpp:166
std::size_t getParentIdx(std::size_t iq) const
Definition: qpoint_grid.cpp:268
const int na
Size of the grid along the first reciprocal axis.
Definition: qpoint_grid.hpp:35
auto copy_symmetry(std::size_t iq, const Symmetry_operations &symms, const Eigen::MatrixBase< T > &x) const -> Eigen::Matrix< typename T::Scalar, Eigen::Dynamic, Eigen::Dynamic >
Remove the component of a Cartesian vector which does transform as a q-point in the grid...
Definition: qpoint_grid.hpp:309
Factory of Dynamical_matrix objects.
Definition: dynamical_matrix.hpp:108
std::array< std::size_t, 3 > Triangle
Convenient shorthand for an array of three indices.
Definition: qpoint_grid.hpp:28
Gamma_grid(const Crystal_structure &poscar, const Symmetry_operations &symms, const Harmonic_ifcs &force_constants, int _na, int _nb, int _nc)
Constructor: initialize all internal variables and compute the spectrum at each q point...
Definition: qpoint_grid.cpp:41
std::vector< size_t > equivalent_qpoints(std::size_t original) const
Return the images of a q point through all the symmetry operations, including inversions.
Definition: qpoint_grid.hpp:213
std::size_t get_nsym() const
Definition: symmetry.hpp:59
std::vector< std::vector< std::size_t > > getSymmetryMap()
Definition: qpoint_grid.hpp:295
const Spectrum_at_point & get_spectrum_at_q(int iq) const
Access the harmonic properties at a point in the grid.
Definition: qpoint_grid.hpp:120
Definitions of the basic data-handling classes in ALMA.
Objects of this class hold a subset of the information provided by spg_get_dataset().
Definition: symmetry.hpp:47
std::size_t three_to_one(const std::array< int, 3 > &indices) const
Return the index of a q point identified by its position along the three axes.
Definition: qpoint_grid.hpp:83
std::array< int, 3 > one_to_three(std::size_t iq) const
Return the coordinates of a q point identified by its index.
Definition: qpoint_grid.hpp:98
Objects of this class represent a regular grid with the Gamma point in one corner.
Definition: qpoint_grid.hpp:32
Hold information about a crystal structure.
Definition: structures.hpp:51
POD class that holds all the information about the harmonic properties of the system at a particular ...
Definition: dynamical_matrix.hpp:30
std::vector< std::size_t > get_equivalence(std::size_t ic) const
Return the elements in an equivalence class.
Definition: qpoint_grid.hpp:155
const Eigen::MatrixXd rlattvec
Reciprocal lattice basis vectors.
Definition: qpoint_grid.hpp:43
std::array< std::size_t, 4 > Tetrahedron
Convenient shorthand for an array of four indices.
Definition: qpoint_grid.hpp:26
const std::size_t nqpoints
Total number of q points in the grid.
Definition: qpoint_grid.hpp:41
double base_sigma(const Eigen::VectorXd &v) const
Return the base broadening (without any prefactor) for a mode.
Definition: qpoint_grid.hpp:179
std::size_t get_nequivalences() const
Definition: qpoint_grid.hpp:109
const int nc
Size of the grid along the third reciprocal axis.
Definition: qpoint_grid.hpp:39
std::vector< Triangle > get_triangles(std::size_t ia) const
Definition: qpoint_grid.cpp:366
std::vector< std::array< std::size_t, 3 > > equivalent_qtriplets(const std::array< std::size_t, 3 > &original) const
Find all q-point triplets equivalent to the input.
Definition: qpoint_grid.cpp:336