At the risk of generating another non-bug bug report for the second time in as many days…
The parsing on the boolean expression in the “if” command seems to return false for anything other than a numerical value (or a suitable expression that evaluates to a numerical value). For example, I could make an input file that says,
if "hello" then "print 'hello'"
if "1" then "print 1"
print "got to the end"
I might expect the output to be
LAMMPS ([version])
[error message]
or perhaps
LAMMPS ([version])
hello
1
got to the end
Total wall time: 0:00:00
(if it evaluated “hello” as being non-zero and thus true), but instead it gives
LAMMPS (23 Jun 2022)
1
got to the end
Total wall time: 0:00:00
This behavior changed from an earlier version of LAMMPS:
LAMMPS (3 Mar 2020)
hello
1
got to the end
Total wall time: 0:00:00
An old version does give an error:
LAMMPS (16 Aug 2013)
ERROR: Invalid Boolean syntax in if command (../variable.cpp:3695)
If you’re wondering, I tripped this by reading the documentation a bit too literally: I saw it said “evaluates to TRUE”, so I tried the constant TRUE out of curiosity:
if TRUE then "print 'yes'"
(I read it again and realized it needed to be 1 in place of TRUE). However, I was surprised that it didn’t give me an error AND evaluated to 0 (given that either “TRUE” shouldn’t evaluate to a number or it should be evaluated as something other than zero.)