git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@324 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2007-02-21 00:18:01 +00:00
parent 5f537d7841
commit 2dabff1657
16 changed files with 282 additions and 203 deletions

View File

@ -94,12 +94,12 @@ across two or more lines.
comment and discarded. comment and discarded.
</P> </P>
<P>(3) The line is searched repeatedly for $ characters which indicate <P>(3) The line is searched repeatedly for $ characters which indicate
variables that are replaced with text. If the $ is followed by curly variables that are replaced with a text string. If the $ is followed
brackets, then the variable name is the text inside the curly by curly brackets, then the variable name is the text inside the curly
brackets. If no curly brackets follow the $, then the variable name brackets. If no curly brackets follow the $, then the variable name
is the character immediately following the $. Thus ${myTemp} and $x is the character immediately following the $. Thus ${myTemp} and $x
refer to variable names "myTemp" and "x". See the refer to variable names "myTemp" and "x". See the
<A HREF = "variable.html">variable</A> command for details of how values are <A HREF = "variable.html">variable</A> command for details of how strings are
assigned to variables and how they are substituted for in input assigned to variables and how they are substituted for in input
scripts. scripts.
</P> </P>
@ -315,12 +315,12 @@ descriptions of each style or click on the style itself for a full
description: description:
</P> </P>
<DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 > <DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 >
<TR ALIGN="center"><TD ><A HREF = "fix_addforce.html">addforce</A></TD><TD ><A HREF = "fix_aveforce.html">aveforce</A></TD><TD ><A HREF = "fix_com.html">com</A></TD><TD ><A HREF = "fix_deposit.html">deposit</A></TD><TD ><A HREF = "fix_drag.html">drag</A></TD><TD ><A HREF = "fix_efield.html">efield</A></TD><TD ><A HREF = "fix_enforce2d.html">enforce2d</A></TD><TD ><A HREF = "fix_freeze.html">freeze</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "fix_addforce.html">addforce</A></TD><TD ><A HREF = "fix_aveforce.html">aveforce</A></TD><TD ><A HREF = "fix_ave_spatial.html">ave/spatial</A></TD><TD ><A HREF = "fix_ave_time.html">ave/time</A></TD><TD ><A HREF = "fix_box_relax.html">box/relax</A></TD><TD ><A HREF = "fix_com.html">com</A></TD><TD ><A HREF = "fix_deposit.html">deposit</A></TD><TD ><A HREF = "fix_drag.html">drag</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "fix_gran_diag.html">gran/diag</A></TD><TD ><A HREF = "fix_gravity.html">gravity</A></TD><TD ><A HREF = "fix_gyration.html">gyration</A></TD><TD ><A HREF = "fix_indent.html">indent</A></TD><TD ><A HREF = "fix_langevin.html">langevin</A></TD><TD ><A HREF = "fix_lineforce.html">lineforce</A></TD><TD ><A HREF = "fix_msd.html">msd</A></TD><TD ><A HREF = "fix_momentum.html">momentum</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "fix_efield.html">efield</A></TD><TD ><A HREF = "fix_enforce2d.html">enforce2d</A></TD><TD ><A HREF = "fix_freeze.html">freeze</A></TD><TD ><A HREF = "fix_gran_diag.html">gran/diag</A></TD><TD ><A HREF = "fix_gravity.html">gravity</A></TD><TD ><A HREF = "fix_gyration.html">gyration</A></TD><TD ><A HREF = "fix_indent.html">indent</A></TD><TD ><A HREF = "fix_langevin.html">langevin</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "fix_nph.html">nph</A></TD><TD ><A HREF = "fix_npt.html">npt</A></TD><TD ><A HREF = "fix_nve.html">nve</A></TD><TD ><A HREF = "fix_nve_gran.html">nve/gran</A></TD><TD ><A HREF = "fix_nvt.html">nvt</A></TD><TD ><A HREF = "fix_orient_fcc.html">orient/fcc</A></TD><TD ><A HREF = "fix_planeforce.html">planeforce</A></TD><TD ><A HREF = "fix_poems.html">poems</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "fix_lineforce.html">lineforce</A></TD><TD ><A HREF = "fix_msd.html">msd</A></TD><TD ><A HREF = "fix_momentum.html">momentum</A></TD><TD ><A HREF = "fix_nph.html">nph</A></TD><TD ><A HREF = "fix_npt.html">npt</A></TD><TD ><A HREF = "fix_nve.html">nve</A></TD><TD ><A HREF = "fix_nve_gran.html">nve/gran</A></TD><TD ><A HREF = "fix_nvt.html">nvt</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "fix_pour.html">pour</A></TD><TD ><A HREF = "fix_print.html">print</A></TD><TD ><A HREF = "fix_rdf.html">rdf</A></TD><TD ><A HREF = "fix_recenter.html">recenter</A></TD><TD ><A HREF = "fix_rigid.html">rigid</A></TD><TD ><A HREF = "fix_setforce.html">setforce</A></TD><TD ><A HREF = "fix_shake.html">shake</A></TD><TD ><A HREF = "fix_spring.html">spring</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "fix_orient_fcc.html">orient/fcc</A></TD><TD ><A HREF = "fix_planeforce.html">planeforce</A></TD><TD ><A HREF = "fix_poems.html">poems</A></TD><TD ><A HREF = "fix_pour.html">pour</A></TD><TD ><A HREF = "fix_print.html">print</A></TD><TD ><A HREF = "fix_rdf.html">rdf</A></TD><TD ><A HREF = "fix_recenter.html">recenter</A></TD><TD ><A HREF = "fix_rigid.html">rigid</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "fix_spring_rg.html">spring/rg</A></TD><TD ><A HREF = "fix_spring_self.html">spring/self</A></TD><TD ><A HREF = "fix_temp_rescale.html">temp/rescale</A></TD><TD ><A HREF = "fix_tmd.html">tmd</A></TD><TD ><A HREF = "fix_uniaxial.html">uniaxial</A></TD><TD ><A HREF = "fix_vcm.html">vcm</A></TD><TD ><A HREF = "fix_viscous.html">viscous</A></TD><TD ><A HREF = "fix_volume_rescale.html">volume/rescale</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "fix_setforce.html">setforce</A></TD><TD ><A HREF = "fix_shake.html">shake</A></TD><TD ><A HREF = "fix_spring.html">spring</A></TD><TD ><A HREF = "fix_spring_rg.html">spring/rg</A></TD><TD ><A HREF = "fix_spring_self.html">spring/self</A></TD><TD ><A HREF = "fix_temp_rescale.html">temp/rescale</A></TD><TD ><A HREF = "fix_tmd.html">tmd</A></TD><TD ><A HREF = "fix_uniaxial.html">uniaxial</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "fix_wall_gran.html">wall/gran</A></TD><TD ><A HREF = "fix_wall_lj93.html">wall/lj93</A></TD><TD ><A HREF = "fix_wall_lj126.html">wall/lj126</A></TD><TD ><A HREF = "fix_wall_reflect.html">wall/reflect</A></TD><TD ><A HREF = "fix_wiggle.html">wiggle</A> <TR ALIGN="center"><TD ><A HREF = "fix_vcm.html">vcm</A></TD><TD ><A HREF = "fix_viscous.html">viscous</A></TD><TD ><A HREF = "fix_volume_rescale.html">volume/rescale</A></TD><TD ><A HREF = "fix_wall_gran.html">wall/gran</A></TD><TD ><A HREF = "fix_wall_lj93.html">wall/lj93</A></TD><TD ><A HREF = "fix_wall_lj126.html">wall/lj126</A></TD><TD ><A HREF = "fix_wall_reflect.html">wall/reflect</A></TD><TD ><A HREF = "fix_wiggle.html">wiggle</A>
</TD></TR></TABLE></DIV> </TD></TR></TABLE></DIV>
<HR> <HR>
@ -331,7 +331,7 @@ description:
</P> </P>
<DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 > <DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 >
<TR ALIGN="center"><TD ><A HREF = "compute_centro_atom.html">centro/atom</A></TD><TD ><A HREF = "compute_epair_atom.html">epair/atom</A></TD><TD ><A HREF = "compute_etotal_atom.html">etotal/atom</A></TD><TD ><A HREF = "compute_ke_atom.html">ke/atom</A></TD><TD ><A HREF = "compute_pressure.html">pressure</A></TD><TD ><A HREF = "compute_rotate_dipole.html">rotate/dipole</A></TD></TR> <TR ALIGN="center"><TD ><A HREF = "compute_centro_atom.html">centro/atom</A></TD><TD ><A HREF = "compute_epair_atom.html">epair/atom</A></TD><TD ><A HREF = "compute_etotal_atom.html">etotal/atom</A></TD><TD ><A HREF = "compute_ke_atom.html">ke/atom</A></TD><TD ><A HREF = "compute_pressure.html">pressure</A></TD><TD ><A HREF = "compute_rotate_dipole.html">rotate/dipole</A></TD></TR>
<TR ALIGN="center"><TD ><A HREF = "compute_rotate_gran.html">rotate/gran</A></TD><TD ><A HREF = "compute_stress_atom.html">stress/atom</A></TD><TD ><A HREF = "compute_temp.html">temp</A></TD><TD ><A HREF = "compute_temp_partial.html">temp/partial</A></TD><TD ><A HREF = "compute_temp_ramp.html">temp/ramp</A></TD><TD ><A HREF = "compute_temp_region.html">temp/region</A> <TR ALIGN="center"><TD ><A HREF = "compute_rotate_gran.html">rotate/gran</A></TD><TD ><A HREF = "compute_stress_atom.html">stress/atom</A></TD><TD ><A HREF = "compute_temp.html">temp</A></TD><TD ><A HREF = "compute_temp_partial.html">temp/partial</A></TD><TD ><A HREF = "compute_temp_ramp.html">temp/ramp</A></TD><TD ><A HREF = "compute_temp_region.html">temp/region</A><A HREF = "compute_variable_atom.html">variable/atom</A>
</TD></TR></TABLE></DIV> </TD></TR></TABLE></DIV>
<HR> <HR>

View File

@ -91,12 +91,12 @@ across two or more lines.
comment and discarded. comment and discarded.
(3) The line is searched repeatedly for $ characters which indicate (3) The line is searched repeatedly for $ characters which indicate
variables that are replaced with text. If the $ is followed by curly variables that are replaced with a text string. If the $ is followed
brackets, then the variable name is the text inside the curly by curly brackets, then the variable name is the text inside the curly
brackets. If no curly brackets follow the $, then the variable name brackets. If no curly brackets follow the $, then the variable name
is the character immediately following the $. Thus $\{myTemp\} and $x is the character immediately following the $. Thus $\{myTemp\} and $x
refer to variable names "myTemp" and "x". See the refer to variable names "myTemp" and "x". See the
"variable"_variable.html command for details of how values are "variable"_variable.html command for details of how strings are
assigned to variables and how they are substituted for in input assigned to variables and how they are substituted for in input
scripts. scripts.
@ -371,6 +371,9 @@ description:
"addforce"_fix_addforce.html, "addforce"_fix_addforce.html,
"aveforce"_fix_aveforce.html, "aveforce"_fix_aveforce.html,
"ave/spatial"_fix_ave_spatial.html,
"ave/time"_fix_ave_time.html,
"box/relax"_fix_box_relax.html,
"com"_fix_com.html, "com"_fix_com.html,
"deposit"_fix_deposit.html, "deposit"_fix_deposit.html,
"drag"_fix_drag.html, "drag"_fix_drag.html,
@ -432,7 +435,8 @@ description:
"temp"_compute_temp.html, "temp"_compute_temp.html,
"temp/partial"_compute_temp_partial.html, "temp/partial"_compute_temp_partial.html,
"temp/ramp"_compute_temp_ramp.html, "temp/ramp"_compute_temp_ramp.html,
"temp/region"_compute_temp_region.html :tb(c=6,ea=c) "temp/region"_compute_temp_region.html
"variable/atom"_compute_variable_atom.html :tb(c=6,ea=c)
:line :line

View File

@ -513,10 +513,10 @@ the input script is read. "Name" is the variable name which can be a
single character (referenced as $x in the input script) or a full single character (referenced as $x in the input script) or a full
string (referenced as ${abc}). The value can be any string. Using string (referenced as ${abc}). The value can be any string. Using
this command-line option is equivalent to putting the line "variable this command-line option is equivalent to putting the line "variable
name index value" at the beginning of the input script. See the name equal value" at the beginning of the input script. See the
<A HREF = "variable.html">variable</A> command for more info on defining variables <A HREF = "variable.html">variable</A> command for more info on defining variables
and <A HREF = "Section_commands.html#3_2">this section</A> for more info on using and <A HREF = "Section_commands.html#3_2">this section</A> for more info on using
variables in scripts. variables in input scripts.
</P> </P>
<HR> <HR>

View File

@ -506,10 +506,10 @@ the input script is read. "Name" is the variable name which can be a
single character (referenced as $x in the input script) or a full single character (referenced as $x in the input script) or a full
string (referenced as $\{abc\}). The value can be any string. Using string (referenced as $\{abc\}). The value can be any string. Using
this command-line option is equivalent to putting the line "variable this command-line option is equivalent to putting the line "variable
name index value" at the beginning of the input script. See the name equal value" at the beginning of the input script. See the
"variable"_variable.html command for more info on defining variables "variable"_variable.html command for more info on defining variables
and "this section"_Section_commands.html#3_2 for more info on using and "this section"_Section_commands.html#3_2 for more info on using
variables in scripts. variables in input scripts.
:line :line

View File

@ -32,13 +32,14 @@ compute 3 all ke/atom
</P> </P>
<P>In LAMMPS, a "compute" is used in several ways. Computes that <P>In LAMMPS, a "compute" is used in several ways. Computes that
calculate one or more values for the entire group of atoms can output calculate one or more values for the entire group of atoms can output
those values via the <A HREF = "thermo_style.html">thermo_style custom</A> command. those values via the <A HREF = "thermo_style.html">thermo_style custom</A> or <A HREF = "fix_ave_time.html">fix
Or the values can be referenced in a <A HREF = "variable.html">variable equal</A> ave/time</A> command. Or the values can be referenced
command. Computes that calculate a temperature or pressure are used in a <A HREF = "variable.html">variable equal</A> command. Computes that calculate
by fixes that do thermostatting or barostatting and when atom a temperature or pressure are used by fixes that do thermostatting or
velocities are created. Computes that calculate one or more values barostatting and when atom velocities are created. Computes that
for each atom in the group can output those values via the <A HREF = "dump.html">dump calculate one or more values for each atom in the group can output
custom</A> command. those values via the <A HREF = "dump.html">dump custom</A> command or the <A HREF = "fix_ave_spatial.html">fix
ave/spatial</A> command.
</P> </P>
<P>LAMMPS creates its own computes for thermodynamic output and dumping <P>LAMMPS creates its own computes for thermodynamic output and dumping
atom snapshots. Likewise fixes that compute temperature or pressure atom snapshots. Likewise fixes that compute temperature or pressure
@ -73,7 +74,8 @@ defined in LAMMPS:
<LI><A HREF = "compute_temp.html">temp</A> - temperature of group of atoms <LI><A HREF = "compute_temp.html">temp</A> - temperature of group of atoms
<LI><A HREF = "compute_temp_partial.html">temp/partial</A> - temperature excluding one or more dimensions of velocity <LI><A HREF = "compute_temp_partial.html">temp/partial</A> - temperature excluding one or more dimensions of velocity
<LI><A HREF = "compute_temp_ramp.html">temp/ramp</A> - temperature after subtracting a ramped velocity component <LI><A HREF = "compute_temp_ramp.html">temp/ramp</A> - temperature after subtracting a ramped velocity component
<LI><A HREF = "compute_temp_region.html">temp/region</A> - temperature of a region of atoms <LI><A HREF = "compute_temp_region.html">temp/region</A> - temperature of a region of atoms
<LI><A HREF = "compute_variable_atom.html">variable/atom</A> - calculate a formula for each atom
</UL> </UL>
<P><B>Restrictions:</B> none <P><B>Restrictions:</B> none
</P> </P>

View File

@ -29,13 +29,14 @@ Create a computation that will be performed on a group of atoms.
In LAMMPS, a "compute" is used in several ways. Computes that In LAMMPS, a "compute" is used in several ways. Computes that
calculate one or more values for the entire group of atoms can output calculate one or more values for the entire group of atoms can output
those values via the "thermo_style custom"_thermo_style.html command. those values via the "thermo_style custom"_thermo_style.html or "fix
Or the values can be referenced in a "variable equal"_variable.html ave/time"_fix_ave_time.html command. Or the values can be referenced
command. Computes that calculate a temperature or pressure are used in a "variable equal"_variable.html command. Computes that calculate
by fixes that do thermostatting or barostatting and when atom a temperature or pressure are used by fixes that do thermostatting or
velocities are created. Computes that calculate one or more values barostatting and when atom velocities are created. Computes that
for each atom in the group can output those values via the "dump calculate one or more values for each atom in the group can output
custom"_dump.html command. those values via the "dump custom"_dump.html command or the "fix
ave/spatial"_fix_ave_spatial.html command.
LAMMPS creates its own computes for thermodynamic output and dumping LAMMPS creates its own computes for thermodynamic output and dumping
atom snapshots. Likewise fixes that compute temperature or pressure atom snapshots. Likewise fixes that compute temperature or pressure
@ -70,7 +71,8 @@ defined in LAMMPS:
"temp"_compute_temp.html - temperature of group of atoms "temp"_compute_temp.html - temperature of group of atoms
"temp/partial"_compute_temp_partial.html - temperature excluding one or more dimensions of velocity "temp/partial"_compute_temp_partial.html - temperature excluding one or more dimensions of velocity
"temp/ramp"_compute_temp_ramp.html - temperature after subtracting a ramped velocity component "temp/ramp"_compute_temp_ramp.html - temperature after subtracting a ramped velocity component
"temp/region"_compute_temp_region.html - temperature of a region of atoms :ul "temp/region"_compute_temp_region.html - temperature of a region of atoms
"variable/atom"_compute_variable_atom.html - calculate a formula for each atom :ul
[Restrictions:] none [Restrictions:] none

View File

@ -9,18 +9,18 @@
<HR> <HR>
<H3>compute ke/atom command <H3>compute centro/atom command
</H3> </H3>
<P><B>Syntax:</B> <P><B>Syntax:</B>
</P> </P>
<PRE>compute ID group-ID ke/atom <PRE>compute ID group-ID centro/atom
</PRE> </PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command <UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command
<LI>ke/atom = style name of this compute command <LI>centro/atom = style name of this compute command
</UL> </UL>
<P><B>Examples:</B> <P><B>Examples:</B>
</P> </P>
<PRE>compute 1 all ke/atom <PRE>compute 1 all centro/atom
</PRE> </PRE>
<P><B>Description:</B> <P><B>Description:</B>
</P> </P>

View File

@ -6,18 +6,18 @@
:line :line
compute ke/atom command :h3 compute centro/atom command :h3
[Syntax:] [Syntax:]
compute ID group-ID ke/atom :pre compute ID group-ID centro/atom :pre
ID, group-ID are documented in "compute"_compute.html command ID, group-ID are documented in "compute"_compute.html command
ke/atom = style name of this compute command :ul centro/atom = style name of this compute command :ul
[Examples:] [Examples:]
compute 1 all ke/atom :pre compute 1 all centro/atom :pre
[Description:] [Description:]

View File

@ -263,16 +263,15 @@ quantities calculated by a compute to be output. The ID in the
keyword should be replaced by the actual ID of the compute that has keyword should be replaced by the actual ID of the compute that has
been defined elsewhere in the input script. See the been defined elsewhere in the input script. See the
<A HREF = "compute.html">compute</A> command for details. Note that scalar and <A HREF = "compute.html">compute</A> command for details. Note that scalar and
vector quantities that are not calculated on a per-atoms basis vector quantities that are not calculated on a per-atom basis
(e.g. global temperature or pressure) cannot be output in a dump. (e.g. global temperature or pressure) cannot be output in a dump.
Rather, these quantities are output by the <A HREF = "thermo_style.html">thermo_style Rather, these quantities are output by the <A HREF = "thermo_style.html">thermo_style
custom</A> command. custom</A> command.
</P> </P>
<P>If <I>c_ID</I> is used as a keyword, then the a single per-atom quantity <P>If <I>c_ID</I> is used as a keyword, then the scalar per-atom quantity
calculated by the compute is printed. If <I>c_ID[N]</I> is used, then N in calculated by the compute is printed. If <I>c_ID[N]</I> is used, then N
the range from 1-M will print a specific component of the per-atom in the range from 1-M will print the Nth component of the M-length
vector calculated by the compute. A value of N=0 will output the per-atom vector calculated by the compute.
single per-atom quantity.
</P> </P>
<P>See <A HREF = "Section_modify.html">this section</A> for information on how to add <P>See <A HREF = "Section_modify.html">this section</A> for information on how to add
new compute styles to LAMMPS that calculate per-atom quantities which new compute styles to LAMMPS that calculate per-atom quantities which

View File

@ -253,16 +253,15 @@ quantities calculated by a compute to be output. The ID in the
keyword should be replaced by the actual ID of the compute that has keyword should be replaced by the actual ID of the compute that has
been defined elsewhere in the input script. See the been defined elsewhere in the input script. See the
"compute"_compute.html command for details. Note that scalar and "compute"_compute.html command for details. Note that scalar and
vector quantities that are not calculated on a per-atoms basis vector quantities that are not calculated on a per-atom basis
(e.g. global temperature or pressure) cannot be output in a dump. (e.g. global temperature or pressure) cannot be output in a dump.
Rather, these quantities are output by the "thermo_style Rather, these quantities are output by the "thermo_style
custom"_thermo_style.html command. custom"_thermo_style.html command.
If {c_ID} is used as a keyword, then the a single per-atom quantity If {c_ID} is used as a keyword, then the scalar per-atom quantity
calculated by the compute is printed. If {c_ID\[N\]} is used, then N in calculated by the compute is printed. If {c_ID\[N\]} is used, then N
the range from 1-M will print a specific component of the per-atom in the range from 1-M will print the Nth component of the M-length
vector calculated by the compute. A value of N=0 will output the per-atom vector calculated by the compute.
single per-atom quantity.
See "this section"_Section_modify.html for information on how to add See "this section"_Section_modify.html for information on how to add
new compute styles to LAMMPS that calculate per-atom quantities which new compute styles to LAMMPS that calculate per-atom quantities which

View File

@ -65,6 +65,9 @@ made to the old fix via the <A HREF = "fix_modify.html">fix_modify</A> command.
</P> </P>
<UL><LI><A HREF = "fix_addforce.html">fix addforce</A> - add a force to each atom <UL><LI><A HREF = "fix_addforce.html">fix addforce</A> - add a force to each atom
<LI><A HREF = "fix_aveforce.html">fix aveforce</A> - add an averaged force to each atom <LI><A HREF = "fix_aveforce.html">fix aveforce</A> - add an averaged force to each atom
<LI><A HREF = "fix_ave_spatial.html">fix ave/spatial</A> - output per-atom quantities by layer
<LI><A HREF = "fix_ave_time.html">fix ave/time</A> - output time-averaged compute quantities
<LI><A HREF = "fix_box_relax.html">fix box/relax</A> - relax box size during a minimization
<LI><A HREF = "fix_com.html">fix com</A> - compute a center-of-mass <LI><A HREF = "fix_com.html">fix com</A> - compute a center-of-mass
<LI><A HREF = "fix_desosit.html">fix deposit</A> - add new atoms above a surface <LI><A HREF = "fix_desosit.html">fix deposit</A> - add new atoms above a surface
<LI><A HREF = "fix_drag.html">fix drag</A> - drag atoms towards a defined coordinate <LI><A HREF = "fix_drag.html">fix drag</A> - drag atoms towards a defined coordinate

View File

@ -62,6 +62,9 @@ Here is an alphabetic list of fix styles defined in LAMMPS:
"fix addforce"_fix_addforce.html - add a force to each atom "fix addforce"_fix_addforce.html - add a force to each atom
"fix aveforce"_fix_aveforce.html - add an averaged force to each atom "fix aveforce"_fix_aveforce.html - add an averaged force to each atom
"fix ave/spatial"_fix_ave_spatial.html - output per-atom quantities by layer
"fix ave/time"_fix_ave_time.html - output time-averaged compute quantities
"fix box/relax"_fix_box_relax.html - relax box size during a minimization
"fix com"_fix_com.html - compute a center-of-mass "fix com"_fix_com.html - compute a center-of-mass
"fix deposit"_fix_desosit.html - add new atoms above a surface "fix deposit"_fix_desosit.html - add new atoms above a surface
"fix drag"_fix_drag.html - drag atoms towards a defined coordinate "fix drag"_fix_drag.html - drag atoms towards a defined coordinate

View File

@ -204,8 +204,8 @@ are output by the <A HREF = "dump.html">dump custom</A> command.
</P> </P>
<P>If <I>c_ID</I> is used as a keyword, then the scalar quantity calculated by <P>If <I>c_ID</I> is used as a keyword, then the scalar quantity calculated by
the compute is printed. If <I>c_ID[N]</I> is used, then N in the range the compute is printed. If <I>c_ID[N]</I> is used, then N in the range
from 1-M will print a specific component of the vector calculated by from 1-M will print the Nth component of the M-length vector
the compute. A value of N=0 will output the scalar quantity. calculated by the compute.
</P> </P>
<P>The <I>f_ID</I> and <I>f_ID[N]</I> keywords allow scalar or vector quantities <P>The <I>f_ID</I> and <I>f_ID[N]</I> keywords allow scalar or vector quantities
calculated by a fix to be output. The ID in the keyword should be calculated by a fix to be output. The ID in the keyword should be
@ -214,8 +214,8 @@ in the input script. See the <A HREF = "fix.html">fix</A> command for details.
</P> </P>
<P>If <I>f_ID</I> is used as a keyword, then the scalar quantity calculated by <P>If <I>f_ID</I> is used as a keyword, then the scalar quantity calculated by
the fix is printed. If <I>f_ID[N]</I> is used, then N in the range from the fix is printed. If <I>f_ID[N]</I> is used, then N in the range from
1-M will print a specific component of the vector calculated by the 1-M will print the Nth component of the M-length vector calculated by
fix. A value of N=0 will output the scalar quantity. the fix.
</P> </P>
<P>The <I>v_name</I> keyword allow the current value of a variable to be <P>The <I>v_name</I> keyword allow the current value of a variable to be
output. The name in the keyword should be replaced by the actual namd output. The name in the keyword should be replaced by the actual namd

View File

@ -198,8 +198,8 @@ are output by the "dump custom"_dump.html command.
If {c_ID} is used as a keyword, then the scalar quantity calculated by If {c_ID} is used as a keyword, then the scalar quantity calculated by
the compute is printed. If {c_ID\[N\]} is used, then N in the range the compute is printed. If {c_ID\[N\]} is used, then N in the range
from 1-M will print a specific component of the vector calculated by from 1-M will print the Nth component of the M-length vector
the compute. A value of N=0 will output the scalar quantity. calculated by the compute.
The {f_ID} and {f_ID\[N\]} keywords allow scalar or vector quantities The {f_ID} and {f_ID\[N\]} keywords allow scalar or vector quantities
calculated by a fix to be output. The ID in the keyword should be calculated by a fix to be output. The ID in the keyword should be
@ -208,8 +208,8 @@ in the input script. See the "fix"_fix.html command for details.
If {f_ID} is used as a keyword, then the scalar quantity calculated by If {f_ID} is used as a keyword, then the scalar quantity calculated by
the fix is printed. If {f_ID\[N\]} is used, then N in the range from the fix is printed. If {f_ID\[N\]} is used, then N in the range from
1-M will print a specific component of the vector calculated by the 1-M will print the Nth component of the M-length vector calculated by
fix. A value of N=0 will output the scalar quantity. the fix.
The {v_name} keyword allow the current value of a variable to be The {v_name} keyword allow the current value of a variable to be
output. The name in the keyword should be replaced by the actual namd output. The name in the keyword should be replaced by the actual namd

View File

@ -17,22 +17,26 @@
</PRE> </PRE>
<UL><LI>name = name of variable to define <UL><LI>name = name of variable to define
<LI>style = <I>index</I> or <I>loop</I> or <I>world</I> or <I>universe</I> or <I>uloop</I> or <I>equal</I> <LI>style = <I>index</I> or <I>loop</I> or <I>world</I> or <I>universe</I> or <I>uloop</I> or <I>equal</I> or <I>atom</I>
<PRE> <I>index</I> args = one or more strings <PRE> <I>index</I> args = one or more strings
<I>loop</I> args = N = integer size of loop <I>loop</I> args = N = integer size of loop
<I>world</I> args = one string for each partition of processors <I>world</I> args = one string for each partition of processors
<I>universe</I> args = one or more strings <I>universe</I> args = one or more strings
<I>uloop</I> args = N = integer size of loop <I>uloop</I> args = N = integer size of loop
<I>equal</I> args = one equation containing numbers, thermo keywords, math functions, group functions, atom vectors, compute references, other variables <I>equal</I> or <I>atom</I> args = one equation containing numbers, thermo keywords, math functions, group functions, atom vectors, compute references, other variables
numbers = 0.0, -5.4, 2.8e-4, etc numbers = 0.0, -5.4, 2.8e-4, etc
thermo keywords = vol, ke, press, etc from <A HREF = "thermo_style.html">thermo_style</A> thermo keywords = vol, ke, press, etc from <A HREF = "thermo_style.html">thermo_style</A>
math functions = add(x,y), sub(x,y), mult(x,y), div(x,y), math functions = add(x,y), sub(x,y), mult(x,y), div(x,y),
neg(x), pow(x,y), exp(x), ln(x), sqrt(x) neg(x), pow(x,y), exp(x), ln(x), sqrt(x)
group functions = mass(group), charge(group), xcm(group,dim), group functions = mass(group), charge(group), xcm(group,dim),
vcm(group,dim), bound(group,xmin), gyration(group) vcm(group,dim), bound(group,xmin), gyration(group)
atom vectors = x[N], y[N], z[N], vx[N], vy[N], vz[N], atom vectors for <I>equal</I> = mass[N], x[N], y[N], z[N],
fx[N], fy[N], fz[N] vx[N], vy[N], vz[N],
fx[N], fy[N], fz[N]
atom vectors for <I>atom</I> = mass[], x[], y[], z[],
vx[], vy[], vz[],
fx[], fy[], fz[]
compute references = c_ID[0], c_ID[N] compute references = c_ID[0], c_ID[N]
other variables = v_abc, v_x, etc other variables = v_abc, v_x, etc
</PRE> </PRE>
@ -43,68 +47,78 @@
<PRE>variable x index run1 run2 run3 run4 run5 run6 run7 run8 <PRE>variable x index run1 run2 run3 run4 run5 run6 run7 run8
variable LoopVar loop 20 variable LoopVar loop 20
variable beta equal div(temp,3.0) variable beta equal div(temp,3.0)
variable b1 equal add(x[234],mult(0.5,col)) variable b1 equal add(x[234],mult(0.5,vol))
variable b equal div(xcm(mol1,x),2.0) variable b equal div(xcm(mol1,x),2.0)
variable b equal c_myTemp[0] variable b equal c_myTemp[0]
variable b atom div(mult(x<B></B>,y<B></B>),vol)
variable temp world 300.0 310.0 320.0 330.0 variable temp world 300.0 310.0 320.0 330.0
variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
variable x uloop 15 variable x uloop 15
</PRE> </PRE>
<P><B>Description:</B> <P><B>Description:</B>
</P> </P>
<P>This command assigns one or more values to a variable name so that the <P>This command assigns one or more strings to a variable name.
variable can be used in subsequent input script commands or its value Variables can be used in several ways in LAMMPS. A variable can be
output during a simulation. The "name" of the variable is an referenced elsewhere in an input script. For variable styles that
arbitrary string. Each "value" is a string which could be text or store multiple strings, the <A HREF = "next.html">next</A> command can be used to
numbers, as in the examples above. increment which string is assigned to the variable. Variables can be
evaluated to produce a numeric value which can be output either
directly (see the <A HREF = "print.html">print</A>, <A HREF = "fix_print.html">fix print</A>, and
<A HREF = "run.html">run every</A> commands) or as part of thermodynamic output (see
the <A HREF = "thermo_style.html">thermo_style</A> command), fix output (see the
<A HREF = "fix_ave_spatial.html">fix ave/spatial</A> and <A HREF = "compute_variable_atom.html">compute
variable/atom</A> commands), or dump output
(see the <A HREF = "dump.html">dump custom</A> and <A HREF = "compute_variable_atom.html">compute
variable/atom</A> commands).
</P> </P>
<P>As explained in <A HREF = "Section_commands.html#3_2">this section</A>, occurrences <P>In the discussion that follows, the "name" of the variable is the
of the variable name in an input script line are replaced by the arbitrary string that is the 1st argument in the variable command.
variable's value. The variable name can be referenced in the input The "string" is one of the subsequent arguments. The "value" is the
script as $x if the name "x" is a single character, or as ${LoopVar} numeric quantity resulting from evaluation of the string. Note that
if the name "LoopVar" is one or more characters. the same string can generate different values when it is evaluated at
different times during a simulation.
</P> </P>
<P>Variable values can also be accessed for output once or periodically <P>IMPORTANT NOTE: When a variable command is encountered in the input
during a simulation by the <A HREF = "print.html">print</A> command, <A HREF = "fix_print.html">fix script and the variable name has already been specified, the command
print</A> command, <A HREF = "run.html">run every</A> command, and the is ignored. This means variables can NOT be re-defined in an input
<A HREF = "thermo_style.html">thermo_style</A> command. script. This is to allow an input script with variable commands to be
processed multiple times without resetting the variables; see the
<A HREF = "jump.html">jump</A> or <A HREF = "include.html">include</A> commands. It also means
that using a command-line switch -var will override a corresponding
variable setting in the input script.
</P>
<P>There is one exception to this rule. As described below, if a
variable is iterated on to the end of its list of strings via the
<A HREF = "next.html">next</A> command, it is available to be re-defined in a
subsequent variable command.
</P> </P>
<HR> <HR>
<P><A HREF = "Section_commands.html#3_2">This section</A> explains how occurrences of a
variable name in an input script line are replaced by the variable's
string. The variable name can be referenced as $x if the name "x" is
a single character, or as ${LoopVar} if the name "LoopVar" is one or
more characters.
</P>
<P>As described below, for variable styles <I>index</I>, <I>loop</I>, <I>universe</I>, <P>As described below, for variable styles <I>index</I>, <I>loop</I>, <I>universe</I>,
and <I>uloop</I>, the value assigned to a variable can be incremented via and <I>uloop</I>, the string assigned to a variable can be incremented via
the <A HREF = "next.html">next</A> command. When there are no more values to the <A HREF = "next.html">next</A> command. When there are no more strings to
assign, the variable is "exhausted" and a flag is set that causes the assign, the variable is "exhausted" and a flag is set that causes the
next <A HREF = "jump.html">jump</A> command encountered in the input script to be next <A HREF = "jump.html">jump</A> command encountered in the input script to be
skipped. This enables the construction of simple loops in the input skipped. This enables the construction of simple loops in the input
script that are iterated over and exited from. script that are iterated over and exited from.
</P> </P>
<P>When a variable command is encountered for a variable that has already
been specified, the command is ignored. This allows an input script
with a variable command to be processed multiple times; see the
<A HREF = "jump.html">jump</A> or <A HREF = "include.html">include</A> commands. It also means
that the use of the command-line switch -var will override a
corresponding variable setting in the input script.
</P>
<P>There are two exceptions to this rule. The first is for <I>equal</I> style
variables. They are re-defined each time a variable command using an
equal-style variable is encountered. Also, if a variable is iterated
on to the end of its list via the <A HREF = "next.html">next</A> command, it is
available to be re-defined in a subsequent variable command.
</P>
<HR> <HR>
<P>For the <I>index</I> style, one or more strings are specified. Initially, <P>For the <I>index</I> style, one or more strings are specified. Initially,
the 1st string is assigned to the variable. Each time a the 1st string is assigned to the variable. Each time a
<A HREF = "next.html">next</A> command is used with the variable name, the next <A HREF = "next.html">next</A> command is used with the variable name, the next
string is assigned. All processors assign the same string to the string is assigned. All processors assign the same string to the
variable. <I>Index</I>-style variables can also be set (with a single variable.
value) by using the command-line switch -var; see <A HREF = "Section_start.html#2_6">this
section</A> for details.
</P> </P>
<P>The <I>loop</I> style is identical to the <I>index</I> style except that the <P>The <I>loop</I> style is identical to the <I>index</I> style except that the
strings are the integers from 1 to N. This allows you to generate a strings are the integers from 1 to N. This allows generation of a
long list of runs (e.g. 1000) without having to list N values in your long list of runs (e.g. 1000) without having to list N strings in the
input script. Initially, the string "1" is assigned to the variable. input script. Initially, the string "1" is assigned to the variable.
Each time a <A HREF = "next.html">next</A> command is used with the variable name, Each time a <A HREF = "next.html">next</A> command is used with the variable name,
the next string ("2", "3", etc) is assigned. All processors assign the next string ("2", "3", etc) is assigned. All processors assign
@ -116,7 +130,7 @@ section</A> of the manual for information on
running LAMMPS with multiple partitions via the "-partition" running LAMMPS with multiple partitions via the "-partition"
command-line switch. This variable command assigns one string to each command-line switch. This variable command assigns one string to each
world. All processors in the world are assigned the same string. The world. All processors in the world are assigned the same string. The
next command cannot be used with <I>equal</I>-style variables, since there next command cannot be used with <I>equal</I> style variables, since there
is only one value per world. This style of variable is useful when is only one value per world. This style of variable is useful when
you wish to run different simulations on different partitions, or when you wish to run different simulations on different partitions, or when
performing a parallel tempering simulation (see the performing a parallel tempering simulation (see the
@ -130,31 +144,43 @@ running LAMMPS with multiple partitions via the "-partition"
command-line switch. This variable command initially assigns one command-line switch. This variable command initially assigns one
string to each world. When a <A HREF = "next.html">next</A> command is encountered string to each world. When a <A HREF = "next.html">next</A> command is encountered
using this variable, the first processor partition to encounter it, is using this variable, the first processor partition to encounter it, is
assigned the next available value. This continues until all the assigned the next available string. This continues until all the
variable values are consumed. Thus, this command can be used to run variable strings are consumed. Thus, this command can be used to run
50 simulations on 8 processor partitions. The simulations will be run 50 simulations on 8 processor partitions. The simulations will be run
one after the other on whatever partition becomes available, until one after the other on whatever partition becomes available, until
they are all finished. <I>Universe</I>-style variables are incremented they are all finished. <I>Universe</I> style variables are incremented
using the files "tmp.lammps.variable" and "tmp.lammps.variable.lock" using the files "tmp.lammps.variable" and "tmp.lammps.variable.lock"
which you will see in your directory during such a LAMMPS run. which you will see in your directory during such a LAMMPS run.
</P> </P>
<P>The <I>uloop</I> style is identical to the <I>universe</I> style except that the <P>The <I>uloop</I> style is identical to the <I>universe</I> style except that the
strings are the integers from 1 to N. This allows you to generate a strings are the integers from 1 to N. This allows generation of long
long list of runs (e.g. 1000) without having to list N values in your list of runs (e.g. 1000) without having to list N strings in the input
input script. script.
</P> </P>
<HR> <HR>
<P>For the <I>equal</I> style, a single string is specified which represents <P>For the <I>equal</I> and <I>atom</I> styles, a single string is specified which
an equation that will be evaluated afresh each time the variable is represents an equation that will be evaluated afresh each time the
used. Thus the variable can take on different values at different variable is used. For <I>equal</I> style variables this equation computes
stages of the input script. For example, if the variable is used in a a scalar quantity, which becomes the value of the variable whenever it
<A HREF = "fix_print.html">fix print</A> command, different values could be printed is evaluated. For <I>atom</I> style variables it computes a quantity for
each timestep it was invoked. The next command cannot be used with each atom, which is used by the "compute variable/atom" command and
<I>equal</I>-style variables, since there is only one value. its associated output.
</P> </P>
<P>The equation for an <I>equal</I>-style variable can contain a variety of <P>Note that <I>equal</I> and <I>atom</I> variables can produce different values at
quantities. The syntax for each kind of quantity is simple, but different stages of the input script or at different times during a
run. For example, if an <I>equal</I> variable is used in a <A HREF = "fix_print.html">fix
print</A> command, different values could be printed each
timestep it was invoked.
</P>
<P><I>Equal</I> style variables can also be set by using the command-line
switch -var; see <A HREF = "Section_start.html#2_6">this section</A> for details.
</P>
<P>The next command cannot be used with <I>equal</I> or <I>atom</I> style
variables, since there is only one string.
</P>
<P>The equation for an <I>equal</I> or <I>atom</I> variable can contain a variety
of quantities. The syntax for each kind of quantity is simple, but
multiple quantities can be nested and combined in various ways to multiple quantities can be nested and combined in various ways to
build up formulas of arbitrary complexity. For example, this is a build up formulas of arbitrary complexity. For example, this is a
valid (though strange) variable equation: valid (though strange) variable equation:
@ -163,14 +189,16 @@ valid (though strange) variable equation:
</PRE> </PRE>
<P>Specifically, an equation can contain numbers, thermo keywords, math <P>Specifically, an equation can contain numbers, thermo keywords, math
functions, group functions, atom vectors, compute references, and functions, group functions, atom vectors, compute references, and
other variables: other variables. There is one difference between <I>equal</I> and <I>atom</I>
variables; the syntax of Atom vector references is different.
</P> </P>
<DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 > <DIV ALIGN=center><TABLE WIDTH="0%" BORDER=1 >
<TR><TD >Number</TD><TD > 0.2, 1.0e20, -15.4, etc</TD></TR> <TR><TD >Number</TD><TD > 0.2, 1.0e20, -15.4, etc</TD></TR>
<TR><TD >Thermo keywords</TD><TD > vol, pe, ebond, etc</TD></TR> <TR><TD >Thermo keywords</TD><TD > vol, pe, ebond, etc</TD></TR>
<TR><TD >Math functions</TD><TD > add(x,y), sub(x,y), mult(x,y), div(x,y), neg(x), pow(x,y), exp(x), ln(x), sqrt(x)</TD></TR> <TR><TD >Math functions</TD><TD > add(x,y), sub(x,y), mult(x,y), div(x,y), neg(x), pow(x,y), exp(x), ln(x), sqrt(x)</TD></TR>
<TR><TD >Group functions</TD><TD > mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), bound(ID,dir), gyration(ID)</TD></TR> <TR><TD >Group functions</TD><TD > mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), bound(ID,dir), gyration(ID)</TD></TR>
<TR><TD >Atom vectors</TD><TD > x[N], y[N], z[N], vx[N], vy[N], vz[N], fx[N], fy[N], fz[N]</TD></TR> <TR><TD >Atom vectors for <I>equal</I></TD><TD > mass[N], x[N], y[N], z[N], vx[N], vy[N], vz[N], fx[N], fy[N], fz[N]</TD></TR>
<TR><TD >Atom vectors for <I>atom</I></TD><TD > mass[], x[], y[], z[], vx[], vy[], vz[], fx[], fy[], fz[]</TD></TR>
<TR><TD >Compute references</TD><TD > c_ID[0], c_ID[N]</TD></TR> <TR><TD >Compute references</TD><TD > c_ID[0], c_ID[N]</TD></TR>
<TR><TD >Other variables</TD><TD > v_abc, v_x, etc <TR><TD >Other variables</TD><TD > v_abc, v_x, etc
</TD></TR></TABLE></DIV> </TD></TR></TABLE></DIV>
@ -197,20 +225,24 @@ min/max of a particular coordinate for all atoms in the group.
Gyration() computes the radius-of-gyration of the group of atoms. See Gyration() computes the radius-of-gyration of the group of atoms. See
the <A HREF = "fix_gyration.html">fix gyration</A> command for the formula. the <A HREF = "fix_gyration.html">fix gyration</A> command for the formula.
</P> </P>
<P>The atom vectors take a single integer argument from 1-N, which <P>For <I>equal</I> style variables, atom vectors take a single integer
is the desired atom-ID, e.g. x[243]. argument from 1-N, which is the desired atom-ID, e.g. x[243]. For
<I>atom</I> style variables, atom vectors take no argument. Since <I>atom</I>
style variables compute one value per atom, a reference like x[]
means the x-coord of each atom will be used when evaluating the
variable.
</P> </P>
<P>Compute references access allow access to scalar or vector quantities <P>Compute references access scalar or vector quantities calculated by a
calculated by a compute. The ID in the reference should be replaced <A HREF = "compute.html">compute</A>. The ID in the reference should be replaced by
by the actual ID of the compute that has been defined elsewhere in the the actual ID of the compute defined elsewhere in the input script.
input script. See the <A HREF = "compute.html">compute</A> command for details. See the <A HREF = "compute.html">compute</A> command for details. Note that
Note that per-atom quantities calcalated by a compute cannot be per-atom quantities calculated by a compute cannot be accessed this
accessed this way, but only global scalar or vector quantities. way, but only global scalar or vector quantities.
</P> </P>
<P>If <I>c_ID[0]</I> is used as a keyword, then the scalar quantity <P>If <I>c_ID[0]</I> is used as a keyword, then the scalar quantity
calculated by the compute is printed. If <I>c_ID[N]</I> is used, then N calculated by the compute is printed. If <I>c_ID[N]</I> is used, then N
in the range from 1-M will print a specific component of the vector in the range from 1-M will print the Mth component of the N-length
calculated by the compute. vector calculated by the compute.
</P> </P>
<P>The current values of other variables can be accessed by prepending a <P>The current values of other variables can be accessed by prepending a
"v_" to the variable name. This will cause the other variable to be "v_" to the variable name. This will cause the other variable to be
@ -222,8 +254,8 @@ print $a
</PRE> </PRE>
<P>then LAMMPS will run for a while when the print statement is invoked. <P>then LAMMPS will run for a while when the print statement is invoked.
</P> </P>
<P>Note that there is a subtle difference between using a variable <P>Note that there is a subtle difference between using a variable in a
in a <I>equal</I>-style equation in the form $x versus v_x. <I>equal</I> or <I>atom</I> style equation in the form $x versus v_x.
</P> </P>
<P>In the former case, as with any other input script command, the <P>In the former case, as with any other input script command, the
variable's value is substituted for immediately when the line is read variable's value is substituted for immediately when the line is read
@ -243,7 +275,7 @@ variable y equal mult(v_x,2)
<P>would associate the equation string "mult(v_x,2)" with variable y. <P>would associate the equation string "mult(v_x,2)" with variable y.
</P> </P>
<P>Thus if the variable y were evaluated periodically during a run where <P>Thus if the variable y were evaluated periodically during a run where
the box volume changed, the resulting value would always be 500.0 for the box volume changed, the resulting value would always be 2000.0 for
the first case, but would change dynamically for the second case. the first case, but would change dynamically for the second case.
</P> </P>
<HR> <HR>

View File

@ -13,21 +13,25 @@ variable command :h3
variable name style args ... :pre variable name style args ... :pre
name = name of variable to define :ulb,l name = name of variable to define :ulb,l
style = {index} or {loop} or {world} or {universe} or {uloop} or {equal} :l style = {index} or {loop} or {world} or {universe} or {uloop} or {equal} or {atom} :l
{index} args = one or more strings {index} args = one or more strings
{loop} args = N = integer size of loop {loop} args = N = integer size of loop
{world} args = one string for each partition of processors {world} args = one string for each partition of processors
{universe} args = one or more strings {universe} args = one or more strings
{uloop} args = N = integer size of loop {uloop} args = N = integer size of loop
{equal} args = one equation containing numbers, thermo keywords, math functions, group functions, atom vectors, compute references, other variables {equal} or {atom} args = one equation containing numbers, thermo keywords, math functions, group functions, atom vectors, compute references, other variables
numbers = 0.0, -5.4, 2.8e-4, etc numbers = 0.0, -5.4, 2.8e-4, etc
thermo keywords = vol, ke, press, etc from "thermo_style"_thermo_style.html thermo keywords = vol, ke, press, etc from "thermo_style"_thermo_style.html
math functions = add(x,y), sub(x,y), mult(x,y), div(x,y), math functions = add(x,y), sub(x,y), mult(x,y), div(x,y),
neg(x), pow(x,y), exp(x), ln(x), sqrt(x) neg(x), pow(x,y), exp(x), ln(x), sqrt(x)
group functions = mass(group), charge(group), xcm(group,dim), group functions = mass(group), charge(group), xcm(group,dim),
vcm(group,dim), bound(group,xmin), gyration(group) vcm(group,dim), bound(group,xmin), gyration(group)
atom vectors = x\[N\], y\[N\], z\[N\], vx\[N\], vy\[N\], vz\[N\], atom vectors for {equal} = mass\[N\], x\[N\], y\[N\], z\[N\],
fx\[N\], fy\[N\], fz\[N\] vx\[N\], vy\[N\], vz\[N\],
fx\[N\], fy\[N\], fz\[N\]
atom vectors for {atom} = mass\[\], x\[\], y\[\], z\[\],
vx\[\], vy\[\], vz\[\],
fx\[\], fy\[\], fz\[\]
compute references = c_ID\[0\], c_ID\[N\] compute references = c_ID\[0\], c_ID\[N\]
other variables = v_abc, v_x, etc :pre other variables = v_abc, v_x, etc :pre
:ule :ule
@ -37,68 +41,78 @@ style = {index} or {loop} or {world} or {universe} or {uloop} or {equal} :l
variable x index run1 run2 run3 run4 run5 run6 run7 run8 variable x index run1 run2 run3 run4 run5 run6 run7 run8
variable LoopVar loop 20 variable LoopVar loop 20
variable beta equal div(temp,3.0) variable beta equal div(temp,3.0)
variable b1 equal add(x\[234\],mult(0.5,col)) variable b1 equal add(x\[234\],mult(0.5,vol))
variable b equal div(xcm(mol1,x),2.0) variable b equal div(xcm(mol1,x),2.0)
variable b equal c_myTemp\[0\] variable b equal c_myTemp\[0\]
variable b atom div(mult(x[],y[]),vol)
variable temp world 300.0 310.0 320.0 330.0 variable temp world 300.0 310.0 320.0 330.0
variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
variable x uloop 15 :pre variable x uloop 15 :pre
[Description:] [Description:]
This command assigns one or more values to a variable name so that the This command assigns one or more strings to a variable name.
variable can be used in subsequent input script commands or its value Variables can be used in several ways in LAMMPS. A variable can be
output during a simulation. The "name" of the variable is an referenced elsewhere in an input script. For variable styles that
arbitrary string. Each "value" is a string which could be text or store multiple strings, the "next"_next.html command can be used to
numbers, as in the examples above. increment which string is assigned to the variable. Variables can be
evaluated to produce a numeric value which can be output either
directly (see the "print"_print.html, "fix print"_fix_print.html, and
"run every"_run.html commands) or as part of thermodynamic output (see
the "thermo_style"_thermo_style.html command), fix output (see the
"fix ave/spatial"_fix_ave_spatial.html and "compute
variable/atom"_compute_variable_atom.html commands), or dump output
(see the "dump custom"_dump.html and "compute
variable/atom"_compute_variable_atom.html commands).
As explained in "this section"_Section_commands.html#3_2, occurrences In the discussion that follows, the "name" of the variable is the
of the variable name in an input script line are replaced by the arbitrary string that is the 1st argument in the variable command.
variable's value. The variable name can be referenced in the input The "string" is one of the subsequent arguments. The "value" is the
script as $x if the name "x" is a single character, or as $\{LoopVar\} numeric quantity resulting from evaluation of the string. Note that
if the name "LoopVar" is one or more characters. the same string can generate different values when it is evaluated at
different times during a simulation.
Variable values can also be accessed for output once or periodically IMPORTANT NOTE: When a variable command is encountered in the input
during a simulation by the "print"_print.html command, "fix script and the variable name has already been specified, the command
print"_fix_print.html command, "run every"_run.html command, and the is ignored. This means variables can NOT be re-defined in an input
"thermo_style"_thermo_style.html command. script. This is to allow an input script with variable commands to be
processed multiple times without resetting the variables; see the
"jump"_jump.html or "include"_include.html commands. It also means
that using a command-line switch -var will override a corresponding
variable setting in the input script.
There is one exception to this rule. As described below, if a
variable is iterated on to the end of its list of strings via the
"next"_next.html command, it is available to be re-defined in a
subsequent variable command.
:line :line
"This section"_Section_commands.html#3_2 explains how occurrences of a
variable name in an input script line are replaced by the variable's
string. The variable name can be referenced as $x if the name "x" is
a single character, or as $\{LoopVar\} if the name "LoopVar" is one or
more characters.
As described below, for variable styles {index}, {loop}, {universe}, As described below, for variable styles {index}, {loop}, {universe},
and {uloop}, the value assigned to a variable can be incremented via and {uloop}, the string assigned to a variable can be incremented via
the "next"_next.html command. When there are no more values to the "next"_next.html command. When there are no more strings to
assign, the variable is "exhausted" and a flag is set that causes the assign, the variable is "exhausted" and a flag is set that causes the
next "jump"_jump.html command encountered in the input script to be next "jump"_jump.html command encountered in the input script to be
skipped. This enables the construction of simple loops in the input skipped. This enables the construction of simple loops in the input
script that are iterated over and exited from. script that are iterated over and exited from.
When a variable command is encountered for a variable that has already
been specified, the command is ignored. This allows an input script
with a variable command to be processed multiple times; see the
"jump"_jump.html or "include"_include.html commands. It also means
that the use of the command-line switch -var will override a
corresponding variable setting in the input script.
There are two exceptions to this rule. The first is for {equal} style
variables. They are re-defined each time a variable command using an
equal-style variable is encountered. Also, if a variable is iterated
on to the end of its list via the "next"_next.html command, it is
available to be re-defined in a subsequent variable command.
:line :line
For the {index} style, one or more strings are specified. Initially, For the {index} style, one or more strings are specified. Initially,
the 1st string is assigned to the variable. Each time a the 1st string is assigned to the variable. Each time a
"next"_next.html command is used with the variable name, the next "next"_next.html command is used with the variable name, the next
string is assigned. All processors assign the same string to the string is assigned. All processors assign the same string to the
variable. {Index}-style variables can also be set (with a single variable.
value) by using the command-line switch -var; see "this
section"_Section_start.html#2_6 for details.
The {loop} style is identical to the {index} style except that the The {loop} style is identical to the {index} style except that the
strings are the integers from 1 to N. This allows you to generate a strings are the integers from 1 to N. This allows generation of a
long list of runs (e.g. 1000) without having to list N values in your long list of runs (e.g. 1000) without having to list N strings in the
input script. Initially, the string "1" is assigned to the variable. input script. Initially, the string "1" is assigned to the variable.
Each time a "next"_next.html command is used with the variable name, Each time a "next"_next.html command is used with the variable name,
the next string ("2", "3", etc) is assigned. All processors assign the next string ("2", "3", etc) is assigned. All processors assign
@ -110,7 +124,7 @@ section"_Section_start.html#2_6 of the manual for information on
running LAMMPS with multiple partitions via the "-partition" running LAMMPS with multiple partitions via the "-partition"
command-line switch. This variable command assigns one string to each command-line switch. This variable command assigns one string to each
world. All processors in the world are assigned the same string. The world. All processors in the world are assigned the same string. The
next command cannot be used with {equal}-style variables, since there next command cannot be used with {equal} style variables, since there
is only one value per world. This style of variable is useful when is only one value per world. This style of variable is useful when
you wish to run different simulations on different partitions, or when you wish to run different simulations on different partitions, or when
performing a parallel tempering simulation (see the performing a parallel tempering simulation (see the
@ -124,31 +138,43 @@ running LAMMPS with multiple partitions via the "-partition"
command-line switch. This variable command initially assigns one command-line switch. This variable command initially assigns one
string to each world. When a "next"_next.html command is encountered string to each world. When a "next"_next.html command is encountered
using this variable, the first processor partition to encounter it, is using this variable, the first processor partition to encounter it, is
assigned the next available value. This continues until all the assigned the next available string. This continues until all the
variable values are consumed. Thus, this command can be used to run variable strings are consumed. Thus, this command can be used to run
50 simulations on 8 processor partitions. The simulations will be run 50 simulations on 8 processor partitions. The simulations will be run
one after the other on whatever partition becomes available, until one after the other on whatever partition becomes available, until
they are all finished. {Universe}-style variables are incremented they are all finished. {Universe} style variables are incremented
using the files "tmp.lammps.variable" and "tmp.lammps.variable.lock" using the files "tmp.lammps.variable" and "tmp.lammps.variable.lock"
which you will see in your directory during such a LAMMPS run. which you will see in your directory during such a LAMMPS run.
The {uloop} style is identical to the {universe} style except that the The {uloop} style is identical to the {universe} style except that the
strings are the integers from 1 to N. This allows you to generate a strings are the integers from 1 to N. This allows generation of long
long list of runs (e.g. 1000) without having to list N values in your list of runs (e.g. 1000) without having to list N strings in the input
input script. script.
:line :line
For the {equal} style, a single string is specified which represents For the {equal} and {atom} styles, a single string is specified which
an equation that will be evaluated afresh each time the variable is represents an equation that will be evaluated afresh each time the
used. Thus the variable can take on different values at different variable is used. For {equal} style variables this equation computes
stages of the input script. For example, if the variable is used in a a scalar quantity, which becomes the value of the variable whenever it
"fix print"_fix_print.html command, different values could be printed is evaluated. For {atom} style variables it computes a quantity for
each timestep it was invoked. The next command cannot be used with each atom, which is used by the "compute variable/atom" command and
{equal}-style variables, since there is only one value. its associated output.
The equation for an {equal}-style variable can contain a variety of Note that {equal} and {atom} variables can produce different values at
quantities. The syntax for each kind of quantity is simple, but different stages of the input script or at different times during a
run. For example, if an {equal} variable is used in a "fix
print"_fix_print.html command, different values could be printed each
timestep it was invoked.
{Equal} style variables can also be set by using the command-line
switch -var; see "this section"_Section_start.html#2_6 for details.
The next command cannot be used with {equal} or {atom} style
variables, since there is only one string.
The equation for an {equal} or {atom} variable can contain a variety
of quantities. The syntax for each kind of quantity is simple, but
multiple quantities can be nested and combined in various ways to multiple quantities can be nested and combined in various ways to
build up formulas of arbitrary complexity. For example, this is a build up formulas of arbitrary complexity. For example, this is a
valid (though strange) variable equation: valid (though strange) variable equation:
@ -157,7 +183,8 @@ variable x equal div(add(pe,c_MyTemp\[0\]),pow(vol,div(1,3))) :pre
Specifically, an equation can contain numbers, thermo keywords, math Specifically, an equation can contain numbers, thermo keywords, math
functions, group functions, atom vectors, compute references, and functions, group functions, atom vectors, compute references, and
other variables: other variables. There is one difference between {equal} and {atom}
variables; the syntax of Atom vector references is different.
Number: 0.2, 1.0e20, -15.4, etc Number: 0.2, 1.0e20, -15.4, etc
Thermo keywords: vol, pe, ebond, etc Thermo keywords: vol, pe, ebond, etc
@ -165,8 +192,12 @@ Math functions: add(x,y), sub(x,y), mult(x,y), div(x,y), \
neg(x), pow(x,y), exp(x), ln(x), sqrt(x) neg(x), pow(x,y), exp(x), ln(x), sqrt(x)
Group functions: mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), \ Group functions: mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), \
bound(ID,dir), gyration(ID) bound(ID,dir), gyration(ID)
Atom vectors: x\[N\], y\[N\], z\[N\], vx\[N\], vy\[N\], vz\[N\], \ Atom vectors for {equal}: mass\[N\], x\[N\], y\[N\], z\[N\], \
fx\[N\], fy\[N\], fz\[N\] vx\[N\], vy\[N\], vz\[N\], \
fx\[N\], fy\[N\], fz\[N\]
Atom vectors for {atom}: mass\[\], x\[\], y\[\], z\[\], \
vx\[\], vy\[\], vz\[\], \
fx\[\], fy\[\], fz\[\]
Compute references: c_ID\[0\], c_ID\[N\] Compute references: c_ID\[0\], c_ID\[N\]
Other variables: v_abc, v_x, etc :tb(s=:) Other variables: v_abc, v_x, etc :tb(s=:)
@ -192,20 +223,24 @@ min/max of a particular coordinate for all atoms in the group.
Gyration() computes the radius-of-gyration of the group of atoms. See Gyration() computes the radius-of-gyration of the group of atoms. See
the "fix gyration"_fix_gyration.html command for the formula. the "fix gyration"_fix_gyration.html command for the formula.
The atom vectors take a single integer argument from 1-N, which For {equal} style variables, atom vectors take a single integer
is the desired atom-ID, e.g. x\[243\]. argument from 1-N, which is the desired atom-ID, e.g. x\[243\]. For
{atom} style variables, atom vectors take no argument. Since {atom}
style variables compute one value per atom, a reference like x\[\]
means the x-coord of each atom will be used when evaluating the
variable.
Compute references access allow access to scalar or vector quantities Compute references access scalar or vector quantities calculated by a
calculated by a compute. The ID in the reference should be replaced "compute"_compute.html. The ID in the reference should be replaced by
by the actual ID of the compute that has been defined elsewhere in the the actual ID of the compute defined elsewhere in the input script.
input script. See the "compute"_compute.html command for details. See the "compute"_compute.html command for details. Note that
Note that per-atom quantities calcalated by a compute cannot be per-atom quantities calculated by a compute cannot be accessed this
accessed this way, but only global scalar or vector quantities. way, but only global scalar or vector quantities.
If {c_ID\[0\]} is used as a keyword, then the scalar quantity If {c_ID\[0\]} is used as a keyword, then the scalar quantity
calculated by the compute is printed. If {c_ID\[N\]} is used, then N calculated by the compute is printed. If {c_ID\[N\]} is used, then N
in the range from 1-M will print a specific component of the vector in the range from 1-M will print the Mth component of the N-length
calculated by the compute. vector calculated by the compute.
The current values of other variables can be accessed by prepending a The current values of other variables can be accessed by prepending a
"v_" to the variable name. This will cause the other variable to be "v_" to the variable name. This will cause the other variable to be
@ -217,8 +252,8 @@ print $a :pre
then LAMMPS will run for a while when the print statement is invoked. then LAMMPS will run for a while when the print statement is invoked.
Note that there is a subtle difference between using a variable Note that there is a subtle difference between using a variable in a
in a {equal}-style equation in the form $x versus v_x. {equal} or {atom} style equation in the form $x versus v_x.
In the former case, as with any other input script command, the In the former case, as with any other input script command, the
variable's value is substituted for immediately when the line is read variable's value is substituted for immediately when the line is read
@ -238,7 +273,7 @@ variable y equal mult(v_x,2) :pre
would associate the equation string "mult(v_x,2)" with variable y. would associate the equation string "mult(v_x,2)" with variable y.
Thus if the variable y were evaluated periodically during a run where Thus if the variable y were evaluated periodically during a run where
the box volume changed, the resulting value would always be 500.0 for the box volume changed, the resulting value would always be 2000.0 for
the first case, but would change dynamically for the second case. the first case, but would change dynamically for the second case.
:line :line