git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8354 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-06-20 14:59:29 +00:00
parent bf54b6b9ff
commit 0cd34fb8a2
2 changed files with 33 additions and 24 deletions

View File

@ -48,8 +48,8 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) :
MPI_Comm_rank(world,&me);
MPI_Comm_size(world,&nprocs);
nmax = nint(atom->nlocal*1.05);
ntypes = atom->ntypes;
nmax = atom->nmax;
nevery = atoi(arg[3]);
nrepeat = atoi(arg[4]);
@ -72,8 +72,18 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) :
if (atom->tag_consecutive() == 0)
error->all(FLERR,"Atom IDs must be consecutive for fix reax/c bonds");
sbo = NULL;
nlp = NULL;
avq = NULL;
numneigh = NULL;
neighid = NULL;
tmpid = NULL;
abo = NULL;
tmpabo = NULL;
allocate();
irepeat = 0;
nvalid = nextvalid();
}
@ -83,14 +93,7 @@ FixReaxCBonds::~FixReaxCBonds()
{
MPI_Comm_rank(world,&me);
memory->destroy(sbo);
memory->destroy(nlp);
memory->destroy(avq);
memory->destroy(numneigh);
memory->destroy(neighid);
memory->destroy(tmpid);
memory->destroy(abo);
memory->destroy(tmpabo);
destroy();
if (me == 0) fclose(fp);
}
@ -151,6 +154,12 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp)
int nlocal = atom->nlocal;
int nlocal_tot = static_cast<int> (atom->natoms);
if (atom->nmax > nmax) {
destroy();
nmax = atom->nmax;
allocate();
}
repeat = nrepeat;
// zero out average BO for next Nfreq
if (irepeat == 0)
@ -415,20 +424,22 @@ bigint FixReaxCBonds::nextvalid()
/* ---------------------------------------------------------------------- */
void FixReaxCBonds::destroy()
{
memory->destroy(sbo);
memory->destroy(nlp);
memory->destroy(avq);
memory->destroy(numneigh);
memory->destroy(neighid);
memory->destroy(tmpid);
memory->destroy(abo);
memory->destroy(tmpabo);
}
/* ---------------------------------------------------------------------- */
void FixReaxCBonds::allocate()
{
irepeat = 0;
sbo = NULL;
nlp = NULL;
avq = NULL;
numneigh = NULL;
neighid = NULL;
tmpid = NULL;
abo = NULL;
tmpabo = NULL;
memory->create(sbo,nmax,"reax/c/bonds:sbo");
memory->create(nlp,nmax,"reax/c/bonds:nlp");
memory->create(avq,nmax,"reax/c/bonds:avq");
@ -437,9 +448,6 @@ void FixReaxCBonds::allocate()
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");
irepeat = 0;
}
/* ---------------------------------------------------------------------- */

View File

@ -48,6 +48,7 @@ class FixReaxCBonds : public Fix {
FILE *fp;
void allocate();
void destroy();
void Output_ReaxC_Bonds(bigint, FILE *);
void GatherBond(reax_system*, reax_list*);
void FindBond(reax_system*, reax_list*, int &);