.. index:: set set command =========== Syntax """""" .. parsed-literal:: set style ID keyword values ... * style = *atom* or *type* or *mol* or *group* or *region* * ID = atom ID range or type range or mol ID range or group ID or region ID * one or more keyword/value pairs may be appended * keyword = *type* or *type/fraction* or *mol* or *x* or *y* or *z* or *vx* or *vy* or *vz* or *omegax* or *omegay* or *omegaz* or *charge* or *quat* or *quat_direct* or *quat/random* or *diameter* or *shape* or *length* or *tri* or *theta* or *angmom* or *mass* or *density* or *volume* or *image* or *bond* or *add* or *until* or *property/atom* or *blockiness* .. parsed-literal:: *type* value = atom type value can be an atom-style variable (see below) *type/fraction* values = type fraction seed type = new atom type fraction = fraction of selected atoms to set to new atom type seed = random # seed (prime number greater 10000) *mol* value = molecule ID value can be an atom-style variable (see below) *x*,*y*,*z* value = atom coordinate (distance units) value can be an atom-style variable (see below) *vx*,*vy*,*vz* value = atom velocity (velocity units) value can be an atom-style variable (see below) *omegax*,*omegay*,*omegaz* value = atom rotational velocity (rad / time units) value can be an atom-style variable (see below) *inertiax*,*inertiay*,*inertiaz* value = atom principal moments of inertia for superquadric particles (distance^2 mass units) value can be an atom-style variable (see below) *charge* value = atomic charge (charge units) value can be an atom-style variable (see below) *quat* values = a b c theta a,b,c = unit vector to rotate particle around via right-hand rule theta = rotation angle (degrees) any of a,b,c,theta can be an atom-style variable (see below) *quat/random* value = seed seed = random # seed (prime number greater 10000) for quaternion orientations *quat_direct* values = q1 q2 q3 q4 q1,q2,q3,q4 = components of the unit quaternion, alternative to *quat* a b c theta any of q1,q2,q3,q4 can be an atom-style variable (see below) *diameter* value = diameter of spherical particle (distance units) value can be an atom-style variable (see below) *shape* value = Sx Sy Sz Sx,Sy,Sz = 3 diameters of ellipsoid or semi-axes of superquadric (distance units) *length* value = len len = length of line segment (distance units) len can be an atom-style variable (see below) *tri* value = side side = side length of equilateral triangle (distance units) side can be an atom-style variable (see below) *theta* value = angle (degrees) angle = orientation of line segment with respect to x-axis angle can be an atom-style variable (see below) *angmom* values = Lx Ly Lz Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units) any of Lx,Ly,Lz can be an atom-style variable (see below) *mass* value = per-atom mass (mass units) value can be an atom-style variable (see below) *density* value = particle density for sphere or ellipsoid (mass/distance^3 or mass/distance^2 or mass/distance units, depending on dimensionality of particle) value can be an atom-style variable (see below) *volume* value = particle volume for Peridynamic particle (distance^3 units) value can be an atom-style variable (see below) *image* nx ny nz nx,ny,nz = which periodic image of the simulation box the atom is in *bond* value = bond type for all bonds between selected atoms *add* value = yes no yes = add per-atom quantities to a region or a group *until* value = final timestep final timestep = the final timestep value until which the per-atom quantity is to be added *property/atom* value = varname var_value**0** var_value**1** .... varname = name of the variable to be set var_value**0**, var_value**1**... = values of the property to be set. value can be an atom-style variable (see below) *blockiness* values = n1 n2 n1, n2 = superquadric blockiness parameters, more or equal 2 *aspect_ratio* values = ky kz ky, kz = aspect ratio of a superquadric particle in y and z directions with respect to that in x direction (in principal coordinates). Particle blockiness and volume equivalent diameter must be set first Examples """""""" .. parsed-literal:: set group solvent type 2 set group solvent type/fraction 2 0.5 123457 set group edge bond 4 set region half charge 0.5 set type 3 charge 0.5 set type 1*3 charge 0.5 set atom 100*200 x 0.5 y 1.0 set atom 1492 type 3 set property/atom Temp 273.15 set atom 3 type 2 shape 0.001 0.001 0.001 blockiness 10.0 10.0 density 2500 Description """"""""""" Set one or more properties of one or more atoms. Since atom properties are initially assigned by the :doc:`read_data `, :doc:`read_restart ` or :doc:`create_atoms ` commands, this command changes those assignments. This can be useful for overriding the default values assigned by the :doc:`create_atoms ` command (e.g. charge = 0.0). It can be useful for altering pairwise and molecular force interactions, since force-field coefficients are defined in terms of types. It can be used to change the labeling of atoms by atom type or molecule ID when they are output in :doc:`dump ` files. It can also be useful for debugging purposes; i.e. positioning an atom at a precise location to compute subsequent forces or energy. Note that the *style* and *ID* arguments determine which atoms have their properties reset. The remaining keywords specify which properties to reset and what the new values are. Some strings like *type* or *mol* can be used as a style and/or a keyword. ---------- This section describes how to select which atoms to change the properties of, via the *style* and *ID* arguments. The style *atom* selects all the atoms in a range of atom IDs. The style *type* selects all the atoms in a range of types. The style *mol* selects all the atoms in a range of molecule IDs. In each of the range cases, the range can be specified as a single numeric value, or a wildcard asterisk can be used to specify a range of values. This takes the form "*" or "*n" or "n*" or "m*n". For example, for the style *type*, if N = the number of atom types, then an asterisk with no numeric values means all types from 1 to N. A leading asterisk means all types from 1 to n (inclusive). A trailing asterisk means all types from n to N (inclusive). A middle asterisk means all types from m to n (inclusive). For all the styles except *mol*, the lowest value for the wildcard is 1; for *mol* it is 0. The style *group* selects all the atoms in the specified group. The style *region* selects all the atoms in the specified geometric region. See the :doc:`group ` and :doc:`region ` commands for details of how to specify a group or region. ---------- This section describes the keyword options for which properties to change, for the selected atoms. Note that except where explicitly prohibited below, all of the keywords allow an :doc:`atom-style variable ` to be used as the specified value(s). If the value is a variable, it should be specified as v_name, where name is the variable name. In this case, the variable will be evaluated, and its resulting per-atom value used to determine the value assigned to each selected atom. Atom-style variables can specify formulas with various mathematical functions, and include :doc:`thermo_style ` command keywords for the simulation box parameters and timestep and elapsed time. They can also include per-atom values, such as atom coordinates. Thus it is easy to specify a time-dependent or spatially-dependent set of per-atom values. As explained on the :doc:`variable ` doc page, atomfile-style variables can be used in place of atom-style variables, and thus as arguments to the set command. Atomfile-style variables read their per-atoms values from a file. .. warning:: Atom-style and atomfile-style variables return floating point per-atom values. If the values are assigned to an integer variable, such as the molecule ID, then the floating point value is truncated to its integer portion, e.g. a value of 2.6 would become 2. Keyword *type* sets the atom type for all selected atoms. The specified value must be from 1 to ntypes, where ntypes was set by the :doc:`create_box ` command or the *atom types* field in the header of the data file read by the :doc:`read_data ` command. Keyword *type/fraction* sets the atom type for a fraction of the selected atoms. The actual number of atoms changed is not guaranteed to be exactly the requested fraction, but should be statistically close. Random numbers are used in such a way that a particular atom is changed or not changed, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. Keyword *mol* sets the molecule ID for all selected atoms. The :doc:`atom style ` being used must support the use of molecule IDs. Keywords *x*, *y*, *z*, and *charge* set the coordinates or charge of all selected atoms. For *charge*, the :doc:`atom style ` being used must support the use of atomic charge. Keyword *dipole* uses the specified x,y,z values as components of a vector to set as the orientation of the dipole moment vectors of the selected atoms. The magnitude of the dipole moment is set by the length of this orientation vector. Keyword *dipole/random* randomizes the orientation of the dipole moment vectors of the selected atoms and sets the magnitude of each to the specified *Dlen* value. For 2d systems, the z component of the orientation is set to 0.0. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. Keyword *quat* uses the specified values to create a quaternion (4-vector) that represents the orientation of the selected atoms. The particles must be ellipsoids as defined by the :doc:`atom_style ellipsoid ` command, triangles as defined by the :doc:`atom_style tri ` command or superquadric as defined by the :doc:`atom_style tri ` command. Note that particles defined by :doc:`atom_style ellipsoid ` have 3 shape parameters. The 3 values must be non-zero for each particle set by this command. They are used to specify the aspect ratios of an ellipsoidal particle, which is oriented by default with its x-axis along the simulation box's x-axis, and similarly for y and z. If this body is rotated (via the right-hand rule) by an angle theta around a unit rotation vector (a,b,c), then the quaternion that represents its new orientation is given by (cos(theta/2), a*sin(theta/2), b*sin(theta/2), c*sin(theta/2)). The theta and a,b,c values are the arguments to the *quat* keyword. LIGGGHTS(R)-PUBLIC normalizes the quaternion in case (a,b,c) was not specified as a unit vector. For 2d systems, the a,b,c values are ignored, since a rotation vector of (0,0,1) is the only valid choice. Keyword *quat/random* randomizes the orientation of the quaternion of the selected atoms. The particles must be ellipsoids as defined by the :doc:`atom_style ellipsoid ` command, triangles as defined by the :doc:`atom_style tri ` command or superquadric as defined by the :doc:`atom_style superquadric ` command. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. For 2d systems, only orientations in the xy plane are generated. As with keyword *quat*, for ellipsoidal and superquadric particles, the 3 shape values must be non-zero for each particle set by this command. This keyword does not allow use of an atom-style variable. Keyword *quat_direct* simply creates a quaternion from it's values instead of calculting these from a unit rotation vector and rotation angle. These keyword is an alternative to the keyword *quat*. Keyword *diameter* sets the size of the selected atoms. The particles must be finite-size spheres as defined by the :doc:`atom_style sphere ` command. The diameter of a particle can be set to 0.0, which means they will be treated as point particles. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the :doc:`read_data ` command. Keyword *shape* sets the size and shape of the selected atoms. The particles must be ellipsoids or superquadric as defined by the :doc:`atom_style ellipsoid ` or :doc:`atom_style superquadric ` command. The *Sx*, *Sy*, *Sz* settings are the 3 diameters of the ellipsoid or the 3 semi-axes lenghts of the superquadric in each direction. All 3 can be set to the same value, which means the ellipsoid is effectively a sphere. They can also all be set to 0.0 which means the particle will be treated as a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the :doc:`read_data ` command. Keyword *length* sets the length of selected atoms. The particles must be line segments as defined by the :doc:`atom_style line ` command. If the specified value is non-zero the line segment is (re)set to a length = the specified value, centered around the particle position, with an orientation along the x-axis. If the specified value is 0.0, the particle will become a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the :doc:`read_data ` command. Keyword *tri* sets the size of selected atoms. The particles must be triangles as defined by the :doc:`atom_style tri ` command. If the specified value is non-zero the triangle is (re)set to be an equilateral triangle in the xy plane with side length = the specified value, with a centroid at the particle position, with its base parallel to the x axis, and the y-axis running from the center of the base to the top point of the triangle. If the specified value is 0.0, the particle will become a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the :doc:`read_data ` command. Keyword *theta* sets the orientation of selected atoms. The particles must be line segments as defined by the :doc:`atom_style line ` command. The specified value is used to set the orientation angle of the line segments with respect to the x axis. Keyword *angmom* sets the angular momentum of selected atoms. The particles must be ellipsoids as defined by the :doc:`atom_style ellipsoid ` command, triangles as defined by the :doc:`atom_style tri ` command or superquadrics as defined by the :doc:`atom_style superquadric ` command. The angular momentum vector of the particles is set to the 3 specified components. Keyword *mass* sets the mass of all selected particles. The particles must have a per-atom mass attribute, as defined by the :doc:`atom_style ` command. See the "mass" command for how to set mass values on a per-type basis. Keyword *density* also sets the mass of all selected particles, but in a different way. The particles must have a per-atom mass attribute, as defined by the :doc:`atom_style ` command. If the atom has a radius attribute (see :doc:`atom_style sphere `) and its radius is non-zero, its mass is set from the density and particle volume. If the atom has a shape attribute (see :doc:`atom_style ellipsoid `) and its 3 shape parameters are non-zero, then its mass is set from the density and particle volume. If the atom has a length attribute (see :doc:`atom_style line `) and its length is non-zero, then its mass is set from the density and line segment length (the input density is assumed to be in mass/distance units). If the atom has an area attribute (see :doc:`atom_style tri `) and its area is non-zero, then its mass is set from the density and triangle area (the input density is assumed to be in mass/distance^2 units). If none of these cases are valid, then the mass is set to the density value directly (the input density is assumed to be in mass units). Keyword *volume* sets the volume of all selected particles. Currently, only the :doc:`atom_style peri ` command defines particles with a volume attribute. Note that this command does not adjust the particle mass. Keyword *image* sets which image of the simulation box the atom is considered to be in. An image of 0 means it is inside the box as defined. A value of 2 means add 2 box lengths to get the true value. A value of -1 means subtract 1 box length to get the true value. LIGGGHTS(R)-PUBLIC updates these flags as atoms cross periodic boundaries during the simulation. The flags can be output with atom snapshots via the :doc:`dump ` command. If a value of NULL is specified for any of nx,ny,nz, then the current image value for that dimension is unchanged. For non-periodic dimensions only a value of 0 can be specified. This keyword does not allow use of atom-style variables. This command can be useful after a system has been equilibrated and atoms have diffused one or more box lengths in various directions. This command can then reset the image values for atoms so that they are effectively inside the simulation box, e.g if a diffusion coefficient is about to be measured via the :doc:`compute msd ` command. Care should be taken not to reset the image flags of two atoms in a bond to the same value if the bond straddles a periodic boundary (rather they should be different by +/- 1). This will not affect the dynamics of a simulation, but may mess up analysis of the trajectories if a LIGGGHTS(R)-PUBLIC diagnostic or your own analysis relies on the image flags to unwrap a molecule which straddles the periodic box. Keywords *bond* set the bond type of all bonds of selected atoms to the specified value from 1 to nbondtypes. All atoms in a particular bond must be selected atoms in order for the change to be made. The value of nbondtype was set by the *bond types* field in the header of the data file read by the :doc:`read_data ` command. These keywords do not allow use of an atom-style variable. Keyword *property/atom* can update per-particle properties defined by a :doc:`fix property/atom ` command. varname is the name of the variable you want to set, it is followed by the values that should be assigned to this variable. The number of values provided as var_value**i** must correspond to the number of values needed for the update, i.e. only var_value**0** if the defined property is a scalar, and the appropriate number if the property is a vector. See :doc:`fix property/atom ` for details on how to define such a per-particle property. Keyword *add* and *until* are used to add a per-atom quantity (or property) in addition to the keyword *property/atom*. The *add* keyword is used to turn on the addition of a quantity in a region or a group until the timestep defined by the *until* keyword. Keywords *shape* and *blockiness* define superquadric shape of a particle. Restrictions """""""""""" You cannot set an atom attribute (e.g. *mol* or *q* or *volume*) if the :doc:`atom_style ` does not have that attribute. This command requires inter-processor communication to coordinate the setting of bond types (angle types, etc). This means that your system must be ready to perform a simulation before using one of these keywords (force fields set, atom mass set, etc). This is not necessary for other keywords. Using the *region* style with the bond (angle, etc) keywords can give unpredictable results if there are bonds (angles, etc) that straddle periodic boundaries. This is because the region may only extend up to the boundary and partner atoms in the bond (angle, etc) may have coordinates outside the simulation box if they are ghost atoms. Keywords *quat_direct* and *blockiness* require :doc:`atom_style ` *superquadric* Related commands """""""""""""""" :doc:`create_box `, :doc:`create_atoms `, :doc:`read_data ` **Default:** none .. _liws: http://www.cfdem.com .. _ld: Manual.html .. _lc: Section_commands.html#comm