Page MenuHomec4science

print.html
No OneTemporary

File Metadata

Created
Mon, Nov 4, 16:55

print.html

<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
</CENTER>
<HR>
<H3>print command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>print string keyword value
</PRE>
<UL><LI>string = text string to print, which may contain variables
<LI>zero or more keyword/value pairs may be appended
<LI>keyword = <I>file</I> or <I>append</I> or <I>screen</I>
<PRE> <I>file</I> value = filename
<I>append</I> value = filename
<I>screen</I> value = <I>yes</I> or <I>no</I>
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>print "Done with equilibration" file info.dat
print Vol=$v append info.dat screen no
print "The system volume is now $v"
print 'The system volume is now $v'
print """
System volume = $v
System temperature = $t
"""
</PRE>
<P><B>Description:</B>
</P>
<P>Print a text string to the screen and logfile. The text string must
be a single argument, so if it is one line but more than one word, it
should be enclosed in single or double quotes. To generate multiple
lines of output, the string can be enclosed in triple quotes, as in
the last example above. If the text string contains variables, they
will be evaluated and their current values printed.
</P>
<P>If the <I>file</I> or <I>append</I> keyword is used, a filename is specified to
which the output will be written. If <I>file</I> is used, then the
filename is overwritten if it already exists. If <I>append</I> is used,
then the filename is appended to if it already exists, or created if
it does not exist.
</P>
<P>If the <I>screen</I> keyword is used, output to the screen and logfile can
be turned on or off as desired.
</P>
<P>If you want the print command to be executed multiple times (with
changing variable values), there are 3 options. First, consider using
the <A HREF = "fix_print.html">fix print</A> command, which will print a string
periodically during a simulation. Second, the print command can be
used as an argument to the <I>every</I> option of the <A HREF = "run.html">run</A>
command. Third, the print command could appear in a section of the
input script that is looped over (see the <A HREF = "jump.html">jump</A> and
<A HREF = "next.html">next</A> commands).
</P>
<P>See the <A HREF = "variable.html">variable</A> command for a description of <I>equal</I>
style variables which are typically the most useful ones to use with
the print command. Equal-style variables can calculate formulas
involving mathematical operations, atom properties, group properties,
thermodynamic properties, global values calculated by a
<A HREF = "compute.html">compute</A> or <A HREF = "fix.html">fix</A>, or references to other
<A HREF = "variable.html">variables</A>.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_print.html">fix print</A>, <A HREF = "variable.html">variable</A>
</P>
<P><B>Default:</B>
</P>
<P>The option defaults are no file output and screen = yes.
</P>
</HTML>

Event Timeline