class KineticEnergyDistribution(md_trajectory, start_time=None, end_time=None, maximum_energy=None, resolution=None, atom_selection=None, time_resolution=None, info_panel=None)

Class for calculating the kinetic energy distribution of an MD simulation.

  • md_trajectory (MDTrajectory | AtomicConfiguration) – The MDTrajectory or configuration to calculate the kinetic energy distribution for.
  • start_time (PhysicalQuantity of type time) – The start time.
    Default: 0.0 * fs
  • end_time (PhysicalQuantity of type time) – The end time.
    Default: the last time frame
  • maximum_energy (PhysicalQuantity of type energy) – Upper limit on energy values considered for analysis.
    Default: The maximum kinetic energy of the simulation.
  • resolution (PhysicalQuantity of type energy) – The bin size, which determines the resolution of the histogram.
    Default: 0.01 * eV
  • atom_selection (PeriodicTableElement | str | list of ints) – Only include contributions from this selection. The atoms can be selected by element i.e. PeriodicTableElement, tag or a list of atomic indices.
    Default: all elements
  • time_resolution (PhysicalQuantity of type time) – The time interval between snapshots in the MD trajectory that are included in the analysis.
  • info_panel (InfoPanel (Plot2D)) – Info panel to show the calculation progress.
    Default: No info panel

Return the kinetic energy distribution histogram.


Return the energies associated with the histogram.

Usage Examples

Load an MDTrajectory and calculate the KineticEnergyDistribution considering all aluminum atoms:

md_trajectory = nlread('')[-1]

ke_distribution = KineticEnergyDistribution(md_trajectory,

# Get the energies and the histogram of the kinetic energy distribution.
energies  = ke_distribution.energies().inUnitsOf(eV)
histogram =

# Plot the data using pylab.
import pylab, histogram,
          label='Kinetic energies of aluminum',
pylab.xlabel('Kinetic energy (eV)')


By default, all elements are taken into account.

The atom_selection parameter accepts an element, a tag name, or a list of indices to select atoms for the velocity distribution. This can be useful, e.g. in the presence of constraints as constrained atoms should be excluded in this analysis.