From bfb1cb314c6ff6840b35cb1ca9b04e8f3dd5d3ff Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Sun, 15 Dec 2024 18:34:05 +0100 Subject: [PATCH] add more motions --- angle_dependence.py | 12 +++++++ process_spectrum.py | 41 +++++++++++++++++++++ process_sims.py => process_ste.py | 4 --- python/helpers.py | 1 - python/spectrum.py | 52 +++++++++++++++------------ python/ste.py | 6 ++-- src/CMakeLists.txt | 1 - src/motions/CMakeLists.txt | 2 ++ src/motions/base.cpp | 20 ++++++++--- src/motions/base.h | 2 +- src/motions/bimodalangle.cpp | 6 ++-- src/motions/bimodalangle.h | 2 +- src/motions/conewobble.cpp | 2 +- src/motions/conewobble.h | 2 +- src/motions/coordinates.cpp | 6 ++-- src/motions/foursitejump.cpp | 2 +- src/motions/isosmallangle.cpp | 6 ++-- src/motions/nsiteconejump.cpp | 59 +++++++++++++++++++++++++++++++ src/motions/nsiteconejump.h | 33 +++++++++++++++++ src/motions/rjoac.cpp | 2 +- src/motions/rjoac.h | 2 +- src/motions/sixsitejump.cpp | 35 ++++++++++-------- src/motions/sixsitejump.h | 8 ++--- src/times/base.h | 2 +- src/utils/io.cpp | 4 +-- start_sims.py | 2 ++ 26 files changed, 243 insertions(+), 71 deletions(-) create mode 100644 process_spectrum.py rename process_sims.py => process_ste.py (97%) create mode 100644 src/motions/nsiteconejump.cpp create mode 100644 src/motions/nsiteconejump.h diff --git a/angle_dependence.py b/angle_dependence.py index f699eea..06a1ac4 100644 --- a/angle_dependence.py +++ b/angle_dependence.py @@ -35,6 +35,18 @@ for fit_files in pathlib.Path('.').glob(f'IsotropicAngle/angle=*/Delta/tau=*/ste tau_cc.append(fit_values[nearest_idx, 1]) tau_ss.append(fit_values[nearest_idx, 4]) +angles = np.array(angles) +tau_cc = np.array(tau_cc) +tau_ss = np.array(tau_ss) +tau2 = np.array(tau2) + + +sortidx = np.argsort(angles) +angles = angles[sortidx] +tau_cc = tau_cc[sortidx] +tau_ss = tau_ss[sortidx] +tau2 = tau2[sortidx] + plt.semilogy(angles, tau_cc, '-.') plt.semilogy(angles, tau_ss, '--') diff --git a/process_spectrum.py b/process_spectrum.py new file mode 100644 index 0000000..5be4b6f --- /dev/null +++ b/process_spectrum.py @@ -0,0 +1,41 @@ +import pathlib + +import matplotlib.pyplot as plt + +from python.spectrum import * + +tpulse = 3e-6 +gb = 4e3 + +fig_spec, ax_spec = plt.subplots() + +# for conf_file in pathlib.Path('.').glob(f'SixSiteOctahedral/angle=59/Delta/tau=*/timesignal_*_parameter.txt'): +for conf_file in pathlib.Path('.').glob(f'RandomJumpOnCone/angle=128.*/Delta/tau=*/timesignal_*_parameter.txt'): + vary_string = post_process_spectrum(conf_file, tpulse=tpulse, apod=gb) + print(conf_file) + +# ax_spec +# +# ax_tau_cc.semilogy(tau_cc[:, 0], tau_cc[:, 1], label=vary_string) +# ax_tau_cc.axhline(tau_2[:, 1], color='k', linestyle='--') +# ax_beta_cc.plot(*beta_cc.T, label=vary_string) +# ax_finfty_cc.plot(*finfty_cc.T, label=vary_string) +# ax_tau_ss.semilogy(tau_ss[:, 0], tau_ss[:, 1], label=vary_string) +# ax_tau_ss.axhline(tau_2[:, 1], color='k', linestyle='--') +# ax_beta_ss.plot(*beta_ss.T, label=vary_string) +# ax_finfty_ss.plot(*finfty_ss.T, label=vary_string) +# +# np.savetxt( +# conf_file.with_name(f'ste_fit_{vary_string}.dat'), +# np.c_[ +# tau_cc, beta_cc[:, 1], finfty_cc[:, 1], +# tau_ss[:, 1], beta_ss[:, 1], finfty_ss[:, 1], +# ], +# header=f'Fit STE {vary_string}\n' +# f'F2: tau={tau_2[0, 1]} beta={beta_2[0, 1]} finfty={finfty_2[0, 1]}\n' +# f'tevo\ttaucc\tbetacc\tfinftycc\ttauss\tbetass\tfinftyss', +# ) +# +# for ax in [ax_tau_cc, ax_beta_cc, ax_finfty_cc, ax_tau_ss, ax_beta_ss, ax_finfty_ss]: +# ax.legend() +# plt.show() diff --git a/process_sims.py b/process_ste.py similarity index 97% rename from process_sims.py rename to process_ste.py index 64f4288..28ec206 100644 --- a/process_sims.py +++ b/process_ste.py @@ -1,7 +1,3 @@ -import pathlib - -import matplotlib.pyplot as plt - from python.ste import * fig_tau_cc, ax_tau_cc = plt.subplots() diff --git a/python/helpers.py b/python/helpers.py index c350151..75585c5 100644 --- a/python/helpers.py +++ b/python/helpers.py @@ -1,7 +1,6 @@ from __future__ import annotations import pathlib -import re import subprocess from itertools import product diff --git a/python/spectrum.py b/python/spectrum.py index 6fa64b0..e9d8e87 100644 --- a/python/spectrum.py +++ b/python/spectrum.py @@ -1,8 +1,7 @@ -import numpy import numpy as np -from matplotlib import pyplot - +import matplotlib.pyplot as plt +from python.helpers import read_parameter_file # parameter for spectrum simulations lb = 2e3 @@ -41,30 +40,39 @@ def pulse_attn(freq: np.ndarray, t_pulse: float) -> np.ndarray: return np.pi * numerator / denominator / 2 -def post_process_spectrum(taus, apod, tpulse): - reduction_factor = np.zeros((taus.size, 5)) # hard-coded t_echo :( +def post_process_spectrum(parameter_file, apod, tpulse): + parameter = read_parameter_file(parameter_file) - for i, tau in enumerate(taus): - try: - raw_data = np.loadtxt(f'fid_tau={tau:.6e}.dat') - except OSError: - continue + # files have form ste_arg=0.000000e+01_parameter.txt, first remove ste part then parameter.txt to get variables + varied_string = str(parameter_file).partition('_')[-1].rpartition('_')[0] - t = raw_data[:, 0] - timesignal = raw_data[:, 1:] + # make evolution times + tevo = np.linspace(parameter['techo_start'], parameter['techo_stop'], num=int(parameter['techo_steps'])) - timesignal *= dampening(t, apod)[:, None] - timesignal[0, :] /= 2 + if varied_string: + raw_data = np.loadtxt(parameter_file.with_name(f'timesignal_{varied_string}.dat')) + else: + raw_data = np.loadtxt(parameter_file.with_name(f'timesignal.dat')) - # FT to spectrum - freq = np.fft.fftshift(np.fft.fftfreq(t.size, d=1e-6)) - spec = np.fft.fftshift(np.fft.fft(timesignal, axis=0), axes=0).real - spec *= pulse_attn(freq, t_pulse=tpulse)[:, None] + t = raw_data[:, 0] + timesignal = raw_data[:, 1:] - reduction_factor[i, :] = 2*timesignal[0, :] + timesignal *= dampening(t, apod)[:, None] + timesignal[0, :] /= 2 - plt.plot(freq, spec) - plt.show() + # FT to spectrum + freq = np.fft.fftshift(np.fft.fftfreq(t.size, d=parameter['dwell_time'])) + spec = np.fft.fftshift(np.fft.fft(timesignal, axis=0), axes=0).real + spec *= pulse_attn(freq, t_pulse=tpulse)[:, None] - plt.semilogx(taus, reduction_factor, '.') + # + # + # reduction_factor[i, :] = 2*timesignal[0, :] + + + plt.plot(freq, spec) + plt.gca().set_title(varied_string) plt.show() + # + # plt.semilogx(taus, reduction_factor, '.') + # plt.show() diff --git a/python/ste.py b/python/ste.py index 563140d..c790796 100644 --- a/python/ste.py +++ b/python/ste.py @@ -1,6 +1,5 @@ import pathlib -import numpy import numpy as np from matplotlib import pyplot as plt from scipy.optimize import curve_fit @@ -74,7 +73,10 @@ def fit_ste( # make evolution times tevo = np.linspace(parameter['tevo_start'], parameter['tevo_stop'], num=int(parameter['tevo_steps'])) - raw_data = np.loadtxt(parameter_file.with_name(f'{prefix}_{varied_string}.dat')) + if varied_string: + raw_data = np.loadtxt(parameter_file.with_name(f'{prefix}_{varied_string}.dat')) + else: + raw_data = np.loadtxt(parameter_file.with_name(f'{prefix}.dat')) t_mix = raw_data[:, 0] decay = raw_data[:, 1:] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea5f814..2f3621e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,6 @@ add_subdirectory(utils) add_library(simulation STATIC sims.cpp sims.h) target_link_libraries(simulation PRIVATE utils) - add_executable( rwsim main.cpp diff --git a/src/motions/CMakeLists.txt b/src/motions/CMakeLists.txt index 76b5dad..20ce6a8 100644 --- a/src/motions/CMakeLists.txt +++ b/src/motions/CMakeLists.txt @@ -19,5 +19,7 @@ add_library( bimodalangle.h sixsitejump.cpp sixsitejump.h + nsiteconejump.cpp + nsiteconejump.h ) diff --git a/src/motions/base.cpp b/src/motions/base.cpp index 5a34531..96ee8f2 100644 --- a/src/motions/base.cpp +++ b/src/motions/base.cpp @@ -1,14 +1,20 @@ #include "base.h" + +#include + #include "coordinates.h" #include "bimodalangle.h" #include "isosmallangle.h" #include "random.h" #include "foursitejump.h" +#include "nsiteconejump.h" +#include "sixsitejump.h" +#include "rjoac.h" #include -#include "sixsitejump.h" + namespace motions { BaseMotion::BaseMotion(std::string name, const double delta, const double eta, std::mt19937_64& rng) : m_name(std::move(name)), m_delta(delta), m_eta(eta), m_rng(rng) { @@ -43,8 +49,8 @@ namespace motions { if (input == "FourSiteTetrahedral") return new FourSiteTetrahedron(rng); - if (input == "SixSiteOctahedral") - return new SixSiteOctahedron(rng); + if (input == "SixSiteOctahedralC3") + return new SixSiteOctahedronC3(rng); if (input == "IsotropicAngle") return new SmallAngle(rng); @@ -55,6 +61,12 @@ namespace motions { if (input == "BimodalAngle") return new BimodalAngle(rng); + if (input == "NSiteConeJump") + return new NSiteJumpOnCone(rng); + + if (input == "RandomJumpOnCone") + return new RandomJumpOnCone(rng); + throw std::invalid_argument("Invalid input " + input); } @@ -74,4 +86,4 @@ namespace motions { os << m.getName(); return os; } -} \ No newline at end of file +} diff --git a/src/motions/base.h b/src/motions/base.h index 8022b3d..68f6961 100644 --- a/src/motions/base.h +++ b/src/motions/base.h @@ -28,7 +28,7 @@ namespace motions { [[nodiscard]] double getEta() const { return m_eta; } void setEta(const double eta) { m_eta = eta; } [[nodiscard]] std::string getName() const { return m_name; } - [[nodiscard]] double getInitOmega() const { return m_initial_omega; }; + [[nodiscard]] double getInitOmega() const { return m_initial_omega; } [[nodiscard]] virtual std::string toString() const = 0; diff --git a/src/motions/bimodalangle.cpp b/src/motions/bimodalangle.cpp index 6712104..be64719 100644 --- a/src/motions/bimodalangle.cpp +++ b/src/motions/bimodalangle.cpp @@ -8,18 +8,18 @@ namespace motions { BaseMotion(std::string("BimodalAngle"), delta, eta, rng), m_angle1(angle1 * M_PI / 180.0), m_angle2(angle2 * M_PI / 180.0), - m_prob(prob) {}; + m_prob(prob) {} BimodalAngle::BimodalAngle(std::mt19937_64 &rng) : BaseMotion(std::string("BimodalAngle"), rng) {} void BimodalAngle::initialize() { m_prev_pos = draw_position(); m_initial_omega = omega_q(m_prev_pos); - }; + } double BimodalAngle::jump() { const double angle = m_uni_dist(m_rng) < m_prob ? m_angle1 : m_angle2; const double gamma{2 * M_PI * m_uni_dist(m_rng)}; - m_prev_pos = coordinates::rotate(m_prev_pos, angle, gamma); + m_prev_pos = rotate(m_prev_pos, angle, gamma); return omega_q(m_prev_pos); } diff --git a/src/motions/bimodalangle.h b/src/motions/bimodalangle.h index ac148ce..6b05ace 100644 --- a/src/motions/bimodalangle.h +++ b/src/motions/bimodalangle.h @@ -6,7 +6,7 @@ #include "coordinates.h" namespace motions { - class BimodalAngle : public BaseMotion { + class BimodalAngle final : public BaseMotion { public: BimodalAngle(double, double, double, double, double, std::mt19937_64& ); explicit BimodalAngle(std::mt19937_64&); diff --git a/src/motions/conewobble.cpp b/src/motions/conewobble.cpp index 75fe8fa..660d7c1 100644 --- a/src/motions/conewobble.cpp +++ b/src/motions/conewobble.cpp @@ -16,7 +16,7 @@ namespace motions { double WobbleCone::jump() { const double real_angle = m_uni_dist(m_rng) * m_angle; const double phi = 2 * M_PI * m_uni_dist(m_rng); - return omega_q(coordinates::rotate(m_axis, real_angle, phi)); + return omega_q(rotate(m_axis, real_angle, phi)); } void WobbleCone::setParameters(const std::unordered_map ¶meters) { diff --git a/src/motions/conewobble.h b/src/motions/conewobble.h index 65f5ec5..715be43 100644 --- a/src/motions/conewobble.h +++ b/src/motions/conewobble.h @@ -7,7 +7,7 @@ #include namespace motions { - class WobbleCone: public BaseMotion { + class WobbleCone final: public BaseMotion { public: WobbleCone(double, double, double, std::mt19937_64&); explicit WobbleCone(std::mt19937_64&); diff --git a/src/motions/coordinates.cpp b/src/motions/coordinates.cpp index fe4b6c6..0141500 100644 --- a/src/motions/coordinates.cpp +++ b/src/motions/coordinates.cpp @@ -22,9 +22,9 @@ namespace coordinates { auto [x, y , z] = spherical_to_xyz(old_pos); const auto new_pos = CartesianPos{ - cos_alpha * x + sin_alpha * (-x * z * sin_beta - y * cos_beta) / norm, - cos_alpha * y + sin_alpha * (-y * z * sin_beta + x * cos_beta) / norm, - cos_alpha * z + sin_alpha * norm * sin_beta + cos_alpha * x + sin_alpha * (-cos_beta * y - sin_beta * x * z) / norm, + cos_alpha * y + sin_alpha * (cos_beta * x - sin_beta * y * z) / norm, + cos_alpha * z + sin_alpha * sin_beta * norm, }; return xyz_to_spherical(new_pos); diff --git a/src/motions/foursitejump.cpp b/src/motions/foursitejump.cpp index b35c374..40fc5cf 100644 --- a/src/motions/foursitejump.cpp +++ b/src/motions/foursitejump.cpp @@ -16,7 +16,7 @@ namespace motions { const double alpha = 2. * M_PI * m_uni_dist(m_rng); for (int i = 1; i<4; i++) { - auto corner_pos = coordinates::rotate(pos, m_beta, alpha + (i-1) * 2*M_PI/3.); + auto corner_pos = rotate(pos, m_beta, alpha + (i-1) * 2*M_PI/3.); m_corners[i] = omega_q(corner_pos); } m_initial_omega = FourSiteTetrahedron::jump(); diff --git a/src/motions/isosmallangle.cpp b/src/motions/isosmallangle.cpp index 58f07b0..be6ebeb 100644 --- a/src/motions/isosmallangle.cpp +++ b/src/motions/isosmallangle.cpp @@ -6,17 +6,17 @@ 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) {}; + 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 = coordinates::rotate(m_prev_pos, m_chi, gamma); + m_prev_pos = rotate(m_prev_pos, m_chi, gamma); return omega_q(m_prev_pos); } diff --git a/src/motions/nsiteconejump.cpp b/src/motions/nsiteconejump.cpp new file mode 100644 index 0000000..56976dd --- /dev/null +++ b/src/motions/nsiteconejump.cpp @@ -0,0 +1,59 @@ +// +// Created by dominik on 12/14/24. +// + +#include "nsiteconejump.h" +#include "coordinates.h" + +#include +#include +#include +#include + +namespace motions { + NSiteJumpOnCone::NSiteJumpOnCone(const double delta, const double eta, const int num_sites, const double chi, std::mt19937_64 &rng) : + BaseMotion("NSiteJumpOnCone", delta, eta, rng), + m_num_sites(num_sites), + m_chi(chi*M_PI/180.) {} + + NSiteJumpOnCone::NSiteJumpOnCone(std::mt19937_64 &rng) : BaseMotion("NSiteJumpOnCone", rng) { } + + void NSiteJumpOnCone::initialize() { + m_sites = std::vector(m_num_sites); + m_chooser = std::uniform_int_distribution<>{1, m_num_sites - 1}; + + m_axis = draw_position(); + + const double alpha = m_uni_dist(m_rng) * 2 * M_PI; + const double steps = 2*M_PI / m_num_sites; + for (int i = 0; i < m_num_sites; i++) { + m_sites[i] = omega_q(rotate(m_axis, m_chi, i * steps + alpha)); + } + } + + double NSiteJumpOnCone::jump() { + m_cone_idx += m_chooser(m_rng); + m_cone_idx %= m_num_sites; + + return m_sites[m_cone_idx]; + } + + void NSiteJumpOnCone::setParameters(const std::unordered_map ¶meters) { + BaseMotion::setParameters(parameters); + m_num_sites = static_cast(parameters.at("num_sites")); + m_chi = parameters.at("chi") * M_PI/180.; + } + + std::unordered_map NSiteJumpOnCone::getParameters() const { + auto parameter = BaseMotion::getParameters(); + parameter["num_sites"] = m_num_sites; + parameter["chi"] = m_chi * 180. / M_PI; + + return parameter; + } + + std::string NSiteJumpOnCone::toString() const { + return std::to_string(m_num_sites) + "SiteJumpOnCone/angle=" + std::to_string(m_chi*180/M_PI); + } + +} // motions \ No newline at end of file diff --git a/src/motions/nsiteconejump.h b/src/motions/nsiteconejump.h new file mode 100644 index 0000000..116f620 --- /dev/null +++ b/src/motions/nsiteconejump.h @@ -0,0 +1,33 @@ +#ifndef NSITEJUMPONCONE_H +#define NSITEJUMPONCONE_H + +#include "base.h" + +#include +#include + +namespace motions { + class NSiteJumpOnCone final : public BaseMotion { + public: + NSiteJumpOnCone(double, double, int, double, std::mt19937_64&); + explicit NSiteJumpOnCone(std::mt19937_64&); + + void initialize() override; + double jump() override; + + [[nodiscard]] std::string toString() const override; + + void setParameters(const std::unordered_map &) override; + [[nodiscard]] std::unordered_map getParameters() const override; + + private: + int m_num_sites{2}; + std::vector m_sites{}; + double m_chi{1./2.}; + int m_cone_idx = 0; + coordinates::SphericalPos m_axis{1, 0}; + std::uniform_int_distribution<> m_chooser; + }; +} // motions + +#endif //NSITEJUMPONCONE_H diff --git a/src/motions/rjoac.cpp b/src/motions/rjoac.cpp index e64b3b3..098e848 100644 --- a/src/motions/rjoac.cpp +++ b/src/motions/rjoac.cpp @@ -11,7 +11,7 @@ namespace motions { double RandomJumpOnCone::jump() { const double phi = 2 * M_PI * m_uni_dist(m_rng); - return omega_q(coordinates::rotate(m_axis, m_angle, phi)); + return omega_q(rotate(m_axis, m_angle, phi)); } void RandomJumpOnCone::setParameters(const std::unordered_map ¶meters) { diff --git a/src/motions/rjoac.h b/src/motions/rjoac.h index 59eca9b..d96a7ac 100644 --- a/src/motions/rjoac.h +++ b/src/motions/rjoac.h @@ -7,7 +7,7 @@ #include namespace motions { - class RandomJumpOnCone: public BaseMotion { + class RandomJumpOnCone final: public BaseMotion { public: RandomJumpOnCone(double, double, double, std::mt19937_64&); explicit RandomJumpOnCone(std::mt19937_64&); diff --git a/src/motions/sixsitejump.cpp b/src/motions/sixsitejump.cpp index abf83c4..c34bf7d 100644 --- a/src/motions/sixsitejump.cpp +++ b/src/motions/sixsitejump.cpp @@ -1,34 +1,41 @@ #include "sixsitejump.h" + +#include +#include + #include "coordinates.h" namespace motions { - SixSiteOctahedron::SixSiteOctahedron(const double delta, const double eta, std::mt19937_64& rng) : + SixSiteOctahedronC3::SixSiteOctahedronC3(const double delta, const double eta, const double chi, std::mt19937_64& rng) : + m_chi{chi*M_PI/180.}, BaseMotion(std::string{"SixSiteOctahedral"}, delta, eta, rng) {} - SixSiteOctahedron::SixSiteOctahedron(std::mt19937_64& rng) : BaseMotion(std::string{"SixSiteOctahedral"}, rng) {} - - void SixSiteOctahedron::initialize() { - const auto pos = draw_position(); - m_corners[0] = omega_q(pos); - m_corners[1] = omega_q(rotate(pos, M_PI, 0)); + SixSiteOctahedronC3::SixSiteOctahedronC3(std::mt19937_64& rng) : BaseMotion(std::string{"SixSiteOctahedralC3"}, rng) {} + void SixSiteOctahedronC3::initialize() { + const coordinates::SphericalPos c3_axis = draw_position(); + const auto [x, y, z] = spherical_to_xyz(c3_axis); const double alpha = 2. * M_PI * m_uni_dist(m_rng); - for (int i = 2; i<6; i++) { - auto corner_pos = coordinates::rotate(pos, M_PI_2, alpha + (i-2) * M_PI_2); - m_corners[i] = omega_q(corner_pos); + const double m_chi_opposite = M_PI - m_chi; + + for (int i = 0; i<3; i++) { + m_corners[2*i] = omega_q(rotate(c3_axis, m_chi, alpha + i * 2./3.*M_PI)); + m_corners[2*i+1] = omega_q(rotate(c3_axis, m_chi_opposite, alpha + i * 2./3.*M_PI + M_PI/3.)); } - m_initial_omega = SixSiteOctahedron::jump(); + + m_initial_omega = SixSiteOctahedronC3::jump(); } - double SixSiteOctahedron::jump() { + + double SixSiteOctahedronC3::jump() { m_corner_idx += m_chooser(m_rng); m_corner_idx %= 6; return m_corners[m_corner_idx]; } - std::string SixSiteOctahedron::toString() const { - return {"SixSiteOctahedral"}; + std::string SixSiteOctahedronC3::toString() const { + return {"SixSiteOctahedral/angle=" + std::to_string(m_chi / M_PI * 180.)}; } } diff --git a/src/motions/sixsitejump.h b/src/motions/sixsitejump.h index 32fe9d6..8e203f6 100644 --- a/src/motions/sixsitejump.h +++ b/src/motions/sixsitejump.h @@ -9,10 +9,10 @@ #include namespace motions { - class SixSiteOctahedron final : public BaseMotion { + class SixSiteOctahedronC3 final : public BaseMotion { public: - SixSiteOctahedron(double, double, std::mt19937_64&); - explicit SixSiteOctahedron(std::mt19937_64&); + SixSiteOctahedronC3(double, double, double, std::mt19937_64&); + explicit SixSiteOctahedronC3(std::mt19937_64&); void initialize() override; double jump() override; @@ -20,7 +20,7 @@ namespace motions { [[nodiscard]] std::string toString() const override; private: - const double m_beta{std::acos(-1/3.)}; + const double m_chi{0.95531661812450927816385710251575775424341469501000549095969812932191204590}; // 54.74 deg std::array m_corners{}; int m_corner_idx{0}; diff --git a/src/times/base.h b/src/times/base.h index afcf136..f909e5f 100644 --- a/src/times/base.h +++ b/src/times/base.h @@ -14,7 +14,7 @@ namespace times { [[nodiscard]] double getTau() const { return m_tau; } void setTau(const double tau) { m_tau = tau; } - [[nodiscard]] std::string getName() const { return m_name; }; + [[nodiscard]] std::string getName() const { return m_name; } virtual void setParameters(const std::unordered_map&); [[nodiscard]] virtual std::unordered_map getParameters() const; diff --git a/src/utils/io.cpp b/src/utils/io.cpp index 3664e57..d0fa0fa 100644 --- a/src/utils/io.cpp +++ b/src/utils/io.cpp @@ -25,7 +25,7 @@ std::pair get_optional_parameter(std::vector:: stripped_arg = it->substr(1, it->size()); } std::transform(stripped_arg.begin(), stripped_arg.end(), stripped_arg.begin(), [](unsigned char c) { return std::tolower(c); }); - const auto stripped_value = std::stod(*(++it), nullptr); + const auto stripped_value = std::stod(*++it, nullptr); return std::make_pair(stripped_arg, stripped_value); } @@ -95,7 +95,7 @@ Arguments parse_args(const int argc, char* argv[]) { std::unordered_map read_parameter(const std::filesystem::path& infile) { - if (!std::filesystem::exists(infile)) { + if (!exists(infile)) { std::cerr << "File " << infile << " does not exist" << std::endl; exit(1); } diff --git a/start_sims.py b/start_sims.py index 9baaa0f..ede7a1a 100644 --- a/start_sims.py +++ b/start_sims.py @@ -1,3 +1,5 @@ +import numpy as np + from python.helpers import * #Simulation parameter