39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "isosmallangle.h"
|
|
#include "coordinates.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
namespace motions {
|
|
SmallAngle::SmallAngle(const double delta, const double eta, const double chi, std::mt19937_64 &rng) :
|
|
BaseMotion(std::string("IsotropicAngle"), delta, eta, rng), m_chi(chi * M_PI / 180.0) {}
|
|
SmallAngle::SmallAngle(std::mt19937_64 &rng) : BaseMotion(std::string("IsotropicAngle"), rng) {}
|
|
|
|
void SmallAngle::initialize() {
|
|
m_prev_pos = draw_position();
|
|
m_initial_omega = omega_q(m_prev_pos);
|
|
}
|
|
|
|
double SmallAngle::jump() {
|
|
const double gamma{2 * M_PI * m_uni_dist(m_rng)};
|
|
m_prev_pos = rotate(m_prev_pos, m_chi, gamma);
|
|
|
|
return omega_q(m_prev_pos);
|
|
}
|
|
|
|
void SmallAngle::setParameters(const std::unordered_map<std::string, double> ¶meters) {
|
|
m_chi = parameters.at("angle") * M_PI / 180.0;
|
|
BaseMotion::setParameters(parameters);
|
|
}
|
|
|
|
std::unordered_map<std::string, double> SmallAngle::getParameters() const {
|
|
auto parameter = BaseMotion::getParameters();
|
|
parameter["angle"] = m_chi * 180 / M_PI;
|
|
return parameter;
|
|
}
|
|
|
|
std::string SmallAngle::toString() const {
|
|
return std::string{"IsotropicAngle/angle=" + std::to_string(m_chi * 180 / M_PI)};
|
|
}
|
|
}
|