Studying the Fix Print class
In this section, we will learn about the Fix Print
class and its source code.
The Fix Print
class is controlled by the source code in fix_print.cpp
and fix_print.h
, and it can be used to write a text string to the screen or to a specified file.
This fix accepts a string as a Unix-like variable from the input script and writes it every N
steps. In a LAMMPS input script, the corresponding syntax is as follows:
fix FIX_ID GROUP_ID print N STRING
As described in the LAMMPS manual (https://lammps.sandia.gov/doc/fix_print.html), for this particular fix, GROUP_ID
serves as a placeholder and does not have any effect on the fix. The N
integer represents the number of timesteps between writing the string to a file, while STRING
is a text string that can represent the value of a variable or user-entered text. Similar to Unix-style, STRING
should be preceded by the $
symbol if it is a variable name; for example, ${foo}
...