[lammps-users] sigsev in neighborlist (overflow??)

I have compiled lammps locally and I have an inputfile that gives
sigsev. I would be grateful for some help. I have attached my
inputfile, some output from gdb as well as my makefile.

                                          Thanks in advance

                                                         Niels

***************** My input file *********************

[[email protected] bench]$ cat in.lj20000x4
# 3d Lennard-Jones melt

variable x index 31.748
variable y index 31.748
variable z index 31.748

units lj
atom_style atomic

lattice fcc 0.8442
region box block 0 $x 0 $y 0 $z
create_box 1 box
create_atoms 1
mass 1 1.0

velocity all create 1.44 87287 loop geom

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

neighbor 0.3 bin
neigh_modify delay 0 every 20 check no

fix 1 all nve

run 20000

*************** gdb run *****************

(gdb) r -in ../bench/in.lj20000x4
[Thread debugging using libthread_db enabled]
[New Thread 182905599712 (LWP 22206)]
LAMMPS (10 Nov 2005)
Created box = (0 0 0) to (53.3238 53.3238 53.3238)
  1 by 1 by 1 processor grid
Created 131072 atoms
Setting up run ...
Memory usage per processor = 43.6951 Mbytes
Step Temperature E_pair E_bond E_total Pressure
     0 1.44 -2.9986934 0 -0.83870991 9.8414349

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182905599712 (LWP 22206)]
0x00000000004651e1 in Neighbor::bin_atoms (this=0x6ce500) at neighbor.cpp:1247
1247 bins[i] = binhead[ibin];
(gdb) bt
#0 0x00000000004651e1 in Neighbor::bin_atoms (this=0x6ce500) at
neighbor.cpp:1247
#1 0x0000000000467160 in Neighbor::pair_bin_newton (this=0x6ce500) at
neigh_pair.cpp:274
#2 0x0000000000463abd in Neighbor::build (this=0x6ce500) at neighbor.cpp:715
#3 0x00000000004ab6d1 in Verlet::iterate (this=0x6db2a0, n=20000) at
verlet.cpp:189
#4 0x00000000004ab3e8 in Verlet::run (this=0x6db2a0) at verlet.cpp:105
#5 0x00000000004a0e8d in Run::command (this=0x7fbff7e4f0,
narg=-1765576704, arg=0x6dc650) at run.cpp:34
#6 0x000000000045ce2b in main (argc=3, argv=0x7fbff7e6b8) at style.h:67

(gdb) p mbins
$1 = 85184
(gdb) p nlocal
$2 = 131072
(gdb) p nall
$3 = 175654
(gdb) p i
$4 = 131242
(gdb) p ibin
$5 = 7777472
(gdb) p maxhead
$7 = 85184
(gdb) p *x[i]@3
$10 = {55.287160691799002, 1195.9215653219892, -1151.4360923821766}
(gdb) p bininvx
$13 = 0.71262711641169574
(gdb) p bininvy
$14 = 0.71262711641169574
(gdb) p bininvz
$15 = 0.71262711641169574
(gdb) p nbinx
$16 = 38
(gdb) p nbiny
$17 = 38
(gdb) p nbinz
$18 = 38

**************** Relevant part of the code ***************

void Neighbor::bin_atoms()
{
  int i,ibin,nlocal,nall;
  double **x;

  nlocal = atom->nlocal;
  nall = atom->nlocal + atom->nghost;
  x = atom->x;

  for (i = 0; i < mbins; i++) binhead[i] = -1;

  // bin ghost atoms 1st, so will be at end of linked list

  for (i = nlocal; i < nall; i++) {
    ibin = coord2bin(x[i]);
    bins[i] = binhead[ibin]; <- ********* Line 1247 is here **************
    binhead[ibin] = i;
  }

  // bin owned atoms

  for (i = 0; i < nlocal; i++) {
    ibin = coord2bin(x[i]);
    bins[i] = binhead[ibin];
    binhead[ibin] = i;
  }
}

****************** My makefile **************

[[email protected] bench]$ cat ../src/MAKE/Makefile.g++
# g++ = RedHat Linux box, g++, MPICH, FFTW

SHELL = /bin/sh
#.IGNORE:

# System-specific settings

CC = g++
#CCFLAGS = -g -O -I/home/sjplimp/tools/mpich/include \
# -I/home/sjplimp/tools/fftw/include \
# -I/home/sjplimp/lammps/poems
CCFLAGS = -g -O -I/opt/mpich-mpd/gnu/lib/include \
                -I/home/niels/md/fftw-2.1.5/include \
                -I/opt/lam/gnu/include \
                -I/opt/gm/include \
                -DFFT_FFTW -DGZIP \

DEPFLAGS = -M
LINK = g++
#LINKFLAGS = -g -O -L/home/sjplimp/tools/mpich/lib \
# -L/home/sjplimp/tools/fftw/lib -L/home/sjplimp/lammps/poems
#USRLIB = -lfftw -lmpich -lpoems
LINKFLAGS = -g -O -L/opt/mpich-mpd/gnu/lib \
                -L/home/niels/md/fftw-2.1.5/lib\
                -L/opt/lam/gnu/lib \
                -L/opt/gm/lib \
                -Wl,-rpath,/opt/gm/lib

USRLIB = -lfftw -lmpi -llam -llammpio -lpthread -ldl -lgm

SYSLIB =
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size

# Link target

\(EXE\): (OBJ)
        \(LINK\) (LINKFLAGS) \(OBJ\) (USRLIB) \(SYSLIB\) \-o (EXE)
        \(SIZE\) (EXE)

# Library target

lib: \(OBJ\) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ARCHIVE) \(ARFLAGS\) (EXE) $(OBJ)

# Compilation rules

\.o:.cpp
        \(CC\) (CCFLAGS) -c $<

\.d:.cpp
        \(CC\) (CCFLAGS) \(DEPFLAGS\) < > [email protected]

# Individual dependencies

DEPENDS = \(OBJ:\.o=\.d\) include (DEPENDS)

Setting the xyz variables to 31.748 is your problem. In
this script, those are the number of cubic unit cells in your
periodic box and when atoms are created. If you make it
a non-integer # of cells, you can create atoms nearly on top
of each other. Your system KE blows up in the first
few timesteps (set thermo to 1 to see it). If you set
xyz to 32, you will have no problem.

Steve