25 #include <Eigen/Dense> 26 #include <randutils.hpp> 38 inline double random_dt(
double w, randutils::mt19937_rng& rng) {
41 double u = rng.uniform(0., 1.);
42 return -std::log(u) / w;
50 std::vector<double> cumulative;
52 randutils::mt19937_rng& rng;
63 : rng(_rng), nqpoints(grid.nqpoints),
64 nmodes(grid.get_spectrum_at_q(0).omega.size()) {
83 std::array<std::size_t, 2>
sample() {
84 double u = this->rng.uniform(0., 1.);
85 auto pos = std::lower_bound(
86 this->cumulative.begin(), this->cumulative.end(), u) -
87 this->cumulative.begin();
89 std::array<std::size_t, 2> nruter;
90 nruter[0] = pos % this->
nmodes;
91 nruter[1] = pos / this->
nmodes;
109 const Eigen::Ref<const Eigen::ArrayXXd>& w,
111 randutils::mt19937_rng& _rng);
130 const Eigen::Ref<const Eigen::Vector3d>& nablaT,
132 randutils::mt19937_rng& _rng);
154 const Eigen::Ref<const Eigen::Vector3d>& normal,
155 randutils::mt19937_rng& _rng);
171 const Eigen::Ref<const Eigen::Vector3d>& normal,
172 randutils::mt19937_rng& _rng);
180 std::map<char, std::size_t> Nbranches;
182 std::map<char, std::size_t> Ntot;
184 std::map<char, double> volume;
194 using dos_tuple = std::
195 tuple<char, std::size_t, std::size_t, double, double, Gaussian_for_DOS>;
198 typedef std::tuple<char, std::size_t, double> lookup_entry;
200 std::vector<std::vector<lookup_entry>> lookup_incidentA;
202 std::vector<std::vector<lookup_entry>> lookup_incidentB;
204 randutils::mt19937_rng& rng;
214 std::vector<dos_tuple> get_modes(
217 const Eigen::Ref<const Eigen::Vector3d>& normal,
235 const Eigen::Ref<const Eigen::Vector3d>& normal,
237 randutils::mt19937_rng& _rng,
238 double Tref = 300.0);
247 char reemit(
char incidence,
D_particle& particle);
278 std::tuple<char, std::size_t, std::size_t, Gaussian_for_DOS>;
281 std::vector<std::vector<double>> cumulative;
283 std::vector<std::vector<std::size_t>> allowed;
286 Eigen::MatrixXd directions;
288 randutils::mt19937_rng& rng;
296 std::vector<dos_tuple> get_all_modes(
const Gamma_grid& gridA,
298 double scalebroad)
const;
311 randutils::mt19937_rng& _rng);
321 char reemit(
char incidence,
322 const Eigen::Ref<const Eigen::Vector3d>& normal,
339 using dos_tuple = std::tuple<std::size_t, std::size_t, Gaussian_for_DOS>;
342 std::vector<std::vector<double>> cumulative;
344 std::vector<std::vector<std::size_t>> allowed;
347 Eigen::MatrixXd directions;
349 randutils::mt19937_rng& rng;
356 std::vector<dos_tuple> get_all_modes(
const Gamma_grid& grid,
357 double scalebroad)
const;
368 randutils::mt19937_rng& _rng);
382 void scatter(
const Eigen::Ref<const Eigen::Vector3d>& normal,
Definition: analytic1d.hpp:26
Grid_distribution(const Gamma_grid &grid, randutils::mt19937_rng &_rng)
Constructor.
Definition: sampling.hpp:62
Exception related to the parameters passed to a function.
Definition: exceptions.hpp:33
Classes and functions used to manipulate grids in reciprocal space.
void fill_cumulative(const std::vector< double > &p)
Fill the 'cumulative' vector.
Definition: sampling.cpp:26
Objects of this class allow us to sample from a discrete distribution over a q-point grid with a PMF ...
Definition: sampling.hpp:100
virtual ~Grid_distribution()
Trivial virtual destructor.
Definition: sampling.hpp:69
const std::size_t nqpoints
Number of q points.
Definition: sampling.hpp:56
Each object of this class represents a deviational particle in the simulation.
Definition: deviational_particle.hpp:42
std::array< std::size_t, 2 > sample()
Draw a sample from the distribution.
Definition: sampling.hpp:83
Objects of this class allow us to simulate completely diffusive interfaces between two media...
Definition: sampling.hpp:257
Detection and representation of allowed three-phonon processes.
double random_dt(double w, randutils::mt19937_rng &rng)
Generate a random time delta from an exponential distribution.
Definition: sampling.hpp:38
Definitions of the basic data-handling classes in ALMA.
Objects of this class allow us to sample from a discrete distribution over a q-point grid with a PMF ...
Definition: sampling.hpp:120
Definition: sampling.hpp:328
Code used to describe deviational particles.
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
const std::size_t nmodes
Number of phonon modes at each q point.
Definition: sampling.hpp:58
Code related to the phonon density fo states (DOS).
Diffuse mismatch distribution.
Definition: sampling.hpp:177
planar_source_distribution Emission probability for outgoing modes is proportional to heat capacity *...
Definition: sampling.hpp:161
Objects of this class allow us to sample from a discrete distribution over a q-point grid with a PMF ...
Definition: sampling.hpp:140
Base class for discrete distributions over a q-point grid.
Definition: sampling.hpp:47