polypy.msd

MSD functions included with polypy. There are two MSD classes and one class to store the data generated from the MSD calculation. The first class performs a standard MSD calculation for the entire dataset while the second class will perform an MSD calculation within a specified region of the simulation cell.

class polypy.msd.MSD(data, sweeps=1)[source]

Bases: object

The polypy.msd.MSD class calculates the mean squared displacements for a given atom.

Parameters:
  • data (polypy.read.Trajectory) – Object containing the information from the HISTORY or ARCHIVE files.
  • sweeps (int, optional) – How many times should the starting timestep be changed. Default is 1.
calculate_distances(trajectories, start)[source]

Calculates the distances.

Parameters:
  • trajectories (array_like) – Fractional coordinates.
  • start (float) – Timestep to start the calculation.
Returns:

Distances. timestamp (array_like): Timesteps.

Return type:

distances (array_like)

msd()[source]

Calculates the mean squared displacement for the trajectory.

Returns:Object containing the information for the MSD.
Return type:(polypy.msd.MSDContainer)
one_dimension_square_distance(distances, run)[source]

Calculate the MSD in one dimension.

Parameters:
  • distances (array_like) – Distances.
  • run (float) – Timestep to start the calculation.
squared_displacements(distances, run)[source]

Calculates the squared distances.

Parameters:
  • distances (array_like) – Distances.
  • run (float) – Timestep to start the calculation.
three_dimension_square_distance(distances, run)[source]

Calculate the MSD in three dimensions.

Parameters:
  • distances (array_like) – Distances.
  • run (float) – Timestep to start the calculation.
two_dimension_square_distance(distances, run)[source]

Calculate the MSD in two dimensions.

Parameters:
  • distances (array_like) – Distances.
  • run (float) – Timestep to start the calculation.
class polypy.msd.MSDContainer[source]

Bases: object

The polypy.msd.MSDContainer class stores the output from the msd calculation.

clean_data()[source]

Post msd the data is a list of time vs msd for each run. This needs to be normalised to give one continuous series of points.

smooth_msd_data(x, y)[source]

Smooths the data from the smoothed msd function. The data consists of multiple msd runs but the data is unordered. This function will order the data and average all y values with equivalent x values.

Parameters:
  • x (array_like) – Time data.
  • y (array_like) – MSD data.
Returns:

Time / MSD data.

Return type:

z (array_like)

x_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the one dimensional x diffusion coefficient.

Returns:x Diffusion coefficient.
Return type:(float)
xy_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the two dimensional xy diffusion coefficient.

Returns:xy Diffusion coefficient.
Return type:(float)
xyz_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the three dimensional xyz diffusion coefficient.

Returns:xyx Diffusion coefficient.
Return type:(float)
xz_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the two dimensional xz diffusion coefficient.

Returns:xz Diffusion coefficient.
Return type:(float)
y_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the one dimensional y diffusion coefficient.

Returns:y Diffusion coefficient.
Return type:(float)
yz_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the two dimensional yz diffusion coefficient.

Returns:yz Diffusion coefficient.
Return type:(float)
z_diffusion_coefficient(exclude_initial=0, exclude_final=1)[source]

Calculates the one dimensional z diffusion coefficient.

Returns:z Diffusion coefficient.
Return type:(float)
class polypy.msd.RegionalMSD(data, lower_boundary, upper_boundary, dimension='x', sweeps=1, trajectory_length=100)[source]

Bases: object

The polypy.msd.RegionalMSD class calculates the mean squared displacements for a given atom in a specific region of a simulation cell.

Parameters:
  • data (polypy.read.Trajectory) – Object containing the information from the HISTORY or ARCHIVE files.
  • lower_boundary (float) – Coordinate of the lower limit of the region of interest.
  • upper_boundary (int, optional) – Coordinate of the upper limit of the region of interest.
  • dimension (int, optional) – Direction perpedicular to the region of interest. Default is 'x'.
  • sweeps (int, optional) – How many times should the starting timestep be changed. Default is 1.
analyse_trajectory()[source]

Analyse the trajectory object.

Returns:MSDContainer object - MSD information.
Return type:msd_information (polypy.msd.MSDContainer)
check_trajectory(trajectory, xc)[source]

Analyse the trajectory of an individual atom.

Parameters:
  • trajectory (polypy.read.Trajectory) – Trajectory object.
  • xc (array_like) – Coordinates perpendicular to the region of interest.
initialise_new_trajectory()[source]

Create a new MSDContainer object, specific to slice of a trajectory.

Returns:MSDContainer object.
Return type:new_trajectory (polypy.msd.MSDContainer)
update_msd_info(container)[source]

Adds the information calculated for a single atom to the information of the whole trajectory.

Parameters:container (polypy.msd.MSDContainer) – MSDContainer object - single atom.