Rezwan,
As Steve says, the bonds used in the peridynamics module within LAMMPS are not bonds in the normal LAMMPS sense. Right now they are created and stored in the fix_peri_neigh fix, and there is no mechanism to dump them to disk. I've only had a need to dump the peridynamics bonds once in the past, and wrote a quick-n-dirty fix that simply dumps the peridynamics bonds to disk at the end of step. Each processor writes their own bonds, so you'll need to write a postprocessing script to merge these separate bond files together. I've attached some of the contents of the .cpp file below; you can use that to quickly create your own fix to dump the bonds.
Let me know if you feel adding some functionality like this to the public distribution would be useful. Aside from me, you're the only other person to ask about this, so I've never put this functionality into the public release.
- Mike
FixPeriNeighPrint::FixPeriNeighPrint(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg) {
// fix ID group-ID fix_peri_neigh_print N file string
if (narg != 6) error->all(FLERR,"Illegal fix_peri_neigh_print command");
nevery = atoi(arg[3]);
if (nevery <= 0) error->all(FLERR,"Illegal fix_peri_neigh_print command");
MPI_Comm_rank(world,&me);
fp = NULL;
char filename[100];
sprintf(filename,"%s.%i.dat",arg[5],me);
fp = fopen(filename,"w");
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open fix print file %s",arg[5]);
error->one(FLERR,str); // prudenci
}
// print file comment line
if (fp) {
fprintf(fp,"# fix_peri_neigh_print output for fix %s from proc %i\n",id,me);
fflush(fp);
}
}
/* ---------------------------------------------------------------------- */
FixPeriNeighPrint::~FixPeriNeighPrint() {
if (fp) fclose(fp);
}
/* ---------------------------------------------------------------------- */
int FixPeriNeighPrint::setmask() {
int mask = 0;
mask |= END_OF_STEP;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixPeriNeighPrint::end_of_step() {
int i,j,jj,jnum;
int ifix_peri = -1;
int nlocal = atom->nlocal;
int *tag = atom->tag;
if ( fp ) {
for (i = 0; i < modify->nfix; i++)
if (strcmp(modify->fix[i]->style,"PERI_NEIGH") == 0) ifix_peri = i;
int **partner = ((FixPeriNeigh *) modify->fix[ifix_peri])->partner;
int *npartner = ((FixPeriNeigh *) modify->fix[ifix_peri])->npartner;
for (i = 0; i < nlocal; i++) {
fprintf(fp,"%i: ",tag[i]);
jnum = npartner[i];
for (jj = 0; jj < jnum; jj++) {
if (partner[i][jj] == 0) continue;
j = atom->map(partner[i][jj]);
// check if lost a partner without first breaking bond
if (j < 0) {
partner[i][jj] = 0;
continue;
}
fprintf(fp,"%i ",tag[j]);
}
fprintf(fp,"\n");
fflush(fp);
}
}
fprintf(fp,"\n\n");
fflush(fp);
}