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

Computes and stores pairwise distances and bond angles in tensors indexed by element type. More...

#include <StructureAnalyzer.hpp>

Collaboration diagram for correlation::analysis::StructureAnalyzer:

Public Types

using RawHistogramTensor = std::vector<std::vector<std::vector<real_t>>>
 Tensor for storing raw distance histogram bins [element1][element2][bin_index].
using AngleTensor = std::vector<std::vector<std::vector<std::vector<real_t>>>>
 Tensor for storing bond angles [center][outer1][outer2][angle_index].
using DihedralTensor = std::vector<std::vector<std::vector<std::vector<std::vector<real_t>>>>>
 Tensor for storing dihedrals [e1][e2][e3][e4][dihedral_index].

Public Member Functions

Constructors & Destructors
 StructureAnalyzer (std::shared_ptr< const correlation::core::Cell > cell, real_t cutoff, BondCutoffMatrix bond_cutoffs, bool ignore_periodic_self_interactions=true, real_t r_bin_width=static_cast< real_t >(0.02))
 Constructs a StructureAnalyzer using shared ownership of the Cell.
 StructureAnalyzer (const correlation::core::Cell &cell, real_t cutoff, BondCutoffMatrix bond_cutoffs, bool ignore_periodic_self_interactions=true, real_t r_bin_width=static_cast< real_t >(0.02))
 Constructs a StructureAnalyzer copying the cell into a shared instance.
 ~StructureAnalyzer ()=default
 StructureAnalyzer (const StructureAnalyzer &)=delete
StructureAnalyzer & operator= (const StructureAnalyzer &)=delete
 StructureAnalyzer (StructureAnalyzer &&other) noexcept
StructureAnalyzer & operator= (StructureAnalyzer &&other) noexcept
Accessors
const correlation::core::Cell & cell () const noexcept
 Gets a reference to the periodic cell.
std::shared_ptr< const correlation::core::Cell > cellPtr () const noexcept
 Gets the shared pointer to the periodic cell.
const RawHistogramTensor & rawHistograms () const
 Gets a multi-dimensional tensor containing raw distance histogram bins.
const AngleTensor & angles () const
 Gets a multi-dimensional tensor containing bond angles. Computed lazily on first access in a thread-safe manner.
const DihedralTensor & dihedrals () const
 Gets a multi-dimensional tensor containing dihedral angles. Computed lazily on first access in a thread-safe manner.
const correlation::core::NeighborGraph & neighborGraph () const
 Gets the corresponding neighbor graph capturing topological connections.
bool getIgnorePeriodicSelfInteractions () const
 Returns true if periodic self-interactions are ignored.

Private Member Functions

void ensureAnglesComputed () const
void ensureDihedralsComputed () const

Private Attributes

std::shared_ptr< const correlation::core::Cell > cell_
 Shared pointer to the periodic cell.
real_t cutoff_sq_
 Squared cutoff for efficiency.
BondCutoffMatrix bond_cutoffs_
 Internal bond cutoffs matrix.
bool ignore_periodic_self_interactions_
 Interaction guard.
correlation::core::NeighborGraph neighbor_graph_
 Graph of topological bonds.
RawHistogramTensor raw_histograms_
 Raw distance histogram storage.
AngleTensor angle_tensor_
 Bond angle storage (lazy).
DihedralTensor dihedral_tensor_
 Dihedral angle storage (lazy).
std::mutex compute_mutex_
 Mutex guarding lazy computation.
std::atomic< bool > angles_computed_ {false}
 Flag indicating if angles are computed.
std::atomic< bool > dihedrals_computed_
 Flag indicating if dihedrals are computed.

Detailed Description

Computes and stores pairwise distances and bond angles in tensors indexed by element type.

This class efficiently finds all atom pairs within a cutoff radius and all unique bond angles, storing the results in multi-dimensional vectors (tensors) suitable for calculating partial distribution functions. Angle and Dihedral tensors are computed lazily on first access.

Member Typedef Documentation

◆ AngleTensor

using correlation::analysis::StructureAnalyzer::AngleTensor = std::vector<std::vector<std::vector<std::vector<real_t>>>>

Tensor for storing bond angles [center][outer1][outer2][angle_index].

◆ DihedralTensor

using correlation::analysis::StructureAnalyzer::DihedralTensor = std::vector<std::vector<std::vector<std::vector<std::vector<real_t>>>>>

Tensor for storing dihedrals [e1][e2][e3][e4][dihedral_index].

◆ RawHistogramTensor

using correlation::analysis::StructureAnalyzer::RawHistogramTensor = std::vector<std::vector<std::vector<real_t>>>

Tensor for storing raw distance histogram bins [element1][element2][bin_index].

Constructor & Destructor Documentation

◆ StructureAnalyzer() [1/4]

correlation::analysis::StructureAnalyzer::StructureAnalyzer ( std::shared_ptr< const correlation::core::Cell > cell,
real_t cutoff,
BondCutoffMatrix bond_cutoffs,
bool ignore_periodic_self_interactions = true,
real_t r_bin_width = static_cast<real_t>(0.02) )
explicit

Constructs a StructureAnalyzer using shared ownership of the Cell.

Parameters
cellShared pointer to the periodic simulation cell (zero-copy).
cutoffNeighbor search cutoff radius.
bond_cutoffsMatrix of per-pair bond cutoffs.
ignore_periodic_self_interactionsFlag to ignore periodic self-interactions.
r_bin_widthBin width for radial histograms.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StructureAnalyzer() [2/4]

correlation::analysis::StructureAnalyzer::StructureAnalyzer ( const correlation::core::Cell & cell,
real_t cutoff,
BondCutoffMatrix bond_cutoffs,
bool ignore_periodic_self_interactions = true,
real_t r_bin_width = static_cast<real_t>(0.02) )
explicit

Constructs a StructureAnalyzer copying the cell into a shared instance.

Parameters
cellReference to the periodic simulation cell.
cutoffNeighbor search cutoff radius.
bond_cutoffsMatrix of per-pair bond cutoffs.
ignore_periodic_self_interactionsFlag to ignore periodic self-interactions.
r_bin_widthBin width for radial histograms.
Here is the call graph for this function:

◆ ~StructureAnalyzer()

correlation::analysis::StructureAnalyzer::~StructureAnalyzer ( )
default

◆ StructureAnalyzer() [3/4]

correlation::analysis::StructureAnalyzer::StructureAnalyzer ( const StructureAnalyzer & )
delete
Here is the call graph for this function:

◆ StructureAnalyzer() [4/4]

correlation::analysis::StructureAnalyzer::StructureAnalyzer ( StructureAnalyzer && other)
noexcept
Here is the call graph for this function:

Member Function Documentation

◆ angles()

const StructureAnalyzer::AngleTensor & correlation::analysis::StructureAnalyzer::angles ( ) const
nodiscard

Gets a multi-dimensional tensor containing bond angles. Computed lazily on first access in a thread-safe manner.

Returns
The angle tensor [center_element][outer_element1][outer_element2][angle_index].
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell()

const correlation::core::Cell & correlation::analysis::StructureAnalyzer::cell ( ) const
inlinenodiscardnoexcept

Gets a reference to the periodic cell.

Returns
Constant reference to the Cell object.
Here is the caller graph for this function:

◆ cellPtr()

std::shared_ptr< const correlation::core::Cell > correlation::analysis::StructureAnalyzer::cellPtr ( ) const
inlinenodiscardnoexcept

Gets the shared pointer to the periodic cell.

Returns
Constant shared pointer to the Cell object.

◆ dihedrals()

const StructureAnalyzer::DihedralTensor & correlation::analysis::StructureAnalyzer::dihedrals ( ) const
nodiscard

Gets a multi-dimensional tensor containing dihedral angles. Computed lazily on first access in a thread-safe manner.

Returns
The dihedral tensor [element1][element2][element3][element4][dihedral_index].
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureAnglesComputed()

void correlation::analysis::StructureAnalyzer::ensureAnglesComputed ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureDihedralsComputed()

void correlation::analysis::StructureAnalyzer::ensureDihedralsComputed ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIgnorePeriodicSelfInteractions()

bool correlation::analysis::StructureAnalyzer::getIgnorePeriodicSelfInteractions ( ) const
inlinenodiscard

Returns true if periodic self-interactions are ignored.

Returns
True if periodic self-interactions are ignored.
Here is the caller graph for this function:

◆ neighborGraph()

const correlation::core::NeighborGraph & correlation::analysis::StructureAnalyzer::neighborGraph ( ) const
inlinenodiscard

Gets the corresponding neighbor graph capturing topological connections.

Returns
Constant reference to the correlation::core::NeighborGraph object.
Here is the caller graph for this function:

◆ operator=() [1/2]

StructureAnalyzer & correlation::analysis::StructureAnalyzer::operator= ( const StructureAnalyzer & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

StructureAnalyzer & correlation::analysis::StructureAnalyzer::operator= ( StructureAnalyzer && other)
noexcept
Here is the call graph for this function:

◆ rawHistograms()

const RawHistogramTensor & correlation::analysis::StructureAnalyzer::rawHistograms ( ) const
inlinenodiscard

Gets a multi-dimensional tensor containing raw distance histogram bins.

Returns
The raw histogram tensor [element1][element2][bin_index].
Here is the caller graph for this function:

Member Data Documentation

◆ angle_tensor_

AngleTensor correlation::analysis::StructureAnalyzer::angle_tensor_
mutableprivate

Bond angle storage (lazy).

◆ angles_computed_

std::atomic<bool> correlation::analysis::StructureAnalyzer::angles_computed_ {false}
mutableprivate

Flag indicating if angles are computed.

◆ bond_cutoffs_

BondCutoffMatrix correlation::analysis::StructureAnalyzer::bond_cutoffs_
private

Internal bond cutoffs matrix.

◆ cell_

std::shared_ptr<const correlation::core::Cell> correlation::analysis::StructureAnalyzer::cell_
private

Shared pointer to the periodic cell.

◆ compute_mutex_

std::mutex correlation::analysis::StructureAnalyzer::compute_mutex_
mutableprivate

Mutex guarding lazy computation.

◆ cutoff_sq_

real_t correlation::analysis::StructureAnalyzer::cutoff_sq_
private

Squared cutoff for efficiency.

◆ dihedral_tensor_

DihedralTensor correlation::analysis::StructureAnalyzer::dihedral_tensor_
mutableprivate

Dihedral angle storage (lazy).

◆ dihedrals_computed_

std::atomic<bool> correlation::analysis::StructureAnalyzer::dihedrals_computed_
mutableprivate
Initial value:
{
false}

Flag indicating if dihedrals are computed.

◆ ignore_periodic_self_interactions_

bool correlation::analysis::StructureAnalyzer::ignore_periodic_self_interactions_
private

Interaction guard.

◆ neighbor_graph_

correlation::core::NeighborGraph correlation::analysis::StructureAnalyzer::neighbor_graph_
private

Graph of topological bonds.

◆ raw_histograms_

RawHistogramTensor correlation::analysis::StructureAnalyzer::raw_histograms_
private

Raw distance histogram storage.


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