Skip to content
Snippets Groups Projects
Commit 4f9c0456 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

eliminate variable length arrays from compute entropy/atom

parent 264f832b
No related branches found
No related tags found
No related merge requests found
......@@ -163,7 +163,8 @@ void ComputeEntropyAtom::compute_peratom()
int i,j,ii,jj,inum,jnum;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *ilist,*jlist,*numneigh,**firstneigh;
double rbin[nbin], rbinsq[nbin];
double *rbin = new double[nbin];
double *rbinsq = new double[nbin];
invoked_peratom = update->ntimestep;
......@@ -235,7 +236,7 @@ void ComputeEntropyAtom::compute_peratom()
// loop over list of all neighbors within force cutoff
// initialize gofr
double gofr[nbin];
double *gofr = new double[nbin];
for(int k=0;k<nbin;++k) gofr[k]=0.;
for (jj = 0; jj < jnum; jj++) {
......@@ -265,7 +266,7 @@ void ComputeEntropyAtom::compute_peratom()
}
// Calculate integrand
double integrand[nbin];
double *integrand = new double[nbin];
for(int k=0;k<nbin;++k){
if (gofr[k]<1.e-10) {
integrand[k] = rbinsq[k];
......@@ -273,6 +274,7 @@ void ComputeEntropyAtom::compute_peratom()
integrand[k] = (gofr[k]*log(gofr[k])-gofr[k]+1)*rbinsq[k];
}
}
delete [] gofr;
// Integrate with trapezoid rule
double value = 0.;
......@@ -282,9 +284,9 @@ void ComputeEntropyAtom::compute_peratom()
value += 0.5*integrand[0];
value += 0.5*integrand[nbin-1];
value *= deltar;
delete [] integrand;
pair_entropy[i] = -2*MY_PI*density*value;
}
}
......@@ -320,7 +322,8 @@ void ComputeEntropyAtom::compute_peratom()
}
}
}
delete [] rbin;
delete [] rbinsq;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment