Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
DynamicsAnalyzer.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
12#include "core/Trajectory.hpp"
13
14#include <map>
15#include <string>
16#include <utility>
17#include <vector>
18
19namespace correlation::analysis {
20
26 std::vector<real_t> total_unweighted;
27 std::vector<real_t> total_mass_weighted;
28 std::map<std::string, std::vector<real_t>> element_vacfs;
29 std::map<std::string, real_t> element_mass_weights;
30};
31
37 std::vector<real_t> total;
38 std::map<std::string, std::vector<real_t>> element_msds;
39};
40
48public:
49 DynamicsAnalyzer() = delete;
50
53
66 [[nodiscard]] static std::vector<real_t>
67 calculateVACF(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames,
68 StartFrame start_frame = {0}, EndFrame end_frame = {static_cast<size_t>(-1)});
69
80 [[nodiscard]] static std::vector<real_t>
82 MaxFrames max_correlation_frames, StartFrame start_frame = {0},
83 EndFrame end_frame = {static_cast<size_t>(-1)});
84
104 [[nodiscard]] static std::vector<real_t>
105 calculateMSD(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames,
106 StartFrame start_frame = {0}, EndFrame end_frame = {static_cast<size_t>(-1)},
107 bool remove_com_drift = true);
108
119 [[nodiscard]] static PartialMSDResult
120 calculatePartialMSD(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames,
121 StartFrame start_frame = {0}, EndFrame end_frame = {static_cast<size_t>(-1)},
122 bool remove_com_drift = true);
123
133 [[nodiscard]] static PartialVACFResult
134 calculatePartialVACF(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames,
135 StartFrame start_frame = {0},
136 EndFrame end_frame = {static_cast<size_t>(-1)});
137
152 [[nodiscard]] static std::pair<std::vector<real_t>, std::vector<real_t>>
153 calculateVDOS(const std::vector<real_t> &vacf, real_t time_step,
154 VDOSWindowType window_type = VDOSWindowType::Hann, size_t zero_pad_factor = 4);
155
163 [[nodiscard]] static real_t computeDiffusionCoefficientMSD(const std::vector<real_t> &time,
164 const std::vector<real_t> &msd);
165
173 [[nodiscard]] static real_t computeDiffusionCoefficientVACF(const std::vector<real_t> &time,
174 const std::vector<real_t> &vacf);
175
182 [[nodiscard]] static real_t computeRelaxationTime(const std::vector<real_t> &time,
183 const std::vector<real_t> &normalized_vacf);
184
186};
187
188} // namespace correlation::analysis
Trajectory data structure for time-series atomistic simulations.
static PartialMSDResult calculatePartialMSD(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)}, bool remove_com_drift=true)
Calculates total and per-element Mean Squared Displacements (MSD).
Definition DynamicsAnalyzer.cpp:431
static std::pair< std::vector< real_t >, std::vector< real_t > > calculateVDOS(const std::vector< real_t > &vacf, real_t time_step, VDOSWindowType window_type=VDOSWindowType::Hann, size_t zero_pad_factor=4)
Calculates the Vibrational Density of States (VDOS) from the VACF.
Definition DynamicsAnalyzer.cpp:552
static std::vector< real_t > calculateNormalizedVACF(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)})
Calculates the Normalized Velocity Autocorrelation Function. Divides the VACF by its initial value (a...
Definition DynamicsAnalyzer.cpp:538
static real_t computeDiffusionCoefficientVACF(const std::vector< real_t > &time, const std::vector< real_t > &vacf)
Computes the self-diffusion coefficient D from VACF using Green-Kubo integration (trapezoidal rule).
Definition DynamicsAnalyzer.cpp:640
static std::vector< real_t > calculateVACF(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)})
Calculates the Velocity Autocorrelation Function (VACF).
Definition DynamicsAnalyzer.cpp:423
static std::vector< real_t > calculateMSD(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)}, bool remove_com_drift=true)
Calculates the Mean Squared Displacement (MSD).
Definition DynamicsAnalyzer.cpp:528
static real_t computeDiffusionCoefficientMSD(const std::vector< real_t > &time, const std::vector< real_t > &msd)
Computes the self-diffusion coefficient D from MSD using linear regression on the second half of the ...
Definition DynamicsAnalyzer.cpp:597
static real_t computeRelaxationTime(const std::vector< real_t > &time, const std::vector< real_t > &normalized_vacf)
Computes the relaxation time tau from the normalized VACF using trapezoidal integration.
Definition DynamicsAnalyzer.cpp:663
static PartialVACFResult calculatePartialVACF(const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)})
Calculates total (unweighted and mass-weighted) and per-element VACFs.
Definition DynamicsAnalyzer.cpp:344
This class stores a series of snapshots of a system.
Definition Trajectory.hpp:32
Definition AnalysisTypes.hpp:11
VDOSWindowType
Time-domain tapering half-window applied to the VACF prior to Fourier cosine transform.
Definition AnalysisTypes.hpp:448
@ Hann
Half-Hann: 0.5 * (1 + cos(pi * t / t_max)) — exact zero at t_max (default).
Definition AnalysisTypes.hpp:449
double real_t
Definition Precision.hpp:18
Definition AnalysisTypes.hpp:21
Definition AnalysisTypes.hpp:13
Container for total and per-element Mean Squared Displacement (MSD) curves.
Definition DynamicsAnalyzer.hpp:36
std::map< std::string, std::vector< real_t > > element_msds
Per-element MSDs (Ų).
Definition DynamicsAnalyzer.hpp:38
std::vector< real_t > total
Total unweighted MSD (Ų).
Definition DynamicsAnalyzer.hpp:37
Container for total (unweighted and mass-weighted) and per-element VACF curves.
Definition DynamicsAnalyzer.hpp:25
std::vector< real_t > total_unweighted
Unweighted total VACF (Ų fs⁻²), for Green-Kubo D.
Definition DynamicsAnalyzer.hpp:26
std::map< std::string, real_t > element_mass_weights
Normalized mass weights w_α.
Definition DynamicsAnalyzer.hpp:29
std::map< std::string, std::vector< real_t > > element_vacfs
Per-element unweighted VACFs.
Definition DynamicsAnalyzer.hpp:28
std::vector< real_t > total_mass_weighted
Mass-weighted total VACF (Ų fs⁻²), for phonon VDOS.
Definition DynamicsAnalyzer.hpp:27
Definition AnalysisTypes.hpp:17