class TemperatureProfile(md_trajectory, start_time=None, end_time=None, resolution=None, atom_selection=None, direction_index=None, time_resolution=None, info_panel=None)

Class for calculating the spatial temperature profile of an MD simulation.

  • md_trajectory (MDTrajectory | AtomicConfiguration) – The MDTrajectory or configuration to calculate the temperature profile 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.
  • resolution (PhysicalQuantity of type length) – The bin size, which determines the resolution of the profile.
    Default: 2.0 * Angstrom
  • 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 atoms.
  • direction_index (int) – The index of the cell vector along which the profile should be calculated. Has to be an element of [0, 1, 2].
    Default: 2
  • 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 temperature profile.


Return the positions of the bins associated with the temperature profile.

Usage Examples

Load an MDTrajectory, calculate the TemperatureProfile along the z-axis, and plot the results:

md_trajectory = nlread('alumina_trajectory.nc')[-1]

t_profile = TemperatureProfile(md_trajectory)

# Get the bin_centers and the temperature values.
z            = t_profile.zValues().inUnitsOf(Angstrom)
temperatures = t_profile.data().inUnitsOf(Kelvin)

# Plot the data using pylab.
import pylab

pylab.plot(z, temperatures, label='Temperature profile')
pylab.xlabel('z (Ang)')
pylab.ylabel('T(z) (K)')




The TemperatureProfile is always calculated along the cartesian z-axis. It is recommended to use an orthogonal cell, if you want to calculate the TemperatureProfile.

The temperature values of empty bins in the profile are set to zero.

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.