diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 764c463037..a919a3e13c 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -167,7 +167,7 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp) if (irepeat == 0) for (i = 0; i < nmax; i++) { sbo[i] = nlp[i] = avq[i] = 0.0; - for (j = 0; j < MAXBOND; j++) { + for (j = 0; j < MAXREAXBOND; j++) { tmpid[i][j] = 0; tmpabo[i][j] = 0.0; } @@ -232,7 +232,7 @@ void FixReaxCBonds::GatherBond( struct _reax_system *system, struct _reax_list * here:; if (jtag != tmpid[i][nj] && tmpid[i][nj] != 0) { nj ++; - if (nj > MAXBOND) error->all(FLERR,"Increase MAXBOND value"); + if (nj > MAXREAXBOND) error->all(FLERR,"Increase MAXREAXBOND value"); goto here; } tmpid[i][nj] = jtag; @@ -266,7 +266,7 @@ void FixReaxCBonds::FindBond( struct _reax_system *system, struct _reax_list *li nlp[i] /= repeat; avq[i] /= repeat; numneigh[i] = 0; - for (j = 0; j < MAXBOND; j++) { + for (j = 0; j < MAXREAXBOND; j++) { tmpabo[i][j] /= repeat; neighid[i][j] = 0; abo[i][j] = 0.0; @@ -277,7 +277,7 @@ void FixReaxCBonds::FindBond( struct _reax_system *system, struct _reax_list *li i = ilist[ii]; nj = 0; - for (j = 0; j < MAXBOND; j++){ + for (j = 0; j < MAXREAXBOND; j++){ if (tmpabo[i][j] > bo_cut) { neighid[i][nj] = tmpid[i][j]; abo[i][nj] = tmpabo[i][j]; @@ -446,10 +446,10 @@ void FixReaxCBonds::allocate() memory->create(nlp,nmax,"reax/c/bonds:nlp"); memory->create(avq,nmax,"reax/c/bonds:avq"); memory->create(numneigh,nmax,"reax/c/bonds:numneigh"); - memory->create(abo,nmax,MAXBOND,"reax/c/bonds:abo"); - memory->create(neighid,nmax,MAXBOND,"reax/c/bonds:neighid"); - memory->create(tmpabo,nmax,MAXBOND,"reax/c/bonds:tmpabo"); - memory->create(tmpid,nmax,MAXBOND,"reax/c/bonds:tmpid"); + memory->create(abo,nmax,MAXREAXBOND,"reax/c/bonds:abo"); + memory->create(neighid,nmax,MAXREAXBOND,"reax/c/bonds:neighid"); + memory->create(tmpabo,nmax,MAXREAXBOND,"reax/c/bonds:tmpabo"); + memory->create(tmpid,nmax,MAXREAXBOND,"reax/c/bonds:tmpid"); } /* ---------------------------------------------------------------------- */ @@ -460,8 +460,8 @@ double FixReaxCBonds::memory_usage() bytes += 3.0*nmax*sizeof(double); bytes += nmax*sizeof(int); - bytes += 2.0*nmax*MAXBOND*sizeof(double); - bytes += 2.0*nmax*MAXBOND*sizeof(int); + bytes += 2.0*nmax*MAXREAXBOND*sizeof(double); + bytes += 2.0*nmax*MAXREAXBOND*sizeof(int); return bytes; } diff --git a/src/USER-REAXC/pair_reax_c.cpp b/src/USER-REAXC/pair_reax_c.cpp index 67058da7d7..746d68c11b 100644 --- a/src/USER-REAXC/pair_reax_c.cpp +++ b/src/USER-REAXC/pair_reax_c.cpp @@ -281,6 +281,7 @@ void PairReaxC::coeff( int nargs, char **args ) continue; } + /* itmp = atoi(args[i]) - 1; map[i-2] = itmp; @@ -288,11 +289,26 @@ void PairReaxC::coeff( int nargs, char **args ) if (itmp < 0 || itmp >= nreax_types) error->all(FLERR,"Non-existent ReaxFF type"); - + */ + } int n = atom->ntypes; + // pair_coeff element map + itmp = 0; + for (int i = 3; i < nargs; i++) + for (int j = 0; j < nreax_types; j++) + if (strcasecmp(args[i],system->reax_param.sbp[j].name) == 0) { + map[i-2] = j; + itmp ++; + } + + // error check + if (itmp != n) + error->all(FLERR,"Non-existent ReaxFF type"); + + int count = 0; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) { @@ -538,13 +554,13 @@ void PairReaxC::compute(int eflag, int vflag) memory->destroy(tmpid); memory->destroy(tmpbo); nmax = system->N; - memory->create(tmpr,nmax,MAXBOND,"pair:tmpr"); - memory->create(tmpid,nmax,MAXBOND,"pair:tmpid"); - memory->create(tmpbo,nmax,MAXBOND,"pair:tmpbo"); + memory->create(tmpr,nmax,MAXSPECBOND,"pair:tmpr"); + memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid"); + memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo"); } for (i = 0; i < system->N; i ++) - for (j = 0; j < MAXBOND; j ++) { + for (j = 0; j < MAXSPECBOND; j ++) { tmpr[i][j] = tmpbo[i][j] = 0.0; tmpid[i][j] = -1; } @@ -779,7 +795,7 @@ void PairReaxC::FindBond() tmpid[i][nj] = j; tmpbo[i][nj] = bo_tmp; nj ++; - if (nj > MAXBOND) error->all(FLERR,"Increase MAXSPECBOND in fix_reaxc_species.h"); + if (nj > MAXSPECBOND) error->all(FLERR,"Increase MAXSPECBOND in fix_reaxc_species.h"); } } } diff --git a/src/USER-REAXC/reaxc_defs.h b/src/USER-REAXC/reaxc_defs.h index 00ce6ab9cc..1b28336f0a 100644 --- a/src/USER-REAXC/reaxc_defs.h +++ b/src/USER-REAXC/reaxc_defs.h @@ -116,7 +116,7 @@ #define MAX_BOND 20 -#define MAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reax_c.cpp */ +#define MAXREAXBOND 24 /* used in fix_reaxc_bonds.cpp and pair_reax_c.cpp */ #define MAXSPECBOND 12 /* used in fix_species.cpp and pair_reax_c.cpp */ /******************* ENUMERATIONS *************************/