git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@16053 f3b2605a-c512-4ea7-a41b...
[lammps.git] / doc / src / compute_temp_profile.txt
blob54eebd6d8fd3c96fcb6ad5b3e61a801d5b5141c6
1 "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
3 :link(lws,http://lammps.sandia.gov)
4 :link(ld,Manual.html)
5 :link(lc,Section_commands.html#comm)
7 :line
9 compute temp/profile command :h3
11 [Syntax:]
13 compute ID group-ID temp/profile xflag yflag zflag binstyle args :pre
15 ID, group-ID are documented in "compute"_compute.html command :ulb,l
16 temp/profile = style name of this compute command :l
17 xflag,yflag,zflag = 0/1 for whether to exclude/include this dimension :l
18 binstyle = {x} or {y} or {z} or {xy} or {yz} or {xz} or {xyz} :l
19   {x} arg = Nx
20   {y} arg = Ny
21   {z} arg = Nz
22   {xy} args = Nx Ny
23   {yz} args = Ny Nz
24   {xz} args = Nx Nz
25   {xyz} args = Nx Ny Nz
26     Nx,Ny,Nz = number of velocity bins in x,y,z dimensions :pre
28 zero or more keyword/value pairs may be appended :l
29 keyword = {out} :l
30   {out} value = {tensor} or {bin} :pre
31 :ule
33 [Examples:]
35 compute myTemp flow temp/profile 1 1 1 x 10
36 compute myTemp flow temp/profile 1 1 1 x 10 out bin
37 compute myTemp flow temp/profile 0 1 1 xyz 20 20 20 :pre
39 [Description:]
41 Define a computation that calculates the temperature of a group of
42 atoms, after subtracting out a spatially-averaged center-of-mass
43 velocity field, before computing the kinetic energy.  This can be
44 useful for thermostatting a collection of atoms undergoing a complex
45 flow, e.g. via a profile-unbiased thermostat (PUT) as described in
46 "(Evans)"_#Evans.  A compute of this style can be used by any command
47 that computes a temperature, e.g. "thermo_modify"_thermo_modify.html,
48 "fix temp/rescale"_fix_temp_rescale.html, "fix npt"_fix_nh.html, etc.
50 The {xflag}, {yflag}, {zflag} settings determine which components of
51 average velocity are subtracted out.
53 The {binstyle} setting and its {Nx}, {Ny}, {Nz} arguments determine
54 how bins are setup to perform spatial averaging.  "Bins" can be 1d
55 slabs, 2d pencils, or 3d bricks depending on which {binstyle} is used.
56 The simulation box is partitioned conceptually into {Nx} by {Ny} by
57 {Nz} bins.  Depending on the {binstyle}, you may only specify one or
58 two of these values; the others are effectively set to 1 (no binning
59 in that dimension).  For non-orthogonal (triclinic) simulation boxes,
60 the bins are "tilted" slabs or pencils or bricks that are parallel to
61 the tilted faces of the box.  See the "region prism"_region.html
62 command for a discussion of the geometry of tilted boxes in LAMMPS.
64 When a temperature is computed, the center-of-mass velocity for the
65 set of atoms that are both in the compute group and in the same
66 spatial bin is calculated.  This bias velocity is then subtracted from
67 the velocities of individual atoms in the bin to yield a thermal
68 velocity for each atom.  Note that if there is only one atom in the
69 bin, its thermal velocity will thus be 0.0.
71 After the spatially-averaged velocity field has been subtracted from
72 each atom, the temperature is calculated by the formula KE = (dim*N
73 - dim*Nx*Ny*Nz) k T/2, where KE = total kinetic energy of the group of
74 atoms (sum of 1/2 m v^2), dim = 2 or 3 = dimensionality of the
75 simulation, N = number of atoms in the group, k = Boltzmann constant,
76 and T = temperature.  The dim*Nx*Ny*Nz term are degrees of freedom
77 subtracted to adjust for the removal of the center-of-mass velocity in
78 each of Nx*Ny*Nz bins, as discussed in the "(Evans)"_#Evans paper.
80 If the {out} keyword is used with a {tensor} value, which is the
81 default, a kinetic energy tensor, stored as a 6-element vector, is
82 also calculated by this compute for use in the computation of a
83 pressure tensor.  The formula for the components of the tensor is the
84 same as the above formula, except that v^2 is replaced by vx*vy for
85 the xy component, etc.  The 6 components of the vector are ordered xx,
86 yy, zz, xy, xz, yz.
88 If the {out} keyword is used with a {bin} value, the count of atoms
89 and computed temperature for each bin are stored for output, as an
90 array of values, as described below.  The temperature of each bin is
91 calculated as described above, where the bias velocity is subtracted
92 and only the remaining thermal velocity of atoms in the bin
93 contributes to the temperature.  See the note below for how the
94 temperature is normalized by the degrees-of-freedom of atoms in the
95 bin.
97 The number of atoms contributing to the temperature is assumed to be
98 constant for the duration of the run; use the {dynamic} option of the
99 "compute_modify"_compute_modify.html command if this is not the case.
101 The removal of the spatially-averaged velocity field by this fix is
102 essentially computing the temperature after a "bias" has been removed
103 from the velocity of the atoms.  If this compute is used with a fix
104 command that performs thermostatting then this bias will be subtracted
105 from each atom, thermostatting of the remaining thermal velocity will
106 be performed, and the bias will be added back in.  Thermostatting
107 fixes that work in this way include "fix nvt"_fix_nh.html, "fix
108 temp/rescale"_fix_temp_rescale.html, "fix
109 temp/berendsen"_fix_temp_berendsen.html, and "fix
110 langevin"_fix_langevin.html.
112 This compute subtracts out degrees-of-freedom due to fixes that
113 constrain molecular motion, such as "fix shake"_fix_shake.html and
114 "fix rigid"_fix_rigid.html.  This means the temperature of groups of
115 atoms that include these constraints will be computed correctly.  If
116 needed, the subtracted degrees-of-freedom can be altered using the
117 {extra} option of the "compute_modify"_compute_modify.html command.
119 NOTE: When using the {out} keyword with a value of {bin}, the
120 calculated temperature for each bin does not include the
121 degrees-of-freedom adjustment described in the preceeding paragraph,
122 for fixes that constrain molecular motion.  It does include the
123 adjustment due to the {extra} option, which is applied to each bin.
125 See "this howto section"_Section_howto.html#howto_16 of the manual for
126 a discussion of different ways to compute temperature and perform
127 thermostatting.  Using this compute in conjunction with a
128 thermostatting fix, as explained there, will effectively implement a
129 profile-unbiased thermostat (PUT), as described in "(Evans)"_#Evans.
131 [Output info:]
133 This compute calculates a global scalar (the temperature).  Depending
134 on the setting of the {out} keyword, it also calculates a global
135 vector or array.  For {out} = {tensor}, it calculates a vector of
136 length 6 (KE tensor), which can be accessed by indices 1-6.  For {out}
137 = {bin} it calculates a global array which has 2 columns and N rows,
138 where N is the number of bins.  The first column contains the number
139 of atoms in that bin.  The second contains the temperature of that
140 bin, calculated as described above.  The ordering of rows in the array
141 is as follows.  Bins in x vary fastest, then y, then z.  Thus for a
142 10x10x10 3d array of bins, there will be 1000 rows.  The bin with
143 indices ix,iy,iz = 2,3,4 would map to row M = (iz-1)*10*10 + (iy-1)*10
144 + ix = 322, where the rows are numbered from 1 to 1000 and the bin
145 indices are numbered from 1 to 10 in each dimension.
147 These values can be used by any command that uses global scalar or
148 vector or array values from a compute as input.  See "this
149 section"_Section_howto.html#howto_15 for an overview of LAMMPS output
150 options.
152 The scalar value calculated by this compute is "intensive".  The
153 vector values are "extensive".  The array values are "intensive".
155 The scalar value will be in temperature "units"_units.html.  The
156 vector values will be in energy "units"_units.html.  The first column
157 of array values are counts; the values in the second column will be in
158 temperature "units"_units.html.
160 [Restrictions:]
162 You should not use too large a velocity-binning grid, especially in
163 3d.  In the current implementation, the binned velocity averages are
164 summed across all processors, so this will be inefficient if the grid
165 is too large, and the operation is performed every timestep, as it
166 will be for most thermostats.
168 [Related commands:]
170 "compute temp"_compute_temp.html, "compute
171 temp/ramp"_compute_temp_ramp.html, "compute
172 temp/deform"_compute_temp_deform.html, "compute
173 pressure"_compute_pressure.html
175 [Default:]
177 The option default is out = tensor.
179 :line
181 :link(Evans)
182 [(Evans)] Evans and Morriss, Phys Rev Lett, 56, 2172-2175 (1986).