cpp/motions/tetrahedral.cpp

31 lines
807 B
C++
Raw Normal View History

2024-08-16 17:55:27 +00:00
//
// Created by dominik on 8/16/24.
//
#include <random>
2024-08-16 17:55:27 +00:00
#include "tetrahedral.h"
TetrahedralJump::TetrahedralJump(const double delta, const double eta, std::mt19937_64& rng) :
Motion(std::string{"TetrahedralJump"}, delta, eta, rng) {}
2024-08-16 17:55:27 +00:00
TetrahedralJump::TetrahedralJump(std::mt19937_64& rng) : Motion(std::string{"TetrahedralJump"}, rng) {}
2024-08-16 17:55:27 +00:00
2024-08-18 11:21:27 +00:00
void TetrahedralJump::initialize() {
2024-08-23 16:33:38 +00:00
const auto pos = draw_position();
m_corners[0] = omega_q(pos);
2024-08-20 15:51:49 +00:00
2024-08-23 16:33:38 +00:00
const double alpha = 2. * M_PI * m_uni_dist(m_rng);
2024-08-20 15:51:49 +00:00
for (int i = 1; i<4; i++) {
2024-08-23 16:33:38 +00:00
auto corner_pos = rotate(pos, m_beta, alpha + (i-1) * 2*M_PI/3.);
m_corners[i] = omega_q(corner_pos);
2024-08-20 15:51:49 +00:00
}
2024-08-18 11:21:27 +00:00
}
2024-08-16 17:55:27 +00:00
double TetrahedralJump::jump() {
2024-08-20 15:51:49 +00:00
m_corner_idx += m_chooser(m_rng);
m_corner_idx %= 4;
return m_corners[m_corner_idx];
2024-08-16 17:55:27 +00:00
}