\(\renewcommand{\AA}{\text{Å}}\)
8.6.3. Using the LAMMPS GUI
LAMMPS GUI is a simple graphical text editor that is linked to the LAMMPS C-library interface and thus can run LAMMPS directly using the contents of the editor’s text buffer as input.
This is similar to what people traditionally would do to run LAMMPS: using a regular text editor to edit the input and run the necessary commands, possibly including the text editor, too, from a command line terminal window. That is quite effective when running LAMMPS on high-performance computing facilities and when you are very proficient in using the command line. The main benefit of a GUI application is that this integrates well with graphical desktop environments and many basic tasks can be done directly from within the GUI without switching to a text console or requiring external programs or scripts to extract data from the generated output. This makes it easier for beginners to get started running simple LAMMPS simulations and thus very suitable for tutorials on LAMMPS. But also makes it easier to switch to a full featured text editor and more sophisticated visualization and analysis tools.
The following text provides a detailed tour of the features and functionality of the LAMMPS GUI. This document describes LAMMPS GUI version 1.2.
Main window
When LAMMPS GUI starts, it will show the main window with either an empty buffer, or have a file loaded. In the latter case it may look like the following:
There is the menu bar at the top, then the main editor buffer with the input file contents in the center with line numbers on the left and the input colored according to the LAMMPS input file syntax. At the bottom is the status bar, which shows the status of LAMMPS execution on the left (“Ready.” when idle) and the current working directory on the right. The size of the main window will be stored when exiting and restored when starting again. The name of the current file in the buffer is shown in the window title and the text *modified* is added in case the buffer has modifications that are not yet saved to a file.
Opening Files
The LAMMPS GUI application will try to open the first command line
argument as input file, further arguments are ignored. When no
argument is given LAMMPS GUI will start with an empty buffer.
Files can also be opened via the File
menu or by drag-and-drop
of a file from a file manager to the editor window. Only one
file can be open at a time, so opening a new file with a filled
buffer will close this buffer and in case the buffer has unsaved
modifications will ask to either cancel the load, discard the
changes or save them.
Running LAMMPS
From within the LAMMPS GUI main window LAMMPS can be started either from
the Run
menu, by the hotkey Ctrl-Enter (Command-Enter on macOS),
or by clicking on the green button in the status bar. LAMMPS runs in a
separate thread, so the GUI stays responsive and thus it is able to
interact with the calculation and access its data. It is important to
note, that LAMMPS is using the contents of the input buffer for the run,
not the file it was read from. If there are unsaved changes in the
buffer, they will be used.
While LAMMPS is running, the contents of the status bar change: on the
left side there is a text indicating that LAMMPS is running, which will
contain the selected number of threads, if thread-parallel acceleration
was selected in the Preferences
dialog. On the right side, a
progress bar is shown that displays the estimated progress on the
current run command. Additionally, two windows will open:
the log window with the captured screen output and the chart window with
a line graph created from the thermodynamic output of the run.
The run can be stopped cleanly by using either the Stop LAMMPS
entry
in the Run
menu, the hotkey Ctrl-/ (Command-/ on macOS), or
clicking on the red button in the status bar. This will cause that the
running LAMMPS process will complete the current iteration and then
stop. This is equivalent to the command timer timeout 0
and implemented by calling the lammps_force_timeout()
function
of the LAMMPS C-library interface.
Viewing Snapshot Images
By selecting the View Image
entry in the Run
menu, by hitting
the Ctrl-I (Command-I on macOS) hotkey or by clicking on the
“palette” button in the status bar, LAMMPS GUI will issue a
write_dump image command and read the resulting
snapshot image into an image viewer window. When possible, LAMMPS
GUI will try to detect which elements the atoms correspond to (via
their mass) and then colorize them accordingly. Otherwise just some
predefined sequence of colors are assigned to different atom types.
The default image size, some default image quality settings, the view
style and some colors can be changed in the Preferences
dialog
window. From the image viewer window further adjustments can be made:
actual image size, high-quality rendering, anti-aliasing, view style,
display of box or axes, zoom factor. The the image can be rotated
horizontally and vertically and it is possible to only display the atoms
within a predefined group (default is “all”). After each change, the
image is rendered again and the display updated. The small palette icon
on the top left will be colored while LAMMPS is running to render the
image and it will be grayed out again, when it is done. When there are
many items to show and high quality images with anti-aliasing are
requested, re-rendering can take several seconds. From the File
menu, the shown image can be saved to a file permanently or copied into
the cut-n-paste buffer for pasting into another application.
Editor Functions
The editor has most the usual functionality that similar programs have: text selection via mouse or with cursor moves while holding the Shift key, Cut, Copy, Paste, Undo, Redo. All of these editing functions are available via hotkeys. When trying to exit the editor with a modified buffer, a dialog will pop up asking whether to cancel the quit, or don’t save or save the buffer’s contents to a file.
Context Specific Help
A unique feature of the LAMMPS GUI is the option to look up the documentation for the command in the current line. This can be achieved by either clicking the right mouse button or by using the Ctrl-? hotkey. When clicking the mouse there are additional entries in the context menu that will open the corresponding documentation page in the online LAMMPS documentation. When using the hotkey, the first of those entries will be chosen directly.
Preferences
The Preferences
dialog allows to customize some of the behavior
and looks of the LAMMPS GUI application. The settings are grouped
and each group is displayed within a tab.
General Settings:
Echo input to log: when checked, all input commands, including variable expansions, will be echoed to the log window. This is equivalent to using -echo screen at the command line. There is no log file produced since it always uses -log none.
Include citation details: when checked full citation info will be included to the log window. This is equivalent to using -cite screen on the command line.
Show log window by default: when checked, the screen output of a LAMMPS run will be collected in a log window during the run
Show chart window by default: when checked, the thermodynamic output of a LAMMPS run will be collected and displayed in a chart window as line graphs.
Replace log window on new run: when checked, an existing log window will be replaced on a new LAMMPS run, otherwise each run will create a new log window.
Replace chart window on new run: when checked, an existing chart window will be replaced on a new LAMMPS run, otherwise each run will create a new chart window.
Replace image window on new render: when checked, an existing chart window will be replaced when a new snapshot image is requested, otherwise each command will create a new image window.
Path to LAMMPS Shared Library File: this options is only available when LAMMPS GUI was compiled to load the LAMMPS library at run time instead of being linked to it directly. With the
Browse..
button or by changing the text, a different shared library file with a different compilation of LAMMPS with different settings or from a different version can be loaded. After this setting was changed, LAMMPS GUI needs to be re-launched.Select Default Font: Opens a font selection dialog where the type and size for the default font (used for everything but the editor and log) of the application can be set.
Select Text Font: Opens a font selection dialog where the type and size for the text editor and log font of the application can be set.
Accelerators:
This tab enables to select which accelerator package is used and is equivalent to using the -suffix and -package flags on the command line. Only settings supported by the LAMMPS library and local hardware are available. The Number of threads field allows to set the maximum number of threads for the accelerator packages that use threads.
Snapshot Image:
This tab allows to set some defaults for the snapshot images displayed
in the Image Viewer
window, like its dimensions and the zoom factor
applied. The Antialias switch requests to render images with twice
the number of pixels for width and height and then smoothly scales the
image back to the requested size. This produces higher quality images
with smoother edges at the expense of requiring more CPU time to render
the image. The HQ Image mode option turns on using a screen space
ambient occlusion mode (SSAO) when rendering images. This is also more
time consuming, but produces a more ‘spatial’ representation of the
system. The VDW Style checkbox selects whether atoms are represented
by space filling spheres when checked or by smaller spheres and stick.
Finally there are a couple of drop down lists to select the background
and box color.
Hotkeys
Almost all functionality is accessible from the menu or via hotkeys. The following hotkeys are available (On macOS use the Command key instead of Ctrl/Control).
Hotkey |
Function |
Hotkey |
Function |
Hotkey |
Function |
Hotkey |
Function |
---|---|---|---|---|---|---|---|
Ctrl+N |
New File |
Ctrl+Z |
Undo edit |
Ctrl+Enter |
Run LAMMPS |
Ctrl+Shift+A |
About LAMMPS GUI |
Ctrl+O |
Open File |
Ctrl+Shift+Z |
Redo edit |
Ctrl+/ |
Stop Active Run |
Ctrl+Shift+H |
Quick Help |
CTRL+S |
Save File |
Ctrl+C |
Copy text |
Ctrl+Shift+V |
Set Variables |
Ctrl+Shift+G |
LAMMPS GUI Howto |
Ctrl+Shift+S |
Save File As |
Ctrl+X |
Cut text |
Ctrl+I |
Create Snapshot Image |
Ctrl+Shift+M |
LAMMPS Manual |
Ctrl+Q |
Quit |
Ctrl+V |
Paste text |
Ctrl+P |
Preferences |
Ctrl+? |
Context Help |
Further editing keybindings are documented with the Qt documentation. In case of conflicts the list above takes precedence.