trajectory_analyzer

Tools for analyzing a trajectory.

class TrajectoryAnalyzer(parameters, trajectory, temperatures=None, target_calculator=None, target_temperature=None, malada_compatability=False)[source]

Bases: object

Provides useful functions to analyze a trajectory.

Parameters:
  • parameters (mala.common.parameters.Parameters) – Parameters object used to create this instance.

  • trajectory (ase.io.Trajectory or string) – Trajectory or path to trajectory to be analyzed.

  • target_calculator (mala.targets.target.Target) – A target calculator to calculate e.g. the RDF. If None is provided, one will be generated ad-hoc (recommended).

  • temperatures (string or numpy.ndarray) – Array holding the temperatures for the trajectory or path to numpy file containing temperatures.

  • target_temperature (float) – Target temperature for equilibration.

  • malada_compatability (bool) – If True, twice the radius set by the minimum imaging convention (MIC) will be used for RDF calculation. This is generally discouraged, but some older malada calculations have been performed with it, so this parameter provides reproducibility.

parameters

MALA data generation parameters.

Type:

mala.common.parameters.ParametersDataGeneration

average_distance_equilibrated

Distance threshold for determination of first equilibrated snapshot.

Type:

float

distance_metrics_denoised

RDF based distance metrics used for equilibration analysis.

Type:

numpy.ndarray

distances_realspace

Realspace distance metrics used to sample snapshots.

Type:

numpy.ndarray

first_considered_snapshot

First snapshot to be considered during equilibration analysis (i.e., after pruning).

Type:

int

last_considered_snapshot

Last snapshot to be considered during equilibration analysis (i.e., after pruning).

Type:

int

target_calculator

Target calculator used for computing RDFs.

Type:

mala.targets.target.Target

get_first_snapshot(equilibrated_snapshot=None, distance_threshold=None)[source]

Calculate distance metrics/first equilibrated timestep on a trajectory.

For this step, the RDF+Cosine distance will be used as a distance metric. Only the first snapshot is return, all the other quantities can be accessed as member variables of the object calling this function.

Parameters:
  • equilibrated_snapshot (ase.Atoms) – An equilibrated snapshot. Will usually be read from the trajectory itself, but may be provided by the user if desired.

  • distance_threshold (float) – Distance threshold to be used. Usually determined by analyzing the end of the trajectory, but may be provided by user if e.g. multiple trajectories are to be compared.

Returns:

first_snapshot – First snapshot for which the trajectory is equilibrated.

Return type:

int

get_snapshot_correlation_cutoff()[source]

Determine the cutoff for the distance metric.

If a cutoff is set by the user via the Parameters object, this function simply returns this value. Elsewise, the value is determined numerically. The distance metric used here is realspace (i.e. the smallest displacement of an atom between two snapshots). The cutoff gives a lower estimate for the oscillations of the trajectory. Any distance above this cutoff can be attributed to the oscillations in the trajectory. Any cutoff below is the consquence of temporal neighborhood of these snapshots.

Returns:

cutoff – Cutoff below which two snapshots can be assumed to be similar to each other to a degree that suggests temporal neighborhood.

Return type:

float

get_uncorrelated_snapshots(filename_uncorrelated_snapshots)[source]

Calculate a set of uncorrelated configurations from a trajectory.

If not priorly determined with the object calling this function, the first equilibrated configuration will be determined automatically. This function will create two files, one archiving the MD step number of all snapshots sampled, and one with the actual snapshots themselves.

Parameters:

filename_uncorrelated_snapshots (string) – Name of the file in which to save the uncorrelated snapshots.

uncache_properties()[source]

Uncache all cached properties of this calculator.

property first_snapshot

First equilibrated snapshot.

property snapshot_correlation_cutoff

Cutoff for the snapshot correlation analysis.

property trajectory

Trajectory to be analyzed.