|
Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
|
Manages the calculation and storage of various distribution functions. More...
#include <DistributionFunctions.hpp>

Public Member Functions | |
Constructors | |
| DistributionFunctions (correlation::core::Cell cell, real_t cutoff=0.0, BondCutoffMatrix bond_cutoffs={}) | |
| Constructs a DistributionFunctions object. | |
| DistributionFunctions (DistributionFunctions &&other) noexcept | |
| Move constructor. | |
| DistributionFunctions & | operator= (DistributionFunctions &&other) noexcept |
| Move assignment operator. | |
| ~DistributionFunctions ()=default | |
| Default destructor. | |
| DistributionFunctions (const DistributionFunctions &)=delete | |
| Deleted copy constructor (contains non-copyable std::mutex). | |
| DistributionFunctions & | operator= (const DistributionFunctions &)=delete |
| Deleted copy assignment operator (contains non-copyable std::mutex). | |
Accessors | |
| const correlation::core::Cell & | cell () const |
| Access the underlying simulation cell. | |
| const Histogram & | getHistogram (const std::string &name) const |
| Access a specific calculated histogram by name. | |
| Histogram & | getMutableHistogram (const std::string &name) |
| Access a mutable calculated histogram by name. | |
| bool | hasHistogram (const std::string &name) const |
| Checks if a calculated histogram exists by name or alias. | |
| const std::map< std::string, Histogram > & | getAllHistograms () const |
| Access all calculated histograms. | |
| std::map< std::string, Histogram > & | getAllHistograms () noexcept |
| Access mutable collection of all calculated histograms. | |
| const std::map< std::string, real_t > & | getAshcroftWeights () const |
| Gets the Ashcroft-Langreth weights used for S(Q) partials. | |
| void | addHistogram (const std::string &name, Histogram &&histogram) |
| Manually add a histogram to the collection. | |
| bool | removeHistogram (const std::string &name) |
| Removes a histogram from the collection if present. | |
| const StructureAnalyzer * | neighbors () const |
| Returns the structure analyzer providing neighbor information. | |
| std::vector< std::string > | getAvailableHistograms () const |
| Gets a list of names for all currently available histograms. | |
| const DynamicProperties & | dynamicProperties () const noexcept |
| Gets the trajectory-wide dynamic properties. | |
| DynamicProperties & | dynamicProperties () noexcept |
| Gets mutable trajectory-wide dynamic properties. | |
| void | setDynamicProperties (const DynamicProperties &props) noexcept |
| Sets the trajectory-wide dynamic properties. | |
| real_t | getDiffusionCoefficientMSD () const noexcept |
| Gets the self-diffusion coefficient computed from Mean Squared Displacement (MSD). | |
| void | setDiffusionCoefficientMSD (real_t diff_coeff) noexcept |
| Sets the self-diffusion coefficient computed from Mean Squared Displacement (MSD). | |
| real_t | getDiffusionCoefficientVACF () const noexcept |
| Gets the self-diffusion coefficient computed from Velocity Autocorrelation Function (VACF). | |
| void | setDiffusionCoefficientVACF (real_t diff_coeff) noexcept |
| Sets the self-diffusion coefficient computed from Velocity Autocorrelation Function (VACF). | |
| real_t | getRelaxationTime () const noexcept |
| Gets the relaxation time computed from normalized VACF. | |
| void | setRelaxationTime (real_t relax_time) noexcept |
| Sets the relaxation time computed from normalized VACF. | |
| real_t | getDeborahNumber () const noexcept |
| Gets the Deborah number. | |
| void | setDeborahNumber (real_t deborah_num) noexcept |
| Sets the Deborah number. | |
| const HyperuniformityDiagnostics & | getHyperuniformityDiagnostics () const noexcept |
| Gets the scalar hyperuniformity diagnostics struct. | |
| void | setHyperuniformityDiagnostics (const HyperuniformityDiagnostics &diag) noexcept |
| Sets the scalar hyperuniformity diagnostics struct. | |
| real_t | getHyperuniformityBeta () const noexcept |
| Gets the real-space number variance scaling exponent β (σ²_N(R) ∝ R^β). | |
| real_t | getHyperuniformityChiH () const noexcept |
| Gets the large-R asymptotic real-space hyperuniformity index χ_H(R_max). | |
| real_t | getHyperuniformityHIndex () const noexcept |
| Gets the reciprocal-space Torquato-Stillinger index H = S(0⁺) / S(q_peak). | |
| real_t | getHyperuniformityAlpha () const noexcept |
| Gets the low-q structure factor scaling exponent α (S(q) ∝ q^α). | |
| const ElectronicDiagnostics & | getElectronicDiagnostics () const noexcept |
| Gets the electronic structure diagnostics extracted from LDOS/TDOS. | |
| void | setElectronicDiagnostics (ElectronicDiagnostics diagnostics) noexcept |
| Sets the electronic structure diagnostics extracted from LDOS/TDOS. | |
| const SuperconductingDiagnostics & | getSuperconductingDiagnostics () const noexcept |
| Gets the superconducting screening diagnostics derived from Eliashberg α²F(ω). | |
| void | setSuperconductingDiagnostics (const SuperconductingDiagnostics &diagnostics) noexcept |
| Sets the superconducting screening diagnostics derived from Eliashberg α²F(ω). | |
Calculation Methods | |
| void | calculateCoordinationNumber () |
| Calculates the Coordination Number (CN) distribution. Requires that neighbors have been computed. | |
| void | calculateRDF (RDFParams params={}) |
| Calculates the radial distribution function g(r). | |
| void | calculatePAD (real_t bin_width=0.25) |
| Calculates the Plane Angle Distribution (PAD). | |
| void | calculateDAD (real_t bin_width=0.25) |
| Calculates the Dihedral Angle Distribution (DAD). | |
| void | calculateVACF (const correlation::core::Trajectory &traj, MaxFrames max_correlation_frames={-1}, StartFrame start_frame={0}, EndFrame end_frame={static_cast< size_t >(-1)}) |
| Calculates the Velocity Autocorrelation Function (VACF). | |
| void | calculateVDOS (VDOSWindowType window_type=VDOSWindowType::Hann, size_t zero_pad_factor=4, real_t max_freq=static_cast< real_t >(-1.0)) |
| Calculates the Vibrational Density of States (VDOS) from the VACF. Requires calculateVACF to be called first. | |
| void | calculateXRD (XRDParams params={}) |
| Calculates the XRD pattern. | |
| void | smooth (const std::string &name, real_t sigma, correlation::math::KernelType kernel=correlation::math::KernelType::Gaussian) |
| Smooths a specific histogram. | |
| void | smoothAll (real_t sigma, correlation::math::KernelType kernel=correlation::math::KernelType::Gaussian) |
| Smooths all available histograms. | |
| void | setStructureAnalyzer (const StructureAnalyzer *analyzer) |
| Uses an external StructureAnalyzer for neighborhood/bond info. | |
| void | setStructureAnalyzerOwned (std::unique_ptr< StructureAnalyzer > analyzer) |
| Takes ownership of a StructureAnalyzer for neighborhood/bond info. | |
Private Member Functions | |
| void | ensureNeighborsComputed (real_t r_max) |
| Ensures neighbors are computed for the given cutoff. | |
| void | calculateAshcroftWeights () |
| Calculates weights for partial distributions based on concentrations. | |
Static Private Member Functions | |
| static std::unique_ptr< DistributionFunctions > | processSingleFrame (correlation::core::Trajectory &trajectory, const TrajectoryAnalyzer &analyzer, size_t frame_idx, const AnalysisSettings &settings, const BondCutoffMatrix &bond_cutoffs) |
| static void | normalizeHistograms (DistributionFunctions &dist_funcs) |
Private Attributes | |
| correlation::core::Cell | cell_ |
| Reference to the cell being analyzed. | |
| const StructureAnalyzer * | neighbors_ref_ {nullptr} |
| Pointer to external neighbor info. | |
| std::unique_ptr< StructureAnalyzer > | neighbors_owned_ |
| Owned neighbor info. | |
| real_t | current_cutoff_ {-1.0} |
| Last cutoff used for neighbor searching. | |
| BondCutoffMatrix | bond_cutoffs_ |
| Cached squared bond cutoff ranges. | |
| std::map< std::string, Histogram > | histograms_ |
| Storage for all analysis results. | |
| std::map< std::string, real_t > | ashcroft_weights_ |
| Scalar weights for S(Q) calculations. | |
| std::mutex | histogram_mutex_ |
| Protects concurrent access to histograms_. | |
| DynamicProperties | dynamic_properties_ {} |
| Trajectory-wide dynamic properties. | |
| HyperuniformityDiagnostics | hyperuniformity_diagnostics_ {} |
| Scalar hyperuniformity diagnostics. | |
| ElectronicDiagnostics | electronic_diagnostics_ {} |
| Electronic LDOS/TDOS diagnostics. | |
| SuperconductingDiagnostics | superconducting_diagnostics_ {} |
| Eliashberg α²F(ω) superconducting diagnostics. | |
| std::shared_ptr< PerFrameDistributionStore > | per_frame_store_ |
| Per-frame 1D distribution curves. | |
Accumulation | |
| void | add (const DistributionFunctions &other) |
| Adds the histograms from another DistributionFunctions object to this one. Used for averaging over multiple frames. | |
| void | scale (real_t factor) |
| Scales all histograms in this object by a factor. Used for normalizing averaged distributions. | |
| std::string | getPartialKey (int type1, int type2) const |
| Generates a unique string key for a pair of element types. | |
| std::string | getInversePartialKey (int type1, int type2) const |
| Generates the inverse string key for a pair of element types. | |
| std::shared_ptr< const PerFrameDistributionStore > | getPerFrameStore () const noexcept |
| Accesses the per-frame distribution store (if computed). | |
| std::shared_ptr< PerFrameDistributionStore > | mutablePerFrameStore () noexcept |
| Accesses mutable shared pointer to the per-frame distribution store. | |
| void | setPerFrameStore (std::shared_ptr< PerFrameDistributionStore > store) noexcept |
| Sets or updates the per-frame distribution store. | |
| static std::unique_ptr< DistributionFunctions > | computeMean (correlation::core::Trajectory &trajectory, const TrajectoryAnalyzer &analyzer, size_t start_frame, const AnalysisSettings &settings, std::function< void(float, const std::string &)> progress_callback=nullptr) |
| Computes the mean distribution functions over a trajectory. Uses parallel execution to speed up calculation. | |
| static PerFrameDistributionStore::FrameCurveArray | computeLightweightFrameCurves (const correlation::core::Cell &cell, const AnalysisSettings &settings, const BondCutoffMatrix &bond_cutoffs, std::array< bool, PerFrameDistributionStore::METRIC_COUNT > wanted_metrics) |
| Computes lightweight 1D [RDF, PAD, SQ, XRD] curves for a single cell frame. | |
Manages the calculation and storage of various distribution functions.
This class includes methods for calculating:
It acts as a container for all analysis results associated with a correlation::core::Cell or correlation::core::Trajectory.
|
explicit |
Constructs a DistributionFunctions object.
| cell | Reference to the cell (structure) being analyzed. |
| cutoff | Optional cutoff radius for neighbor calculations (if not pre computed). |
| bond_cutoffs | Optional bond cutoffs for neighbor calculations. |


|
noexcept |
Move constructor.
| other | The DistributionFunctions object to move from. |

|
default |
Default destructor.
|
delete |
Deleted copy constructor (contains non-copyable std::mutex).

| void correlation::analysis::DistributionFunctions::add | ( | const DistributionFunctions & | other | ) |
Adds the histograms from another DistributionFunctions object to this one. Used for averaging over multiple frames.
| other | The other DistributionFunctions object to add. |


| void correlation::analysis::DistributionFunctions::addHistogram | ( | const std::string & | name, |
| Histogram && | histogram ) |
Manually add a histogram to the collection.
| name | Name of the histogram. |
| histogram | The Histogram data to move into the collection. |

|
private |
Calculates weights for partial distributions based on concentrations.


| void correlation::analysis::DistributionFunctions::calculateCoordinationNumber | ( | ) |
Calculates the Coordination Number (CN) distribution. Requires that neighbors have been computed.


| void correlation::analysis::DistributionFunctions::calculateDAD | ( | real_t | bin_width = 0.25 | ) |
Calculates the Dihedral Angle Distribution (DAD).
| bin_width | Width of angular bins in degrees. |


| void correlation::analysis::DistributionFunctions::calculatePAD | ( | real_t | bin_width = 0.25 | ) |
Calculates the Plane Angle Distribution (PAD).
| bin_width | Width of angular bins in degrees. |


| void correlation::analysis::DistributionFunctions::calculateRDF | ( | RDFParams | params = {} | ) |
Calculates the radial distribution function g(r).
| params | RDF calculation parameters (r_max, r_bin_width). |
| std::invalid_argument | if parameters are invalid |
| std::logic_error | if cell volume is invalid |


| void correlation::analysis::DistributionFunctions::calculateVACF | ( | const correlation::core::Trajectory & | traj, |
| MaxFrames | max_correlation_frames = {-1}, | ||
| StartFrame | start_frame = {0}, | ||
| EndFrame | end_frame = {static_cast<size_t>(-1)} ) |
Calculates the Velocity Autocorrelation Function (VACF).
| traj | The trajectory containing pre-calculated velocities. |
| max_correlation_frames | Maximum lag frames. -1 uses default (half trajectory). |
| start_frame | Starting frame index. |
| end_frame | Ending frame index (exclusive). |


| void correlation::analysis::DistributionFunctions::calculateVDOS | ( | VDOSWindowType | window_type = VDOSWindowType::Hann, |
| size_t | zero_pad_factor = 4, | ||
| real_t | max_freq = static_cast<real_t>(-1.0) ) |
Calculates the Vibrational Density of States (VDOS) from the VACF. Requires calculateVACF to be called first.
| window_type | Time-domain tapering half-window (default: Half-Hann). |
| zero_pad_factor | Zero-padding multiplier for FFT interpolation (>= 1, default: 4). |
| max_freq | Maximum real frequency in THz (<= 0 uses element-based recommendation). |


| void correlation::analysis::DistributionFunctions::calculateXRD | ( | XRDParams | params = {} | ) |
Calculates the XRD pattern.
| params | XRD calculation parameters (lambda, theta_min, theta_max, bin_width). |


|
inlinenodiscard |
Access the underlying simulation cell.

|
staticnodiscard |
Computes lightweight 1D [RDF, PAD, SQ, XRD] curves for a single cell frame.
| [in] | cell | Atomic cell frame to evaluate. |
| [in] | settings | Analysis bin/cutoff parameters. |
| [in] | bond_cutoffs | Pairwise squared bond cutoffs. |
| [in] | wanted_metrics | Boolean mask indicating which [RDF, PAD, SQ, XRD] curves are needed. |


|
staticnodiscard |
Computes the mean distribution functions over a trajectory. Uses parallel execution to speed up calculation.
| trajectory | The trajectory to analyze. |
| analyzer | A pre-configured TrajectoryAnalyzer for neighbor info. |
| start_frame | Index of the frame to start analysis from. |
| settings | The analysis parameters (bin widths, cutoffs, etc.). |
| progress_callback | Optional callback to report completion progress. |


|
inlinenodiscardnoexcept |
Gets the trajectory-wide dynamic properties.
|
inlinenodiscardnoexcept |
Gets mutable trajectory-wide dynamic properties.
|
private |
Ensures neighbors are computed for the given cutoff.
| r_max | Cutoff radius. |

|
inlinenodiscard |
Access all calculated histograms.

|
inlinenodiscardnoexcept |
Access mutable collection of all calculated histograms.
|
inlinenodiscard |
Gets the Ashcroft-Langreth weights used for S(Q) partials.

|
nodiscard |
Gets a list of names for all currently available histograms.

|
inlinenodiscardnoexcept |
Gets the Deborah number.

|
inlinenodiscardnoexcept |
Gets the self-diffusion coefficient computed from Mean Squared Displacement (MSD).

|
inlinenodiscardnoexcept |
Gets the self-diffusion coefficient computed from Velocity Autocorrelation Function (VACF).

|
inlinenodiscardnoexcept |
Gets the electronic structure diagnostics extracted from LDOS/TDOS.

|
nodiscard |
Access a specific calculated histogram by name.
| name | The name of the distribution function (e.g., "g(r)", "S(Q)"). |
| std::out_of_range | if the name is not found. |

|
inlinenodiscardnoexcept |
Gets the low-q structure factor scaling exponent α (S(q) ∝ q^α).

|
inlinenodiscardnoexcept |
Gets the real-space number variance scaling exponent β (σ²_N(R) ∝ R^β).

|
inlinenodiscardnoexcept |
Gets the large-R asymptotic real-space hyperuniformity index χ_H(R_max).

|
inlinenodiscardnoexcept |
Gets the scalar hyperuniformity diagnostics struct.
|
inlinenodiscardnoexcept |
Gets the reciprocal-space Torquato-Stillinger index H = S(0⁺) / S(q_peak).

|
nodiscard |
Generates the inverse string key for a pair of element types.
| type1 | First element ID. |
| type2 | Second element ID. |
|
nodiscard |
Access a mutable calculated histogram by name.
| name | The name of the distribution function. |
| std::out_of_range | if the name is not found. |

|
nodiscard |
Generates a unique string key for a pair of element types.
| type1 | First element ID. |
| type2 | Second element ID. |

|
inlinenodiscardnoexcept |
Accesses the per-frame distribution store (if computed).
|
inlinenodiscardnoexcept |
Gets the relaxation time computed from normalized VACF.

|
inlinenodiscardnoexcept |
Gets the superconducting screening diagnostics derived from Eliashberg α²F(ω).

|
nodiscard |
Checks if a calculated histogram exists by name or alias.
| name | The name or alias to query. |

|
inlinenodiscardnoexcept |
Accesses mutable shared pointer to the per-frame distribution store.
|
nodiscard |
Returns the structure analyzer providing neighbor information.

|
staticprivate |


|
delete |
Deleted copy assignment operator (contains non-copyable std::mutex).

|
noexcept |
Move assignment operator.
| other | The DistributionFunctions object to move from. |

|
staticprivate |


| bool correlation::analysis::DistributionFunctions::removeHistogram | ( | const std::string & | name | ) |
Removes a histogram from the collection if present.
| name | Name of the histogram to remove. |
| void correlation::analysis::DistributionFunctions::scale | ( | real_t | factor | ) |
Scales all histograms in this object by a factor. Used for normalizing averaged distributions.
| factor | The scaling factor. |

|
inlinenoexcept |
Sets the Deborah number.
| deborah_num | The new Deborah number value. |

|
inlinenoexcept |
Sets the self-diffusion coefficient computed from Mean Squared Displacement (MSD).
| diff_coeff | The new diffusion coefficient value in Ų/fs. |

|
inlinenoexcept |
Sets the self-diffusion coefficient computed from Velocity Autocorrelation Function (VACF).
| diff_coeff | The new diffusion coefficient value in Ų/fs. |

|
inlinenoexcept |
Sets the trajectory-wide dynamic properties.
| props | The DynamicProperties struct. |
|
inlinenoexcept |
Sets the electronic structure diagnostics extracted from LDOS/TDOS.
| [in] | diagnostics | ElectronicDiagnostics payload to store. |
|
inlinenoexcept |
Sets the scalar hyperuniformity diagnostics struct.
| diag | The computed HyperuniformityDiagnostics values. |

|
inlinenoexcept |
Sets or updates the per-frame distribution store.
| [in] | store | Shared pointer to PerFrameDistributionStore. |
|
inlinenoexcept |
Sets the relaxation time computed from normalized VACF.
| relax_time | The new relaxation time value in fs. |

| void correlation::analysis::DistributionFunctions::setStructureAnalyzer | ( | const StructureAnalyzer * | analyzer | ) |
Uses an external StructureAnalyzer for neighborhood/bond info.
| analyzer | A pre-computed external analyzer instance. |
| void correlation::analysis::DistributionFunctions::setStructureAnalyzerOwned | ( | std::unique_ptr< StructureAnalyzer > | analyzer | ) |
Takes ownership of a StructureAnalyzer for neighborhood/bond info.
| analyzer | A pre-computed analyzer instance. |

|
inlinenoexcept |
Sets the superconducting screening diagnostics derived from Eliashberg α²F(ω).
| [in] | diagnostics | SuperconductingDiagnostics payload to store. |

| void correlation::analysis::DistributionFunctions::smooth | ( | const std::string & | name, |
| real_t | sigma, | ||
| correlation::math::KernelType | kernel = correlation::math::KernelType::Gaussian ) |
Smooths a specific histogram.
| name | Name of the histogram (e.g., "g(r)"). |
| sigma | Smoothing width. |
| kernel | The smoothing kernel type. |


| void correlation::analysis::DistributionFunctions::smoothAll | ( | real_t | sigma, |
| correlation::math::KernelType | kernel = correlation::math::KernelType::Gaussian ) |
Smooths all available histograms.
| sigma | Smoothing width. |
| kernel | The smoothing kernel type. |


|
private |
Scalar weights for S(Q) calculations.
|
private |
Cached squared bond cutoff ranges.
|
private |
Reference to the cell being analyzed.
|
private |
Last cutoff used for neighbor searching.
|
private |
Trajectory-wide dynamic properties.
|
private |
Electronic LDOS/TDOS diagnostics.
|
mutableprivate |
Protects concurrent access to histograms_.
|
private |
Storage for all analysis results.
|
private |
Scalar hyperuniformity diagnostics.
|
private |
Owned neighbor info.
|
private |
Pointer to external neighbor info.
|
private |
Per-frame 1D distribution curves.
|
private |
Eliashberg α²F(ω) superconducting diagnostics.