"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

compute variable command :h3

[Syntax:]

compute ID group-ID variable name :pre

ID, group-ID are documented in "compute"_compute.html command
variable/atom = style name of this compute command
name = variable name to invoke to compute a scalar quantity :ul

[Examples:]

compute 1 all variable myTemp :pre

[Description:]

Define a computation that calculates a formula that returns a scalar
quantity.  This quantity can be time averaged and output via the "fix
ave/time"_fix_ave_time.html command.  It could also be output via the
"thermo_style custom"_thermo_style.html command, although it makes
more sense to access the variable directly in this case.

The formula is defined by the "variable equal"_variable.html command.
A variable of style {equal} can access properties of the system, such
as volume or temperature, and also reference individual atom
attributes, such as its coordinates or velocity.

For example, these 3 commands would time average the system density
(assuming the volume fluctuates) temperature and output the average
value periodically to the file den.profile:

variable den equal div(atoms,vol)
compute density all variable den
fix 1 all ave/time 1 1000 density 0 den.profile :pre

[Restrictions:] none

[Related commands:]

"fix ave/time"_fix_ave_time.html, "variable"_variable.html

[Default:] none
