Logo
Version: latest
git info: 30Sep2026-411-g2b85e289b1

User Guide

  • 1. Introduction
  • 2. Install LAMMPS
  • 3. Build LAMMPS
  • 4. Run LAMMPS
  • 5. Errors
  • 6. Commands
  • 7. Accelerate performance
  • 8. Optional packages
  • 9. Auxiliary tools
  • 10. Howto discussions
  • 11. Example scripts

Programmer Guide

  • 1. LAMMPS Library Interfaces
  • 2. Use Python with LAMMPS
  • 3. Modifying & extending LAMMPS
  • 4. Information for Developers

Command Reference

  • Commands
    • angle_coeff command
    • angle_style command
    • angle_write command
    • atom_modify command
    • atom_style command
    • balance command
    • bond_coeff command
    • bond_style command
    • bond_write command
    • boundary command
    • change_box command
    • clear command
    • comm_modify command
    • comm_style command
    • compute command
    • compute_modify command
    • create_atoms command
    • create_bonds command
    • create_box command
    • delete_atoms command
    • delete_bonds command
    • dielectric command
    • dihedral_coeff command
    • dihedral_style command
    • dihedral_write command
    • dimension command
    • displace_atoms command
    • dynamical_matrix command
    • echo command
    • fenix command
    • fix command
    • fix_modify command
    • fitpod command
    • geturl command
    • group command
    • group2ndx command
    • ndx2group command
    • hyper command
    • if command
    • improper_coeff command
    • improper_style command
    • include command
    • info command
    • jump command
    • kim command
    • kspace_modify command
    • kspace_style command
    • label command
    • labelmap command
    • lattice command
    • log command
    • mass command
    • mdi command
    • min_modify command
    • min_style spin command
    • min_style spin/cg command
    • min_style spin/lbfgs command
    • min_style cg command
    • min_style hftn command
    • min_style sd command
    • min_style quickmin command
    • min_style fire command
    • min_style spin command
    • min_style spin/cg command
    • min_style spin/lbfgs command
    • minimize command
    • molecule command
    • neb command
    • neb/spin command
    • neigh_modify command
    • neighbor command
    • newton command
    • next command
    • package command
    • pair_coeff command
    • pair_modify command
    • pair_style command
    • pair_write command
    • partition command
    • plugin command
    • prd command
    • print command
      • Syntax
      • Examples
      • Description
      • Restrictions
      • Related commands
      • Default
    • processors command
    • python command
    • quit command
    • read_data command
    • read_dump command
    • read_restart command
    • region command
    • region2vmd command
    • replicate command
    • rerun command
    • reset_atoms command
    • reset_timestep command
    • restart command
    • run command
    • run_style command
    • set command
    • shell command
    • special_bonds command
    • suffix command
    • tad command
    • temper command
    • temper/grem command
    • temper/npt command
    • thermo command
    • thermo_modify command
    • thermo_style command
    • third_order command
    • timer command
    • timestep command
    • uncompute command
    • undump command
    • unfix command
    • units command
    • variable command
    • velocity command
    • write_coeff command
    • write_data command
    • write_dump command
    • write_molecule command
    • write_restart command
  • Fix Styles
  • Compute Styles
  • Pair Styles
  • Bond Styles
  • Angle Styles
  • Dihedral Styles
  • Improper Styles
  • Dump Styles
  • Bibliography
Index
LAMMPS
  • Commands
  • print command
  • LAMMPS Homepage | Commands
Previous Next

print command

Syntax

print string keyword value
  • string = text string to print, which may contain variables

  • zero or more keyword/value pairs may be appended

  • keyword = file or append or screen or universe

    file value = filename
    append value = filename
    screen value = yes or no
    universe value = yes or no

Examples

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 "NEB calculation 1 complete" screen no universe yes
print """
System volume = $v
System temperature = $t
"""

Description

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.

Added in version 15Jun2023: support for vector style variables

See the 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 compute or fix, or references to other variables. 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 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 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 Commands parse doc page.

If you want the print command to be executed multiple times (with changing variable values), there are 3 options. First, consider using the fix print command, which will print a string periodically during a simulation. Second, the print command can be used as an argument to the every option of the run command. Third, the print command could appear in a section of the input script that is looped over (see the jump and next commands).

If the file or append keyword is used, a filename is specified to which the output 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 to the screen and logfile can be turned on or off as desired.

If the universe keyword is used, output to the global screen and logfile can be turned on or off as desired. In multi-partition calculations, the screen option and the corresponding output only apply to the screen and logfile of the individual partition.

Restrictions

none

Related commands

fix print, variable

Default

The option defaults are no file output, screen = yes, and universe = no.

Previous Next

© Copyright 2003-2026 Sandia Corporation.

Built with Sphinx using a theme provided by Read the Docs.
Version latest
LAMMPS Branch:
develop
stable
release
Downloads:
PDF
Source
Git Info:
30Sep2026-411-g2b85e289b1