Syntax:
next variables
Examples:
next x next a t x
Description:
This command is used with variables of the index style as defined by the variable command. It sets the value of the variable to the next argument in the variable list, so that when $X is substituted for in an input script line, the new value is used. X is a single lower-case character from "a" to "z".
The behavior of the next command depends on whether LAMMPS is running on a single partition or multiple partitions. See this section for a discussion of the -partition command-line switch.
If all processors are in one partition, then occurences of $X are substituted for on all processors. Initially the variable is set to the 1st argument. After a next command is invoked for variable X, the 2nd argument is used in substitutions for $X, etc. For example, an input script in.polymer could use these commands to run a series of 8 simulations from directories run1 thru run8.
variable d index run1 run2 run3 run4 run5 run6 run7 run8 cd $d read_data data.polymer run 10000 cd .. next d jump in.polymer
When the next command increments an index style variable past its final value, LAMMPS exits. This prevents scripts, like the example just given, from looping endlessly.
When LAMMPS is running on multiple partitions, a variable command for an index style variable assigns a different value to each partition. I.e. on 4 partitions, the first 4 values of the variable are assigned, one to each partition. When a next command is encountered, the first partition to invoke the command assigns the next available argument to the variable. A partition which invokes the next command later in time will assign the next available value, etc. If you have several variables that must be incremented simultaneously in this fashion, list them as arguments to a single next commmand.
On 3 partitions, the same in.polymer script above would run the 8 simulations on 3 sets of processors. Whenever a partition finishes one simulation it will set the variable d to the next available value and run another simulation. When all 8 simulations finish on whatever partitions they ran on, LAMMPS will exit.
To coordinate the variable usage between multiple partitions, LAMMPS creates a temporary file, lammps.variable, with information about variable status. This file should not be deleted or modified while LAMMPS is running.
Restrictions: none
Related commands:
Default: none