Dynamics module¶
Module for reading and processing input files.
-
class
sdanalysis.dynamics.
Dynamics
(timestep, box, position, orientation=None, molecule=None, wave_number=None, angular_resolution=360)[source]¶ Bases:
object
Compute dynamic properties of a simulation.
- Parameters
timestep (
int
) – The timestep on which the configuration was taken.box (
ndarray
) – The lengths of each side of the simulation cell including any tilt factors.position (
ndarray
) – The positions of the molecules with shape(nmols, 3)
. Even if the simulation is only 2D, all 3 dimensions of the position need to be passed.orientation (
Optional
[ndarray
]) – The orientations of all the molecules as a quaternion in the form(w, x, y, z)
. If no orientation is supplied then no rotational quantities are calculated.molecule (
Optional
[Molecule
]) – The molecule for which to compute the dynamics quantities. This is used to compute the structural relaxation for all particles.wave_number (
Optional
[float
]) – The wave number of the maximum peak in the Fourier transform of the radial distribution function. If None this is calculated from the initial configuration.
-
add
(position, orientation=None)[source]¶ Update the state of the dynamics calculations by adding a Frame.
This updates the motion of the particles, comparing the positions and orientations of the current frame with the previous frame, adding the difference to the total displacement. This approach allows for tracking particles over periodic boundaries, or through larger rotations assuming that there are sufficient frames to capture the information. Each single displacement obeys the minimum image convention, so for large time intervals it is still possible to have missing information.
-
add_frame
(frame)[source]¶ Update the state of the dynamics calculations by adding a Frame.
This updates the motion of the particles, comparing the positions and orientations of the current frame with the previous frame, adding the difference to the total displacement. This approach allows for tracking particles over periodic boundaries, or through larger rotations assuming that there are sufficient frames to capture the information. Each single displacement obeys the minimum image convention, so for large time intervals it is still possible to have missing information.
- Parameters
frame (
Frame
) – The configuration containing the current particle information.
-
compute_all
(timestep, position, orientation=None, scattering_function=False)[source]¶ Compute all possible dynamics quantities.
- Parameters
- Return type
- Returns
Mapping of the names of each dynamic quantity to their values for each particle.
Where a quantity can’t be calculated, an array of nan values will be supplied instead, allowing for continued compatibility.
-
compute_alpha
()[source]¶ Compute the non-Gaussian parameter alpha for translational motion in 2D.
\[\alpha = \frac{\langle \Delta r^4\rangle} {2\langle \Delta r^2 \rangle^2} -1\]- Return type
-
compute_alpha_rot
()[source]¶ Compute the non-Gaussian parameter alpha for rotational motion in 2D.
Rotational motion in 2D, is a single dimension of rotational motion, hence the use of a different divisor than translational motion.
\[\alpha = \frac{\langle \Delta \theta^4\rangle} {3\langle \Delta \theta^2 \rangle^2} -1\]- Return type
-
compute_displacement
()[source]¶ Compute the translational displacement for each particle.
- Return type
-
compute_gamma
()[source]¶ Calculate the second order coupling of translations and rotations.
\[\gamma = \frac{\langle(\Delta r \Delta\theta)^2 \rangle} {\langle\Delta r^2\rangle\langle\Delta\theta^2\rangle} - 1\]- Returns
The squared coupling of translations and rotations \(\gamma\)
- Return type
-
compute_rotational_relax1
()[source]¶ Compute the first-order rotational relaxation function.
\[C_1(t) = \langle \hat{\mathbf{e}}(0) \cdot \hat{\mathbf{e}}(t) \rangle\]- Returns
The rotational relaxation
- Return type
-
compute_rotational_relax2
()[source]¶ Compute the second rotational relaxation function.
\[C_1(t) = \langle 2(\hat{\mathbf{e}}(0) \cdot \hat{\mathbf{e}}(t))^2 - 1 \rangle\]- Returns
The rotational relaxation
- Return type
-
compute_time_delta
(timestep)[source]¶ Time difference between initial frame and timestep.
- Return type
-
property
delta_rotation
¶
-
property
delta_translation
¶
-
class
sdanalysis.dynamics.
TrackedMotion
(box, position, orientation)[source]¶ Bases:
object
Keep track of the motion of a particle allowing for multiple periods.
This keeps track of the position of a particle as each frame is added, which allows for tracking the motion of a particle through multiple periods, as long as each motion takes the shortest distance.
-
add
(position, orientation)[source]¶ Update the state of the dynamics calculations by adding the next values.
This updates the motion of the particles, comparing the positions and orientations of the current frame with the previous frame, adding the difference to the total displacement. This approach allows for tracking particles over periodic boundaries, or through larger rotations assuming that there are sufficient frames to capture the information. Each single displacement obeys the minimum image convention, so for large time intervals it is still possible to have missing information.
-
-
class
sdanalysis.dynamics.
LastMolecularRelaxation
(num_elements, threshold, irreversibility=1.0, relaxation_type=None)[source]¶ Bases:
sdanalysis.dynamics.relaxations.MolecularRelaxation
-
class
sdanalysis.dynamics.
MolecularRelaxation
(num_elements, threshold, relaxation_type=None)[source]¶ Bases:
object
Compute the relaxation of each molecule.
-
relaxation_type
= 2¶
-
-
class
sdanalysis.dynamics.
Relaxations
(timestep, box, position, orientation, molecule=None, is2D=None, wave_number=None)[source]¶ Bases:
object
-
add
(timestep, position, orientation)[source]¶ Update the state of the relaxation calculations by adding a Frame.
This updates the motion of the particles, comparing the positions and orientations of the current frame with the previous frame, adding the difference to the total displacement. This approach allows for tracking particles over periodic boundaries, or through larger rotations assuming that there are sufficient frames to capture the information. Each single displacement obeys the minimum image convention, so for large time intervals it is still possible to have missing information.
-
add_frame
(frame)[source]¶ Update the state of the relaxation calculations by adding a Frame.
This updates the motion of the particles, comparing the positions and orientations of the current frame with the previous frame, adding the difference to the total displacement. This approach allows for tracking particles over periodic boundaries, or through larger rotations assuming that there are sufficient frames to capture the information. Each single displacement obeys the minimum image convention, so for large time intervals it is still possible to have missing information.
- Parameters
frame (
Frame
) – The configuration containing the current particle information.
-
property
distance
¶
-