Invalid variable syntax when using random function

Hello all,

I’m attempting this:

variable velocity_seed equal round(random(0,9999,657))

However, I’m getting

ERROR: Invalid syntax in variable formula

But when I do:

variable velocity_seed equal round(5.5)

It correctly uses 6 as the ${velocity_seed}

I’ve tried wrapping round(random…) in quotes but that did not help and I’ve also tried separate variables like:

variable random_number equal random(0,9999,657)
variable velocity_seed equal round(${random_number})

That also did not work.

Thanks for the help!

Hello all,

I'm attempting this:

     variable velocity_seed equal round(random(0,9999,657))

However, I'm getting

     ERROR: Invalid syntax in variable formula

cannot reproduce this either.

please *always* state which version and platform
you use when reporting problems with input syntax.

the online documentation *always* documents the
current patchlevel of LAMMPS. if you use an older
version and the documented syntax doesn't work,
you either have to refer to the documentation
shipped with that version or update to the current
patch level.

please understand that nobody will provide
support for old LAMMPS versions.


Turns out this was also from using an older version of LAMMPS (2010 vs 2011).