Question: on "compute" and "thermo_style"

Dear members,

I would like to know if it is necessary to declare each “compute” in “thermo_style”

to be used later in a calculation or for file-output.

For example:

To print out, say, average x-velocity in a “region_1” I now do the following 5 steps:

  1. compute ave_xvel all reduce/region region_1 ave vx # compute average x-vel in region_1

  2. thermo_style custom c_ave_xvel # store compute “ave_avel” in memory

  3. run 0 # compute the value “ave_xvel”

  4. variable avg_xvel equal c_ave_xvel # assign computed value to variable

  5. print " average velocity = ${avg_xvel}" # print out the variable

In addition to screen out, I dump data to an output file also.

Is it possible to avoid any of the steps 2,3,4 to get to step 5 ?

In particular is it possible to avoid step 2 and 3 ?

If I try to avoid 2 or 3, it results in error “variable between runs is not current”

Dear members,

I would like to know if it is necessary to declare each "compute" in
"thermo_style"
to be used later in a calculation or for file-output.

For example:
To print out, say, average x-velocity in a "region_1" I now do the
following 5 steps:

1. compute ave_xvel all reduce/region region_1 ave vx #
compute average x-vel in region_1
2. thermo_style custom c_ave_xvel
# store compute "ave_avel" in memory
3. run 0
# compute the value "ave_xvel"
4. variable avg_xvel equal c_ave_xvel
# assign computed value to variable
5. print " average velocity = ${avg_xvel}"
# print out the variable

In addition to screen out, I dump data to an output file also.

Is it possible to avoid any of the steps 2,3,4 to get to step 5 ?

In particular is it possible to avoid step 2 and 3 ?

no. computes are "hooks", i.e. they are only executed/updated under
certain conditions. you need to execute an MD step (or at least the
setup part) and it is necessary to flag that a compute is going to be
required before the MD step is initiated. anything else would
massively increase the cost of an MD step.

If I try to avoid 2 or 3, it results in error "variable between runs is not
current"

exactly. to avoid this, you would have to implement an
"update_computes" command that would streamline the process by only
executing the parts of steps 2 and 3 that are necessary for your use.

axel.

Thanks very much.

regards

shankar