Add support for inline format strings to immediate variable substitution
This commit is contained in:
@ -129,6 +129,15 @@ region 1 block $((xlo+xhi)/2+sqrt(v_area)) 2 INF INF EDGE EDGE :pre
|
||||
|
||||
so that you do not have to define (or discard) a temporary variable X.
|
||||
|
||||
Additionally, the "immediate" expression may be followed by a colon,
|
||||
followed by a C-style format string, e.g. "%f" or "%.10g", which must be
|
||||
appropriate for formatting a double-precision floating-point value. The
|
||||
format string will be used to output the result of the variable evaluation,
|
||||
so you do not have to define a temporary "format-style variable"_variable.html.
|
||||
This may be used for formatting print output:
|
||||
|
||||
print "Final energy per atom: $(pe/atoms:%10.3f) eV/atom" :pre
|
||||
|
||||
Note that neither the curly-bracket or immediate form of variables can
|
||||
contain nested $ characters for other variables to substitute for.
|
||||
Thus you cannot do this:
|
||||
|
||||
Reference in New Issue
Block a user