Calculate the mass density of each frame in a trajectory.
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.
density_trace : np.array, shape=(n_frames), dtype=float
The mass density of each frame.