LAMMPS calculator failed to perform structual optimization in ASE

Hi, I have been trying to use LAMMPSlib to perform structual optimization in ASE (Ver. 3.19.3) with lammps stable-build (29-Sep-2021) on cluster (CentOS).

It can only perform one-step optimization, and will show Segmentation fault immediately.

Here is my ase_test.py script:

import ase.io
from ase.optimize import FIRE
from ase.constraints import UnitCellFilter
from ase.io.trajectory import Trajectory
from ase.calculators.lammpslib import LAMMPSlib

atoms = ase.io.read('.'+'/'+'POSCAR')

trajfile = 'opt.traj'

cmds = ["pair_style eam/fs",
        "pair_coeff * * Li_v2.eam.fs Li",
        "compute eng all pe/atom pair bond",
        "compute eatoms all reduce sum c_eng",
        "dump coord all custom 10 lammps.dump id type x y z c_eng",
        "min_style fire",
        "minimize 1e-15 1e-15 5000 5000"]
lammps = LAMMPSlib(lmpcmds = cmds, log_file = 'lammps.log')

atoms.calc = lammps

af = UnitCellFilter(atoms)

opt = FIRE(af, maxmove = 1.e-1, trajectory = trajfile)
opt.run(fmax = 0.001)

traj = Trajectory(trajfile)
ase.io.write('opt.vasp', traj[-1], direct = True, long_format=True, vasp5 = True)

And the slurm job shell script is:

#!/bin/sh
#SBATCH --partition main
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem-per-cpu=2GB
#SBATCH --time=02:00:00

module purge
module load intel/17.0.4 python
export OMP_NUM_THREADS=1
export LAMMPS_COMMAND="mpirun -np 16 $HOME/.local/bin/lmp"
export ASE_LAMMPSRUN_COMMAND="mpirun -np 16 $HOME/.local/bin/lmp"

python3 ase_test.py

The error msg is:

      Step     Time          Energy         fmax
*Force-consistent energies used in optimization.
FIRE:    0 15:26:21       -6.448428*       0.0510
/var/lib/slurm/slurmd/job2606810/slurm_script: line 16: 25255 Segmentation fault      python3 ase_test.py

However the lammps dump file shows that the energy minimization is finished in 188 timesteps.

tail -n 13 lammps.dump 
ITEM: TIMESTEP
188
ITEM: NUMBER OF ATOMS
4
ITEM: BOX BOUNDS xy xz yz pp pp pp
0.0000000000000000e+00 4.3198900000000000e+00 0.0000000000000000e+00
0.0000000000000000e+00 4.3198900000000000e+00 0.0000000000000000e+00
0.0000000000000000e+00 4.3198900000000000e+00 0.0000000000000000e+00
ITEM: ATOMS id type x y z c_eng
1 1 3.19214 4.86174 1.68937 -1.61238
2 1 1.0322 2.7018 1.68937 -1.61238
3 1 3.19214 2.7018 3.84932 -1.61238
4 1 1.0322 0.541854 3.84932 -1.61238

Can anyone help me with this?