After fix orient/eco source code modification in lammps, f_eco[1] gets infinity or infinitesimal value

My model adds an extruded gap with a single grain boundary, so orient/eco, which is designed to move grain boundaries, does not meet my needs. When I tried to modify orient/eco source, the f_eco[1] output of dump was inf or -inf, and grain boundaries did not move. Part of the dump output file is shown below.
ITEM: TIMESTEP
100
ITEM: NUMBER OF ATOMS
40801
ITEM: BOX BOUNDS pp pp pp
-1.6138402399940688e-02 2.2396068026954168e+01
-3.4262988291089869e-01 3.8407848629979532e+02
-6.0363005801065128e-02 7.7586713364888794e+01
ITEM: ATOMS xs ys zs f_eco[1] f_eco[2]
0.119807 0.0182198 0.030867 -inf -1
0.0203263 0.0160062 0.0136767 -inf -1
0.318141 0.0184982 0.0300697 -inf -1
0.218923 0.0159543 0.0146055 -inf -1
0.420008 0.0159356 0.0145852 -inf -1
0.516368 0.0183916 0.030449 -inf -1
0.620738 0.0158537 0.0140633 -inf -1
0.719769 0.0184089 0.0297774 -inf -1
0.819209 0.0159562 0.0134935 -inf -1
0.918862 0.0184174 0.0301164 -inf -1
0.0211992 0.0230304 0.0127984 -inf -1
0.019574 0.0204918 0.0466975 inf 1
0.0216762 0.0276238 0.0462301 -inf -1
0.120676 0.0252765 0.0305172 -inf -1
0.21917 0.0229662 0.0136986 -inf -1
0.220578 0.0205573 0.0465221 inf 1
0.218916 0.0277098 0.047156 -inf -1
0.318366 0.0254132 0.0310167 -inf -1
0.418572 0.0230516 0.0140915 inf 1
0.419518 0.0204662 0.0473984 inf 1
The following code is the part I modified.

if (chi > eta) {
      added_energy += half_u;
      nbr[i].duchi = 0.0;
      order[i][1] = sign;
    } else if (chi < -eta) {
      added_energy -= half_u;
      nbr[i].duchi = 0.0;
      order[i][1] = -sign;
    } else {
        //Identify the atoms at the left boundary.
        if (x[i][1] < new_position_coordinate_y[0]) {
            added_energy += half_u;
            nbr[i].duchi = 0.0;
            order[i][1] = sign; 
        }
        //Identify the atoms at the right edge.
        else if (x[i][1] > new_position_coordinate_y[new_position_coordinate_y.size() - 1]) {
            added_energy -= half_u;
            nbr[i].duchi = 0.0;
            order[i][1] = -sign;
        }
        else {
            if (GB_clusters[0] <= x[i][1] <= GB_clusters[GB_clusters.size() - 1]) {
                omega = omega_pre * chi;
                sin_om = sin(omega);

                added_energy += half_u * sin_om;
                nbr[i].duchi = duchi_pre * cos(omega);
                order[i][1] = sign * sin_om;
            }
            else {
                added_energy += half_u;
                nbr[i].duchi = 0.0;
                order[i][1] = sign;
            }            
        }
  1. new_position_coordinate_y stores the y-coordinate values of atoms at the interstitial and grain boundaries.
  2. GB_clusters store only the y coordinate values of the atoms at the grain boundaries.
  3. The y coordinates in both lists have been sorted in ascending order.
    With only grain boundaries, the original orient/eco command can be used to move grain boundaries in the negative Y-axis direction. I just added the judgment of the gap and grain boundary according to my own model (my model is rectangular and the Y-axis is the length of the rectangular model).

There is no question here and your information about your modifications is incomplete. So what kind of response do you expect? Since you are modifying source code here, you clearly cannot expect that somebody else will be doing your debugging for you.

OK!Thank you for your advice!I’ll think about it later.