# Adjacency matrix or neighbor list in lammps for the pmb style?

Hi,

I use lammps for the peridynamics with the pmb style and for
visualization I like to get a adjacency matrix or a list for each
particle with the id of the neighbors including a broken flag. I need
some information about the broken bonds.

Using > compute C2 all property/local natom1 natom2 ntype1 ntype2

delivers the actual neighbors, but not the ID of the neighbors which are
broken.

What is the best approach to implement this in lammps? A compute command
or a dump command?

Regards

Patrick

There is a compute damage/atom command for PD that

may have the info you want (on a per-atom basis).

The

a hidden fix, called FixPeriNeigh, that all of the PD pair
styles create, it is a one-time neighbor list, created at
the start of a run. I can’t recall the details, but I think
it probably stores flags of which neighbors are still
active as bonds break.

Steve

Thanks for this hint and I was able to use the
compute_property_local.class to write the neighbors in a dump file.

int nlocal = atom->nlocal;
int **partner = ((FixPeriNeigh *) modify->fix[ifix_peri])->partner;
int *npartner = ((FixPeriNeigh *) modify->fix[ifix_peri])->npartner;
int i, jj, jnum, j;
int m = 0;

for (i = 0; i < nlocal; i++) {
//nneigh[i] = 0.0;
jnum = npartner[i];

for (jj = 0; jj < jnum; jj++) {
//if (partner[i][jj] == 0)
// continue;

// look up local index of this partner particle
// skip if particle is "lost"

j = atom->map(partner[i][jj]);
//if (j < 0)
// continue;

if (flag) {
indices[m][0] = i;
indices[m][1] = j;
}

m += 1.0;
}
}
}

return m;

After that I use one of the pack commands. Checking the amount of bonds,
for the example in the User Guide, in the dump file delivers

0 10009800
1 10009800
2 10009800
3 10009800
4 10009800
5 10009800
6 10009800
7 10009800
8 10009800
9 10009800
10 10009800
11 10009800
12 10009500
13 10008716
14 10007766
15 10005624
16 10002182
17 9996354
18 9989112
19 9982678
20 9972098

If the neighborlist is only created once at the start why is the amount
of neighbors increasing after some time?

a hidden fix, called FixPeriNeigh, that all of the PD pair

styles create, it is a one-time neighbor list, created at
the start of a run.

Regards

Patrick

Don’t know why it would be increasing. I’m not
sure what you are doing or if your code is correct.

I you want to monitor the length of the neighbors

stored within FixNeighPeri, I would put print statements
there.

Steve

I do not want to monitor the length of the neighbors. I want to monitor
the bonds between particles and get a list with for each n-th time step with

#id of particle1 id of particle 2 bond status
1 2 1
1 2 1
1 3 0

All ids of particles, which initially had a bond with the particle with
the id 1 and a flag which indicates if the bond is broken or alive.

Patrick

I didn’t mean the distance between neighbor pairs,

I means the length of the neighbor lists, i.e. the

number of neighbors (per atom or total). If you

think that number is increasing in your code, then

I suggest you print those values from where the

static neigh list is stored (FixPeriNeigh), since

if I recall the neigh list is formed one time and should

never change in size.

Steve

I just solved the problem and now I can write the neighborlist. The
problem was that the Id of the particle in the list for broken bond was
set to 0.
Now I wrote my own peri_style where the id of the particle of a broken
bond is set to the negative id. Thus no information about broken bonds a
lost and we can use it for visualization in computer graphics.

Patrick