diff --git a/doc/variable.html b/doc/variable.html index 6197e442ea..82369b4ebd 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -17,9 +17,10 @@
index args = one or more strings +delete = no args + index args = one or more strings loop args = N = integer size of loop world args = one string for each partition of processors universe args = one or more strings @@ -53,10 +54,11 @@ variable b1 equal x[234]+0.5*vol variable b1 equal "x[234] + 0.5*vol" variable b equal xcm(mol1,x)/2.0 variable b equal c_myTemp -variable b atom x*y/vol +variable b atom x[]*y[]/vol variable temp world 300.0 310.0 320.0 ${Tfinal} variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -variable x uloop 15 +variable x uloop 15 +variable x deleteDescription:
@@ -109,7 +111,8 @@ loop.Second, as described below, if a variable is iterated on to the end of its list of strings via the next command, it is removed from the list of active variables, and is thus available to be -re-defined in a subsequent variable command. +re-defined in a subsequent variable command. The delete option does +the same thing.
@@ -127,6 +130,22 @@ next jump command encountered in the input script to b skipped. This enables the construction of simple loops in the input script that are iterated over and then exited from. +As explained above, an exhausted variable can be re-used in an input +script. The delete option also removes the variable, the same as if +it were exhausted, allowing it to be redefined later in the input +script or when the input script is looped over. This can be useful +when breaking out of a loop via the if and jump +commands before the variable would become exhausted. For example, +
+label loop +variable a loop 5 +print "A = $a" +if $a > 2 then "jump in.test break" +next a +jump in.test loop +label break +variable a delete +
For the index style, one or more strings are specified. Initially, diff --git a/doc/variable.txt b/doc/variable.txt index 2a7cc9fc05..bb19c00d5b 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -13,7 +13,8 @@ variable command :h3 variable name style args ... :pre name = name of variable to define :ulb,l -style = {index} or {loop} or {world} or {universe} or {uloop} or {equal} or {atom} :l +style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {equal} or {atom} :l + {delete} = no args {index} args = one or more strings {loop} args = N = integer size of loop {world} args = one string for each partition of processors @@ -47,10 +48,11 @@ variable b1 equal x\[234\]+0.5*vol variable b1 equal "x\[234\] + 0.5*vol" variable b equal xcm(mol1,x)/2.0 variable b equal c_myTemp -variable b atom x[]*y[]/vol +variable b atom x\[\]*y\[\]/vol variable temp world 300.0 310.0 320.0 $\{Tfinal\} variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -variable x uloop 15 :pre +variable x uloop 15 +variable x delete :pre [Description:] @@ -103,7 +105,8 @@ loop. Second, as described below, if a variable is iterated on to the end of its list of strings via the "next"_next.html command, it is removed from the list of active variables, and is thus available to be -re-defined in a subsequent variable command. +re-defined in a subsequent variable command. The {delete} option does +the same thing. :line @@ -121,6 +124,22 @@ next "jump"_jump.html command encountered in the input script to be skipped. This enables the construction of simple loops in the input script that are iterated over and then exited from. +As explained above, an exhausted variable can be re-used in an input +script. The {delete} option also removes the variable, the same as if +it were exhausted, allowing it to be redefined later in the input +script or when the input script is looped over. This can be useful +when breaking out of a loop via the "if"_if.html and "jump"_jump.html +commands before the variable would become exhausted. For example, + +label loop +variable a loop 5 +print "A = $a" +if $a > 2 then "jump in.test break" +next a +jump in.test loop +label break +variable a delete :pre + :line For the {index} style, one or more strings are specified. Initially,