cpp/motions/tetrahedral.cpp
2024-11-09 17:59:37 +01:00

31 lines
807 B
C++

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