[lammps-users] ERROR: Illegal set command!

Dear Sir,
I am trying to set a fraction of the total particle to some type say 2 by using the set type/ratio command but I am encountering the following problem:
ERROR: Illegal set command (…/set.cpp:566)
Last command: set type 1 type/ratio 2 0.5 58912
Below is my script, Kindly assist me here:

script

units lj
dimension 3
atom_style charge
boundary p p p

lattice sc ${rhostar}
region box block -5 5 -5 5 -5 5
create_box 2 box
create_atoms 1 box

set type 1 type/ratio 2 0.5 58912
mass 1 1.0
mass 2 1.0
set type 1 charge 2.0
set type 2 charge -2.0

Please always report the LAMMPS version that you are using and the platform you are running on.

Hi,

I am using the lammps-29 Oct 2020 version in Ubuntu 16.04 LTS operating system.

I am trying to set a fraction of the total particle to some type, say 2, by using the set type/ratio command, but I am encountering the following problem:
ERROR: Illegal set command (…/set.cpp:566)
Last command: set type 1 type/ratio 2 0.5 58912
Below is my script; kindly assist me here:

script

units LJ
dimension 3
atom_style charge
boundary p p p

lattice sc ${rhostar}
region box block -5 5 -5 5 -5 5
create_box 2 box
create_atoms 1 box

set type 1 type/ratio 2 0.5 58912
mass 1 1.0
mass 2 1.0
set type 1 charge 2.0
set type 2 charge -2.0

there is no problem with the input you provide with the version you say you are using.
either you are using a much older version that does not support set with type/ratio (check the log file) or you are not using exactly the same input as you quoted in your e-mail.

axel.

please see the output below.

LAMMPS (29 Oct 2020)
using 1 OpenMP thread(s) per MPI task
Lattice spacing in x,y,z = 1.0000000 1.0000000 1.0000000
Created orthogonal box = (-5.0000000 -5.0000000 -5.0000000) to (5.0000000 5.0000000 5.0000000)
1 by 1 by 1 MPI processor grid
Created 1000 atoms
create_atoms CPU = 0.001 seconds
Setting atom values …
500 settings made for type/ratio
Setting atom values …
500 settings made for charge
Setting atom values …
500 settings made for charge
Total wall time: 0:00:00