pylj.sample

This module is dedicated visualisation of the pylj output. More details of how to implement custom visualisation see visualisation.

class pylj.sample.CellPlus(system, xlabel, ylabel, size='medium')[source]

Bases: object

The CellPlus class will plot the particles positions in addition to one user defined one-dimensional dataset. This is designed to allow user interaction with the plotting data.

Parameters:
  • system (System) – The whole system information.
  • xlabel (string) – The label for the x-axis of the custom plot.
  • ylabel (string) – The label for the y-axis of the custom plot.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
update(system, xdata, ydata)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so use this wisely.

Parameters:
  • system (System) – The whole system information.
  • xdata (float, array-like) – x-data that should be plotted in the custom plot.
  • ydata (float, array-like) – y-data that should be plotted in the custom plot.
class pylj.sample.Energy(system, size='medium')[source]

Bases: object

The energy class will plot the particle positions and potential energy of the system.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.Interactions(system, size='medium')[source]

Bases: object

The Interactions class will plot the particle positions, total force, simulation pressure and temperature. This class is perfect for showing the interactions between the particles and therefore the behaviour of ideal gases and deviation when the conditions of an ideal gas are not met.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.JustCell(system, size='medium', scale=1)[source]

Bases: object

The JustCell class will plot just the particles positions. This is a simplistic sampling class for quick visualisation.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
  • scale (float (optional)) – The amount by which to scale down the size of the particles
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so use this wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.MaxBolt(system, size='medium')[source]

Bases: object

The MaxBolt class will plot the particle positions and a histogram of the particle velocities.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.Phase(system, size='medium')[source]

Bases: object

The Phase class will plot the particle positions, radial distribution function, mean squared deviation and total energy of the simulation. This sampling class is ideal for observing the phase transitions between solid, liquid, gas.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
average()[source]
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.RDF(system, size='medium')[source]

Bases: object

The RDF class will plot the particle positions and radial distribution function. This sampling class is can be used to show the relative RDFs for solid, liquid, gas.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
average()[source]
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
class pylj.sample.Scattering(system, size='medium')[source]

Bases: object

The Scattering class will plot the particle positions, radial distribution function, mean squared deviation and scattering profile (as a fft of the rdf). This sampling class is ideal for observing the phase transitions between solid, liquid, gas.

Parameters:
  • system (System) – The whole system information.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
average()[source]
update(system)[source]

This updates the visualisation environment. Often this can be slower than the cythonised force calculation so used is wisely.

Parameters:system (System) – The whole system information.
pylj.sample.environment(panes, size='medium')[source]

The visualisation environment consists of a series of panes (1, 2, or 4 are allowed). This function allows the number of panes in the visualisation to be defined.

Parameters:
  • panes (int) – Number of visualisation panes.
  • size (string) –
    The size of the visualisation:
    • ’small’
    • ’medium’ (default)
    • ’large’
Returns:

  • Matplotlib.figure.Figure object – The relevant Matplotlib figure.
  • Axes object or array of axes objects – The axes related to each of the panes. For panes=1 this is a single object, for panes=2 it is a 1-D array and for panes=4 it is a 2-D array.

pylj.sample.setup_cellview(ax, system, scale=1)[source]

Builds the particle position visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
  • scale (float (optional)) – The amount by which the particle size should be scaled down.
pylj.sample.setup_diffview(ax)[source]

Builds the scattering profile visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_energyview(ax)[source]

Builds the total force visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_forceview(ax)[source]

Builds the total force visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_maxbolthist(ax)[source]

Builds the simulation velocity histogram visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_msdview(ax)[source]

Builds the simulation mean squared deviation visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_pressureview(ax)[source]

Builds the simulation instantaneous pressure visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.setup_rdfview(ax, system)[source]

Builds the radial distribution function visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.setup_tempview(ax)[source]

Builds the simulation instantaneous temperature visualisation pane.

Parameters:ax (Axes object) – The axes position that the pane should be placed in.
pylj.sample.update_cellview(ax, system)[source]

Updates the particle positions visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_diffview(ax, system, average_diff, q)[source]

Updates the scattering profile visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
  • average_diff (array_like) – The scattering profile’s i(q) for each timestep, to later be averaged.
  • q (array_like) – The scattering profile’s q for each timestep, to later be averaged.
pylj.sample.update_energyview(ax, system)[source]

Updates the total force visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_forceview(ax, system)[source]

Updates the total force visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_maxbolthist(ax, system, velocities)[source]

Updates the simulation velocity histogram visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_msdview(ax, system)[source]

Updates the simulation mean squared deviation visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_pressureview(ax, system)[source]

Updates the simulation instantaneous pressure visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
pylj.sample.update_rdfview(ax, system, average_rdf, r)[source]

Updates the radial distribution function visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.
  • average_rdf (array_like) – The radial distribution functions g(r) for each timestep, to later be averaged.
  • r (array_like) – The radial distribution functions r for each timestep, to later be averaged.
pylj.sample.update_tempview(ax, system)[source]

Updates the simulation instantaneous temperature visualisation pane.

Parameters:
  • ax (Axes object) – The axes position that the pane should be placed in.
  • system (System) – The whole system information.