Skip to content

MeanSquareDisplacement

Overview

The Mean Square Displacement (MSD) analysis calculates the average squared displacement of particles over time, providing insights into diffusion and mobility.

Constructor

MeanSquareDisplacement(system, particles, ...)

Creates a new analysis instance.

Parameters: - system (System): The molecular system to analyze - particles (List[Particle]): List of particles to include in analysis

Methods

compute()

Performs the analysis calculation.

is_computed() → bool

Returns whether the analysis has been computed.

msd_values() → List[float]

Returns the calculated MSD values.

lag_times() → List[float]

Returns the lag times for MSD calculation.

Usage Example

import smolsat

# Create trajectory and system
trajectory = smolsat.create_example_trajectory(num_particles=100, num_frames=1000)
system = smolsat.System(trajectory, periodic_boundaries=True)

# Select particles for analysis
particles = [trajectory.particle(i) for i in range(50)]

# Create and run analysis
analysis = smolsat.MeanSquareDisplacement(system, particles)
analysis.compute()

# Get results
msd_values = analysis.msd_values()
lag_times = analysis.lag_times()