"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

fix property/atom command :h3

[Syntax:]

fix ID group-ID property/atom vec1 vec2 ... keyword value ... :pre

ID, group-ID are documented in "fix"_fix.html command :ulb,l
property/atom = style name of this fix command :l
vec1,vec2,... = {mol} or {q} or {i_name} or {d_name} :l
  {mol} = molecule IDs
  {q} = charge
  {i_name} = new integer vector referenced by name
  {d_name} = new floating-point vector referenced by name :pre
zero of more keyword/value pairs may be appended :l
keyword = {ghost} :l
  {ghost} value = {no} or {yes} for whether ghost atom info in communicated :pre
:ule

[Examples:]

fix 1 all property/atom mol
fix 1 all property/atom i_myflag1 i_myflag2
fix 1 all property/atom d_sx d_sy d_sz :pre

[Description:]

Create one or more additional per-atom vectors to store information
about atoms and to use during a simulation.  The specified {group-ID}
is ignored by this fix.

The atom style used for a simulation defines a set of per-atom
properties, as explained on the "atom_style"_atom_style.html and
"read_data"_read_data.html doc pages.  The latter command allows these
properties to be defined for each atom in the system when a data file
is read.  This fix will augment the set of properties with new custom
ones.

This can be useful in at least two scenarios.

If the atom style does not define molecule IDs or per-atom charge,
they can be added using the {mol} or {q} keywords.  This can be
useful, e.g, to define "molecules" to use as rigid bodies with the
"fix rigid"_fix_rigid.html command, or just to carry around an extra
flag with the atoms (stored as a molecule ID).  An alternative is to
use an atom style that does define molecule IDs or charge or to use a
hybrid atom style that combines two styles to allow for molecule IDs
or charge, but that has 2 practical drawbacks.  First it typically
necessitates changing the format of the data file.  And it may define
additional properties that aren't needed such as bond lists, which has
some overhead when there are no bonds.

In the future, we may add additional per-atom properties similar to
{mol} or {q}, which "turn-on" specific properties defined by some atom
styles, so they can be used by atom styles that don't define them.

More generally, the {i_name} and {d_name} vectors allow one or more
new custom per-atom properties to be defined.  Each name must be
unique and can use alphanumeric or underscore characters.  These
vectors can store whatever values you decide are useful in your
simulation.  As explained below there are several ways to initialize
and access and output these values, both via input script commands and
in new code that you add to LAMMPS.

This is effectively a simple way to add per-atom properties to a model
without needing to write code for a new "atom style"_atom_style.html
that defines the properties.  Note however that implementing a new
atom style allows new atom properties to be more tightly and
seamlessly integrated with the rest of the code.

The new atom properties encode values that migrate with atoms to new
processors and are written to restart files.  If you want the new
properties to also be defined for ghost atoms, then use the {ghost}
keyword with a value of {yes}.  This will invoke extra communication
when ghost atoms are created (at every re-neighboring) to insure the
new properties are also defined for the ghost atoms.

IMPORTANT NOTE: If you use this command with the {mol} or {charge}
vectors than you most likely want to set {ghost} yes, since these
properties are stored with ghost atoms if you use an
"atom_style"_atom_style.html that defines them, and many LAMMPS
operations that use molecule IDs or charge, such as neighbor lists and
pair styles, will expect ghost atoms to have these valuse.  LAMMPS
will issue a warning it you define those vectors but do not set
{ghost} yes.

IMPORTANT NOTE: The properties for ghost atoms are not updated every
timestep, but only once every few steps when neighbor lists are
re-built.  Thus the {ghost} keyword is suitable for static properties,
like molecule IDs, but not for dynamic properties that change every
step.  For the latter, the code you add to LAMMPS to change the
properties will also need to communicate their new values to/from
ghost atoms, an operation that can be invoked from within a "pair
style"_pair_style.html or "fix"_fix.html or "compute"_compute.html
that you write.

:line

This fix is one of a small number that can be defined in an input
script before the simulation box is created or atoms are defined.
This is so it can be used with the "read_data"_read_data.html command
as described below.

Per-atom properties that are defined by the "atom
style"_atom_style.html are initialized when atoms are created, e.g. by
the "read_data"_read_data.html or "create_atoms"_create_atoms.html
commands.  The per-atom properaties defined by this fix are not.  So
you need to initialize them explicitly.  This can be done by the
"read_data"_read_data.html command, using its {fix} keyword and
passing it the fix-ID of this fix.

Thus these commands:

fix prop all property/atom mol d_flag
read_data data.txt fix prop NULL Molecules :pre

would allow a data file to have a section like this:

Molecules :pre

1 4 1.5
2 4 3.0
3 10 1.0
4 10 1.0
5 10 1.0
...
N 763 4.5 :pre

where N is the number of atoms, and the first field on each line is
the atom-ID, followed by a molecule-ID and a floating point value that
will be stored in a new property called "flag".  Note that the list of
per-atom properties can be in any order.

Another way of initializing the new properties is via the
"set"_set.html command.  For example, if you wanted molecules
defined for every set of 10 atoms, based on their atom-IDs,
these commands could be used:

fix prop all property/atom mol
variable cluster atom ((id-1)/10)+1
set id * mol v_cluster :pre

The "atom-style variable"_variable.html will create values for atoms
with IDs 31,32,33,...40 that are 4.0,4.1,4.2,...,4.9.  When the
"set"_set.html commands assigns them to the molecule ID for each atom,
they will be truncated to an integer value, so atoms 31-40 will all be
assigned a molecule ID of 4.

Note that "atomfile-style variables"_variable.html can also be used in
place of atom-style variables, which means in this case that the
molecule IDs could be read-in from a separate file and assinged by the
"set"_set.html command.  This allows you to initialize new per-atom
properties in a completely general fashion.

:line

For new atom properties specified as {i_name} or {d_name}, the
"compute property/atom"_compute_property_atom.html command can access
their values.  This means that the values can be output via the "dump
custom"_dump.html command, accessed by fixes like "fix
ave/atom"_fix_ave_atom.html, accessed by other computes like "compute
reduce"_compute_reduce.html, or used in "atom-style
variables"_variables.

For example, these commands will output two new properties to a custom
dump file:

fix prop all property/atom i_flag1 d_flag2
compute 1 all property/atom i_flag1 d_flag2
dump 1 all custom 100 tmp.dump id x y z c_1\[1\] c_1\[2\] :pre

:line

If you wish to add new "pair styles"_pair_style.html,
"fixes"_fix.html, or "computes"_compute.html that use the per-atom
properties defined by this fix, see "Section
modify"_Section_modify.html#mod_1 of the manual which has some details
on how the properties can be accessed from added classes.

:line

[Restart, fix_modify, output, run start/stop, minimize info:]

This fix writes the per-atom values it stores to "binary restart
files"_restart.html, so that the values can be restored when a
simulation is restarted.  See the "read_restart"_read_restart.html
command for info on how to re-specify a fix in an input script that
reads a restart file, so that the operation of the fix continues in an
uninterrupted fashion.

None of the "fix_modify"_fix_modify.html options
are relevant to this fix.  No global or per-atom quantities are stored
by this fix for access by various "output
commands"_Section_howto.html#howto_15.  No parameter of this fix can
be used with the {start/stop} keywords of the "run"_run.html command.
This fix is not invoked during "energy minimization"_minimize.html.

[Restrictions:] none

[Related commands:]

"read_data"_read_data.html, "set"_set.html, "compute
property/atom"_compute_property_atom.html

[Default:]

The default keyword values are ghost = no.
