Correlation functions

The interface to dynasor when computing structure factors consists of two functions, which are used for dynamic and static correlations, respectively.

dynasor also provides functionality for computing the spectral energy density (SED) via the function compute_spectral_energy_density [Thomas et al., 2010].

dynasor.compute_dynamic_structure_factors(traj, q_points, dt, window_size, window_step=1, calculate_currents=False, calculate_incoherent=False)[source]

Compute dynamic structure factors. The results are returned in the form of a DynamicSample object.

Parameters
  • traj (Trajectory) – Input trajectory

  • q_points (ndarray[Any, dtype[float]]) – Array of q-points in units of 2π/Å with shape (N_qpoints, 3) in Cartesian coordinates

  • dt (float) – Time difference in femtoseconds between two consecutive snapshots in the trajectory. Note that you should not change dt if you change frame_step in traj.

  • window_size (int) – Length of the trajectory frame window to use for time correlation calculation. It is expressed in terms of the number of time lags to consider and thus determines the smallest frequency resolved.

  • window_step (int) – Window step (or stride) given as the number of frames between consecutive trajectory windows. This parameter does not affect the time between consecutive frames in the calculation. If, e.g., window_step > window_size, some frames will not be used.

  • calculate_currents (bool) – Calculate the current correlations. Requires velocities to be available in traj.

  • calculate_incoherent (bool) – Calculate the incoherent part (self-part) of \(F_incoh\).

Return type

DynamicSample

dynasor.compute_static_structure_factors(traj, q_points)[source]

Compute static structure factors. The results are returned in the form of a StaticSample object.

Parameters
  • traj (Trajectory) – Input trajectory

  • q_points (ndarray[Any, dtype[float]]) – Array of q-points in units of 2π/Å with shape (N_qpoints, 3) in Cartesian coordinates

Return type

StaticSample

dynasor.compute_spectral_energy_density(traj, ideal_supercell, primitive_cell, q_points, dt)[source]

Compute the spectral energy density (SED) at specific q-points. The results are returned in the form of a tuple, which comprises the angular frequencies in an array of length N_times in units of 2π/fs and the SED in units of Da*(Å/fs)² as an array of shape (N_qpoints, N_times).

More details can be found in Thomas et al., Physical Review B 81, 081411 (2010), which should be cited when using this function along with the dynasor reference.

Note 1: SED analysis is only suitable for crystalline materials without diffusion as atoms are assumed to move around fixed reference positions throughout the entire trajectory.

Note 2: This implementation reads the full trajectory and can thus consume a lot of memory.

Parameters
  • traj (Trajectory) – Input trajectory

  • ideal_supercell (Atoms) – Ideal structure defining the reference positions

  • primitive_cell (Atoms) – Underlying primitive structure. Must be aligned correctly with ideal_supercell.

  • q_points (ndarray[Any, dtype[float]]) – Array of q-points in units of 2π/Å with shape (N_qpoints, 3) in Cartesian coordinates

  • dt (float) – Time difference in femtoseconds between two consecutive snapshots in the trajectory. Note that you should not change dt if you change frame_step in traj.

Return type

Tuple[ndarray[Any, dtype[float]], ndarray[Any, dtype[float]]]