KineticEnergyDistribution

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.

Parameters:
  • 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
data()

Return the kinetic energy distribution histogram.

energies()

Return the energies associated with the histogram.

Usage Examples

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

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

ke_distribution = KineticEnergyDistribution(md_trajectory,
                                            start_time=10000.0*fs,
                                            end_time=50000.0*fs,
                                            maximum_energy=1.0*eV,
                                            resolution=0.005*eV,
                                            atom_selection=Aluminum)

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

# Plot the data using pylab.
import pylab

pylab.bar(energies, histogram,
          label='Kinetic energies of aluminum',
          width=0.005)
pylab.xlabel('Kinetic energy (eV)')
pylab.ylabel('Histogram')
pylab.legend()

pylab.show()

kinetic_energy_distribution.py

Notes

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.