1 "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
3 :link(lws,http://lammps.sandia.gov)
5 :link(lc,Section_commands.html#comm)
13 print string keyword value :pre
15 string = text string to print, which may contain variables :ulb,l
16 zero or more keyword/value pairs may be appended :l
17 keyword = {file} or {append} or {screen} :l
18 {file} value = filename
19 {append} value = filename
20 {screen} value = {yes} or {no} :pre
25 print "Done with equilibration" file info.dat
26 print Vol=$v append info.dat screen no
27 print "The system volume is now $v"
28 print 'The system volume is now $v'
31 System temperature = $t
36 Print a text string to the screen and logfile. The text string must
37 be a single argument, so if it is one line but more than one word, it
38 should be enclosed in single or double quotes. To generate multiple
39 lines of output, the string can be enclosed in triple quotes, as in
40 the last example above. If the text string contains variables, they
41 will be evaluated and their current values printed.
43 If the {file} or {append} keyword is used, a filename is specified to
44 which the output will be written. If {file} is used, then the
45 filename is overwritten if it already exists. If {append} is used,
46 then the filename is appended to if it already exists, or created if
49 If the {screen} keyword is used, output to the screen and logfile can
50 be turned on or off as desired.
52 If you want the print command to be executed multiple times (with
53 changing variable values), there are 3 options. First, consider using
54 the "fix print"_fix_print.html command, which will print a string
55 periodically during a simulation. Second, the print command can be
56 used as an argument to the {every} option of the "run"_run.html
57 command. Third, the print command could appear in a section of the
58 input script that is looped over (see the "jump"_jump.html and
59 "next"_next.html commands).
61 See the "variable"_variable.html command for a description of {equal}
62 style variables which are typically the most useful ones to use with
63 the print command. Equal-style variables can calculate formulas
64 involving mathematical operations, atom properties, group properties,
65 thermodynamic properties, global values calculated by a
66 "compute"_compute.html or "fix"_fix.html, or references to other
67 "variables"_variable.html.
73 "fix print"_fix_print.html, "variable"_variable.html
77 The option defaults are no file output and screen = yes.