Page MenuHomec4science

compute_variable.html
No OneTemporary

File Metadata

Created
Fri, Oct 11, 17:52

compute_variable.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>compute variable command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>compute ID group-ID variable name
</PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command
<LI>variable/atom = style name of this compute command
<LI>name = variable name to invoke to compute a scalar quantity
</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 all variable myTemp
</PRE>
<P><B>Description:</B>
</P>
<P>Define a computation that calculates a formula that returns a scalar
quantity. This quantity can be time averaged and output via the <A HREF = "fix_ave_time.html">fix
ave/time</A> command. It could also be output via the
<A HREF = "thermo_style.html">thermo_style custom</A> command, although it makes
more sense to access the variable directly in this case.
</P>
<P>The formula is defined by the <A HREF = "variable.html">variable equal</A> command.
A variable of style <I>equal</I> can access properties of the system, such
as volume or temperature, and also reference individual atom
attributes, such as its coordinates or velocity.
</P>
<P>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:
</P>
<PRE>variable den equal div(atoms,vol)
compute density all variable den
fix 1 all ave/time 1 1000 density 0 den.profile
</PRE>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_ave_time.html">fix ave/time</A>, <A HREF = "variable.html">variable</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>

Event Timeline