138 lines
5.0 KiB
ReStructuredText
138 lines
5.0 KiB
ReStructuredText
.. index:: fix print
|
|
|
|
fix print command
|
|
=================
|
|
|
|
Syntax
|
|
""""""
|
|
|
|
.. code-block:: LAMMPS
|
|
|
|
fix ID group-ID print N string keyword value ...
|
|
|
|
* ID, group-ID are documented in :doc:`fix <fix>` command
|
|
* print = style name of this fix command
|
|
* N = print every N steps; N can be a variable (see below)
|
|
* string = text string to print with optional variable names
|
|
* zero or more keyword/value pairs may be appended
|
|
* keyword = *file* or *append* or *screen* or *title*
|
|
|
|
.. parsed-literal::
|
|
|
|
*file* value = filename
|
|
*append* value = filename
|
|
*screen* value = *yes* or *no*
|
|
*title* value = string
|
|
string = text to print as 1st line of output file
|
|
|
|
Examples
|
|
""""""""
|
|
|
|
.. code-block:: LAMMPS
|
|
|
|
fix extra all print 100 "Coords of marker atom = $x $y $z"
|
|
fix extra all print 100 "Coords of marker atom = $x $y $z" file coord.txt
|
|
|
|
Description
|
|
"""""""""""
|
|
|
|
Print a text string every N steps during a simulation run. This can
|
|
be used for diagnostic purposes or as a debugging tool to monitor some
|
|
quantity during a run. The text string must be a single argument, so
|
|
it should be enclosed in single or double quotes if it is more than
|
|
one word. If it contains variables it must be enclosed in double
|
|
quotes to ensure they are not evaluated when the input script line is
|
|
read, but will instead be evaluated each time the string is printed.
|
|
|
|
.. versionadded:: 15Jun2023
|
|
|
|
support for vector style variables
|
|
|
|
See the :doc:`variable <variable>` command for a description of
|
|
*equal* and *vector* style variables which are typically the most
|
|
useful ones to use with the print command. Equal- and vector-style
|
|
variables can calculate formulas involving mathematical operations,
|
|
atom properties, group properties, thermodynamic properties, global
|
|
values calculated by a :doc:`compute <compute>` or :doc:`fix <fix>`,
|
|
or references to other :doc:`variables <variable>`. Vector-style
|
|
variables are printed in a bracketed, comma-separated format,
|
|
e.g. [1,2,3,4] or [12.5,2,4.6,10.1].
|
|
|
|
.. note::
|
|
|
|
As discussed on the :doc:`Commands parse <Commands_parse>` doc
|
|
page, the text string can use "immediate" variables, specified as
|
|
$(formula) with parenthesis, where the numeric formula has the same
|
|
syntax as equal-style variables described on the :doc:`variable
|
|
<variable>` doc page. This is a convenient way to evaluate a
|
|
formula immediately without using the variable command to define a
|
|
named variable and then use that variable in the text string. The
|
|
formula can include a trailing colon and format string which
|
|
determines the precision with which the numeric value is output.
|
|
This is also explained on the :doc:`Commands parse
|
|
<Commands_parse>` doc page.
|
|
|
|
Instead of a numeric value, N can be specified as an :doc:`equal-style
|
|
variable <variable>`, which should be specified as v_name, where name
|
|
is the variable name. In this case, the variable is evaluated at the
|
|
beginning of a run to determine the **next** timestep at which the
|
|
string will be written out. On that timestep, the variable will be
|
|
evaluated again to determine the next timestep, etc. Thus the
|
|
variable should return timestep values. See the stagger() and
|
|
logfreq() and stride() math functions for :doc:`equal-style variables
|
|
<variable>`, as examples of useful functions to use in this
|
|
context. For example, the following commands will print output at
|
|
timesteps 10,20,30,100,200,300,1000,2000,etc:
|
|
|
|
.. code-block:: LAMMPS
|
|
|
|
variable s equal logfreq(10,3,10)
|
|
fix extra all print v_s "Coords of marker atom = $x $y $z"
|
|
|
|
The specified group-ID is ignored by this fix.
|
|
|
|
If the *file* or *append* keyword is used, a filename is specified to
|
|
which the output generated by this fix will be written. If *file* is
|
|
used, then the filename is overwritten if it already exists. If
|
|
*append* is used, then the filename is appended to if it already
|
|
exists, or created if it does not exist.
|
|
|
|
If the *screen* keyword is used, output by this fix to the screen and
|
|
logfile can be turned on or off as desired.
|
|
|
|
The *title* keyword allow specification of the string that will be
|
|
printed as the first line of the output file, assuming the *file*
|
|
keyword was used. By default, the title line is as follows:
|
|
|
|
.. parsed-literal::
|
|
|
|
# Fix print output for fix ID
|
|
|
|
where ID is replaced with the fix-ID.
|
|
|
|
Restart, fix_modify, output, run start/stop, minimize info
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
No information about this fix is written to :doc:`binary restart files
|
|
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
|
|
relevant to this fix. No global or per-atom quantities are stored by
|
|
this fix for access by various :doc:`output commands <Howto_output>`.
|
|
No parameter of this fix can be used with the *start/stop* keywords of
|
|
the :doc:`run <run>` command. This fix is not invoked during
|
|
:doc:`energy minimization <minimize>`.
|
|
|
|
Restrictions
|
|
""""""""""""
|
|
none
|
|
|
|
Related commands
|
|
""""""""""""""""
|
|
|
|
:doc:`variable <variable>`, :doc:`print <print>`
|
|
|
|
Default
|
|
"""""""
|
|
|
|
The option defaults are no file output, screen = yes, and title string
|
|
as described above.
|