[lammps-users] ERROR: Illegal if command in new version


Are there any changes in the current version to cause the following error. When I run the example in /example/ELASTIC, the following error occurs:

if {dir} == 1 then "variable len0 equal {lx0}"
if 1 == 1 then “variable len0 equal ${lx0}”
ERROR: Illegal if command

I wonder which src file contains this " if command"? Thanks,




Here’s the description of the 19 Nov 2010 bug fix:

"19 Nov 2010

Enhanced the syntax for the if command to allow for arbitrarily complex Boolean expressions and to include “elif” clauses, so that a sequence of Boolean tests can be made, i.e. the equivalent of an if/then/elif/elif/else statement in a programming language.

Also enhanced the input script parser to allow for both double and single quoting of arguments with white space, so that they are treated as a single argument (only double quotes were allowed before). Double and single quotes can now be nested. See this section of the manual for details.

The motivation for this was to enable entire commands which use quoted arguments (like print) to be used as arguments within the if and run every commands. For consistency, the syntax of the print command was changed so that it now takes only a single (typically quoted) argument.

BACKWARD COMPATIBILITY for if and print commands: The syntax of these two commands has changed and the old mode of usage will typically give an error. The if command now takes a single argument for its Boolean expressions (e.g. “$x < $y” instead of $x < $y which is 3 args). The print command takes only a single arg (which, as before, can be quoted if it contains spaces). It no longer allows any nubmer of args which previously were combined internally with inserted spaces.

This patch file can be applied to the 18 Nov 2010 version. This is the list of changed files.


Hope this helps.