API Reference

File

class File(ifile)

Class for handling lammps log files.

Parameters

param ifile:

path to lammps log file

type ifile:

string or file

get(entry_name, run_num=-1)

Get time-series from log file by name.

Paramerers

param entry_name:

Name of the entry, for example “Temp”

type entry_name:

str

param run_num:

Lammps simulations commonly involve several run-commands. Here you may choose what run you want the log data from. Default of -1 returns data from all runs concatenated

type run_num:

int

If the rows in the log file changes between runs, the logs are being flushed.

get_keywords(run_num=-1)

Return list of available data columns in the log file.

Utilities

get_color_value(value, minValue, maxValue, cmap='viridis')

Get color from colormap.

Parameters

param value:

Value used tpo get color from colormap

param minValue:

Minimum value in colormap. Values below this value will saturate on the lower color of the colormap.

param maxValue:

Maximum value in colormap. Values above this value will saturate on the upper color of the colormap.

returns:

4-vector containing colormap values.

This is useful if you are plotting data from several simulations, and want to color them based on some parameters changing between the simulations. For example, you may want the color to gradually change along a clormap as the temperature increases.

get_matlab_color(i)

Get colors from matlabs standard color order.

Parameters

param i:

Index. Cycles with a period of 7, so calling with 1 returns the same color as calling with 8.

type i:

int

returns:

color as 3-vector

running_mean(data, N)

Calculate running mean of an array-like dataset.

Parameters

param data:

The array

type data:

1d array-like

param N:

Width of the averaging window

type N:

int

Command line interface

Plot contents from lammps log files. Input file argument comes before keyword arguments.

usage: lammps_logplotter [-h] [-x X] [-y Y [Y ...]] [-a RUNNING_AVERAGE]
                         [-o FOUT] [-c]
                         INPUT_FILE

Positional Arguments

INPUT_FILE

Lammps log file containing thermo output from lammps simulation.

Named Arguments

-x

Data to plot on the first axis

Default: 'Time'

-y

Data to plot on the second axis. You can supply several names to get several plot lines in the same figure.

-a, --running_average

Optionally average over this many log entries with a running average. Some thermo properties fluctuate wildly, and often we are interested in te running average of properties like temperature and pressure.

Default: 1

-o

Save the figure to this file; the format must be supported by matplotlib.

Default: ''

-c, --columns

Print columns of the lammps logfile

Default: False

Indices and tables