**Syntax:**

compute ID tvib/grid group-ID mix-ID

- ID is documented in compute command
- tvib/grid = style name of this compute command
- group-ID = group ID for which grid cells to perform calculation on
- mix-ID = mixture ID to perform calculation on

**Examples:**

compute 1 tvib/grid all species compute 1 tvib/grid subset all

**Description:**

Define a computation that calculates the vibrational temperature for each grid cell in a grid cell group, based on the particles in the cell. The temperature is calculated separately for each group of species in the specified mixture, as described in the Output section below. See the mixture command for how a set of species can be partitioned into groups.

Only grid cells in the grid group specified by *group-ID* are included
in the calculations. See the group grid command for info
on how grid cells can be assigned to grid groups.

The results of this compute can be used by different commands in different ways. The values for a single timestep can be output by the dump grid command.

The values over many sampling timesteps can be averaged by the fix ave/grid command. It does its averaging as if the particles in the cell at each sampling timestep were combined together into one large set to compute the formulas below. Note that this is a different normalization than taking the values produced by the formulas below for a single timestep, summing them over the sampling timesteps, and then dividing by the number of sampling steps.

The vibrational temperature for a group of particles comprised of different species is defined as a weighted average as follows:

T_group = (T1*N1 + T2*N2 + ...) / (N1 + N2 + ...)

The sums in the numerator and denominator are over the different species in the group. T1, T2, ... are the vibrational temperatures of each species. N1, N2, ... are the counts of particles of each species.

The vibrational temperature Tsp for particles of a single species in the group is defined as Tsp as follows:

Ibar = Sum_i (e_vib_i) / (N kB Theta) Tsp = (2/kB) Sum_i (evib_i) / N (2 Ibar ln(1 + 1/Ibar))

where e_vib is the vibrational energy of a single particle I, N is the
total # of particles of that species, and *kB* is the Boltzmann factor.
Theta is the characteristic vibrational temperature for the species,
as defined in the file read by the species command.

Note that the collide_modify vibrate command affects how vibrational energy is treated in particle collisions and stored by particles. It thus also affects the vibrational temperature calculated by this compute.

**Output info:**

This compute calculates a per-grid array, with the number of columns equal to the number of groups in the specified mixture.

This compute performs calculations for all flavors of child grid cells in the simulation, which includes unsplit, cut, split, and sub cells. See Section 6.8 of the manual gives details of how SPARTA defines child, unsplit, split, and sub cells. Note that cells inside closed surfaces contain no particles. These could be unsplit or cut cells (if they have zero flow volume). Both of these kinds of cells will compute a zero result for all their values. Likewise, split cells store no particles and will produce a zero result. This is because their sub-cells actually contain the particles that are geometrically inside the split cell.

Grid cells not in the specified *group-ID* will output zeroes for all
their values.

The array can be accessed by any command that uses per-grid values from a compute as input. See Section 6.4 for an overview of SPARTA output options.

The per-grid array values will be in temperature units.

**Restrictions:** none

**Related commands:**

**Default:** none