Page MenuHomec4science

compute.html
No OneTemporary

File Metadata

Created
Fri, Jul 12, 22:22

compute.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 command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>compute ID group-ID style args
</PRE>
<UL><LI>ID = user-assigned name for the computation
<LI>group-ID = ID of the group of atoms to perform the computation on
<LI>style = one of a list of possible style names (see below)
<LI>args = arguments used by a particular style
</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 all temp
compute newtemp flow temp/partial 1 1 0
compute 3 all ke/atom
</PRE>
<P><B>Description:</B>
</P>
<P>Define a computation that will be performed on a group of atoms.
Quantities calculated by a compute are instantaneous values, meaning
they are calculated from information about atoms on the current
timestep or iteration, though a compute may internally store some
information about a previous state of the system. Defining a compute
does not perform a computation. Instead computes are invoked by other
LAMMPS commands as needed, e.g. to calculate a temperature needed for
a thermostat fix or to generate thermodynamic or dump file output.
See this <A HREF = "Section_howto.html#howto_15">howto section</A> for a summary of
various LAMMPS output options, many of which involve computes.
</P>
<P>The ID of a compute can only contain alphanumeric characters and
underscores.
</P>
<HR>
<P>Computes calculate one of three styles of quantities: global,
per-atom, or local. A global quantity is one or more system-wide
values, e.g. the temperature of the system. A per-atom quantity is
one or more values per atom, e.g. the kinetic energy of each atom.
Per-atom values are set to 0.0 for atoms not in the specified compute
group. Local quantities are calculated by each processor based on the
atoms it owns, but there may be zero or more per atom, e.g. a list of
bond distances. Computes that produce per-atom quantities have the
word "atom" in their style, e.g. <I>ke/atom</I>. Computes that produce
local quantities have the word "local" in their style,
e.g. <I>bond/local</I>. Styles with neither "atom" or "local" in their
style produce global quantities.
</P>
<P>Note that a single compute produces either global or per-atom or local
quantities, but never more than one of these.
</P>
<P>Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values. The
doc page for each compute describes the style and kind of values it
produces, e.g. a per-atom vector. Some computes produce more than one
kind of a single style, e.g. a global scalar and a global vector.
</P>
<P>When a compute quantity is accessed, as in many of the output commands
discussed below, it can be referenced via the following bracket
notation, where ID is the ID of the compute:
</P>
<DIV ALIGN=center><TABLE BORDER=1 >
<TR><TD >c_ID </TD><TD > entire scalar, vector, or array</TD></TR>
<TR><TD >c_ID[I] </TD><TD > one element of vector, one column of array</TD></TR>
<TR><TD >c_ID[I][J] </TD><TD > one element of array
</TD></TR></TABLE></DIV>
<P>In other words, using one bracket reduces the dimension of the
quantity once (vector -> scalar, array -> vector). Using two brackets
reduces the dimension twice (array -> scalar). Thus a command that
uses scalar compute values as input can also process elements of a
vector or array.
</P>
<P>Note that commands and <A HREF = "variable.html">variables</A> which use compute
quantities typically do not allow for all kinds, e.g. a command may
require a vector of values, not a scalar. This means there is no
ambiguity about referring to a compute quantity as c_ID even if it
produces, for example, both a scalar and vector. The doc pages for
various commands explain the details.
</P>
<HR>
<P>In LAMMPS, the values generated by a compute can be used in several
ways:
</P>
<UL><LI>The results of computes that calculate a global temperature or
pressure can be used by fixes that do thermostatting or barostatting
or when atom velocities are created.
<LI>Global values can be output via the <A HREF = "thermo_style.html">thermo_style
custom</A> or <A HREF = "fix_ave_time.html">fix ave/time</A> command.
Or the values can be referenced in a <A HREF = "variable.html">variable equal</A> or
<A HREF = "variable.html">variable atom</A> command.
<LI>Per-atom values can be output via the <A HREF = "dump.html">dump custom</A> command
or the <A HREF = "fix_ave_spatial.html">fix ave/spatial</A> command. Or they can be
time-averaged via the <A HREF = "fix_ave_atom.html">fix ave/atom</A> command or
reduced by the <A HREF = "compute_reduce.html">compute reduce</A> command. Or the
per-atom values can be referenced in an <A HREF = "variable.html">atom-style
variable</A>.
<LI>Local values can be reduced by the <A HREF = "compute_reduce.html">compute
reduce</A> command, or histogrammed by the <A HREF = "fix_ave_histo.html">fix
ave/histo</A> command, or output by the <A HREF = "dump.html">dump
local</A> command.
</UL>
<P>The results of computes that calculate global quantities can be either
"intensive" or "extensive" values. Intensive means the value is
independent of the number of atoms in the simulation,
e.g. temperature. Extensive means the value scales with the number of
atoms in the simulation, e.g. total rotational kinetic energy.
<A HREF = "thermo_style.html">Thermodynamic output</A> will normalize extensive
values by the number of atoms in the system, depending on the
"thermo_modify norm" setting. It will not normalize intensive values.
If a compute value is accessed in another way, e.g. by a
<A HREF = "variable.html">variable</A>, you may want to know whether it is an
intensive or extensive value. See the doc page for individual
computes for further info.
</P>
<HR>
<P>LAMMPS creates its own computes internally for thermodynamic output.
Three computes are always created, named "thermo_temp",
"thermo_press", and "thermo_pe", as if these commands had been invoked
in the input script:
</P>
<PRE>compute thermo_temp all temp
compute thermo_press all pressure thermo_temp
compute thermo_pe all pe
</PRE>
<P>Additional computes for other quantities are created if the thermo
style requires it. See the documentation for the
<A HREF = "thermo_style.html">thermo_style</A> command.
</P>
<P>Fixes that calculate temperature or pressure, i.e. for thermostatting
or barostatting, may also create computes. These are discussed in the
documentation for specific <A HREF = "fix.html">fix</A> commands.
</P>
<P>In all these cases, the default computes LAMMPS creates can be
replaced by computes defined by the user in the input script, as
described by the <A HREF = "thermo_modify.html">thermo_modify</A> and <A HREF = "fix_modify.html">fix
modify</A> commands.
</P>
<P>Properties of either a default or user-defined compute can be modified
via the <A HREF = "compute_modify.html">compute_modify</A> command.
</P>
<P>Computes can be deleted with the <A HREF = "uncompute.html">uncompute</A> command.
</P>
<P>Code for new computes can be added to LAMMPS (see <A HREF = "Section_modify.html">this
section</A> of the manual) and the results of their
calculations accessed in the various ways described above.
</P>
<HR>
<P>Each compute style has its own doc page which describes its arguments
and what it does. Here is an alphabetic list of compute styles
available in LAMMPS:
</P>
<UL><LI><A HREF = "compute_bond_local.html">angle/local</A> - theta and energy of each angle
<LI><A HREF = "compute_atom_molecule.html">atom/molecule</A> - sum per-atom properties for each molecule
<LI><A HREF = "compute_body_local.html">body/local</A> - attributes of body sub-particles
<LI><A HREF = "compute_bond_local.html">bond/local</A> - distance and energy of each bond
<LI><A HREF = "compute_centro_atom.html">centro/atom</A> - centro-symmetry parameter for each atom
<LI><A HREF = "compute_cluster_atom.html">cluster/atom</A> - cluster ID for each atom
<LI><A HREF = "compute_cna_atom.html">cna/atom</A> - common neighbor analysis (CNA) for each atom
<LI><A HREF = "compute_com.html">com</A> - center-of-mass of group of atoms
<LI><A HREF = "compute_com_molecule.html">com/molecule</A> - center-of-mass for each molecule
<LI><A HREF = "compute_contact_atom.html">contact/atom</A> - contact count for each spherical particle
<LI><A HREF = "compute_coord_atom.html">coord/atom</A> - coordination number for each atom
<LI><A HREF = "compute_damage_atom.html">damage/atom</A> - Peridynamic damage for each atom
<LI><A HREF = "compute_dihedral_local.html">dihedral/local</A> - angle of each dihedral
<LI><A HREF = "compute_displace_atom.html">displace/atom</A> - displacement of each atom
<LI><A HREF = "compute_erotate_asphere.html">erotate/asphere</A> - rotational energy of aspherical particles
<LI><A HREF = "compute_erotate_sphere.html">erotate/sphere</A> - rotational energy of spherical particles
<LI><A HREF = "compute_erotate_sphere.html">erotate/sphere/atom</A> - rotational energy for each spherical particle
<LI><A HREF = "compute_event_displace.html">event/displace</A> - detect event on atom displacement
<LI><A HREF = "compute_group_group.html">group/group</A> - energy/force between two groups of atoms
<LI><A HREF = "compute_gyration.html">gyration</A> - radius of gyration of group of atoms
<LI><A HREF = "compute_gyration_molecule.html">gyration/molecule</A> - radius of gyration for each molecule
<LI><A HREF = "compute_heat_flux.html">heat/flux</A> - heat flux through a group of atoms
<LI><A HREF = "compute_improper_local.html">improper/local</A> - angle of each improper
<LI><A HREF = "compute_inertia_molecule.html">inertia/molecule</A> - inertia tensor for each molecule
<LI><A HREF = "compute_ke.html">ke</A> - translational kinetic energy
<LI><A HREF = "compute_ke_atom.html">ke/atom</A> - kinetic energy for each atom
<LI><A HREF = "compute_msd.html">msd</A> - mean-squared displacement of group of atoms
<LI><A HREF = "compute_msd_molecule.html">msd/molecule</A> - mean-squared displacement for each molecule
<LI><A HREF = "compute_pair.html">pair</A> - values computed by a pair style
<LI><A HREF = "compute_pair_local.html">pair/local</A> - distance/energy/force of each pairwise interaction
<LI><A HREF = "compute_pe.html">pe</A> - potential energy
<LI><A HREF = "compute_pe_atom.html">pe/atom</A> - potential energy for each atom
<LI><A HREF = "compute_pressure.html">pressure</A> - total pressure and pressure tensor
<LI><A HREF = "compute_property_atom.html">property/atom</A> - convert atom attributes to per-atom vectors/arrays
<LI><A HREF = "compute_property_local.html">property/local</A> - convert local attributes to localvectors/arrays
<LI><A HREF = "compute_property_molecule.html">property/molecule</A> - convert molecule attributes to localvectors/arrays
<LI><A HREF = "compute_rdf.html">rdf</A> - radial distribution function g(r) histogram of group of atoms
<LI><A HREF = "compute_reduce.html">reduce</A> - combine per-atom quantities into a single global value
<LI><A HREF = "compute_reduce.html">reduce/region</A> - same as compute reduce, within a region
<LI><A HREF = "compute_slice.html">slice</A> - extract values from global vector or array
<LI><A HREF = "compute_stress_atom.html">stress/atom</A> - stress tensor for each atom
<LI><A HREF = "compute_temp.html">temp</A> - temperature of group of atoms
<LI><A HREF = "compute_temp_asphere.html">temp/asphere</A> - temperature of aspherical particles
<LI><A HREF = "compute_temp_com.html">temp/com</A> - temperature after subtracting center-of-mass velocity
<LI><A HREF = "compute_temp_deform.html">temp/deform</A> - temperature excluding box deformation velocity
<LI><A HREF = "compute_temp_partial.html">temp/partial</A> - temperature excluding one or more dimensions of velocity
<LI><A HREF = "compute_temp_profile.html">temp/profile</A> - temperature excluding a binned velocity profile
<LI><A HREF = "compute_temp_ramp.html">temp/ramp</A> - temperature excluding ramped velocity component
<LI><A HREF = "compute_temp_region.html">temp/region</A> - temperature of a region of atoms
<LI><A HREF = "compute_temp_sphere.html">temp/sphere</A> - temperature of spherical particles
<LI><A HREF = "compute_ti.html">ti</A> - thermodyanmic integration free energy values
<LI><A HREF = "compute_voronoi_atom.html">voronoi/atom</A> - Voronoi volume and neighbors for each atom
</UL>
<P>There are also additional compute styles submitted by users which are
included in the LAMMPS distribution. The list of these with links to
the individual styles are given in the compute section of <A HREF = "Section_commands.html#cmd_5">this
page</A>.
</P>
<P>There are also additional accelerated compute styles included in the
LAMMPS distribution for faster performance on CPUs and GPUs. The list
of these with links to the individual styles are given in the pair
section of <A HREF = "Section_commands.html#cmd_5">this page</A>.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "uncompute.html">uncompute</A>, <A HREF = "compute_modify.html">compute_modify</A>, <A HREF = "fix_ave_atom.html">fix
ave/atom</A>, <A HREF = "fix_ave_spatial.html">fix ave/spatial</A>,
<A HREF = "fix_ave_time.html">fix ave/time</A>, <A HREF = "fix_ave_histo.html">fix ave/histo</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>

Event Timeline