lammps/doc/compute_variable_atom.html

62 lines
1.9 KiB
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/atom command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>compute ID group-ID variable/atom 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 for each atom
</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 flow variable/atom myVar
</PRE>
<P><B>Description:</B>
</P>
<P>Define a computation that calculates a formula for each atom in the
group. The per-atom quantities can be output via the <A HREF = "dump.html">dump
custom</A> command or spatially averaged via the <A HREF = "fix_ave_spatial.html">fix
ave/spatial</A> command.
</P>
<P>The formula is defined by the <A HREF = "variable.html">variable atom</A> command.
A variable of style <I>atom</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 compute the xy kinectic energy of
atoms in the flow group and include the values in dumped snapshots of
the system.
</P>
<PRE>variable xy atom mult(0.5,add(mult(vx[],vx[]),mult(vy[],vy[])))
compute ke flow variable/atom xy
dump 1 flow custom 1000 dump.flow tag type x y z c_ke
</PRE>
<P>If the dump line were replaced by
</P>
<PRE>fix 1 flow ave/spatial 100 1000 z lower 2.0 ke.profile compute ke
</PRE>
<P>then the xy kinetic energy values would be averaged by z layer and the
layer averages written periodically to the file ke.profile.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "dump.html">dump custom</A>, <A HREF = "fix_ave_spatial.html">fix ave/spatial</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>