Difficulties with Could not find delete_atoms region ID for the delete_atoms command

Hi, everyon! Why do I still get an error using delete_atoms when I have defined a region ‘fiberbox’: Could not find delete_element region ID (SRC /delete_atoms. CPP :428) .
The script is the folowing.

units metal
boundary s s s
variable length equal 60
variable width equal 70
variable height equal 45

region fiberbox block 0 ${length} 0 ${width} 0 ${height}                                 
atom_style bond
timestep 0.001
create_box 1 fiberbox bond/types 1 extra/bond/per/atom 4

pair_style airebo 13.6
pair_coeff * * CH.airebo C
neighbor 0.1 bin
neigh_modify one 20000 page 200000
variable len_unit equal 1.42
variable len_layer equal 3.4
variable phai equal 16.0126/180*PI
variable two equal 2
variable z_layer1 equal 3          
variable z_layer2 equal 4          
variable z_layer3 equal 3          
variable x_num equal 12            

variable y_num equal 60
variable std_graphite1 equal 15      
variable disloca equal 30          
variable std_graphite2 equal ${y_num}-${std_graphite1}-${disloca}      
variable num_atom equal 0          
variable ntype_atom equal 1          
variable z loop ${z_layer1}
label loopz1
    variable y loop ${y_num}

    label loopy1
        variable x loop ${x_num}    
        label loopx1
            if '$((v_y-1)*v_len_unit*sqrt(3)/2)>${width}' then &
                'jump fiber_1.lmp break1'
            if $(v_y%v_two)==1 then &
                'variable xx equal ${len_unit}+($x-1)*${len_unit}*3' &
                'variable yy equal ($y-1)*${len_unit}*sqrt(3)/2' &
                'variable zz equal ($z-1)*${len_layer}' &
                'create_atoms 1 single ${xx} ${yy} ${zz}' &
                'variable num_atom equal ${num_atom}+1' &
                'variable xx equal ${len_unit}*2+($x-1)*${len_unit}*3' &
                'create_atoms 1 single ${xx} ${yy} ${zz}' &
                'variable num_atom equal ${num_atom}+1' &
            else &
                'variable xx equal ${len_unit}/2+($x-1)*${len_unit}*3' &
                'variable yy equal ($y-1)*${len_unit}*sqrt(3)/2' &
                'variable zz equal ($z-1)*${len_layer}' &
                'create_atoms 1 single ${xx} ${yy} ${zz}' &
                'variable num_atom equal ${num_atom}+1' &
                'variable xx equal ${len_unit}*2.5+($x-1)*${len_unit}*3' &
                'create_atoms 1 single ${xx} ${yy} ${zz}' &
                'variable num_atom equal ${num_atom}+1'
        next x
        jump fiber_1.lmp loopx1
    next y
    jump fiber_1.lmp loopy1
    label break1
    variable x delete
    variable y delete
next z
jump fiber_1.lmp loopz1
mass * 12.01069      
group fiber region fiberbox
delete_atoms porosity fiber fiberbox 0.02 ${num_atom} compress yes

Which version of LAMMPS are you using?
The syntax for the delete_atoms porosity option changed for the 27 October 2021 version.
Please compare the manual entry for the current version: delete_atoms command — LAMMPS documentation
and the manual entry for the (older) stable version: delete_atoms command — LAMMPS documentation
What you enter as group ID would be interpreted as a region ID by an older version of LAMMPS.

The LAMMPS manual is very careful to emphasize that you must use the manual matching the version of LAMMPS you are using and that the online version always represents the latest patch release (well, we now have a version also for the latest stable release and the current development branch version).

Two more comments.

  • Your input is very convoluted and thus difficult to read, but most of that is completely irrelevant to your issue. Best practice to get good help fast is thus to reduce your input deck to the minimum required to reproduce the issue. in this case, the following would have been sufficient:
units metal
boundary s s s
region fiberbox block 0 10 0 10 0 10
timestep 0.001
create_box 1 fiberbox
lattice fcc 4.0
create_atoms 1 box
pair_style airebo 3.0
pair_coeff * * CH.airebo C
mass * 12.01069
group fiber region fiberbox
delete_atoms porosity fiber fiberbox 0.02 398562 compress yes
  • your use of the airebo potential is bad. If you look at the pair style airebo documentation, the cutoff is not given in angstrom, but as a scaling factor of sigma. It should be left at 3.0 unless there are very, very good reasons for it since changing this makes some of the spline tables less accurate (they are created assuming a value of 3.0) using a value of 13.6 will correspond to a cutoff of over 40 angstrom (which is not only inaccurate but also will slow down your calculation massively due to the very large number of neighbors to be considered).

Dear Akohlmey,
Thank you very much for your help and comments. I will pay attention to these details in future topics.

Dear akohlmey,
Could I ask whether LAMMPS has the manual of 27 October 2021 version.

The manual is included in the LAMMPS sources. If you downloaded LAMMPS via github, then you can create your copy of the manual following the instructions here: 3.8. Build the LAMMPS documentation — LAMMPS documentation