mdtraj.density

mdtraj.density(traj, masses=None)

Calculate the mass density of each frame in a trajectory.

Parameters:

traj : Trajectory

An mdtraj trajectory.

masses : np.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_trace : np.array, shape=(n_frames), dtype=float

The mass density of each frame.

Versions