mdtraj.density

mdtraj.density(traj, masses=None)

Calculate the mass density of each frame in a trajectory.

Parameters
trajTrajectory

An mdtraj trajectory.

massesnp.ndarray, optional, default=None

If not None, use these masses when calculating the density. If None, then use the standard elemental masses associated with traj.topology.atoms.

Returns
density_tracenp.array, shape=(n_frames), dtype=float

The mass density of each frame.