API Reference¶
Log Reader¶
- read_log(filename)¶
Reads a LAMMPS log file and returns a pandas DataFrame containing all thermo data.
Now attempts to use fast mmap-based parsing, falling back to robust line-based parsing for streams or unsupported file objects.
Utilities¶
- get_color_value(value, minValue, maxValue, cmap='viridis')¶
Get color from colormap.
- Parameters:
value (float) – Value used to get color from colormap.
minValue (float) – Minimum value in colormap. Values below this value will saturate on the lower color of the colormap.
maxValue (float) – Maximum value in colormap. Values above this value will saturate on the upper color of the colormap.
cmap (str, optional) – Name of the colormap to use. Default is ‘viridis’.
- Returns:
4-vector containing colormap values.
- Return type:
Notes
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 colormap as the temperature increases.
- get_matlab_color(i)¶
Get colors from matlabs standard color order.
- Parameters:
i (int) – Index. Cycles with a period of 7, so calling with 1 returns the same color as calling with 8.
- Returns:
Color as 3-vector.
- Return type:
Command Line Interface¶
lammps-logfile includes a command-line interface (CLI) tool called lammps_logplotter for quick visualization of log files without writing any Python code.
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