Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::analysis::DynamicsAnalyzer Class Reference

Static class providing dynamics analysis methods. More...

#include <DynamicsAnalyzer.hpp>

Public Member Functions

 DynamicsAnalyzer ()=delete

Static Public Member Functions

Calculation Methods
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).
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 (at t=0).
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).
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).
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.
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.
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 time series.
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).
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.

Detailed Description

Static class providing dynamics analysis methods.

This class contains stateless static methods for calculating time-dependent properties like VACF and VDOS from correlation::core::Trajectory data.

Constructor & Destructor Documentation

◆ DynamicsAnalyzer()

correlation::analysis::DynamicsAnalyzer::DynamicsAnalyzer ( )
delete

Member Function Documentation

◆ calculateMSD()

std::vector< real_t > correlation::analysis::DynamicsAnalyzer::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 )
staticnodiscard

Calculates the Mean Squared Displacement (MSD).

MSD(t) = < |r_i(t0 + t) - r_i(t0)|^2 >

Uses unwrapped (continuous) trajectories to correctly handle atoms crossing periodic boundary conditions. The displacement is accumulated frame-by-frame using the minimum image convention, so no stored unwrapped positions are needed. Time-averaging over all valid origins is used for maximum statistical efficiency.

Parameters
trajThe trajectory containing atomic positions.
max_correlation_framesThe maximum lag (in frames) to compute. Pass -1 to use half the trajectory length (recommended).
start_frameFirst frame to include (default: 0).
end_frameOne-past-last frame to include (default: all frames).
remove_com_driftRemove center-of-mass drift when num_atoms > 1 (default: true).
Returns
A vector of MSD values indexed by lag (in Ų).
Here is the call graph for this function:

◆ calculateNormalizedVACF()

std::vector< real_t > correlation::analysis::DynamicsAnalyzer::calculateNormalizedVACF ( const correlation::core::Trajectory & traj,
MaxFrames max_correlation_frames,
StartFrame start_frame = {0},
EndFrame end_frame = {static_cast<size_t>(-1)} )
staticnodiscard

Calculates the Normalized Velocity Autocorrelation Function. Divides the VACF by its initial value (at t=0).

Parameters
trajThe trajectory containing pre-calculated velocities.
max_correlation_framesThe maximum time lag.
start_frameFirst frame to include (default: 0).
end_frameOne-past-last frame to include (default: all frames).
Returns
A vector containing the normalized VACF values.
Here is the call graph for this function:

◆ calculatePartialMSD()

PartialMSDResult correlation::analysis::DynamicsAnalyzer::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 )
staticnodiscard

Calculates total and per-element Mean Squared Displacements (MSD).

Parameters
trajThe trajectory containing atomic positions.
max_correlation_framesMaximum lag in frames (-1 = half trajectory).
start_frameFirst frame to include (default: 0).
end_frameOne-past-last frame to include (default: all frames).
remove_com_driftRemove center-of-mass drift when num_atoms > 1 (default: true).
Returns
PartialMSDResult containing total and per-element MSDs (in Ų).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculatePartialVACF()

PartialVACFResult correlation::analysis::DynamicsAnalyzer::calculatePartialVACF ( const correlation::core::Trajectory & traj,
MaxFrames max_correlation_frames,
StartFrame start_frame = {0},
EndFrame end_frame = {static_cast<size_t>(-1)} )
staticnodiscard

Calculates total (unweighted and mass-weighted) and per-element VACFs.

Parameters
trajThe trajectory containing pre-calculated velocities.
max_correlation_framesMaximum time lag in frames (-1 = half trajectory).
start_frameFirst frame to include (default: 0).
end_frameOne-past-last frame to include (default: all frames).
Returns
PartialVACFResult containing total and per-element VACFs and mass weights.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateVACF()

std::vector< real_t > correlation::analysis::DynamicsAnalyzer::calculateVACF ( const correlation::core::Trajectory & traj,
MaxFrames max_correlation_frames,
StartFrame start_frame = {0},
EndFrame end_frame = {static_cast<size_t>(-1)} )
staticnodiscard

Calculates the Velocity Autocorrelation Function (VACF).

\( C(t) = \langle \mathbf{v}(t_0) \cdot \mathbf{v}(t_0 + t) \rangle \)

Parameters
trajThe trajectory containing pre-calculated velocities.
max_correlation_framesThe maximum time lag (in frames) to calculate correlation for.
start_frameFirst frame to include (default: 0).
end_frameOne-past-last frame to include (default: all frames).
Returns
A vector containing the VACF values for lag times 0 to max_correlation_frames.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateVDOS()

std::pair< std::vector< real_t >, std::vector< real_t > > correlation::analysis::DynamicsAnalyzer::calculateVDOS ( const std::vector< real_t > & vacf,
real_t time_step,
VDOSWindowType window_type = VDOSWindowType::Hann,
size_t zero_pad_factor = 4 )
staticnodiscard

Calculates the Vibrational Density of States (VDOS) from the VACF.

Evaluates the real one-sided Fourier cosine transform via a zero-padded even-symmetric FFT (DCT-I equivalent) after applying a smooth time-domain half-window:

\[ g(\nu) = 2 \int_0^{t_{\max}} C(t)\,w(t)\,\cos(2\pi \nu t)\,\mathrm{d}t \]

Parameters
vacfThe Velocity Autocorrelation Function.
time_stepThe time step between frames (in femtoseconds).
window_typeTime-domain tapering half-window (default: Half-Hann).
zero_pad_factorZero-padding multiplier for frequency interpolation (>= 1, default: 4).
Returns
A pair: {frequencies (THz, >= 0), intensities (>= 0)}.
Here is the call graph for this function:

◆ computeDiffusionCoefficientMSD()

real_t correlation::analysis::DynamicsAnalyzer::computeDiffusionCoefficientMSD ( const std::vector< real_t > & time,
const std::vector< real_t > & msd )
staticnodiscard

Computes the self-diffusion coefficient D from MSD using linear regression on the second half of the time series.

Parameters
timeThe time values (bins).
msdThe MSD values.
Returns
The diffusion coefficient in Ų/fs.
Here is the caller graph for this function:

◆ computeDiffusionCoefficientVACF()

real_t correlation::analysis::DynamicsAnalyzer::computeDiffusionCoefficientVACF ( const std::vector< real_t > & time,
const std::vector< real_t > & vacf )
staticnodiscard

Computes the self-diffusion coefficient D from VACF using Green-Kubo integration (trapezoidal rule).

Parameters
timeThe time values (bins).
vacfThe VACF values.
Returns
The diffusion coefficient in Ų/fs.
Here is the caller graph for this function:

◆ computeRelaxationTime()

real_t correlation::analysis::DynamicsAnalyzer::computeRelaxationTime ( const std::vector< real_t > & time,
const std::vector< real_t > & normalized_vacf )
staticnodiscard

Computes the relaxation time tau from the normalized VACF using trapezoidal integration.

Parameters
timeThe time values (bins).
normalized_vacfThe normalized VACF values.
Returns
The relaxation time in fs.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: