41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
//
|
|
// Created by dominik on 8/12/24.
|
|
//
|
|
|
|
// #include <cmath>
|
|
#include <random>
|
|
#include <cmath>
|
|
|
|
#include "base.h"
|
|
#include "coordinates.h"
|
|
|
|
#include <iostream>
|
|
|
|
Motion::Motion(const double delta, const double eta, std::mt19937_64& rng) : m_delta(delta), m_eta(eta), m_rng(rng) {
|
|
m_uni_dist = std::uniform_real_distribution(0., 1.);
|
|
}
|
|
|
|
Motion::Motion(std::mt19937_64& rng) : m_rng(rng) {
|
|
m_uni_dist = std::uniform_real_distribution(0., 1.);
|
|
}
|
|
|
|
double Motion::omega_q(const double cos_theta, const double phi) const {
|
|
const double cos_theta_square = cos_theta * cos_theta;
|
|
const double sin_theta_square = 1. - cos_theta_square;
|
|
|
|
return M_PI * m_delta * (3. * cos_theta_square - 1. - m_eta * sin_theta_square * std::cos(2.*phi));
|
|
}
|
|
|
|
double Motion::omega_q(const SphericalPos& pos) const {
|
|
// std::cout << pos.cos_theta << " " << pos.phi << std::endl;
|
|
auto [cos_theta, phi] = pos;
|
|
|
|
return omega_q(cos_theta, phi);
|
|
}
|
|
|
|
SphericalPos Motion::draw_position() {
|
|
const double cos_theta = 1 - 2 * m_uni_dist(m_rng);
|
|
const double phi = 2.0 * M_PI * m_uni_dist(m_rng);
|
|
|
|
return {cos_theta, phi};
|
|
} |