<HTML>
<CENTER><A HREF = "https://sparta.github.io">SPARTA WWW Site</A> - <A HREF = "Manual.html">SPARTA Documentation</A> - <A HREF = "Section_commands.html#comm">SPARTA Commands</A> 
</CENTER>






<HR>

<H3>fix temp/rescale command 
</H3>
<H3>fix temp/rescale/kk command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID temp/rescale N Tstart Tstop keyword value ... 
</PRE>
<UL><LI>ID is documented in <A HREF = "fix.html">fix</A> command 

<LI>temp/rescale = style name of this fix command 

<LI>N = thermostat every N timesteps 

<LI>Tstart,Tstop = desired temperature at start/end of run (temperature units) 

<LI>zero or more keyword/args pairs may be appended 

<LI>keyword = <I>ave</I> 

<PRE>  ave values = <I>yes</I> or <I>no</I> 
</PRE>

</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 temp/rescale 100 300.0 300.0
fix 5 temp/rescale 10 300.0 10.0 ave yes 
</PRE>
<P><B>Description:</B>
</P>
<P>Reset the thermal temperature of all the particles within each grid
cell by explicitly rescaling their thermal velocities.  This is a
simple thermostatting operation to keep the thermal temperature of the
gas near the desired target temperature. This can be useful if an
external driving force is adding energy to the system.  Or if you wish
the thermal temperature of the system to heat or cool over time.
</P>
<P>The rescaling is applied to only the translational degrees of freedom
for the particles.  Their rotational or vibrational degrees of freedom
are not altered.
</P>
<P>Rescaling is performed every N timesteps. The target temperature
(Ttarget) is a ramped value between the Tstart and Tstop temperatures
at the beginning and end of the run.
</P>
<P>This fix performs thermostatting on a per grid cell basis.  For each
grid cell, the center-of-mass velocity and thermal temperature of the
particles in the grid cell is computed.  The thermal temperature is
defined as the kinetic temperature after any center-of-mass motion
(e.g. a flow velocity) is subtracted from the collection of particles
in the grid cell.  These are the same calculations as are performed by
the <A HREF = "compute_thermal_grid.html">compute thermal/grid</A> command.  See its
doc page for the equations.  See the <A HREF = "fix_temp_globalrescale.html">fix
temp/global/rescale</A> doc page for a
command that thermostats the temperature of the global system.
</P>
<P>How the rescaling of particle velocities is done depends on the value
of the <I>ave</I> keyword.
</P>
<P>For <I>ave</I> with a value <I>no</I> (the default), the thermal temperature
(Tthermal) of each cell is used to compute a velocity scale factor for
that cell, which is
</P>
<PRE>vscale = sqrt(Ttarget/Tthermal) 
</PRE>
<P>The vscale factor is applied to each of the components of the thermal
velocity for each particle in the grid cell.  Only cells with 2 or
more particles have their particle velocities rescaled.
</P>
<P>For <I>ave</I> with a value <I>yes</I>, the thermal temperatures of all the
cells are averaged.  The average thermal temperature is simply the sum
of cell thermal temperatures divided by the number of cells.  Cells
with less than 2 particles or whose thermal temperature = 0.0
contribute a thermal temperaure = Ttarget to the average.  The average
thermal temperature (Tthermal_ave) for all cells is used to compute a
velocity scale factor for all cells, which is
</P>
<PRE>vscale = sqrt(Ttarget/Tthermal_ave) 
</PRE>
<P>This single vscale factor is applied to each of the components of the
thermal velocity for each particle in all the grid cells, including
the particles in single-particle cells.
</P>
<P>After rescaling, for either <I>ave</I> = <I>no</I> or <I>yes</I>, if the thermal
temperature were re-computed for any grid cell with more than one
particle, it would be exactly the target temperature.
</P>
<HR>

<P><B>Restart, output info:</B>
</P>
<P>No information about this fix is written to <A HREF = "restart.html">binary restart
files</A>.
</P>
<P>This fix produces no output.
</P>
<P>This fix can ramp its target temperature over multiple runs, using the
start and stop keywords of the run command. See the run command for
details of how to do this.
</P>
<HR>

<P>Styles with a <I>kk</I> suffix are functionally the same as the
corresponding style without the suffix.  They have been optimized to
run faster, depending on your available hardware, as discussed in the
<A HREF = "Section_accelerate.html">Accelerating SPARTA</A> section of the manual.
The accelerated styles take the same arguments and should produce the
same results, except for different random number, round-off and
precision issues.
</P>
<P>These accelerated styles are part of the KOKKOS package. They are only
enabled if SPARTA was built with that package.  See the <A HREF = "Section_start.html#start_3">Making
SPARTA</A> section for more info.
</P>
<P>You can specify the accelerated styles explicitly in your input script
by including their suffix, or you can use the <A HREF = "Section_start.html#start_7">-suffix command-line
switch</A> when you invoke SPARTA, or you can
use the <A HREF = "suffix.html">suffix</A> command in your input script.
</P>
<P>See the <A HREF = "Section_accelerate.html">Accelerating SPARTA</A> section of the
manual for more instructions on how to use the accelerated styles
effectively.
</P>
<HR>

<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_temp_global_rescale.html">fix temp/global/rescale</A>
</P>
<P><B>Default:</B>
</P>
<P>The default is ave = no.
</P>
</HTML>
