Relaxation module¶
These are a series of summary values of the dynamics quantities.
This provides methods of easily comparing values across variables.
-
class
sdanalysis.relaxation.
Result
[source]¶ Bases:
tuple
Hold the result of a relaxation calculation.
This uses the NamedTuple class to make the access of the returned values more transparent and easier to understand.
-
property
error
¶ Alias for field number 1
-
property
mean
¶ Alias for field number 0
-
property
-
sdanalysis.relaxation.
compute_relaxation_value
(timesteps, values, relax_type)[source]¶ Compute a single representative value for each dynamic quantity.
- Parameters
- Return type
- Returns
The representative relaxation time for a quantity.
There are some special values of the relaxation which are treated in a special way. The main one of these is the “msd”, for which the relaxation is fitted to a straight line. The “struct_msd” relaxation, is a threshold_relaxation, with the time required to pass the threshold of 0.16. The other relaxations which are treated separately are the “alpha” and “gamma” relaxations, where the relaxation time is the maximum of these functions.
All other relaxations are assumed to have the behaviour of exponential decay, with the representative time being how long it takes to decay to the value 1/e.
-
sdanalysis.relaxation.
compute_relaxations
(infile)[source]¶ Summary time value for the dynamic quantities.
This computes the characteristic timescale of the dynamic quantities which have been calculated and are present in INFILE. The INFILE is a path to the pre-computed dynamic quantities and needs to be in the HDF5 format with either the ‘.hdf5’ or ‘.h5’ extension.
The output is written to the table ‘relaxations’ in INFILE.
- Return type
None
-
sdanalysis.relaxation.
diffusion_constant
(time, msd, dimensions=2)[source]¶ Compute the diffusion_constant from the mean squared displacement.
-
sdanalysis.relaxation.
exponential_relaxation
(time, value, sigma=None, value_width=0.3)[source]¶ Fit a region of the exponential relaxation with an exponential.
This fits an exponential to the small region around the value 1/e. A small region is chosen as the interest here is the time for the decay to reach a value, rather than a fit to the overall curve, so this provides a method of getting an accurate time, while including a collection of points.
- Parameters
- Returns
The relaxation time for the given quantity error (float): Estimated error of the relaxation time.
- Return type
relaxation_time (float)
-
sdanalysis.relaxation.
max_time_relaxation
(time, value)[source]¶ Time at which the maximum value is recorded.
-
sdanalysis.relaxation.
series_relaxation_value
(series)[source]¶ Calculate the relaxation of a pandas Series.
When a pandas.Series object, which has an index being the timesteps, and the name of the series being the dynamic quantity, this function provides a simple method of calculating the relaxation aggregation. In particular this function is useful to use with the aggregate function.
- Parameters
series (
Series
) – The series containing the relaxation quantities- Return type
- Returns
The calculated value of the relaxation.