1 "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
3 :link(lws,http://lammps.sandia.gov)
5 :link(lc,Section_commands.html#comm)
13 set style ID keyword values ... :pre
15 style = {atom} or {type} or {mol} or {group} or {region} :ulb,l
16 ID = atom ID range or type range or mol ID range or group ID or region ID :l
17 one or more keyword/value pairs may be appended :l
18 keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \
19 {charge} or {dipole} or {dipole/random} or {quat} or \
20 {quat/random} or {diameter} or {shape} or \
21 {length} or {tri} or {theta} or {theta/random} or \
22 {angmom} or {omega} or \
23 {mass} or {density} or {volume} or {image} or \
24 {bond} or {angle} or {dihedral} or {improper} or \
25 {meso/e} or {meso/cv} or {meso/rho} or \
26 {smd/contact/radius} or {smd/mass/density} or {dpd/theta} or \
27 {i_name} or {d_name} :l
28 {type} value = atom type
29 value can be an atom-style variable (see below)
30 {type/fraction} values = type fraction seed
32 fraction = fraction of selected atoms to set to new atom type
33 seed = random # seed (positive integer)
34 {mol} value = molecule ID
35 value can be an atom-style variable (see below)
36 {x},{y},{z} value = atom coordinate (distance units)
37 value can be an atom-style variable (see below)
38 {charge} value = atomic charge (charge units)
39 value can be an atom-style variable (see below)
40 {dipole} values = x y z
41 x,y,z = orientation of dipole moment vector
42 any of x,y,z can be an atom-style variable (see below)
43 {dipole/random} value = seed Dlen
44 seed = random # seed (positive integer) for dipole moment orientations
45 Dlen = magnitude of dipole moment (dipole units)
46 {quat} values = a b c theta
47 a,b,c = unit vector to rotate particle around via right-hand rule
48 theta = rotation angle (degrees)
49 any of a,b,c,theta can be an atom-style variable (see below)
50 {quat/random} value = seed
51 seed = random # seed (positive integer) for quaternion orientations
52 {diameter} value = diameter of spherical particle (distance units)
53 value can be an atom-style variable (see below)
54 {shape} value = Sx Sy Sz
55 Sx,Sy,Sz = 3 diameters of ellipsoid (distance units)
57 len = length of line segment (distance units)
58 len can be an atom-style variable (see below)
60 side = side length of equilateral triangle (distance units)
61 side can be an atom-style variable (see below)
62 {theta} value = angle (degrees)
63 angle = orientation of line segment with respect to x-axis
64 angle can be an atom-style variable (see below)
65 {theta/random} value = seed
66 seed = random # seed (positive integer) for line segment orienations
67 {angmom} values = Lx Ly Lz
68 Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units)
69 any of Lx,Ly,Lz can be an atom-style variable (see below)
70 {omega} values = Wx Wy Wz
71 Wx,Wy,Wz = components of angular velocity vector (radians/time units)
72 any of wx,wy,wz can be an atom-style variable (see below)
73 {mass} value = per-atom mass (mass units)
74 value can be an atom-style variable (see below)
75 {density} value = particle density for sphere or ellipsoid (mass/distance^3 or mass/distance^2 or mass/distance units, depending on dimensionality of particle)
76 value can be an atom-style variable (see below)
77 {volume} value = particle volume for Peridynamic particle (distance^3 units)
78 value can be an atom-style variable (see below)
80 nx,ny,nz = which periodic image of the simulation box the atom is in
81 {bond} value = bond type for all bonds between selected atoms
82 {angle} value = angle type for all angles between selected atoms
83 {dihedral} value = dihedral type for all dihedrals between selected atoms
84 {improper} value = improper type for all impropers between selected atoms
85 {meso/e} value = energy of SPH particles (need units)
86 value can be an atom-style variable (see below)
87 {meso/cv} value = heat capacity of SPH particles (need units)
88 value can be an atom-style variable (see below)
89 {meso/rho} value = density of SPH particles (need units)
90 value can be an atom-style variable (see below)
91 {smd/contact/radius} = radius for short range interactions, i.e. contact and friction
92 value can be an atom-style variable (see below)
93 {smd/mass/density} = set particle mass based on volume by providing a mass density
94 value can be an atom-style variable (see below)
95 {dpd/theta} value = internal temperature of DPD particles (temperature units)
96 value can be an atom-style variable (see below)
97 value can be NULL which sets internal temp of each particle to KE temp
98 {i_name} value = value for custom integer vector with name
99 {d_name} value = value for custom floating-point vector with name :pre
104 set group solvent type 2
105 set group solvent type/fraction 2 0.5 12393
106 set group edge bond 4
107 set region half charge 0.5
108 set type 3 charge 0.5
109 set type 1*3 charge 0.5
110 set atom * charge v_atomfile
111 set atom 100*200 x 0.5 y 1.0
112 set atom 1492 type 3 :pre
116 Set one or more properties of one or more atoms. Since atom
117 properties are initially assigned by the "read_data"_read_data.html,
118 "read_restart"_read_restart.html or "create_atoms"_create_atoms.html
119 commands, this command changes those assignments. This can be useful
120 for overriding the default values assigned by the
121 "create_atoms"_create_atoms.html command (e.g. charge = 0.0). It can
122 be useful for altering pairwise and molecular force interactions,
123 since force-field coefficients are defined in terms of types. It can
124 be used to change the labeling of atoms by atom type or molecule ID
125 when they are output in "dump"_dump.html files. It can also be useful
126 for debugging purposes; i.e. positioning an atom at a precise location
127 to compute subsequent forces or energy.
129 Note that the {style} and {ID} arguments determine which atoms have
130 their properties reset. The remaining keywords specify which
131 properties to reset and what the new values are. Some strings like
132 {type} or {mol} can be used as a style and/or a keyword.
136 This section describes how to select which atoms to change
137 the properties of, via the {style} and {ID} arguments.
139 The style {atom} selects all the atoms in a range of atom IDs. The
140 style {type} selects all the atoms in a range of types. The style
141 {mol} selects all the atoms in a range of molecule IDs.
143 In each of the range cases, the range can be specified as a single
144 numeric value, or a wildcard asterisk can be used to specify a range
145 of values. This takes the form "*" or "*n" or "n*" or "m*n". For
146 example, for the style {type}, if N = the number of atom types, then
147 an asterisk with no numeric values means all types from 1 to N. A
148 leading asterisk means all types from 1 to n (inclusive). A trailing
149 asterisk means all types from n to N (inclusive). A middle asterisk
150 means all types from m to n (inclusive). For all the styles except
151 {mol}, the lowest value for the wildcard is 1; for {mol} it is 0.
153 The style {group} selects all the atoms in the specified group. The
154 style {region} selects all the atoms in the specified geometric
155 region. See the "group"_group.html and "region"_region.html commands
156 for details of how to specify a group or region.
160 This section describes the keyword options for which properties to
161 change, for the selected atoms.
163 Note that except where explicitly prohibited below, all of the
164 keywords allow an "atom-style or atomfile-style
165 variable"_variable.html to be used as the specified value(s). If the
166 value is a variable, it should be specified as v_name, where name is
167 the variable name. In this case, the variable will be evaluated, and
168 its resulting per-atom value used to determine the value assigned to
169 each selected atom. Note that the per-atom value from the variable
170 will be ignored for atoms that are not selected via the {style} and
171 {ID} settings explained above. A simple way to use per-atom values
172 from the variable to reset a property for all atoms is to use style
173 {atom} with {ID} = "*"; this selects all atom IDs.
175 Atom-style variables can specify formulas with various mathematical
176 functions, and include "thermo_style"_thermo_style.html command
177 keywords for the simulation box parameters and timestep and elapsed
178 time. They can also include per-atom values, such as atom
179 coordinates. Thus it is easy to specify a time-dependent or
180 spatially-dependent set of per-atom values. As explained on the
181 "variable"_variable.html doc page, atomfile-style variables can be
182 used in place of atom-style variables, and thus as arguments to the
183 set command. Atomfile-style variables read their per-atoms values
186 NOTE: Atom-style and atomfile-style variables return floating point
187 per-atom values. If the values are assigned to an integer variable,
188 such as the molecule ID, then the floating point value is truncated to
189 its integer portion, e.g. a value of 2.6 would become 2.
191 Keyword {type} sets the atom type for all selected atoms. The
192 specified value must be from 1 to ntypes, where ntypes was set by the
193 "create_box"_create_box.html command or the {atom types} field in the
194 header of the data file read by the "read_data"_read_data.html
197 Keyword {type/fraction} sets the atom type for a fraction of the
198 selected atoms. The actual number of atoms changed is not guaranteed
199 to be exactly the requested fraction, but should be statistically
200 close. Random numbers are used in such a way that a particular atom
201 is changed or not changed, regardless of how many processors are being
202 used. This keyword does not allow use of an atom-style variable.
204 Keyword {mol} sets the molecule ID for all selected atoms. The "atom
205 style"_atom_style.html being used must support the use of molecule
208 Keywords {x}, {y}, {z}, and {charge} set the coordinates or charge of
209 all selected atoms. For {charge}, the "atom style"_atom_style.html
210 being used must support the use of atomic charge.
212 Keyword {dipole} uses the specified x,y,z values as components of a
213 vector to set as the orientation of the dipole moment vectors of the
214 selected atoms. The magnitude of the dipole moment is set
215 by the length of this orientation vector.
217 Keyword {dipole/random} randomizes the orientation of the dipole
218 moment vectors for the selected atoms and sets the magnitude of each
219 to the specified {Dlen} value. For 2d systems, the z component of the
220 orientation is set to 0.0. Random numbers are used in such a way that
221 the orientation of a particular atom is the same, regardless of how
222 many processors are being used. This keyword does not allow use of an
225 Keyword {quat} uses the specified values to create a quaternion
226 (4-vector) that represents the orientation of the selected atoms. The
227 particles must define a quaternion for their orientation
228 (e.g. ellipsoids, triangles, body particles) as defined by the
229 "atom_style"_atom_style.html command. Note that particles defined by
230 "atom_style ellipsoid"_atom_style.html have 3 shape parameters. The 3
231 values must be non-zero for each particle set by this command. They
232 are used to specify the aspect ratios of an ellipsoidal particle,
233 which is oriented by default with its x-axis along the simulation
234 box's x-axis, and similarly for y and z. If this body is rotated (via
235 the right-hand rule) by an angle theta around a unit rotation vector
236 (a,b,c), then the quaternion that represents its new orientation is
237 given by (cos(theta/2), a*sin(theta/2), b*sin(theta/2),
238 c*sin(theta/2)). The theta and a,b,c values are the arguments to the
239 {quat} keyword. LAMMPS normalizes the quaternion in case (a,b,c) was
240 not specified as a unit vector. For 2d systems, the a,b,c values are
241 ignored, since a rotation vector of (0,0,1) is the only valid choice.
243 Keyword {quat/random} randomizes the orientation of the quaternion for
244 the selected atoms. The particles must define a quaternion for their
245 orientation (e.g. ellipsoids, triangles, body particles) as defined by
246 the "atom_style"_atom_style.html command. Random numbers are used in
247 such a way that the orientation of a particular atom is the same,
248 regardless of how many processors are being used. For 2d systems,
249 only orientations in the xy plane are generated. As with keyword
250 {quat}, for ellipsoidal particles, the 3 shape values must be non-zero
251 for each particle set by this command. This keyword does not allow
252 use of an atom-style variable.
254 Keyword {diameter} sets the size of the selected atoms. The particles
255 must be finite-size spheres as defined by the "atom_style
256 sphere"_atom_style.html command. The diameter of a particle can be
257 set to 0.0, which means they will be treated as point particles. Note
258 that this command does not adjust the particle mass, even if it was
259 defined with a density, e.g. via the "read_data"_read_data.html
262 Keyword {shape} sets the size and shape of the selected atoms. The
263 particles must be ellipsoids as defined by the "atom_style
264 ellipsoid"_atom_style.html command. The {Sx}, {Sy}, {Sz} settings are
265 the 3 diameters of the ellipsoid in each direction. All 3 can be set
266 to the same value, which means the ellipsoid is effectively a sphere.
267 They can also all be set to 0.0 which means the particle will be
268 treated as a point particle. Note that this command does not adjust
269 the particle mass, even if it was defined with a density, e.g. via the
270 "read_data"_read_data.html command.
272 Keyword {length} sets the length of selected atoms. The particles
273 must be line segments as defined by the "atom_style
274 line"_atom_style.html command. If the specified value is non-zero the
275 line segment is (re)set to a length = the specified value, centered
276 around the particle position, with an orientation along the x-axis.
277 If the specified value is 0.0, the particle will become a point
278 particle. Note that this command does not adjust the particle mass,
279 even if it was defined with a density, e.g. via the
280 "read_data"_read_data.html command.
282 Keyword {tri} sets the size of selected atoms. The particles must be
283 triangles as defined by the "atom_style tri"_atom_style.html command.
284 If the specified value is non-zero the triangle is (re)set to be an
285 equilateral triangle in the xy plane with side length = the specified
286 value, with a centroid at the particle position, with its base
287 parallel to the x axis, and the y-axis running from the center of the
288 base to the top point of the triangle. If the specified value is 0.0,
289 the particle will become a point particle. Note that this command
290 does not adjust the particle mass, even if it was defined with a
291 density, e.g. via the "read_data"_read_data.html command.
293 Keyword {theta} sets the orientation of selected atoms. The particles
294 must be line segments as defined by the "atom_style
295 line"_atom_style.html command. The specified value is used to set the
296 orientation angle of the line segments with respect to the x axis.
298 Keyword {theta/random} randomizes the orientation of theta for the
299 selected atoms. The particles must be line segments as defined by the
300 "atom_style line"_atom_style.html command. Random numbers are used in
301 such a way that the orientation of a particular atom is the same,
302 regardless of how many processors are being used. This keyword does
303 not allow use of an atom-style variable.
305 Keyword {angmom} sets the angular momentum of selected atoms. The
306 particles must be ellipsoids as defined by the "atom_style
307 ellipsoid"_atom_style.html command or triangles as defined by the
308 "atom_style tri"_atom_style.html command. The angular momentum vector
309 of the particles is set to the 3 specified components.
311 Keyword {omega} sets the angular velocity of selected atoms. The
312 particles must be spheres as defined by the "atom_style sphere"_
313 atom_style.html command. The angular velocity vector of the particles
314 is set to the 3 specified components.
316 Keyword {mass} sets the mass of all selected particles. The particles
317 must have a per-atom mass attribute, as defined by the
318 "atom_style"_atom_style.html command. See the "mass" command for how
319 to set mass values on a per-type basis.
321 Keyword {density} also sets the mass of all selected particles, but in
322 a different way. The particles must have a per-atom mass attribute,
323 as defined by the "atom_style"_atom_style.html command. If the atom
324 has a radius attribute (see "atom_style sphere"_atom_style.html) and
325 its radius is non-zero, its mass is set from the density and particle
326 volume. If the atom has a shape attribute (see "atom_style
327 ellipsoid"_atom_style.html) and its 3 shape parameters are non-zero,
328 then its mass is set from the density and particle volume. If the
329 atom has a length attribute (see "atom_style line"_atom_style.html)
330 and its length is non-zero, then its mass is set from the density and
331 line segment length (the input density is assumed to be in
332 mass/distance units). If the atom has an area attribute (see
333 "atom_style tri"_atom_style.html) and its area is non-zero, then its
334 mass is set from the density and triangle area (the input density is
335 assumed to be in mass/distance^2 units). If none of these cases are
336 valid, then the mass is set to the density value directly (the input
337 density is assumed to be in mass units).
339 Keyword {volume} sets the volume of all selected particles.
340 Currently, only the "atom_style peri"_atom_style.html command defines
341 particles with a volume attribute. Note that this command does not
342 adjust the particle mass.
344 Keyword {image} sets which image of the simulation box the atom is
345 considered to be in. An image of 0 means it is inside the box as
346 defined. A value of 2 means add 2 box lengths to get the true value.
347 A value of -1 means subtract 1 box length to get the true value.
348 LAMMPS updates these flags as atoms cross periodic boundaries during
349 the simulation. The flags can be output with atom snapshots via the
350 "dump"_dump.html command. If a value of NULL is specified for any of
351 nx,ny,nz, then the current image value for that dimension is
352 unchanged. For non-periodic dimensions only a value of 0 can be
353 specified. This keyword does not allow use of atom-style variables.
354 This command can be useful after a system has been equilibrated and
355 atoms have diffused one or more box lengths in various directions.
356 This command can then reset the image values for atoms so that they
357 are effectively inside the simulation box, e.g if a diffusion
358 coefficient is about to be measured via the "compute
359 msd"_compute_msd.html command. Care should be taken not to reset the
360 image flags of two atoms in a bond to the same value if the bond
361 straddles a periodic boundary (rather they should be different by +/-
362 1). This will not affect the dynamics of a simulation, but may mess
363 up analysis of the trajectories if a LAMMPS diagnostic or your own
364 analysis relies on the image flags to unwrap a molecule which
365 straddles the periodic box.
367 Keywords {bond}, {angle}, {dihedral}, and {improper}, set the bond
368 type (angle type, etc) of all bonds (angles, etc) of selected atoms to
369 the specified value from 1 to nbondtypes (nangletypes, etc). All
370 atoms in a particular bond (angle, etc) must be selected atoms in
371 order for the change to be made. The value of nbondtype (nangletypes,
372 etc) was set by the {bond types} ({angle types}, etc) field in the
373 header of the data file read by the "read_data"_read_data.html
374 command. These keywords do not allow use of an atom-style variable.
376 Keywords {meso/e}, {meso/cv}, and {meso/rho} set the energy, heat
377 capacity, and density of smmothed particle hydrodynamics (SPH)
378 particles. See "this PDF guide"_USER/sph/SPH_LAMMPS_userguide.pdf to
381 Keyword {smd/mass/density} sets the mass of all selected particles,
382 but it is only applicable to the Smooth Mach Dynamics package
383 USER-SMD. It assumes that the particle volume has already been
384 correctly set and calculates particle mass from the provided mass
387 Keyword {smd/contact/radius} only applies to simulations with the
388 Smooth Mach Dynamics package USER-SMD. Itsets an interaction radius
389 for computing short-range interactions, e.g. repulsive forces to
390 prevent different individual physical bodies from penetrating each
391 other. Note that the SPH smoothing kernel diameter used for computing
392 long range, nonlocal interactions, is set using the {diameter}
395 Keyword {dpd/theta} sets the internal temperature of a DPD particle as
396 defined by the USER-DPD package. If the specified value is a number
397 it must be >= 0.0. If the specified value is NULL, then the kinetic
398 temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2
399 m v^2 = 1/2 m (vx*vx+vy*vy+vz*vz). Each particle's internal
400 temperature is set to Tkin. If the specified value is an atom-style
401 variable, then the variable is evaluated for each particle. If a
402 value >= 0.0, the internal temperature is set to that value. If it is
403 < 0.0, the computation of Tkin is performed and the internal
404 temperature is set to that value.
406 Keywords {i_name} and {d_name} refer to custom integer and
407 floating-point properties that have been added to each atom via the
408 "fix property/atom"_fix_property_atom.html command. When that command
409 is used specific names are given to each attribute which are what is
410 specified as the "name" portion of {i_name} or {d_name}.
414 You cannot set an atom attribute (e.g. {mol} or {q} or {volume}) if
415 the "atom_style"_atom_style.html does not have that attribute.
417 This command requires inter-processor communication to coordinate the
418 setting of bond types (angle types, etc). This means that your system
419 must be ready to perform a simulation before using one of these
420 keywords (force fields set, atom mass set, etc). This is not
421 necessary for other keywords.
423 Using the {region} style with the bond (angle, etc) keywords can give
424 unpredictable results if there are bonds (angles, etc) that straddle
425 periodic boundaries. This is because the region may only extend up to
426 the boundary and partner atoms in the bond (angle, etc) may have
427 coordinates outside the simulation box if they are ghost atoms.
431 "create_box"_create_box.html, "create_atoms"_create_atoms.html,
432 "read_data"_read_data.html