remove trailing whitespace

This commit is contained in:
Axel Kohlmeyer
2017-05-24 16:29:26 -04:00
parent 5345ad2da7
commit 0e3cfbc007
19 changed files with 486 additions and 486 deletions

View File

@ -122,14 +122,14 @@ void AngleDipoleOMP::eval(int nfrom, int nto, ThrData * const thr)
delTx = tangle * (dely*mu[iDip][2] - delz*mu[iDip][1]); delTx = tangle * (dely*mu[iDip][2] - delz*mu[iDip][1]);
delTy = tangle * (delz*mu[iDip][0] - delx*mu[iDip][2]); delTy = tangle * (delz*mu[iDip][0] - delx*mu[iDip][2]);
delTz = tangle * (delx*mu[iDip][1] - dely*mu[iDip][0]); delTz = tangle * (delx*mu[iDip][1] - dely*mu[iDip][0]);
torque[iDip][0] += delTx; torque[iDip][0] += delTx;
torque[iDip][1] += delTy; torque[iDip][1] += delTy;
torque[iDip][2] += delTz; torque[iDip][2] += delTz;
// Force couple that counterbalances dipolar torque // Force couple that counterbalances dipolar torque
fx = dely*delTz - delz*delTy; // direction (fi): - r x (-T) fx = dely*delTz - delz*delTy; // direction (fi): - r x (-T)
fy = delz*delTx - delx*delTz; fy = delz*delTx - delx*delTz;
fz = delx*delTy - dely*delTx; fz = delx*delTy - dely*delTx;
fmod = sqrt(delTx*delTx + delTy*delTy + delTz*delTz) / r; // magnitude fmod = sqrt(delTx*delTx + delTy*delTy + delTz*delTz) / r; // magnitude
@ -142,11 +142,11 @@ void AngleDipoleOMP::eval(int nfrom, int nto, ThrData * const thr)
fj[0] = -fi[0]; fj[0] = -fi[0];
fj[1] = -fi[1]; fj[1] = -fi[1];
fj[2] = -fi[2]; fj[2] = -fi[2];
f[iDip][0] += fj[0]; f[iDip][0] += fj[0];
f[iDip][1] += fj[1]; f[iDip][1] += fj[1];
f[iDip][2] += fj[2]; f[iDip][2] += fj[2];
f[iRef][0] += fi[0]; f[iRef][0] += fi[0];
f[iRef][1] += fi[1]; f[iRef][1] += fi[1];
f[iRef][2] += fi[2]; f[iRef][2] += fi[2];

View File

@ -168,10 +168,10 @@ void FixQEqReaxOMP::allocate_storage()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixQEqReaxOMP::deallocate_storage() void FixQEqReaxOMP::deallocate_storage()
{ {
memory->destroy(b_temp); memory->destroy(b_temp);
FixQEqReax::deallocate_storage(); FixQEqReax::deallocate_storage();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -275,7 +275,7 @@ void FixQEqReaxOMP::init()
n -= 1.0; n -= 1.0;
d += 1.0; d += 1.0;
} }
// fprintf(stdout,"aspc_omega= %f\n",aspc_omega); // fprintf(stdout,"aspc_omega= %f\n",aspc_omega);
// for(int i=0; i<aspc_order_max+2; i++) fprintf(stdout,"i= %i B= %f\n",i,aspc_b[i]); // for(int i=0; i<aspc_order_max+2; i++) fprintf(stdout,"i= %i B= %f\n",i,aspc_b[i]);
// error->all(FLERR,"Early Termination"); // error->all(FLERR,"Early Termination");
@ -306,21 +306,21 @@ void FixQEqReaxOMP::compute_H()
firstneigh = list->firstneigh; firstneigh = list->firstneigh;
} }
int ai, num_nbrs; int ai, num_nbrs;
// sumscan of the number of neighbors per atom to determine the offsets // sumscan of the number of neighbors per atom to determine the offsets
// most likely, we are overallocating. desirable to work on this part // most likely, we are overallocating. desirable to work on this part
// to reduce the memory footprint of the far_nbrs list. // to reduce the memory footprint of the far_nbrs list.
num_nbrs = 0; num_nbrs = 0;
for (int itr_i = 0; itr_i < inum; ++itr_i) { for (int itr_i = 0; itr_i < inum; ++itr_i) {
ai = ilist[itr_i]; ai = ilist[itr_i];
H.firstnbr[ai] = num_nbrs; H.firstnbr[ai] = num_nbrs;
num_nbrs += numneigh[ai]; num_nbrs += numneigh[ai];
} }
// fill in the H matrix // fill in the H matrix
#pragma omp parallel default(shared) #pragma omp parallel default(shared)
{ {
int i, j, ii, jj, mfill, jnum, flag; int i, j, ii, jj, mfill, jnum, flag;
@ -328,7 +328,7 @@ void FixQEqReaxOMP::compute_H()
double dx, dy, dz, r_sqr; double dx, dy, dz, r_sqr;
mfill = 0; mfill = 0;
//#pragma omp for schedule(dynamic,50) //#pragma omp for schedule(dynamic,50)
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {
@ -340,12 +340,12 @@ void FixQEqReaxOMP::compute_H()
for (jj = 0; jj < jnum; jj++) { for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
dx = x[j][0] - x[i][0]; dx = x[j][0] - x[i][0];
dy = x[j][1] - x[i][1]; dy = x[j][1] - x[i][1];
dz = x[j][2] - x[i][2]; dz = x[j][2] - x[i][2];
r_sqr = SQR(dx) + SQR(dy) + SQR(dz); r_sqr = SQR(dx) + SQR(dy) + SQR(dz);
flag = 0; flag = 0;
if (r_sqr <= SQR(swb)) { if (r_sqr <= SQR(swb)) {
if (j < n) flag = 1; if (j < n) flag = 1;
@ -358,7 +358,7 @@ void FixQEqReaxOMP::compute_H()
} }
} }
} }
if( flag ) { if( flag ) {
H.jlist[mfill] = j; H.jlist[mfill] = j;
H.val[mfill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]] ); H.val[mfill] = calculate_H( sqrt(r_sqr), shld[type[i]][type[j]] );
@ -378,7 +378,7 @@ void FixQEqReaxOMP::compute_H()
error->all(FLERR,"Fix qeq/reax/omp has insufficient QEq matrix size"); error->all(FLERR,"Fix qeq/reax/omp has insufficient QEq matrix size");
} }
} // omp } // omp
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -386,10 +386,10 @@ void FixQEqReaxOMP::compute_H()
void FixQEqReaxOMP::init_storage() void FixQEqReaxOMP::init_storage()
{ {
int NN; int NN;
if(reaxc) NN = reaxc->list->inum + reaxc->list->gnum; if(reaxc) NN = reaxc->list->inum + reaxc->list->gnum;
else NN = list->inum + list->gnum; else NN = list->inum + list->gnum;
#pragma omp parallel for schedule(static) #pragma omp parallel for schedule(static)
for (int i = 0; i < NN; i++) { for (int i = 0; i < NN; i++) {
Hdia_inv[i] = 1. / eta[atom->type[i]]; Hdia_inv[i] = 1. / eta[atom->type[i]];
@ -450,9 +450,9 @@ void FixQEqReaxOMP::pre_force(int vflag)
ompTimingCGCount[COMPUTECG1INDEX]+= matvecs_s; ompTimingCGCount[COMPUTECG1INDEX]+= matvecs_s;
startTimeBase = endTimeBase; startTimeBase = endTimeBase;
#endif #endif
matvecs_t = CG(b_t, t); // CG on t - parallel matvecs_t = CG(b_t, t); // CG on t - parallel
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTECG2INDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTECG2INDEX] += (endTimeBase-startTimeBase);
@ -495,7 +495,7 @@ void FixQEqReaxOMP::init_matvec()
long endTimeBase, startTimeBase; long endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
/* fill-in H matrix */ /* fill-in H matrix */
compute_H(); compute_H();
@ -611,12 +611,12 @@ int FixQEqReaxOMP::CG( double *b, double *x )
if (atom->mask[i] & groupbit) { if (atom->mask[i] & groupbit) {
r[i] = b[i] - q[i]; r[i] = b[i] - q[i];
d[i] = r[i] * Hdia_inv[i]; //pre-condition d[i] = r[i] * Hdia_inv[i]; //pre-condition
tmp1 += b[i] * b[i]; tmp1 += b[i] * b[i];
tmp2 += r[i] * d[i]; tmp2 += r[i] * d[i];
} }
} }
my_buf[0] = tmp1; my_buf[0] = tmp1;
my_buf[1] = tmp2; my_buf[1] = tmp2;
@ -633,7 +633,7 @@ int FixQEqReaxOMP::CG( double *b, double *x )
tmp1 = 0.0; tmp1 = 0.0;
#pragma omp parallel #pragma omp parallel
{ {
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1) #pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1)
for( jj = 0; jj < nn; jj++) { for( jj = 0; jj < nn; jj++) {
ii = ilist[jj]; ii = ilist[jj];
@ -656,7 +656,7 @@ int FixQEqReaxOMP::CG( double *b, double *x )
if(atom->mask[ii] & groupbit) { if(atom->mask[ii] & groupbit) {
x[ii] += alpha * d[ii]; x[ii] += alpha * d[ii];
r[ii] -= alpha * q[ii]; r[ii] -= alpha * q[ii];
// pre-conditioning // pre-conditioning
p[ii] = r[ii] * Hdia_inv[ii]; p[ii] = r[ii] * Hdia_inv[ii];
tmp1 += r[ii] * p[ii]; tmp1 += r[ii] * p[ii];
@ -665,12 +665,12 @@ int FixQEqReaxOMP::CG( double *b, double *x )
} // omp parallel } // omp parallel
sig_old = sig_new; sig_old = sig_new;
MPI_Allreduce(&tmp1, &tmp2, 1, MPI_DOUBLE, MPI_SUM, world); MPI_Allreduce(&tmp1, &tmp2, 1, MPI_DOUBLE, MPI_SUM, world);
sig_new = tmp2; sig_new = tmp2;
beta = sig_new / sig_old; beta = sig_new / sig_old;
#pragma omp for schedule(dynamic,50) private(ii) #pragma omp for schedule(dynamic,50) private(ii)
for( jj = 0; jj < nn; jj++) { for( jj = 0; jj < nn; jj++) {
ii = ilist[jj]; ii = ilist[jj];
@ -699,7 +699,7 @@ void FixQEqReaxOMP::sparse_matvec( sparse_matrix *A, double *x, double *b )
int *ilist; int *ilist;
int nthreads = comm->nthreads; int nthreads = comm->nthreads;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
if(reaxc) { if(reaxc) {
nn = reaxc->list->inum; nn = reaxc->list->inum;
NN = reaxc->list->inum + reaxc->list->gnum; NN = reaxc->list->inum + reaxc->list->gnum;
@ -709,21 +709,21 @@ void FixQEqReaxOMP::sparse_matvec( sparse_matrix *A, double *x, double *b )
NN = list->inum + list->gnum; NN = list->inum + list->gnum;
ilist = list->ilist; ilist = list->ilist;
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (ii = 0; ii < nn; ++ii) { for (ii = 0; ii < nn; ++ii) {
i = ilist[ii]; i = ilist[ii];
if(atom->mask[i] & groupbit) b[i] = eta[ atom->type[i] ] * x[i]; if(atom->mask[i] & groupbit) b[i] = eta[ atom->type[i] ] * x[i];
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (ii = nn; ii < NN; ++ii) { for (ii = nn; ii < NN; ++ii) {
i = ilist[ii]; i = ilist[ii];
if(atom->mask[i] & groupbit) b[i] = 0; if(atom->mask[i] & groupbit) b[i] = 0;
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (i = 0; i < NN; ++i) for (i = 0; i < NN; ++i)
for(int t=0; t<nthreads; t++) b_temp[t][i] = 0.0; for(int t=0; t<nthreads; t++) b_temp[t][i] = 0.0;
// Wait for b accumulated and b_temp zeroed. // Wait for b accumulated and b_temp zeroed.
@ -748,7 +748,7 @@ void FixQEqReaxOMP::sparse_matvec( sparse_matrix *A, double *x, double *b )
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (i = 0; i < NN; ++i) for (i = 0; i < NN; ++i)
for (int t = 0; t < nthreads; ++t) b[i] += b_temp[t][i]; for (int t = 0; t < nthreads; ++t) b[i] += b_temp[t][i];
} //end omp parallel } //end omp parallel
} }
@ -797,7 +797,7 @@ void FixQEqReaxOMP::calculate_Q()
i = ilist[ii]; i = ilist[ii];
if(atom->mask[i] & groupbit) { if(atom->mask[i] & groupbit) {
q[i] = s[i] - u * t[i]; q[i] = s[i] - u * t[i];
// backup s & t // backup s & t
for (int k = 4; k > 0; --k) { for (int k = 4; k > 0; --k) {
s_hist[i][k] = s_hist[i][k-1]; s_hist[i][k] = s_hist[i][k-1];
@ -817,7 +817,7 @@ void FixQEqReaxOMP::calculate_Q()
// double FixQEqReaxOMP::parallel_norm( double *v, int n ) // double FixQEqReaxOMP::parallel_norm( double *v, int n )
// { // {
// int i; // int i;
// double my_sum, norm_sqr; // double my_sum, norm_sqr;
// int *ilist; // int *ilist;
@ -911,7 +911,7 @@ void FixQEqReaxOMP::vector_sum( double* dest, double c, double* v,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixQEqReaxOMP::vector_add( double* dest, double c, double* v, int k ) void FixQEqReaxOMP::vector_add( double* dest, double c, double* v, int k )
{ {
int i; int i;
int *ilist; int *ilist;
@ -971,18 +971,18 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2 )
int indxI = 2 * i; int indxI = 2 * i;
r[indxI ] = b1[i] - q[indxI ]; r[indxI ] = b1[i] - q[indxI ];
r[indxI+1] = b2[i] - q[indxI+1]; r[indxI+1] = b2[i] - q[indxI+1];
d[indxI ] = r[indxI ] * Hdia_inv[i]; //pre-condition d[indxI ] = r[indxI ] * Hdia_inv[i]; //pre-condition
d[indxI+1] = r[indxI+1] * Hdia_inv[i]; d[indxI+1] = r[indxI+1] * Hdia_inv[i];
tmp1 += b1[i] * b1[i]; tmp1 += b1[i] * b1[i];
tmp2 += b2[i] * b2[i]; tmp2 += b2[i] * b2[i];
tmp3 += r[indxI ] * d[indxI ]; tmp3 += r[indxI ] * d[indxI ];
tmp4 += r[indxI+1] * d[indxI+1]; tmp4 += r[indxI+1] * d[indxI+1];
} }
} }
my_buf[0] = tmp1; my_buf[0] = tmp1;
my_buf[1] = tmp2; my_buf[1] = tmp2;
my_buf[2] = tmp3; my_buf[2] = tmp3;
@ -1004,7 +1004,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2 )
tmp1 = tmp2 = 0.0; tmp1 = tmp2 = 0.0;
#pragma omp parallel #pragma omp parallel
{ {
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1,tmp2) #pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1,tmp2)
for( jj = 0; jj < nn; jj++) { for( jj = 0; jj < nn; jj++) {
ii = ilist[jj]; ii = ilist[jj];
@ -1037,14 +1037,14 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2 )
int indxI = 2 * ii; int indxI = 2 * ii;
x1[ii] += alpha_s * d[indxI ]; x1[ii] += alpha_s * d[indxI ];
x2[ii] += alpha_t * d[indxI+1]; x2[ii] += alpha_t * d[indxI+1];
r[indxI ] -= alpha_s * q[indxI ]; r[indxI ] -= alpha_s * q[indxI ];
r[indxI+1] -= alpha_t * q[indxI+1]; r[indxI+1] -= alpha_t * q[indxI+1];
// pre-conditioning // pre-conditioning
p[indxI ] = r[indxI ] * Hdia_inv[ii]; p[indxI ] = r[indxI ] * Hdia_inv[ii];
p[indxI+1] = r[indxI+1] * Hdia_inv[ii]; p[indxI+1] = r[indxI+1] * Hdia_inv[ii];
tmp1 += r[indxI ] * p[indxI ]; tmp1 += r[indxI ] * p[indxI ];
tmp2 += r[indxI+1] * p[indxI+1]; tmp2 += r[indxI+1] * p[indxI+1];
} }
@ -1053,20 +1053,20 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2 )
my_buf[0] = tmp1; my_buf[0] = tmp1;
my_buf[1] = tmp2; my_buf[1] = tmp2;
sig_old_s = sig_new_s; sig_old_s = sig_new_s;
sig_old_t = sig_new_t; sig_old_t = sig_new_t;
MPI_Allreduce(&my_buf, &buf, 2, MPI_DOUBLE, MPI_SUM, world); MPI_Allreduce(&my_buf, &buf, 2, MPI_DOUBLE, MPI_SUM, world);
sig_new_s = buf[0]; sig_new_s = buf[0];
sig_new_t = buf[1]; sig_new_t = buf[1];
if( sqrt(sig_new_s)/b_norm_s <= tolerance || sqrt(sig_new_t)/b_norm_t <= tolerance) break; if( sqrt(sig_new_s)/b_norm_s <= tolerance || sqrt(sig_new_t)/b_norm_t <= tolerance) break;
beta_s = sig_new_s / sig_old_s; beta_s = sig_new_s / sig_old_s;
beta_t = sig_new_t / sig_old_t; beta_t = sig_new_t / sig_old_t;
#pragma omp for schedule(dynamic,50) private(ii) #pragma omp for schedule(dynamic,50) private(ii)
for( jj = 0; jj < nn; jj++) { for( jj = 0; jj < nn; jj++) {
ii = ilist[jj]; ii = ilist[jj];
@ -1082,7 +1082,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2 )
i++; i++;
matvecs_s = matvecs_t = i; // The plus one makes consistent with count from CG() matvecs_s = matvecs_t = i; // The plus one makes consistent with count from CG()
matvecs = i; matvecs = i;
// Timing info for iterating s&t together // Timing info for iterating s&t together
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
@ -1140,7 +1140,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2
int nthreads = comm->nthreads; int nthreads = comm->nthreads;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
if (reaxc) { if (reaxc) {
nn = reaxc->list->inum; nn = reaxc->list->inum;
NN = reaxc->list->inum + reaxc->list->gnum; NN = reaxc->list->inum + reaxc->list->gnum;
@ -1150,7 +1150,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2
NN = list->inum + list->gnum; NN = list->inum + list->gnum;
ilist = list->ilist; ilist = list->ilist;
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for( ii = 0; ii < nn; ++ii ) { for( ii = 0; ii < nn; ++ii ) {
i = ilist[ii]; i = ilist[ii];
@ -1160,7 +1160,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2
b[indxI+1] = eta[ atom->type[i] ] * x2[i]; b[indxI+1] = eta[ atom->type[i] ] * x2[i];
} }
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for( ii = nn; ii < NN; ++ii ) { for( ii = nn; ii < NN; ++ii ) {
i = ilist[ii]; i = ilist[ii];
@ -1179,7 +1179,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x1, double *x2
b_temp[t][indxI+1] = 0.0; b_temp[t][indxI+1] = 0.0;
} }
} }
// Wait for b accumulated and b_temp zeroed // Wait for b accumulated and b_temp zeroed
#pragma omp barrier #pragma omp barrier
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
@ -1226,7 +1226,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b )
int nthreads = comm->nthreads; int nthreads = comm->nthreads;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
if (reaxc) { if (reaxc) {
nn = reaxc->list->inum; nn = reaxc->list->inum;
NN = reaxc->list->inum + reaxc->list->gnum; NN = reaxc->list->inum + reaxc->list->gnum;
@ -1236,7 +1236,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b )
NN = list->inum + list->gnum; NN = list->inum + list->gnum;
ilist = list->ilist; ilist = list->ilist;
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for( ii = 0; ii < nn; ++ii ) { for( ii = 0; ii < nn; ++ii ) {
i = ilist[ii]; i = ilist[ii];
@ -1246,7 +1246,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b )
b[indxI+1] = eta[ atom->type[i] ] * x[indxI+1]; b[indxI+1] = eta[ atom->type[i] ] * x[indxI+1];
} }
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for( ii = nn; ii < NN; ++ii ) { for( ii = nn; ii < NN; ++ii ) {
i = ilist[ii]; i = ilist[ii];
@ -1265,7 +1265,7 @@ void FixQEqReaxOMP::dual_sparse_matvec( sparse_matrix *A, double *x, double *b )
b_temp[t][indxI+1] = 0.0; b_temp[t][indxI+1] = 0.0;
} }
} }
// Wait for b accumulated and b_temp zeroed // Wait for b accumulated and b_temp zeroed
#pragma omp barrier #pragma omp barrier
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)

View File

@ -43,7 +43,7 @@ class FixQEqReaxOMP : public FixQEqReax {
virtual void init_storage(); virtual void init_storage();
virtual void pre_force(int); virtual void pre_force(int);
virtual void post_constructor(); virtual void post_constructor();
protected: protected:
double **b_temp; double **b_temp;
@ -53,7 +53,7 @@ class FixQEqReaxOMP : public FixQEqReax {
int aspc_order, aspc_order_max; int aspc_order, aspc_order_max;
double aspc_omega; double aspc_omega;
double * aspc_b; double * aspc_b;
virtual void pertype_parameters(char*); virtual void pertype_parameters(char*);
virtual void allocate_storage(); virtual void allocate_storage();
virtual void deallocate_storage(); virtual void deallocate_storage();
@ -64,7 +64,7 @@ class FixQEqReaxOMP : public FixQEqReax {
virtual int CG(double*,double*); virtual int CG(double*,double*);
virtual void sparse_matvec(sparse_matrix*,double*,double*); virtual void sparse_matvec(sparse_matrix*,double*,double*);
virtual void calculate_Q(); virtual void calculate_Q();
/* virtual double parallel_norm( double*, int ); */ /* virtual double parallel_norm( double*, int ); */
/* virtual double parallel_dot( double*, double*, int ); */ /* virtual double parallel_dot( double*, double*, int ); */
/* virtual double parallel_vector_acc( double*, int ); */ /* virtual double parallel_vector_acc( double*, int ); */
@ -72,7 +72,7 @@ class FixQEqReaxOMP : public FixQEqReax {
virtual void vector_sum(double*,double,double*,double,double*,int); virtual void vector_sum(double*,double,double*,double,double*,int);
virtual void vector_add(double*, double, double*,int); virtual void vector_add(double*, double, double*,int);
// dual CG support // dual CG support
virtual int dual_CG(double*,double*,double*,double*); virtual int dual_CG(double*,double*,double*,double*);
virtual void dual_sparse_matvec(sparse_matrix*,double*,double*,double*); virtual void dual_sparse_matvec(sparse_matrix*,double*,double*,double*);
virtual void dual_sparse_matvec(sparse_matrix*,double*,double*); virtual void dual_sparse_matvec(sparse_matrix*,double*,double*);

View File

@ -5,7 +5,7 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under certain rights in this software. This software is distributed under
the GNU General Public License. the GNU General Public License.
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.

View File

@ -5,7 +5,7 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under certain rights in this software. This software is distributed under
the GNU General Public License. the GNU General Public License.
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
@ -26,17 +26,17 @@ FixStyle(reax/c/species/omp,FixReaxCSpeciesOMP)
#define BUFLEN 1000 #define BUFLEN 1000
namespace LAMMPS_NS { namespace LAMMPS_NS {
class FixReaxCSpeciesOMP : public FixReaxCSpecies { class FixReaxCSpeciesOMP : public FixReaxCSpecies {
public: public:
FixReaxCSpeciesOMP(class LAMMPS *, int, char **); FixReaxCSpeciesOMP(class LAMMPS *, int, char **);
~FixReaxCSpeciesOMP(){}; ~FixReaxCSpeciesOMP(){};
virtual void init(); virtual void init();
private: private:
class PairReaxCOMP *reaxc; class PairReaxCOMP *reaxc;
}; };
} }

View File

@ -89,7 +89,7 @@ PairReaxCOMP::~PairReaxCOMP()
int myrank; int myrank;
MPI_Comm_rank(mpi_data->world,&myrank); MPI_Comm_rank(mpi_data->world,&myrank);
// Write screen output // Write screen output
if (myrank == 0 && screen) { if (myrank == 0 && screen) {
fprintf(screen,"\n\nWrite_Lists took %11.3lf seconds", ompTimingData[COMPUTEWLINDEX]); fprintf(screen,"\n\nWrite_Lists took %11.3lf seconds", ompTimingData[COMPUTEWLINDEX]);
@ -98,11 +98,11 @@ PairReaxCOMP::~PairReaxCOMP()
fprintf(screen,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]); fprintf(screen,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]);
fprintf(screen,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]); fprintf(screen,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]);
fprintf(screen,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]); fprintf(screen,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]);
fprintf(screen,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]); fprintf(screen,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]);
fprintf(screen,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]); fprintf(screen,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]);
fprintf(screen,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]); fprintf(screen,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]);
fprintf(screen,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]); fprintf(screen,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]);
fprintf(screen,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]); fprintf(screen,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]);
fprintf(screen,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]); fprintf(screen,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]);
fprintf(screen,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]); fprintf(screen,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]);
@ -124,11 +124,11 @@ PairReaxCOMP::~PairReaxCOMP()
fprintf(logfile,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]); fprintf(logfile,"\n ->Initial Forces: %11.3lf seconds", ompTimingData[COMPUTEIFINDEX]);
fprintf(logfile,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]); fprintf(logfile,"\n ->Bond Order: %11.3lf seconds", ompTimingData[COMPUTEBOINDEX]);
fprintf(logfile,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]); fprintf(logfile,"\n ->Atom Energy: %11.3lf seconds", ompTimingData[COMPUTEATOMENERGYINDEX]);
fprintf(logfile,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]); fprintf(logfile,"\n ->Bond: %11.3lf seconds", ompTimingData[COMPUTEBONDSINDEX]);
fprintf(logfile,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]); fprintf(logfile,"\n ->Hydrogen bonds: %11.3lf seconds", ompTimingData[COMPUTEHBONDSINDEX]);
fprintf(logfile,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]); fprintf(logfile,"\n ->Torsion Angles: %11.3lf seconds", ompTimingData[COMPUTETORSIONANGLESBOINDEX]);
fprintf(logfile,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]); fprintf(logfile,"\n ->Valence Angles: %11.3lf seconds", ompTimingData[COMPUTEVALENCEANGLESBOINDEX]);
fprintf(logfile,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]); fprintf(logfile,"\n ->Non-Bonded For: %11.3lf seconds", ompTimingData[COMPUTENBFINDEX]);
fprintf(logfile,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]); fprintf(logfile,"\n ->Total Forces: %11.3lf seconds", ompTimingData[COMPUTETFINDEX]);
fprintf(logfile,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]); fprintf(logfile,"\n\nfixQEQ: %11.3lf seconds", ompTimingData[COMPUTEQEQINDEX]);
@ -150,41 +150,41 @@ void PairReaxCOMP::compute(int eflag, int vflag)
{ {
double evdwl,ecoul; double evdwl,ecoul;
double t_start, t_end; double t_start, t_end;
// communicate num_bonds once every reneighboring // communicate num_bonds once every reneighboring
// 2 num arrays stored by fix, grab ptr to them // 2 num arrays stored by fix, grab ptr to them
if (neighbor->ago == 0) comm->forward_comm_fix(fix_reax); if (neighbor->ago == 0) comm->forward_comm_fix(fix_reax);
int *num_bonds = fix_reax->num_bonds; int *num_bonds = fix_reax->num_bonds;
int *num_hbonds = fix_reax->num_hbonds; int *num_hbonds = fix_reax->num_hbonds;
evdwl = ecoul = 0.0; evdwl = ecoul = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); if (eflag || vflag) ev_setup(eflag,vflag);
else ev_unset(); else ev_unset();
if (vflag_global) control->virial = 1; if (vflag_global) control->virial = 1;
else control->virial = 0; else control->virial = 0;
system->n = atom->nlocal; // my atoms system->n = atom->nlocal; // my atoms
system->N = atom->nlocal + atom->nghost; // mine + ghosts system->N = atom->nlocal + atom->nghost; // mine + ghosts
system->bigN = static_cast<int> (atom->natoms); // all atoms in the system system->bigN = static_cast<int> (atom->natoms); // all atoms in the system
system->big_box.V = 0; system->big_box.V = 0;
system->big_box.box_norms[0] = 0; system->big_box.box_norms[0] = 0;
system->big_box.box_norms[1] = 0; system->big_box.box_norms[1] = 0;
system->big_box.box_norms[2] = 0; system->big_box.box_norms[2] = 0;
if( comm->me == 0 ) t_start = MPI_Wtime(); if( comm->me == 0 ) t_start = MPI_Wtime();
// setup data structures // setup data structures
setup(); setup();
Reset( system, control, data, workspace, &lists, world ); Reset( system, control, data, workspace, &lists, world );
// Why not update workspace like in MPI-only code? // Why not update workspace like in MPI-only code?
// Using the MPI-only way messes up the hb energy // Using the MPI-only way messes up the hb energy
//workspace->realloc.num_far = write_reax_lists(); //workspace->realloc.num_far = write_reax_lists();
write_reax_lists(); write_reax_lists();
// timing for filling in the reax lists // timing for filling in the reax lists
if( comm->me == 0 ) { if( comm->me == 0 ) {
t_end = MPI_Wtime(); t_end = MPI_Wtime();
@ -192,7 +192,7 @@ void PairReaxCOMP::compute(int eflag, int vflag)
} }
// forces // forces
#ifdef OMP_TIMING #ifdef OMP_TIMING
double startTimeBase,endTimeBase; double startTimeBase,endTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
@ -200,20 +200,20 @@ void PairReaxCOMP::compute(int eflag, int vflag)
Compute_ForcesOMP(system,control,data,workspace,&lists,out_control,mpi_data); Compute_ForcesOMP(system,control,data,workspace,&lists,out_control,mpi_data);
read_reax_forces(vflag); read_reax_forces(vflag);
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTEINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTEINDEX] += (endTimeBase-startTimeBase);
#endif #endif
#pragma omp parallel for schedule(static) #pragma omp parallel for schedule(static)
for(int k = 0; k < system->N; ++k) { for(int k = 0; k < system->N; ++k) {
num_bonds[k] = system->my_atoms[k].num_bonds; num_bonds[k] = system->my_atoms[k].num_bonds;
num_hbonds[k] = system->my_atoms[k].num_hbonds; num_hbonds[k] = system->my_atoms[k].num_hbonds;
} }
// energies and pressure // energies and pressure
if (eflag_global) { if (eflag_global) {
evdwl += data->my_en.e_bond; evdwl += data->my_en.e_bond;
evdwl += data->my_en.e_ov; evdwl += data->my_en.e_ov;
@ -226,13 +226,13 @@ void PairReaxCOMP::compute(int eflag, int vflag)
evdwl += data->my_en.e_tor; evdwl += data->my_en.e_tor;
evdwl += data->my_en.e_con; evdwl += data->my_en.e_con;
evdwl += data->my_en.e_vdW; evdwl += data->my_en.e_vdW;
ecoul += data->my_en.e_ele; ecoul += data->my_en.e_ele;
ecoul += data->my_en.e_pol; ecoul += data->my_en.e_pol;
// Store the different parts of the energy // Store the different parts of the energy
// in a list for output by compute pair command // in a list for output by compute pair command
pvector[0] = data->my_en.e_bond; pvector[0] = data->my_en.e_bond;
pvector[1] = data->my_en.e_ov + data->my_en.e_un; pvector[1] = data->my_en.e_ov + data->my_en.e_un;
pvector[2] = data->my_en.e_lp; pvector[2] = data->my_en.e_lp;
@ -250,16 +250,16 @@ void PairReaxCOMP::compute(int eflag, int vflag)
} }
if (vflag_fdotr) virial_fdotr_compute(); if (vflag_fdotr) virial_fdotr_compute();
// Set internal timestep counter to that of LAMMPS // Set internal timestep counter to that of LAMMPS
data->step = update->ntimestep; data->step = update->ntimestep;
Output_Results( system, control, data, &lists, out_control, mpi_data ); Output_Results( system, control, data, &lists, out_control, mpi_data );
// populate tmpid and tmpbo arrays for fix reax/c/species // populate tmpid and tmpbo arrays for fix reax/c/species
int i, j; int i, j;
if(fixspecies_flag) { if(fixspecies_flag) {
if (system->N > nmax) { if (system->N > nmax) {
memory->destroy(tmpid); memory->destroy(tmpid);
@ -268,14 +268,14 @@ void PairReaxCOMP::compute(int eflag, int vflag)
memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid"); memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid");
memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo"); memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo");
} }
#pragma omp parallel for collapse(2) schedule(static) default(shared) #pragma omp parallel for collapse(2) schedule(static) default(shared)
for (i = 0; i < system->N; i ++) for (i = 0; i < system->N; i ++)
for (j = 0; j < MAXSPECBOND; j ++) { for (j = 0; j < MAXSPECBOND; j ++) {
tmpbo[i][j] = 0.0; tmpbo[i][j] = 0.0;
tmpid[i][j] = 0; tmpid[i][j] = 0;
} }
FindBond(); FindBond();
} }
} }
@ -284,7 +284,7 @@ void PairReaxCOMP::compute(int eflag, int vflag)
void PairReaxCOMP::init_style( ) void PairReaxCOMP::init_style( )
{ {
if (!atom->q_flag) if (!atom->q_flag)
error->all(FLERR,"Pair reax/c/omp requires atom attribute q"); error->all(FLERR,"Pair reax/c/omp requires atom attribute q");
// firstwarn = 1; // firstwarn = 1;
@ -330,7 +330,7 @@ void PairReaxCOMP::init_style( )
fix_reax = (FixReaxC *) modify->fix[modify->nfix-1]; fix_reax = (FixReaxC *) modify->fix[modify->nfix-1];
} }
#pragma omp parallel #pragma omp parallel
{ control->nthreads = omp_get_num_threads(); } { control->nthreads = omp_get_num_threads(); }
} }
@ -397,11 +397,11 @@ void PairReaxCOMP::setup( )
for(int k = oldN; k < system->N; ++k) for(int k = oldN; k < system->N; ++k)
Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS ); Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS );
// estimate far neighbor list size // estimate far neighbor list size
// Not present in MPI-only version // Not present in MPI-only version
workspace->realloc.num_far = estimate_reax_lists(); workspace->realloc.num_far = estimate_reax_lists();
// check if I need to shrink/extend my data-structs // check if I need to shrink/extend my data-structs
ReAllocate( system, control, data, workspace, &lists, mpi_data ); ReAllocate( system, control, data, workspace, &lists, mpi_data );
@ -414,10 +414,10 @@ void PairReaxCOMP::write_reax_atoms()
{ {
int *num_bonds = fix_reax->num_bonds; int *num_bonds = fix_reax->num_bonds;
int *num_hbonds = fix_reax->num_hbonds; int *num_hbonds = fix_reax->num_hbonds;
if (system->N > system->total_cap) if (system->N > system->total_cap)
error->all(FLERR,"Too many ghost atoms"); error->all(FLERR,"Too many ghost atoms");
#pragma omp parallel for schedule(static) default(shared) #pragma omp parallel for schedule(static) default(shared)
for( int i = 0; i < system->N; ++i ){ for( int i = 0; i < system->N; ++i ){
system->my_atoms[i].orig_id = atom->tag[i]; system->my_atoms[i].orig_id = atom->tag[i];
@ -435,28 +435,28 @@ void PairReaxCOMP::write_reax_atoms()
int PairReaxCOMP::estimate_reax_lists() int PairReaxCOMP::estimate_reax_lists()
{ {
int i; int i;
int *ilist = list->ilist; int *ilist = list->ilist;
int *numneigh = list->numneigh; int *numneigh = list->numneigh;
int numall = list->inum + list->gnum; int numall = list->inum + list->gnum;
int mincap = system->mincap; int mincap = system->mincap;
// for good performance in the OpenMP implementation, each thread needs // for good performance in the OpenMP implementation, each thread needs
// to know where to place the neighbors of the atoms it is responsible for. // to know where to place the neighbors of the atoms it is responsible for.
// The sumscan values for the list->numneigh will be used to determine the // The sumscan values for the list->numneigh will be used to determine the
// neighbor offset of each atom. Note that this may cause some significant // neighbor offset of each atom. Note that this may cause some significant
// memory overhead if delayed neighboring is used - so it may be desirable // memory overhead if delayed neighboring is used - so it may be desirable
// to work on this part to reduce the memory footprint of the far_nbrs list. // to work on this part to reduce the memory footprint of the far_nbrs list.
int num_nbrs = 0; int num_nbrs = 0;
for (int itr_i = 0; itr_i < numall; ++itr_i) { for (int itr_i = 0; itr_i < numall; ++itr_i) {
i = ilist[itr_i]; i = ilist[itr_i];
num_nbrs += numneigh[i]; num_nbrs += numneigh[i];
} }
int new_estimate = MAX (num_nbrs, mincap*MIN_NBRS); int new_estimate = MAX (num_nbrs, mincap*MIN_NBRS);
return new_estimate; return new_estimate;
} }
@ -473,51 +473,51 @@ int PairReaxCOMP::write_reax_lists()
int *jlist; int *jlist;
double d_sqr, dist, cutoff_sqr; double d_sqr, dist, cutoff_sqr;
rvec dvec; rvec dvec;
double **x = atom->x; double **x = atom->x;
int *ilist = list->ilist; int *ilist = list->ilist;
int *numneigh = list->numneigh; int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh; int **firstneigh = list->firstneigh;
reax_list *far_nbrs = lists + FAR_NBRS; reax_list *far_nbrs = lists + FAR_NBRS;
far_neighbor_data *far_list = far_nbrs->select.far_nbr_list; far_neighbor_data *far_list = far_nbrs->select.far_nbr_list;
int num_nbrs = 0; int num_nbrs = 0;
int inum = list->inum; int inum = list->inum;
int gnum = list->gnum; int gnum = list->gnum;
int numall = inum + gnum; int numall = inum + gnum;
// sumscan of the number of neighbors per atom to determine the offsets // sumscan of the number of neighbors per atom to determine the offsets
// most likely, we are overallocating. desirable to work on this part // most likely, we are overallocating. desirable to work on this part
// to reduce the memory footprint of the far_nbrs list. // to reduce the memory footprint of the far_nbrs list.
num_nbrs = 0; num_nbrs = 0;
for (itr_i = 0; itr_i < numall; ++itr_i) { for (itr_i = 0; itr_i < numall; ++itr_i) {
i = ilist[itr_i]; i = ilist[itr_i];
num_nbrs_offset[i] = num_nbrs; num_nbrs_offset[i] = num_nbrs;
num_nbrs += numneigh[i]; num_nbrs += numneigh[i];
} }
//#pragma omp parallel for schedule(guided) default(shared) //#pragma omp parallel for schedule(guided) default(shared)
#pragma omp parallel for schedule(dynamic,50) default(shared) \ #pragma omp parallel for schedule(dynamic,50) default(shared) \
private(itr_i, itr_j, i, j, jlist, cutoff_sqr, num_mynbrs, d_sqr, dvec, dist) private(itr_i, itr_j, i, j, jlist, cutoff_sqr, num_mynbrs, d_sqr, dvec, dist)
for (itr_i = 0; itr_i < numall; ++itr_i) { for (itr_i = 0; itr_i < numall; ++itr_i) {
i = ilist[itr_i]; i = ilist[itr_i];
jlist = firstneigh[i]; jlist = firstneigh[i];
Set_Start_Index( i, num_nbrs_offset[i], far_nbrs ); Set_Start_Index( i, num_nbrs_offset[i], far_nbrs );
if (i < inum) if (i < inum)
cutoff_sqr = control->nonb_cut*control->nonb_cut; cutoff_sqr = control->nonb_cut*control->nonb_cut;
else else
cutoff_sqr = control->bond_cut*control->bond_cut; cutoff_sqr = control->bond_cut*control->bond_cut;
num_mynbrs = 0; num_mynbrs = 0;
for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) { for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) {
j = jlist[itr_j]; j = jlist[itr_j];
j &= NEIGHMASK; j &= NEIGHMASK;
get_distance( x[j], x[i], &d_sqr, &dvec ); get_distance( x[j], x[i], &d_sqr, &dvec );
if (d_sqr <= cutoff_sqr) { if (d_sqr <= cutoff_sqr) {
dist = sqrt( d_sqr ); dist = sqrt( d_sqr );
set_far_nbr( &far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec ); set_far_nbr( &far_list[num_nbrs_offset[i] + num_mynbrs], j, dist, dvec );
@ -531,7 +531,7 @@ int PairReaxCOMP::write_reax_lists()
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTEWLINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTEWLINDEX] += (endTimeBase-startTimeBase);
#endif #endif
return num_nbrs; return num_nbrs;
} }

View File

@ -47,40 +47,40 @@ class PairReaxCOMP : public PairReaxC, public ThrOMP {
return fix; return fix;
}; };
inline void ev_setup_thr_proxy(int eflagparm, int vflagparm, int nallparm, inline void ev_setup_thr_proxy(int eflagparm, int vflagparm, int nallparm,
double *eatomparm, double **vatomparm, ThrData *thrparm) { double *eatomparm, double **vatomparm, ThrData *thrparm) {
ev_setup_thr(eflagparm, vflagparm, nallparm, eatomparm, vatomparm, thrparm); ev_setup_thr(eflagparm, vflagparm, nallparm, eatomparm, vatomparm, thrparm);
}; };
// reduce per thread data as needed // reduce per thread data as needed
inline void reduce_thr_proxy(void * const styleparm, const int eflagparm, inline void reduce_thr_proxy(void * const styleparm, const int eflagparm,
const int vflagparm, ThrData * const thrparm) { const int vflagparm, ThrData * const thrparm) {
reduce_thr(styleparm, eflagparm, vflagparm, thrparm); reduce_thr(styleparm, eflagparm, vflagparm, thrparm);
} }
inline void ev_tally_thr_proxy(Pair * const pairparm, const int iparm, const int jparm, inline void ev_tally_thr_proxy(Pair * const pairparm, const int iparm, const int jparm,
const int nlocalparm, const int newton_pairparm, const int nlocalparm, const int newton_pairparm,
const double evdwlparm, const double ecoulparm, const double evdwlparm, const double ecoulparm,
const double fpairparm, const double delxparm, const double fpairparm, const double delxparm,
const double delyparm, const double delzparm, const double delyparm, const double delzparm,
ThrData * const thrparm) { ThrData * const thrparm) {
ev_tally_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm, ev_tally_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm,
evdwlparm, ecoulparm, fpairparm, delxparm, delyparm, delzparm, thrparm); evdwlparm, ecoulparm, fpairparm, delxparm, delyparm, delzparm, thrparm);
} }
inline void ev_tally_xyz_thr_proxy(Pair * const pairparm, const int iparm, const int jparm, inline void ev_tally_xyz_thr_proxy(Pair * const pairparm, const int iparm, const int jparm,
const int nlocalparm, const int newton_pairparm, const int nlocalparm, const int newton_pairparm,
const double evdwlparm, const double ecoulparm, const double evdwlparm, const double ecoulparm,
const double fxparm, const double fyparm, const double fzparm, const double fxparm, const double fyparm, const double fzparm,
const double delxparm, const double delyparm, const double delxparm, const double delyparm,
const double delzparm, ThrData * const thrparm) { const double delzparm, ThrData * const thrparm) {
ev_tally_xyz_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm, ev_tally_xyz_thr(pairparm, iparm, jparm, nlocalparm, newton_pairparm,
evdwlparm, ecoulparm, fxparm, fyparm, fzparm, evdwlparm, ecoulparm, fxparm, fyparm, fzparm,
delxparm, delyparm, delzparm, thrparm); delxparm, delyparm, delzparm, thrparm);
} }
inline void ev_tally3_thr_proxy(Pair * const pairparm,int i, int j, int k, inline void ev_tally3_thr_proxy(Pair * const pairparm,int i, int j, int k,
double evdwl, double ecoul, double *fj, double *fk, double evdwl, double ecoul, double *fj, double *fk,
double *drji, double *drki, ThrData * const thrparm) { double *drji, double *drki, ThrData * const thrparm) {
ev_tally3_thr(pairparm, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm); ev_tally3_thr(pairparm, i, j, k, evdwl, ecoul, fj, fk, drji, drki, thrparm);
} }

View File

@ -44,11 +44,11 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj,
int pk, k, j; int pk, k, j;
PairReaxCOMP *pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); PairReaxCOMP *pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
long reductionOffset = (system->N * tid); long reductionOffset = (system->N * tid);
/* Virial Tallying variables */ /* Virial Tallying variables */
double f_scaler; double f_scaler;
rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp;
@ -154,7 +154,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj,
for( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) { for( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) {
nbr_k = &(bonds->select.bond_list[pk]); nbr_k = &(bonds->select.bond_list[pk]);
k = nbr_k->nbr; k = nbr_k->nbr;
// rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp); // rvec_Scale( temp, -coef.C2dbo, nbr_k->bo_data.dBOp);
// rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp); // rvec_ScaledAdd( temp, -coef.C2dDelta, nbr_k->bo_data.dBOp);
// rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp); // rvec_ScaledAdd( temp, -coef.C3dbopi, nbr_k->bo_data.dBOp);
@ -179,12 +179,12 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj,
delkj[0],delkj[1],delkj[2],thr); delkj[0],delkj[1],delkj[2],thr);
} }
} }
// forces on k: j neighbor // forces on k: j neighbor
for( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) { for( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) {
nbr_k = &(bonds->select.bond_list[pk]); nbr_k = &(bonds->select.bond_list[pk]);
k = nbr_k->nbr; k = nbr_k->nbr;
// rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp ); // rvec_Scale( temp, -coef.C3dbo, nbr_k->bo_data.dBOp );
// rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp); // rvec_ScaledAdd( temp, -coef.C3dDelta, nbr_k->bo_data.dBOp);
// rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp); // rvec_ScaledAdd( temp, -coef.C4dbopi, nbr_k->bo_data.dBOp);
@ -202,7 +202,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj,
pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0, pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,i,system->N,0,0,0,
fk_tmp[0],fk_tmp[1],fk_tmp[2], fk_tmp[0],fk_tmp[1],fk_tmp[2],
delki[0],delki[1],delki[2],thr); delki[0],delki[1],delki[2],thr);
rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x); rvec_ScaledSum(delkj,1.,system->my_atoms[k].x,-1.,system->my_atoms[j].x);
pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0, pair_reax_ptr->ev_tally_xyz_thr_proxy(system->pair_ptr,k,j,system->N,0,0,0,
@ -357,7 +357,7 @@ int BOp_OMP( storage *workspace, reax_list *bonds, double bo_cut,
/****** bonds i-j and j-i ******/ /****** bonds i-j and j-i ******/
ibond = &( bonds->select.bond_list[btop_i] ); ibond = &( bonds->select.bond_list[btop_i] );
jbond = &( bonds->select.bond_list[btop_j] ); jbond = &( bonds->select.bond_list[btop_j] );
ibond->nbr = j; ibond->nbr = j;
jbond->nbr = i; jbond->nbr = i;
ibond->d = nbr_pj->d; ibond->d = nbr_pj->d;
@ -370,19 +370,19 @@ int BOp_OMP( storage *workspace, reax_list *bonds, double bo_cut,
jbond->dbond_index = btop_i; jbond->dbond_index = btop_i;
ibond->sym_index = btop_j; ibond->sym_index = btop_j;
jbond->sym_index = btop_i; jbond->sym_index = btop_i;
bo_ij = &( ibond->bo_data ); bo_ij = &( ibond->bo_data );
bo_ji = &( jbond->bo_data ); bo_ji = &( jbond->bo_data );
bo_ji->BO = bo_ij->BO = BO; bo_ji->BO = bo_ij->BO = BO;
bo_ji->BO_s = bo_ij->BO_s = BO_s; bo_ji->BO_s = bo_ij->BO_s = BO_s;
bo_ji->BO_pi = bo_ij->BO_pi = BO_pi; bo_ji->BO_pi = bo_ij->BO_pi = BO_pi;
bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2; bo_ji->BO_pi2 = bo_ij->BO_pi2 = BO_pi2;
/* Bond Order page2-3, derivative of total bond order prime */ /* Bond Order page2-3, derivative of total bond order prime */
Cln_BOp_s = twbp->p_bo2 * C12 * rr2; Cln_BOp_s = twbp->p_bo2 * C12 * rr2;
Cln_BOp_pi = twbp->p_bo4 * C34 * rr2; Cln_BOp_pi = twbp->p_bo4 * C34 * rr2;
Cln_BOp_pi2 = twbp->p_bo6 * C56 * rr2; Cln_BOp_pi2 = twbp->p_bo6 * C56 * rr2;
/* Only dln_BOp_xx wrt. dr_i is stored here, note that /* Only dln_BOp_xx wrt. dr_i is stored here, note that
dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */ dln_BOp_xx/dr_i = -dln_BOp_xx/dr_j and all others are 0 */
rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec); rvec_Scale(bo_ij->dln_BOp_s,-bo_ij->BO_s*Cln_BOp_s,ibond->dvec);
@ -392,34 +392,34 @@ int BOp_OMP( storage *workspace, reax_list *bonds, double bo_cut,
rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s); rvec_Scale(bo_ji->dln_BOp_s, -1., bo_ij->dln_BOp_s);
rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi ); rvec_Scale(bo_ji->dln_BOp_pi, -1., bo_ij->dln_BOp_pi );
rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 ); rvec_Scale(bo_ji->dln_BOp_pi2, -1., bo_ij->dln_BOp_pi2 );
rvec_Scale( bo_ij->dBOp, rvec_Scale( bo_ij->dBOp,
-(bo_ij->BO_s * Cln_BOp_s + -(bo_ij->BO_s * Cln_BOp_s +
bo_ij->BO_pi * Cln_BOp_pi + bo_ij->BO_pi * Cln_BOp_pi +
bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec ); bo_ij->BO_pi2 * Cln_BOp_pi2), ibond->dvec );
rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp ); rvec_Scale( bo_ji->dBOp, -1., bo_ij->dBOp );
bo_ij->BO_s -= bo_cut; bo_ij->BO_s -= bo_cut;
bo_ij->BO -= bo_cut; bo_ij->BO -= bo_cut;
bo_ji->BO_s -= bo_cut; bo_ji->BO_s -= bo_cut;
bo_ji->BO -= bo_cut; bo_ji->BO -= bo_cut;
bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0; bo_ij->Cdbo = bo_ij->Cdbopi = bo_ij->Cdbopi2 = 0.0;
bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0; bo_ji->Cdbo = bo_ji->Cdbopi = bo_ji->Cdbopi2 = 0.0;
return 1; return 1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void BOOMP( reax_system *system, control_params *control, simulation_data *data, void BOOMP( reax_system *system, control_params *control, simulation_data *data,
storage *workspace, reax_list **lists, output_controls *out_control ) storage *workspace, reax_list **lists, output_controls *out_control )
{ {
#ifdef OMP_TIMING #ifdef OMP_TIMING
double endTimeBase, startTimeBase; double endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
double p_lp1 = system->reax_param.gp.l[15]; double p_lp1 = system->reax_param.gp.l[15];
int num_bonds = 0; int num_bonds = 0;
double p_boc1 = system->reax_param.gp.l[0]; double p_boc1 = system->reax_param.gp.l[0];
@ -427,7 +427,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
reax_list *bonds = (*lists) + BONDS; reax_list *bonds = (*lists) + BONDS;
int natoms = system->N; int natoms = system->N;
int nthreads = control->nthreads; int nthreads = control->nthreads;
#pragma omp parallel default(shared) #pragma omp parallel default(shared)
{ {
int i, j, pj, type_i, type_j; int i, j, pj, type_i, type_j;
@ -442,9 +442,9 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
single_body_parameters *sbp_i, *sbp_j; single_body_parameters *sbp_i, *sbp_j;
two_body_parameters *twbp; two_body_parameters *twbp;
bond_order_data *bo_ij, *bo_ji; bond_order_data *bo_ij, *bo_ji;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
/* Calculate Deltaprime, Deltaprime_boc values */ /* Calculate Deltaprime, Deltaprime_boc values */
#pragma omp for schedule(static) #pragma omp for schedule(static)
for (i = 0; i < system->N; ++i) { for (i = 0; i < system->N; ++i) {
@ -460,7 +460,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
// Wait till initialization complete // Wait till initialization complete
#pragma omp barrier #pragma omp barrier
/* Corrected Bond Order calculations */ /* Corrected Bond Order calculations */
//#pragma omp for schedule(dynamic,50) //#pragma omp for schedule(dynamic,50)
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
@ -473,7 +473,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
Deltap_boc_i = workspace->Deltap_boc[i]; Deltap_boc_i = workspace->Deltap_boc[i];
start_i = Start_Index(i, bonds); start_i = Start_Index(i, bonds);
end_i = End_Index(i, bonds); end_i = End_Index(i, bonds);
for (pj = start_i; pj < end_i; ++pj) { for (pj = start_i; pj < end_i; ++pj) {
j = bonds->select.bond_list[pj].nbr; j = bonds->select.bond_list[pj].nbr;
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
@ -487,23 +487,23 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
bo_ij->C1dbo = 1.000000; bo_ij->C1dbo = 1.000000;
bo_ij->C2dbo = 0.000000; bo_ij->C2dbo = 0.000000;
bo_ij->C3dbo = 0.000000; bo_ij->C3dbo = 0.000000;
bo_ij->C1dbopi = bo_ij->BO_pi; bo_ij->C1dbopi = bo_ij->BO_pi;
bo_ij->C2dbopi = 0.000000; bo_ij->C2dbopi = 0.000000;
bo_ij->C3dbopi = 0.000000; bo_ij->C3dbopi = 0.000000;
bo_ij->C4dbopi = 0.000000; bo_ij->C4dbopi = 0.000000;
bo_ij->C1dbopi2 = bo_ij->BO_pi2; bo_ij->C1dbopi2 = bo_ij->BO_pi2;
bo_ij->C2dbopi2 = 0.000000; bo_ij->C2dbopi2 = 0.000000;
bo_ij->C3dbopi2 = 0.000000; bo_ij->C3dbopi2 = 0.000000;
bo_ij->C4dbopi2 = 0.000000; bo_ij->C4dbopi2 = 0.000000;
} }
else { else {
val_j = system->reax_param.sbp[type_j].valency; val_j = system->reax_param.sbp[type_j].valency;
Deltap_j = workspace->Deltap[j]; Deltap_j = workspace->Deltap[j];
Deltap_boc_j = workspace->Deltap_boc[j]; Deltap_boc_j = workspace->Deltap_boc[j];
/* on page 1 */ /* on page 1 */
if( twbp->ovc >= 0.001 ) { if( twbp->ovc >= 0.001 ) {
/* Correction for overcoordination */ /* Correction for overcoordination */
@ -511,12 +511,12 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
exp_p2i = exp( -p_boc2 * Deltap_i ); exp_p2i = exp( -p_boc2 * Deltap_i );
exp_p1j = exp( -p_boc1 * Deltap_j ); exp_p1j = exp( -p_boc1 * Deltap_j );
exp_p2j = exp( -p_boc2 * Deltap_j ); exp_p2j = exp( -p_boc2 * Deltap_j );
f2 = exp_p1i + exp_p1j; f2 = exp_p1i + exp_p1j;
f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) ); f3 = -1.0 / p_boc2 * log( 0.5 * ( exp_p2i + exp_p2j ) );
f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) + f1 = 0.5 * ( ( val_i + f2 )/( val_i + f2 + f3 ) +
( val_j + f2 )/( val_j + f2 + f3 ) ); ( val_j + f2 )/( val_j + f2 + f3 ) );
/* Now come the derivates */ /* Now come the derivates */
/* Bond Order pages 5-7, derivative of f1 */ /* Bond Order pages 5-7, derivative of f1 */
temp = f2 + f3; temp = f2 + f3;
@ -526,7 +526,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
1.0 / SQR( u1_ji )); 1.0 / SQR( u1_ji ));
Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) + Cf1B_ij = -0.5 * (( u1_ij - f3 ) / SQR( u1_ij ) +
( u1_ji - f3 ) / SQR( u1_ji )); ( u1_ji - f3 ) / SQR( u1_ji ));
Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij - Cf1_ij = 0.50 * ( -p_boc1 * exp_p1i / u1_ij -
((val_i+f2) / SQR(u1_ij)) * ((val_i+f2) / SQR(u1_ij)) *
( -p_boc1 * exp_p1i + ( -p_boc1 * exp_p1i +
@ -535,8 +535,8 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
((val_j+f2) / SQR(u1_ji)) * ((val_j+f2) / SQR(u1_ji)) *
( -p_boc1 * exp_p1i + ( -p_boc1 * exp_p1i +
exp_p2i / ( exp_p2i + exp_p2j ) )); exp_p2i / ( exp_p2i + exp_p2j ) ));
Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j + Cf1_ji = -Cf1A_ij * p_boc1 * exp_p1j +
Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j ); Cf1B_ij * exp_p2j / ( exp_p2i + exp_p2j );
} }
@ -552,11 +552,11 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5); Deltap_boc_i) * twbp->p_boc3 + twbp->p_boc5);
exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) - exp_f5 =exp(-(twbp->p_boc4 * SQR( bo_ij->BO ) -
Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5); Deltap_boc_j) * twbp->p_boc3 + twbp->p_boc5);
f4 = 1. / (1. + exp_f4); f4 = 1. / (1. + exp_f4);
f5 = 1. / (1. + exp_f5); f5 = 1. / (1. + exp_f5);
f4f5 = f4 * f5; f4f5 = f4 * f5;
/* Bond Order pages 8-9, derivative of f4 and f5 */ /* Bond Order pages 8-9, derivative of f4 and f5 */
Cf45_ij = -f4 * exp_f4; Cf45_ij = -f4 * exp_f4;
Cf45_ji = -f5 * exp_f5; Cf45_ji = -f5 * exp_f5;
@ -565,7 +565,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
f4 = f5 = f4f5 = 1.0; f4 = f5 = f4f5 = 1.0;
Cf45_ij = Cf45_ji = 0.0; Cf45_ij = Cf45_ji = 0.0;
} }
/* Bond Order page 10, derivative of total bond order */ /* Bond Order page 10, derivative of total bond order */
A0_ij = f1 * f4f5; A0_ij = f1 * f4f5;
A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO * A1_ij = -2 * twbp->p_boc3 * twbp->p_boc4 * bo_ij->BO *
@ -574,28 +574,28 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji; A2_ji = Cf1_ji / f1 + twbp->p_boc3 * Cf45_ji;
A3_ij = A2_ij + Cf1_ij / f1; A3_ij = A2_ij + Cf1_ij / f1;
A3_ji = A2_ji + Cf1_ji / f1; A3_ji = A2_ji + Cf1_ji / f1;
/* find corrected bond orders and their derivative coef */ /* find corrected bond orders and their derivative coef */
bo_ij->BO = bo_ij->BO * A0_ij; bo_ij->BO = bo_ij->BO * A0_ij;
bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1; bo_ij->BO_pi = bo_ij->BO_pi * A0_ij *f1;
bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1; bo_ij->BO_pi2= bo_ij->BO_pi2* A0_ij *f1;
bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 ); bo_ij->BO_s = bo_ij->BO - ( bo_ij->BO_pi + bo_ij->BO_pi2 );
bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij; bo_ij->C1dbo = A0_ij + bo_ij->BO * A1_ij;
bo_ij->C2dbo = bo_ij->BO * A2_ij; bo_ij->C2dbo = bo_ij->BO * A2_ij;
bo_ij->C3dbo = bo_ij->BO * A2_ji; bo_ij->C3dbo = bo_ij->BO * A2_ji;
bo_ij->C1dbopi = f1*f1*f4*f5; bo_ij->C1dbopi = f1*f1*f4*f5;
bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij; bo_ij->C2dbopi = bo_ij->BO_pi * A1_ij;
bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij; bo_ij->C3dbopi = bo_ij->BO_pi * A3_ij;
bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji; bo_ij->C4dbopi = bo_ij->BO_pi * A3_ji;
bo_ij->C1dbopi2 = f1*f1*f4*f5; bo_ij->C1dbopi2 = f1*f1*f4*f5;
bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij; bo_ij->C2dbopi2 = bo_ij->BO_pi2 * A1_ij;
bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij; bo_ij->C3dbopi2 = bo_ij->BO_pi2 * A3_ij;
bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji; bo_ij->C4dbopi2 = bo_ij->BO_pi2 * A3_ji;
} }
/* neglect bonds that are < 1e-10 */ /* neglect bonds that are < 1e-10 */
if( bo_ij->BO < 1e-10 ) if( bo_ij->BO < 1e-10 )
bo_ij->BO = 0.0; bo_ij->BO = 0.0;
@ -605,7 +605,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
bo_ij->BO_pi = 0.0; bo_ij->BO_pi = 0.0;
if( bo_ij->BO_pi2 < 1e-10 ) if( bo_ij->BO_pi2 < 1e-10 )
bo_ij->BO_pi2 = 0.0; bo_ij->BO_pi2 = 0.0;
workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO workspace->total_bond_order[i] += bo_ij->BO; //now keeps total_BO
} }
// else { // else {
@ -617,11 +617,11 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
// bo_ij->BO_s = bo_ji->BO_s; // bo_ij->BO_s = bo_ji->BO_s;
// bo_ij->BO_pi = bo_ji->BO_pi; // bo_ij->BO_pi = bo_ji->BO_pi;
// bo_ij->BO_pi2 = bo_ji->BO_pi2; // bo_ij->BO_pi2 = bo_ji->BO_pi2;
// workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO // workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO
// } // }
} }
} }
// Wait for bo_ij to be updated // Wait for bo_ij to be updated
@ -635,7 +635,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
if(type_i < 0) continue; if(type_i < 0) continue;
start_i = Start_Index(i, bonds); start_i = Start_Index(i, bonds);
end_i = End_Index(i, bonds); end_i = End_Index(i, bonds);
for (pj = start_i; pj < end_i; ++pj) { for (pj = start_i; pj < end_i; ++pj) {
j = bonds->select.bond_list[pj].nbr; j = bonds->select.bond_list[pj].nbr;
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
@ -647,25 +647,25 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
/* We only need to update bond orders from bo_ji /* We only need to update bond orders from bo_ji
everything else is set in uncorrected_bo calculations */ everything else is set in uncorrected_bo calculations */
sym_index = bonds->select.bond_list[pj].sym_index; sym_index = bonds->select.bond_list[pj].sym_index;
bo_ij = &( bonds->select.bond_list[pj].bo_data ); bo_ij = &( bonds->select.bond_list[pj].bo_data );
bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data); bo_ji = &(bonds->select.bond_list[ sym_index ].bo_data);
bo_ij->BO = bo_ji->BO; bo_ij->BO = bo_ji->BO;
bo_ij->BO_s = bo_ji->BO_s; bo_ij->BO_s = bo_ji->BO_s;
bo_ij->BO_pi = bo_ji->BO_pi; bo_ij->BO_pi = bo_ji->BO_pi;
bo_ij->BO_pi2 = bo_ji->BO_pi2; bo_ij->BO_pi2 = bo_ji->BO_pi2;
workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO workspace->total_bond_order[i] += bo_ij->BO;// now keeps total_BO
} }
} }
} }
/*-------------------------*/ /*-------------------------*/
// Need to wait for total_bond_order to be accumulated. // Need to wait for total_bond_order to be accumulated.
#pragma omp barrier #pragma omp barrier
/* Calculate some helper variables that are used at many places /* Calculate some helper variables that are used at many places
throughout force calculations */ throughout force calculations */
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
@ -673,14 +673,14 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
if(type_j < 0) continue; if(type_j < 0) continue;
sbp_j = &(system->reax_param.sbp[ type_j ]); sbp_j = &(system->reax_param.sbp[ type_j ]);
workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency;
workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e; workspace->Delta_e[j] = workspace->total_bond_order[j] - sbp_j->valency_e;
workspace->Delta_boc[j] = workspace->total_bond_order[j] - workspace->Delta_boc[j] = workspace->total_bond_order[j] -
sbp_j->valency_boc; sbp_j->valency_boc;
workspace->Delta_val[j] = workspace->total_bond_order[j] - workspace->Delta_val[j] = workspace->total_bond_order[j] -
sbp_j->valency_val; sbp_j->valency_val;
workspace->vlpex[j] = workspace->Delta_e[j] - workspace->vlpex[j] = workspace->Delta_e[j] -
2.0 * (int)(workspace->Delta_e[j]/2.0); 2.0 * (int)(workspace->Delta_e[j]/2.0);
explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j])); explp1 = exp(-p_lp1 * SQR(2.0 + workspace->vlpex[j]));
@ -688,7 +688,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j]; workspace->Delta_lp[j] = sbp_j->nlp_opt - workspace->nlp[j];
workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]); workspace->Clp[j] = 2.0 * p_lp1 * explp1 * (2.0 + workspace->vlpex[j]);
workspace->dDelta_lp[j] = workspace->Clp[j]; workspace->dDelta_lp[j] = workspace->Clp[j];
if( sbp_j->mass > 21.0 ) { if( sbp_j->mass > 21.0 ) {
workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency); workspace->nlp_temp[j] = 0.5 * (sbp_j->valency_e - sbp_j->valency);
workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j]; workspace->Delta_lp_temp[j] = sbp_j->nlp_opt - workspace->nlp_temp[j];
@ -700,7 +700,7 @@ void BOOMP( reax_system *system, control_params *control, simulation_data *data,
workspace->dDelta_lp_temp[j] = workspace->Clp[j]; workspace->dDelta_lp_temp[j] = workspace->Clp[j];
} }
} }
} // parallel region } // parallel region
#ifdef OMP_TIMING #ifdef OMP_TIMING

View File

@ -45,7 +45,7 @@ void BondsOMP( reax_system *system, control_params *control,
double endTimeBase, startTimeBase; double endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
int natoms = system->n; int natoms = system->n;
int nthreads = control->nthreads; int nthreads = control->nthreads;
reax_list *bonds = (*lists) + BONDS; reax_list *bonds = (*lists) + BONDS;
@ -57,7 +57,7 @@ void BondsOMP( reax_system *system, control_params *control,
double total_Ebond = 0.0; double total_Ebond = 0.0;
#pragma omp parallel default(shared) reduction(+: total_Ebond) #pragma omp parallel default(shared) reduction(+: total_Ebond)
{ {
int i, j, pj; int i, j, pj;
int start_i, end_i; int start_i, end_i;
int type_i, type_j; int type_i, type_j;
@ -70,31 +70,31 @@ void BondsOMP( reax_system *system, control_params *control,
bond_order_data *bo_ij; bond_order_data *bo_ij;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
long reductionOffset = (system->N * tid); long reductionOffset = (system->N * tid);
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, natoms, system->pair_ptr->vflag_either, natoms,
system->pair_ptr->eatom, system->pair_ptr->vatom, thr); system->pair_ptr->eatom, system->pair_ptr->vatom, thr);
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for (i = 0; i < natoms; ++i) { for (i = 0; i < natoms; ++i) {
start_i = Start_Index(i, bonds); start_i = Start_Index(i, bonds);
end_i = End_Index(i, bonds); end_i = End_Index(i, bonds);
for (pj = start_i; pj < end_i; ++pj) { for (pj = start_i; pj < end_i; ++pj) {
j = bonds->select.bond_list[pj].nbr; j = bonds->select.bond_list[pj].nbr;
if( system->my_atoms[i].orig_id > system->my_atoms[j].orig_id ) continue; if( system->my_atoms[i].orig_id > system->my_atoms[j].orig_id ) continue;
if( system->my_atoms[i].orig_id == system->my_atoms[j].orig_id ) { if( system->my_atoms[i].orig_id == system->my_atoms[j].orig_id ) {
if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue;
if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] &&
system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue;
if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] &&
system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && system->my_atoms[j].x[1] == system->my_atoms[i].x[1] &&
system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue;
} }
@ -105,29 +105,29 @@ void BondsOMP( reax_system *system, control_params *control,
sbp_j = &( system->reax_param.sbp[type_j] ); sbp_j = &( system->reax_param.sbp[type_j] );
twbp = &( system->reax_param.tbp[type_i][type_j] ); twbp = &( system->reax_param.tbp[type_i][type_j] );
bo_ij = &( bonds->select.bond_list[pj].bo_data ); bo_ij = &( bonds->select.bond_list[pj].bo_data );
/* calculate the constants */ /* calculate the constants */
pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 );
exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) );
CEbo = -twbp->De_s * exp_be12 * CEbo = -twbp->De_s * exp_be12 *
( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 );
/* calculate the Bond Energy */ /* calculate the Bond Energy */
total_Ebond += ebond = total_Ebond += ebond =
-twbp->De_s * bo_ij->BO_s * exp_be12 -twbp->De_s * bo_ij->BO_s * exp_be12
-twbp->De_p * bo_ij->BO_pi -twbp->De_p * bo_ij->BO_pi
-twbp->De_pp * bo_ij->BO_pi2; -twbp->De_pp * bo_ij->BO_pi2;
/* tally into per-atom energy */ /* tally into per-atom energy */
if (system->pair_ptr->evflag) if (system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1,
ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr); ebond, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
/* calculate derivatives of Bond Orders */ /* calculate derivatives of Bond Orders */
bo_ij->Cdbo += CEbo; bo_ij->Cdbo += CEbo;
bo_ij->Cdbopi -= (CEbo + twbp->De_p); bo_ij->Cdbopi -= (CEbo + twbp->De_p);
bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp);
/* Stabilisation terminal triple bond */ /* Stabilisation terminal triple bond */
if (bo_ij->BO >= 1.00) { if (bo_ij->BO >= 1.00) {
if (gp37 == 2 || if (gp37 == 2 ||
@ -138,22 +138,22 @@ void BondsOMP( reax_system *system, control_params *control,
exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO));
exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j]));
hulpov = 1.0 / (1.0 + 25.0 * exphuov); hulpov = 1.0 / (1.0 + 25.0 * exphuov);
estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); estriph = gp10 * exphu * hulpov * (exphua1 + exphub1);
total_Ebond += estriph; total_Ebond += estriph;
decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) *
( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) );
decobdboua = -gp10 * exphu * hulpov * decobdboua = -gp10 * exphu * hulpov *
(gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1));
decobdboub = -gp10 * exphu * hulpov * decobdboub = -gp10 * exphu * hulpov *
(gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1));
/* tally into per-atom energy */ /* tally into per-atom energy */
if (system->pair_ptr->evflag) if (system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, natoms, 1,
estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); estriph, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
bo_ij->Cdbo += decobdbo; bo_ij->Cdbo += decobdbo;
workspace->CdDelta[i] += decobdboua; workspace->CdDelta[i] += decobdboua;
workspace->CdDeltaReduction[reductionOffset+j] += decobdboub; workspace->CdDeltaReduction[reductionOffset+j] += decobdboub;
@ -163,12 +163,12 @@ void BondsOMP( reax_system *system, control_params *control,
} // for(i) } // for(i)
} // omp } // omp
data->my_en.e_bond += total_Ebond; data->my_en.e_bond += total_Ebond;
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTEBONDSINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTEBONDSINDEX] += (endTimeBase-startTimeBase);
#endif #endif
} }

View File

@ -77,7 +77,7 @@ void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control,
MPI_Comm comm ) MPI_Comm comm )
{ {
int i; int i;
#ifdef OMP_TIMING #ifdef OMP_TIMING
double startTimeBase, endTimeBase; double startTimeBase, endTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
@ -114,7 +114,7 @@ void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control,
else else
Tabulated_vdW_Coulomb_Energy_OMP( system, control, data, workspace, Tabulated_vdW_Coulomb_Energy_OMP( system, control, data, workspace,
lists, out_control ); lists, out_control );
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTENBFINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTENBFINDEX] += (endTimeBase-startTimeBase);
@ -129,48 +129,48 @@ void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control,
void Compute_Total_ForceOMP( reax_system *system, control_params *control, void Compute_Total_ForceOMP( reax_system *system, control_params *control,
simulation_data *data, storage *workspace, simulation_data *data, storage *workspace,
reax_list **lists, mpi_datatypes *mpi_data ) reax_list **lists, mpi_datatypes *mpi_data )
{ {
#ifdef OMP_TIMING #ifdef OMP_TIMING
double startTimeBase,endTimeBase; double startTimeBase,endTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
int natoms = system->N; int natoms = system->N;
int nthreads = control->nthreads; int nthreads = control->nthreads;
long totalReductionSize = system->N * nthreads; long totalReductionSize = system->N * nthreads;
reax_list *bonds = (*lists) + BONDS; reax_list *bonds = (*lists) + BONDS;
#pragma omp parallel default(shared) //default(none) #pragma omp parallel default(shared) //default(none)
{ {
int i, j, k, pj, pk, start_j, end_j; int i, j, k, pj, pk, start_j, end_j;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
bond_order_data *bo_jk; bond_order_data *bo_jk;
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom,
system->pair_ptr->vatom, thr); system->pair_ptr->vatom, thr);
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for (i = 0; i < system->N; ++i) { for (i = 0; i < system->N; ++i) {
for (j = 0; j < nthreads; ++j) for (j = 0; j < nthreads; ++j)
workspace->CdDelta[i] += workspace->CdDeltaReduction[system->N*j+i]; workspace->CdDelta[i] += workspace->CdDeltaReduction[system->N*j+i];
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (j = 0; j < system->N; ++j) { for (j = 0; j < system->N; ++j) {
start_j = Start_Index(j, bonds); start_j = Start_Index(j, bonds);
end_j = End_Index(j, bonds); end_j = End_Index(j, bonds);
for (pk = start_j; pk < end_j; ++pk) { for (pk = start_j; pk < end_j; ++pk) {
bo_jk = &( bonds->select.bond_list[pk].bo_data ); bo_jk = &( bonds->select.bond_list[pk].bo_data );
for (k = 0; k < nthreads; ++k) for (k = 0; k < nthreads; ++k)
bo_jk->Cdbo += bo_jk->CdboReduction[k]; bo_jk->Cdbo += bo_jk->CdboReduction[k];
} }
} }
// #pragma omp for schedule(guided) //(dynamic,50) // #pragma omp for schedule(guided) //(dynamic,50)
// for (i = 0; i < system->N; ++i) // for (i = 0; i < system->N; ++i)
// for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) // for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj)
@ -188,7 +188,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control,
const int startj = Start_Index(i, bonds); const int startj = Start_Index(i, bonds);
const int endj = End_Index(i, bonds); const int endj = End_Index(i, bonds);
for (pj = startj; pj < endj; ++pj) for (pj = startj; pj < endj; ++pj)
if (i < bonds->select.bond_list[pj].nbr) if (i < bonds->select.bond_list[pj].nbr)
Add_dBond_to_ForcesOMP( system, i, pj, workspace, lists ); Add_dBond_to_ForcesOMP( system, i, pj, workspace, lists );
} }
@ -199,7 +199,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control,
const int startj = Start_Index(i, bonds); const int startj = Start_Index(i, bonds);
const int endj = End_Index(i, bonds); const int endj = End_Index(i, bonds);
for (pj = startj; pj < endj; ++pj) for (pj = startj; pj < endj; ++pj)
if (i < bonds->select.bond_list[pj].nbr) if (i < bonds->select.bond_list[pj].nbr)
Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists ); Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists );
} }
@ -213,8 +213,8 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control,
rvec_Add( workspace->f[i], workspace->forceReduction[system->N*j+i] ); rvec_Add( workspace->f[i], workspace->forceReduction[system->N*j+i] );
} }
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for (i = 0; i < totalReductionSize; i++) { for (i = 0; i < totalReductionSize; i++) {
workspace->forceReduction[i][0] = 0; workspace->forceReduction[i][0] = 0;
workspace->forceReduction[i][1] = 0; workspace->forceReduction[i][1] = 0;
@ -222,7 +222,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control,
workspace->CdDeltaReduction[i] = 0; workspace->CdDeltaReduction[i] = 0;
} }
} // parallel region } // parallel region
if (control->virial) if (control->virial)
for (int i=0; i < nthreads; ++i) { for (int i=0; i < nthreads; ++i) {
rvec_Add(data->my_ext_press, workspace->my_ext_pressReduction[i]); rvec_Add(data->my_ext_press, workspace->my_ext_pressReduction[i]);
@ -249,7 +249,7 @@ void Validate_ListsOMP( reax_system *system, storage *workspace, reax_list **lis
#pragma omp parallel default(shared) private(i, comp, Hindex) #pragma omp parallel default(shared) private(i, comp, Hindex)
{ {
/* bond list */ /* bond list */
if( N > 0 ) { if( N > 0 ) {
bonds = *lists + BONDS; bonds = *lists + BONDS;
@ -269,8 +269,8 @@ void Validate_ListsOMP( reax_system *system, storage *workspace, reax_list **lis
} }
} }
} }
/* hbonds list */ /* hbonds list */
if( numH > 0 ) { if( numH > 0 ) {
hbonds = *lists + HBONDS; hbonds = *lists + HBONDS;
@ -294,7 +294,7 @@ void Validate_ListsOMP( reax_system *system, storage *workspace, reax_list **lis
} }
} }
} }
} // omp parallel } // omp parallel
} }
@ -307,7 +307,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
double startTimeBase, endTimeBase; double startTimeBase, endTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
int i, j, pi, pj; int i, j, pi, pj;
int start_i, end_i, start_j, end_j; int start_i, end_i, start_j, end_j;
int type_i, type_j; int type_i, type_j;
@ -338,7 +338,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
/* uncorrected bond orders */ /* uncorrected bond orders */
cutoff = control->bond_cut; cutoff = control->bond_cut;
#pragma omp parallel default(shared) \ #pragma omp parallel default(shared) \
private(i, atom_i, type_i, pi, start_i, end_i, sbp_i, btop_i, ibond, ihb, ihb_top, \ private(i, atom_i, type_i, pi, start_i, end_i, sbp_i, btop_i, ibond, ihb, ihb_top, \
j, atom_j, type_j, pj, start_j, end_j, sbp_j, nbr_pj, jbond, jhb, twbp) j, atom_j, type_j, pj, start_j, end_j, sbp_j, nbr_pj, jbond, jhb, twbp)
@ -376,7 +376,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
// btop_i++; // btop_i++;
// Set_End_Index(i, btop_i, bonds); // Set_End_Index(i, btop_i, bonds);
// } // }
// } // }
// Trying to minimize time spent in critical section by moving initial part of BOp() // Trying to minimize time spent in critical section by moving initial part of BOp()
@ -412,7 +412,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
if(BO >= bo_cut) { if(BO >= bo_cut) {
int btop_j; int btop_j;
// Update indices in critical section // Update indices in critical section
#pragma omp critical #pragma omp critical
{ {
@ -421,30 +421,30 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
Set_End_Index( j, btop_j+1, bonds ); Set_End_Index( j, btop_j+1, bonds );
Set_End_Index( i, btop_i+1, bonds ); Set_End_Index( i, btop_i+1, bonds );
} // omp critical } // omp critical
// Finish remaining BOp() work // Finish remaining BOp() work
BOp_OMP(workspace, bonds, bo_cut, BOp_OMP(workspace, bonds, bo_cut,
i , btop_i, nbr_pj, sbp_i, sbp_j, twbp, btop_j, i , btop_i, nbr_pj, sbp_i, sbp_j, twbp, btop_j,
C12, C34, C56, BO, BO_s, BO_pi, BO_pi2); C12, C34, C56, BO, BO_s, BO_pi, BO_pi2);
bond_data * ibond = &(bonds->select.bond_list[btop_i]); bond_data * ibond = &(bonds->select.bond_list[btop_i]);
bond_order_data * bo_ij = &(ibond->bo_data); bond_order_data * bo_ij = &(ibond->bo_data);
bond_data * jbond = &(bonds->select.bond_list[btop_j]); bond_data * jbond = &(bonds->select.bond_list[btop_j]);
bond_order_data * bo_ji = &(jbond->bo_data); bond_order_data * bo_ji = &(jbond->bo_data);
workspace->total_bond_order[i] += bo_ij->BO; workspace->total_bond_order[i] += bo_ij->BO;
tmp_bond_order[reductionOffset + j] += bo_ji->BO; tmp_bond_order[reductionOffset + j] += bo_ji->BO;
rvec_Add(workspace->dDeltap_self[i], bo_ij->dBOp); rvec_Add(workspace->dDeltap_self[i], bo_ij->dBOp);
rvec_Add(tmp_ddelta[reductionOffset + j], bo_ji->dBOp); rvec_Add(tmp_ddelta[reductionOffset + j], bo_ji->dBOp);
btop_i++; btop_i++;
num_bonds++; num_bonds++;
} // if(BO>=bo_cut) } // if(BO>=bo_cut)
} // if(cutoff) } // if(cutoff)
} // for(pj) } // for(pj)
} // for(i) } // for(i)
@ -452,7 +452,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
#pragma omp barrier #pragma omp barrier
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for(i=0; i<system->N; i++) for(i=0; i<system->N; i++)
for(int t=0; t<nthreads; t++) { for(int t=0; t<nthreads; t++) {
const int indx = t*system->N + i; const int indx = t*system->N + i;
workspace->dDeltap_self[i][0] += tmp_ddelta[indx][0]; workspace->dDeltap_self[i][0] += tmp_ddelta[indx][0];
@ -467,18 +467,18 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
// for (i = 0; i < system->N; ++i) { // for (i = 0; i < system->N; ++i) {
// start_i = Start_Index(i, bonds); // start_i = Start_Index(i, bonds);
// end_i = End_Index(i, bonds); // end_i = End_Index(i, bonds);
// for (pi = start_i; pi < end_i; ++pi) { // for (pi = start_i; pi < end_i; ++pi) {
// ibond = &(bonds->select.bond_list[pi]); // ibond = &(bonds->select.bond_list[pi]);
// j = ibond->nbr; // j = ibond->nbr;
// if (i < j) { // if (i < j) {
// start_j = Start_Index(j, bonds); // start_j = Start_Index(j, bonds);
// end_j = End_Index(j, bonds); // end_j = End_Index(j, bonds);
// for (pj = start_j; pj < end_j; ++pj) { // for (pj = start_j; pj < end_j; ++pj) {
// jbond = &(bonds->select.bond_list[pj]); // jbond = &(bonds->select.bond_list[pj]);
// if (jbond->nbr == i) { // if (jbond->nbr == i) {
// ibond->sym_index = pj; // ibond->sym_index = pj;
// jbond->sym_index = pi; // jbond->sym_index = pi;
@ -488,13 +488,13 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
// } // }
// } // }
// } // }
/* hydrogen bond list */ /* hydrogen bond list */
if (control->hbond_cut > 0) { if (control->hbond_cut > 0) {
cutoff = control->hbond_cut; cutoff = control->hbond_cut;
//#pragma omp for schedule(guided) reduction(+ : num_hbonds) //#pragma omp for schedule(guided) reduction(+ : num_hbonds)
#pragma omp for schedule(dynamic,50) reduction(+ : num_hbonds) #pragma omp for schedule(dynamic,50) reduction(+ : num_hbonds)
for (i = 0; i < system->n; ++i) { for (i = 0; i < system->n; ++i) {
atom_i = &(system->my_atoms[i]); atom_i = &(system->my_atoms[i]);
type_i = atom_i->type; type_i = atom_i->type;
@ -503,11 +503,11 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
#pragma omp critical #pragma omp critical
{ {
if (ihb == 1 || ihb == 2) { if (ihb == 1 || ihb == 2) {
start_i = Start_Index(i, far_nbrs); start_i = Start_Index(i, far_nbrs);
end_i = End_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs);
for (pj = start_i; pj < end_i; ++pj) { for (pj = start_i; pj < end_i; ++pj) {
nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); nbr_pj = &( far_nbrs->select.far_nbr_list[pj] );
j = nbr_pj->nbr; j = nbr_pj->nbr;
@ -520,12 +520,12 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
if (nbr_pj->d <= control->hbond_cut) { if (nbr_pj->d <= control->hbond_cut) {
int iflag = 0; int iflag = 0;
int jflag = 0; int jflag = 0;
if(ihb==1 && jhb==2) iflag = 1; if(ihb==1 && jhb==2) iflag = 1;
else if(j<system->n && ihb == 2 && jhb == 1) jflag = 1; else if(j<system->n && ihb == 2 && jhb == 1) jflag = 1;
if(iflag || jflag) { if(iflag || jflag) {
// This critical section enforces H-bonds to be added by threads one at a time. // This critical section enforces H-bonds to be added by threads one at a time.
// #pragma omp critical // #pragma omp critical
// { // {
@ -547,14 +547,14 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
hbonds->select.hbond_list[jhb_top].scl = -1; hbonds->select.hbond_list[jhb_top].scl = -1;
hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; hbonds->select.hbond_list[jhb_top].ptr = nbr_pj;
} }
num_hbonds++; num_hbonds++;
} // if(iflag || jflag) } // if(iflag || jflag)
} }
} }
} }
} // omp critical } // omp critical
} }
@ -592,8 +592,8 @@ void Compute_ForcesOMP( reax_system *system, control_params *control,
{ {
int qeq_flag; int qeq_flag;
MPI_Comm comm = mpi_data->world; MPI_Comm comm = mpi_data->world;
// Init Forces // Init Forces
#if defined(LOG_PERFORMANCE) #if defined(LOG_PERFORMANCE)
double t_start = 0; double t_start = 0;
if( system->my_rank == MASTER_NODE ) if( system->my_rank == MASTER_NODE )
@ -602,13 +602,13 @@ void Compute_ForcesOMP( reax_system *system, control_params *control,
Init_Forces_noQEq_OMP( system, control, data, workspace, Init_Forces_noQEq_OMP( system, control, data, workspace,
lists, out_control, comm ); lists, out_control, comm );
#if defined(LOG_PERFORMANCE) #if defined(LOG_PERFORMANCE)
//MPI_Barrier( comm ); //MPI_Barrier( comm );
if( system->my_rank == MASTER_NODE ) if( system->my_rank == MASTER_NODE )
Update_Timing_Info( &t_start, &(data->timing.init_forces) ); Update_Timing_Info( &t_start, &(data->timing.init_forces) );
#endif #endif
// Bonded Interactions // Bonded Interactions
Compute_Bonded_ForcesOMP( system, control, data, workspace, Compute_Bonded_ForcesOMP( system, control, data, workspace,
lists, out_control, mpi_data->world ); lists, out_control, mpi_data->world );
@ -617,19 +617,19 @@ void Compute_ForcesOMP( reax_system *system, control_params *control,
if( system->my_rank == MASTER_NODE ) if( system->my_rank == MASTER_NODE )
Update_Timing_Info( &t_start, &(data->timing.bonded) ); Update_Timing_Info( &t_start, &(data->timing.bonded) );
#endif #endif
// Nonbonded Interactions // Nonbonded Interactions
Compute_NonBonded_ForcesOMP( system, control, data, workspace, Compute_NonBonded_ForcesOMP( system, control, data, workspace,
lists, out_control, mpi_data->world ); lists, out_control, mpi_data->world );
#if defined(LOG_PERFORMANCE) #if defined(LOG_PERFORMANCE)
if( system->my_rank == MASTER_NODE ) if( system->my_rank == MASTER_NODE )
Update_Timing_Info( &t_start, &(data->timing.nonb) ); Update_Timing_Info( &t_start, &(data->timing.nonb) );
#endif #endif
// Total Force // Total Force
Compute_Total_ForceOMP( system, control, data, workspace, lists, mpi_data ); Compute_Total_ForceOMP( system, control, data, workspace, lists, mpi_data );
#if defined(LOG_PERFORMANCE) #if defined(LOG_PERFORMANCE)
if( system->my_rank == MASTER_NODE ) if( system->my_rank == MASTER_NODE )
Update_Timing_Info( &t_start, &(data->timing.bonded) ); Update_Timing_Info( &t_start, &(data->timing.bonded) );

View File

@ -46,10 +46,10 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
double endTimeBase, startTimeBase; double endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
const int nthreads = control->nthreads; const int nthreads = control->nthreads;
long totalReductionSize = system->N; long totalReductionSize = system->N;
#pragma omp parallel default(shared) //default(none) #pragma omp parallel default(shared) //default(none)
{ {
int i, j, k, pi, pk; int i, j, k, pi, pk;
@ -92,11 +92,11 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, system->pair_ptr->vflag_either,
natoms, system->pair_ptr->eatom, natoms, system->pair_ptr->eatom,
system->pair_ptr->vatom, thr); system->pair_ptr->vatom, thr);
/* loops below discover the Hydrogen bonds between i-j-k triplets. /* loops below discover the Hydrogen bonds between i-j-k triplets.
here j is H atom and there has to be some bond between i and j. here j is H atom and there has to be some bond between i and j.
Hydrogen bond is between j and k. Hydrogen bond is between j and k.
@ -113,7 +113,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds ); hb_start_j = Start_Index( system->my_atoms[j].Hindex, hbonds );
hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds );
if(type_j < 0) continue; if(type_j < 0) continue;
top = 0; top = 0;
for( pi = start_j; pi < end_j; ++pi ) { for( pi = start_j; pi < end_j; ++pi ) {
pbond_ij = &( bond_list[pi] ); pbond_ij = &( bond_list[pi] );
@ -230,8 +230,8 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
{ {
data->my_en.e_hb += e_hb_thr; data->my_en.e_hb += e_hb_thr;
} }
pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, thr); system->pair_ptr->vflag_either, thr);
} }

View File

@ -53,7 +53,7 @@ int Init_ListsOMP( reax_system *system, control_params *control,
int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop;
int *hb_top, *bond_top; int *hb_top, *bond_top;
MPI_Comm comm; MPI_Comm comm;
int TWICE = 2; int TWICE = 2;
int mincap = system->mincap; int mincap = system->mincap;
double safezone = system->safezone; double safezone = system->safezone;
@ -96,9 +96,9 @@ int Init_ListsOMP( reax_system *system, control_params *control,
int nthreads = control->nthreads; int nthreads = control->nthreads;
reax_list *bonds = (*lists)+BONDS; reax_list *bonds = (*lists)+BONDS;
for (i = 0; i < bonds->num_intrs; ++i) for (i = 0; i < bonds->num_intrs; ++i)
bonds->select.bond_list[i].bo_data.CdboReduction = bonds->select.bond_list[i].bo_data.CdboReduction =
(double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm); (double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm);
/* 3bodies list */ /* 3bodies list */

View File

@ -45,7 +45,7 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
double endTimeBase, startTimeBase; double endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
/* Initialize parameters */ /* Initialize parameters */
double p_lp1 = system->reax_param.gp.l[15]; double p_lp1 = system->reax_param.gp.l[15];
double p_lp3 = system->reax_param.gp.l[5]; double p_lp3 = system->reax_param.gp.l[5];
@ -58,11 +58,11 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
int natoms = system->n; int natoms = system->n;
int nthreads = control->nthreads; int nthreads = control->nthreads;
reax_list *bonds = (*lists) + BONDS; reax_list *bonds = (*lists) + BONDS;
double total_Elp = 0.0; double total_Elp = 0.0;
double total_Eun = 0.0; double total_Eun = 0.0;
double total_Eov = 0.0; double total_Eov = 0.0;
#pragma omp parallel default(shared) reduction(+:total_Elp, total_Eun, total_Eov) #pragma omp parallel default(shared) reduction(+:total_Elp, total_Eun, total_Eov)
{ {
int i, j, pj, type_i, type_j; int i, j, pj, type_i, type_j;
@ -77,29 +77,29 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
double eng_tmp, f_tmp; double eng_tmp, f_tmp;
double p_lp2, p_ovun2, p_ovun5; double p_lp2, p_ovun2, p_ovun5;
int numbonds; int numbonds;
single_body_parameters *sbp_i, *sbp_j; single_body_parameters *sbp_i, *sbp_j;
two_body_parameters *twbp; two_body_parameters *twbp;
bond_data *pbond; bond_data *pbond;
bond_order_data *bo_ij; bond_order_data *bo_ij;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
long reductionOffset = (system->N * tid); long reductionOffset = (system->N * tid);
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, natoms, system->pair_ptr->vflag_either, natoms,
system->pair_ptr->eatom, system->pair_ptr->vatom, thr); system->pair_ptr->eatom, system->pair_ptr->vatom, thr);
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for ( i = 0; i < system->n; ++i) { for ( i = 0; i < system->n; ++i) {
type_i = system->my_atoms[i].type; type_i = system->my_atoms[i].type;
if(type_i < 0) continue; if(type_i < 0) continue;
sbp_i = &(system->reax_param.sbp[ type_i ]); sbp_i = &(system->reax_param.sbp[ type_i ]);
/* lone-pair Energy */ /* lone-pair Energy */
p_lp2 = sbp_i->p_lp2; p_lp2 = sbp_i->p_lp2;
expvd2 = exp( -75 * workspace->Delta_lp[i] ); expvd2 = exp( -75 * workspace->Delta_lp[i] );
@ -111,21 +111,21 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
numbonds ++; numbonds ++;
/* calculate the energy */ /* calculate the energy */
if(numbonds > 0) if(numbonds > 0)
total_Elp += e_lp = total_Elp += e_lp =
p_lp2 * workspace->Delta_lp[i] * inv_expvd2; p_lp2 * workspace->Delta_lp[i] * inv_expvd2;
dElp = p_lp2 * inv_expvd2 + dElp = p_lp2 * inv_expvd2 +
75 * p_lp2 * workspace->Delta_lp[i] * expvd2 * SQR(inv_expvd2); 75 * p_lp2 * workspace->Delta_lp[i] * expvd2 * SQR(inv_expvd2);
CElp = dElp * workspace->dDelta_lp[i]; CElp = dElp * workspace->dDelta_lp[i];
if(numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term if(numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term
/* tally into per-atom energy */ /* tally into per-atom energy */
if( system->pair_ptr->evflag) if( system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1,
e_lp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); e_lp, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
/* correction for C2 */ /* correction for C2 */
if( p_lp3 > 0.001 && !strcmp(system->reax_param.sbp[type_i].name, "C") ) if( p_lp3 > 0.001 && !strcmp(system->reax_param.sbp[type_i].name, "C") )
for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) {
@ -138,19 +138,19 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
bo_ij = &( bonds->select.bond_list[pj].bo_data ); bo_ij = &( bonds->select.bond_list[pj].bo_data );
Di = workspace->Delta[i]; Di = workspace->Delta[i];
vov3 = bo_ij->BO - Di - 0.040*pow(Di, 4.); vov3 = bo_ij->BO - Di - 0.040*pow(Di, 4.);
if( vov3 > 3. ) { if( vov3 > 3. ) {
total_Elp += e_lph = p_lp3 * SQR(vov3-3.0); total_Elp += e_lph = p_lp3 * SQR(vov3-3.0);
deahu2dbo = 2.*p_lp3*(vov3 - 3.); deahu2dbo = 2.*p_lp3*(vov3 - 3.);
deahu2dsbo = 2.*p_lp3*(vov3 - 3.)*(-1. - 0.16*pow(Di, 3.)); deahu2dsbo = 2.*p_lp3*(vov3 - 3.)*(-1. - 0.16*pow(Di, 3.));
bo_ij->Cdbo += deahu2dbo; bo_ij->Cdbo += deahu2dbo;
workspace->CdDelta[i] += deahu2dsbo; workspace->CdDelta[i] += deahu2dsbo;
/* tally into per-atom energy */ /* tally into per-atom energy */
if( system->pair_ptr->evflag) if( system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, system->n, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, j, system->n, 1,
e_lph, 0.0, 0.0, 0.0, 0.0, 0.0, thr); e_lph, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
} }
} }
@ -163,12 +163,12 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
type_i = system->my_atoms[i].type; type_i = system->my_atoms[i].type;
if(type_i < 0) continue; if(type_i < 0) continue;
sbp_i = &(system->reax_param.sbp[ type_i ]); sbp_i = &(system->reax_param.sbp[ type_i ]);
/* over-coordination energy */ /* over-coordination energy */
if( sbp_i->mass > 21.0 ) if( sbp_i->mass > 21.0 )
dfvl = 0.0; dfvl = 0.0;
else dfvl = 1.0; // only for 1st-row elements else dfvl = 1.0; // only for 1st-row elements
p_ovun2 = sbp_i->p_ovun2; p_ovun2 = sbp_i->p_ovun2;
sum_ovun1 = sum_ovun2 = 0; sum_ovun1 = sum_ovun2 = 0;
for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) {
@ -177,20 +177,20 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
if(type_j < 0) continue; if(type_j < 0) continue;
bo_ij = &(bonds->select.bond_list[pj].bo_data); bo_ij = &(bonds->select.bond_list[pj].bo_data);
twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); twbp = &(system->reax_param.tbp[ type_i ][ type_j ]);
sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO; sum_ovun1 += twbp->p_ovun1 * twbp->De_s * bo_ij->BO;
sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])* sum_ovun2 += (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j])*
( bo_ij->BO_pi + bo_ij->BO_pi2 ); ( bo_ij->BO_pi + bo_ij->BO_pi2 );
} }
exp_ovun1 = p_ovun3 * exp( p_ovun4 * sum_ovun2 ); exp_ovun1 = p_ovun3 * exp( p_ovun4 * sum_ovun2 );
inv_exp_ovun1 = 1.0 / (1 + exp_ovun1); inv_exp_ovun1 = 1.0 / (1 + exp_ovun1);
Delta_lpcorr = workspace->Delta[i] - Delta_lpcorr = workspace->Delta[i] -
(dfvl * workspace->Delta_lp_temp[i]) * inv_exp_ovun1; (dfvl * workspace->Delta_lp_temp[i]) * inv_exp_ovun1;
exp_ovun2 = exp( p_ovun2 * Delta_lpcorr ); exp_ovun2 = exp( p_ovun2 * Delta_lpcorr );
inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2); inv_exp_ovun2 = 1.0 / (1.0 + exp_ovun2);
DlpVi = 1.0 / (Delta_lpcorr + sbp_i->valency + 1e-8); DlpVi = 1.0 / (Delta_lpcorr + sbp_i->valency + 1e-8);
CEover1 = Delta_lpcorr * DlpVi * inv_exp_ovun2; CEover1 = Delta_lpcorr * DlpVi * inv_exp_ovun2;
@ -198,17 +198,17 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
CEover2 = sum_ovun1 * DlpVi * inv_exp_ovun2 * CEover2 = sum_ovun1 * DlpVi * inv_exp_ovun2 *
(1.0 - Delta_lpcorr * ( DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2 )); (1.0 - Delta_lpcorr * ( DlpVi + p_ovun2 * exp_ovun2 * inv_exp_ovun2 ));
CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1 ); CEover3 = CEover2 * (1.0 - dfvl * workspace->dDelta_lp[i] * inv_exp_ovun1 );
CEover4 = CEover2 * (dfvl * workspace->Delta_lp_temp[i]) * CEover4 = CEover2 * (dfvl * workspace->Delta_lp_temp[i]) *
p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1); p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1);
/* under-coordination potential */ /* under-coordination potential */
p_ovun2 = sbp_i->p_ovun2; p_ovun2 = sbp_i->p_ovun2;
p_ovun5 = sbp_i->p_ovun5; p_ovun5 = sbp_i->p_ovun5;
exp_ovun2n = 1.0 / exp_ovun2; exp_ovun2n = 1.0 / exp_ovun2;
exp_ovun6 = exp( p_ovun6 * Delta_lpcorr ); exp_ovun6 = exp( p_ovun6 * Delta_lpcorr );
exp_ovun8 = p_ovun7 * exp(p_ovun8 * sum_ovun2); exp_ovun8 = p_ovun7 * exp(p_ovun8 * sum_ovun2);
@ -222,7 +222,7 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
if(numbonds > 0) total_Eun += e_un = if(numbonds > 0) total_Eun += e_un =
-p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8;
CEunder1 = inv_exp_ovun2n * CEunder1 = inv_exp_ovun2n *
( p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 + ( p_ovun5 * p_ovun6 * exp_ovun6 * inv_exp_ovun8 +
p_ovun2 * e_un * exp_ovun2n ); p_ovun2 * e_un * exp_ovun2n );
@ -230,15 +230,15 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
CEunder3 = CEunder1 * (1.0 - dfvl*workspace->dDelta_lp[i]*inv_exp_ovun1); CEunder3 = CEunder1 * (1.0 - dfvl*workspace->dDelta_lp[i]*inv_exp_ovun1);
CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) * CEunder4 = CEunder1 * (dfvl*workspace->Delta_lp_temp[i]) *
p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2; p_ovun4 * exp_ovun1 * SQR(inv_exp_ovun1) + CEunder2;
/* tally into per-atom energy */ /* tally into per-atom energy */
if (system->pair_ptr->evflag) { if (system->pair_ptr->evflag) {
eng_tmp = e_ov; eng_tmp = e_ov;
if(numbonds > 0) eng_tmp+= e_un; if(numbonds > 0) eng_tmp+= e_un;
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1,
eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
} }
/* forces */ /* forces */
workspace->CdDelta[i] += CEover3; // OvCoor - 2nd term workspace->CdDelta[i] += CEover3; // OvCoor - 2nd term
if(numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term if(numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term
@ -249,35 +249,35 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
bo_ij = &(pbond->bo_data); bo_ij = &(pbond->bo_data);
twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ] twbp = &(system->reax_param.tbp[ system->my_atoms[i].type ]
[system->my_atoms[pbond->nbr].type]); [system->my_atoms[pbond->nbr].type]);
bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s; // OvCoor-1st bo_ij->Cdbo += CEover1 * twbp->p_ovun1 * twbp->De_s; // OvCoor-1st
workspace->CdDeltaReduction[reductionOffset+j] += workspace->CdDeltaReduction[reductionOffset+j] +=
CEover4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // OvCoor-3a CEover4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // OvCoor-3a
bo_ij->Cdbopi += CEover4 * bo_ij->Cdbopi += CEover4 *
(workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b
bo_ij->Cdbopi2 += CEover4 * bo_ij->Cdbopi2 += CEover4 *
(workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // OvCoor-3b
workspace->CdDeltaReduction[reductionOffset+j] += workspace->CdDeltaReduction[reductionOffset+j] +=
CEunder4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // UnCoor - 2a CEunder4 * (1.0 - dfvl*workspace->dDelta_lp[j]) * (bo_ij->BO_pi + bo_ij->BO_pi2); // UnCoor - 2a
bo_ij->Cdbopi += CEunder4 * bo_ij->Cdbopi += CEunder4 *
(workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b
bo_ij->Cdbopi2 += CEunder4 * bo_ij->Cdbopi2 += CEunder4 *
(workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]); // UnCoor-2b
} }
} }
pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, thr); system->pair_ptr->vflag_either, thr);
} }
data->my_en.e_lp += total_Elp; data->my_en.e_lp += total_Elp;
data->my_en.e_ov += total_Eov; data->my_en.e_ov += total_Eov;
data->my_en.e_un += total_Eun; data->my_en.e_un += total_Eun;
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTEATOMENERGYINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTEATOMENERGYINDEX] += (endTimeBase-startTimeBase);

View File

@ -44,7 +44,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
simulation_data *data, storage *workspace, simulation_data *data, storage *workspace,
reax_list **lists, output_controls *out_control ) { reax_list **lists, output_controls *out_control ) {
int natoms = system->n; int natoms = system->n;
int nthreads = control->nthreads; int nthreads = control->nthreads;
long totalReductionSize = system->N * nthreads; long totalReductionSize = system->N * nthreads;
reax_list *far_nbrs = (*lists) + FAR_NBRS; reax_list *far_nbrs = (*lists) + FAR_NBRS;
@ -52,7 +52,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
double p_vdW1i = 1.0 / p_vdW1; double p_vdW1i = 1.0 / p_vdW1;
double total_EvdW = 0.; double total_EvdW = 0.;
double total_Eele = 0.; double total_Eele = 0.;
#pragma omp parallel default(shared) reduction(+: total_EvdW, total_Eele) //default(none) #pragma omp parallel default(shared) reduction(+: total_EvdW, total_Eele) //default(none)
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
@ -67,20 +67,20 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
rvec temp, ext_press; rvec temp, ext_press;
two_body_parameters *twbp; two_body_parameters *twbp;
far_neighbor_data *nbr_pj; far_neighbor_data *nbr_pj;
// Tallying variables: // Tallying variables:
double pe_vdw, f_tmp, delij[3]; double pe_vdw, f_tmp, delij[3];
long reductionOffset = (system->N * tid); long reductionOffset = (system->N * tid);
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, system->pair_ptr->vflag_either,
natoms, system->pair_ptr->eatom, natoms, system->pair_ptr->eatom,
system->pair_ptr->vatom, thr); system->pair_ptr->vatom, thr);
e_core = 0; e_core = 0;
e_vdW = 0; e_vdW = 0;
e_vdW_thr = 0; e_vdW_thr = 0;
@ -94,12 +94,12 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
start_i = Start_Index(i, far_nbrs); start_i = Start_Index(i, far_nbrs);
end_i = End_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs);
orig_i = system->my_atoms[i].orig_id; orig_i = system->my_atoms[i].orig_id;
for( pj = start_i; pj < end_i; ++pj ) { for( pj = start_i; pj < end_i; ++pj ) {
nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); nbr_pj = &(far_nbrs->select.far_nbr_list[pj]);
j = nbr_pj->nbr; j = nbr_pj->nbr;
orig_j = system->my_atoms[j].orig_id; orig_j = system->my_atoms[j].orig_id;
flag = 0; flag = 0;
if(nbr_pj->d <= control->nonb_cut) { if(nbr_pj->d <= control->nonb_cut) {
if(j < natoms) flag = 1; if(j < natoms) flag = 1;
@ -113,7 +113,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
} }
} }
} }
if (flag) { if (flag) {
r_ij = nbr_pj->d; r_ij = nbr_pj->d;
@ -142,14 +142,14 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
{ // shielding { // shielding
powr_vdW1 = pow(r_ij, p_vdW1); powr_vdW1 = pow(r_ij, p_vdW1);
powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1);
fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i ); fn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i );
exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); exp1 = exp( twbp->alpha * (1.0 - fn13 / twbp->r_vdW) );
exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) ); exp2 = exp( 0.5 * twbp->alpha * (1.0 - fn13 / twbp->r_vdW) );
e_vdW = twbp->D * (exp1 - 2.0 * exp2); e_vdW = twbp->D * (exp1 - 2.0 * exp2);
total_EvdW += Tap * e_vdW; total_EvdW += Tap * e_vdW;
dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) * dfn13 = pow( powr_vdW1 + powgi_vdW1, p_vdW1i - 1.0) *
pow(r_ij, p_vdW1 - 2.0); pow(r_ij, p_vdW1 - 2.0);
@ -159,10 +159,10 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
else{ // no shielding else{ // no shielding
exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); exp1 = exp( twbp->alpha * (1.0 - r_ij / twbp->r_vdW) );
exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) ); exp2 = exp( 0.5 * twbp->alpha * (1.0 - r_ij / twbp->r_vdW) );
e_vdW = twbp->D * (exp1 - 2.0 * exp2); e_vdW = twbp->D * (exp1 - 2.0 * exp2);
total_EvdW += Tap * e_vdW; total_EvdW += Tap * e_vdW;
CEvd = dTap * e_vdW - CEvd = dTap * e_vdW -
Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij;
} }
@ -171,23 +171,23 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
{ // innner wall { // innner wall
e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore)));
total_EvdW += Tap * e_core; total_EvdW += Tap * e_core;
de_core = -(twbp->acore/twbp->rcore) * e_core; de_core = -(twbp->acore/twbp->rcore) * e_core;
CEvd += dTap * e_core + Tap * de_core / r_ij; CEvd += dTap * e_core + Tap * de_core / r_ij;
// lg correction, only if lgvdw is yes // lg correction, only if lgvdw is yes
if (control->lgflag) { if (control->lgflag) {
r_ij5 = pow( r_ij, 5.0 ); r_ij5 = pow( r_ij, 5.0 );
r_ij6 = pow( r_ij, 6.0 ); r_ij6 = pow( r_ij, 6.0 );
re6 = pow( twbp->lgre, 6.0 ); re6 = pow( twbp->lgre, 6.0 );
e_lg = -(twbp->lgcij/( r_ij6 + re6 )); e_lg = -(twbp->lgcij/( r_ij6 + re6 ));
total_EvdW += Tap * e_lg; total_EvdW += Tap * e_lg;
de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ; de_lg = -6.0 * e_lg * r_ij5 / ( r_ij6 + re6 ) ;
CEvd += dTap * e_lg + Tap * de_lg / r_ij; CEvd += dTap * e_lg + Tap * de_lg / r_ij;
} }
} }
/*Coulomb Calculations*/ /*Coulomb Calculations*/
@ -207,44 +207,44 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
rvec_ScaledSum( delij, 1., system->my_atoms[i].x, rvec_ScaledSum( delij, 1., system->my_atoms[i].x,
-1., system->my_atoms[j].x ); -1., system->my_atoms[j].x );
f_tmp = -(CEvd + CEclmb); f_tmp = -(CEvd + CEclmb);
pair_reax_ptr->ev_tally_thr_proxy( system->pair_ptr, i, j, natoms, pair_reax_ptr->ev_tally_thr_proxy( system->pair_ptr, i, j, natoms,
1, pe_vdw, e_ele, f_tmp, 1, pe_vdw, e_ele, f_tmp,
delij[0], delij[1], delij[2], thr); delij[0], delij[1], delij[2], thr);
} }
if( control->virial == 0 ) { if( control->virial == 0 ) {
rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec );
rvec_ScaledAdd( workspace->forceReduction[reductionOffset+j], rvec_ScaledAdd( workspace->forceReduction[reductionOffset+j],
+(CEvd + CEclmb), nbr_pj->dvec ); +(CEvd + CEclmb), nbr_pj->dvec );
} }
else { /* NPT, iNPT or sNPT */ else { /* NPT, iNPT or sNPT */
/* for pressure coupling, terms not related to bond order /* for pressure coupling, terms not related to bond order
derivatives are added directly into pressure vector/tensor */ derivatives are added directly into pressure vector/tensor */
rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec );
rvec_ScaledAdd( workspace->f[reductionOffset+i], -1., temp ); rvec_ScaledAdd( workspace->f[reductionOffset+i], -1., temp );
rvec_Add( workspace->forceReduction[reductionOffset+j], temp); rvec_Add( workspace->forceReduction[reductionOffset+j], temp);
rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); rvec_iMultiply( ext_press, nbr_pj->rel_box, temp );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
} }
} }
} }
} }
pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, thr); system->pair_ptr->vflag_either, thr);
} // parallel region } // parallel region
data->my_en.e_vdW = total_EvdW; data->my_en.e_vdW = total_EvdW;
data->my_en.e_ele = total_Eele; data->my_en.e_ele = total_Eele;
Compute_Polarization_Energy( system, data ); Compute_Polarization_Energy( system, data );
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *control, void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *control,
simulation_data *data, storage *workspace, simulation_data *data, storage *workspace,
reax_list **lists, reax_list **lists,
@ -257,7 +257,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
long totalReductionSize = system->N * nthreads; long totalReductionSize = system->N * nthreads;
double total_EvdW = 0.; double total_EvdW = 0.;
double total_Eele = 0.; double total_Eele = 0.;
#pragma omp parallel default(shared) reduction(+:total_EvdW, total_Eele) #pragma omp parallel default(shared) reduction(+:total_EvdW, total_Eele)
{ {
int i, j, pj, r; int i, j, pj, r;
@ -276,12 +276,12 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr); pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, system->pair_ptr->vflag_either,
natoms, system->pair_ptr->eatom, natoms, system->pair_ptr->eatom,
system->pair_ptr->vatom, thr); system->pair_ptr->vatom, thr);
//#pragma omp for schedule(dynamic,50) //#pragma omp for schedule(dynamic,50)
#pragma omp for schedule(guided) #pragma omp for schedule(guided)
for (i = 0; i < natoms; ++i) { for (i = 0; i < natoms; ++i) {
@ -290,7 +290,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
start_i = Start_Index(i,far_nbrs); start_i = Start_Index(i,far_nbrs);
end_i = End_Index(i,far_nbrs); end_i = End_Index(i,far_nbrs);
orig_i = system->my_atoms[i].orig_id; orig_i = system->my_atoms[i].orig_id;
for (pj = start_i; pj < end_i; ++pj) { for (pj = start_i; pj < end_i; ++pj) {
nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); nbr_pj = &(far_nbrs->select.far_nbr_list[pj]);
j = nbr_pj->nbr; j = nbr_pj->nbr;
@ -310,7 +310,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
flag = 1; flag = 1;
} }
} }
} }
if (flag) { if (flag) {
@ -354,30 +354,30 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
if( control->virial == 0 ) { if( control->virial == 0 ) {
rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec ); rvec_ScaledAdd( workspace->f[i], -(CEvd + CEclmb), nbr_pj->dvec );
rvec_ScaledAdd( workspace->forceReduction[froffset+j], rvec_ScaledAdd( workspace->forceReduction[froffset+j],
+(CEvd + CEclmb), nbr_pj->dvec ); +(CEvd + CEclmb), nbr_pj->dvec );
} }
else { // NPT, iNPT or sNPT else { // NPT, iNPT or sNPT
/* for pressure coupling, terms not related to bond order derivatives /* for pressure coupling, terms not related to bond order derivatives
are added directly into pressure vector/tensor */ are added directly into pressure vector/tensor */
rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec ); rvec_Scale( temp, CEvd + CEclmb, nbr_pj->dvec );
rvec_ScaledAdd( workspace->f[i], -1., temp ); rvec_ScaledAdd( workspace->f[i], -1., temp );
rvec_Add( workspace->forceReduction[froffset+j], temp ); rvec_Add( workspace->forceReduction[froffset+j], temp );
rvec_iMultiply( ext_press, nbr_pj->rel_box, temp ); rvec_iMultiply( ext_press, nbr_pj->rel_box, temp );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
} }
} }
} }
} }
pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, thr); system->pair_ptr->vflag_either, thr);
} // end omp parallel } // end omp parallel
data->my_en.e_vdW = total_EvdW; data->my_en.e_vdW = total_EvdW;
data->my_en.e_ele = total_Eele; data->my_en.e_ele = total_Eele;
Compute_Polarization_Energy( system, data ); Compute_Polarization_Energy( system, data );
} }

View File

@ -65,7 +65,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
double total_Etor = 0; double total_Etor = 0;
double total_Econ = 0; double total_Econ = 0;
int nthreads = control->nthreads; int nthreads = control->nthreads;
#pragma omp parallel default(shared) reduction(+: total_Etor, total_Econ) #pragma omp parallel default(shared) reduction(+: total_Etor, total_Econ)
{ {
int i, j, k, l, pi, pj, pk, pl, pij, plk; int i, j, k, l, pi, pj, pk, pl, pij, plk;
@ -73,11 +73,11 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
int start_j, end_j, start_k, end_k; int start_j, end_j, start_k, end_k;
int start_pj, end_pj, start_pk, end_pk; int start_pj, end_pj, start_pk, end_pk;
int num_frb_intrs = 0; int num_frb_intrs = 0;
double Delta_j, Delta_k; double Delta_j, Delta_k;
double r_ij, r_jk, r_kl, r_li; double r_ij, r_jk, r_kl, r_li;
double BOA_ij, BOA_jk, BOA_kl; double BOA_ij, BOA_jk, BOA_kl;
double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl; double exp_tor2_ij, exp_tor2_jk, exp_tor2_kl;
double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv; double exp_tor1, exp_tor3_DjDk, exp_tor4_DjDk, exp_tor34_inv;
double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl; double exp_cot2_jk, exp_cot2_ij, exp_cot2_kl;
@ -102,7 +102,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
bond_data *pbond_ij, *pbond_jk, *pbond_kl; bond_data *pbond_ij, *pbond_jk, *pbond_kl;
bond_order_data *bo_ij, *bo_jk, *bo_kl; bond_order_data *bo_ij, *bo_jk, *bo_kl;
three_body_interaction_data *p_ijk, *p_jkl; three_body_interaction_data *p_ijk, *p_jkl;
// Virial tallying variables // Virial tallying variables
double delil[3], deljl[3], delkl[3]; double delil[3], deljl[3], delkl[3];
double eng_tmp, f_scaler, fi_tmp[3], fj_tmp[3], fk_tmp[3]; double eng_tmp, f_scaler, fi_tmp[3], fj_tmp[3], fk_tmp[3];
@ -123,27 +123,27 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
for (j = 0; j < system->N; ++j) { for (j = 0; j < system->N; ++j) {
start_j = Start_Index(j, bonds); start_j = Start_Index(j, bonds);
end_j = End_Index(j, bonds); end_j = End_Index(j, bonds);
for (pk = start_j; pk < end_j; ++pk) { for (pk = start_j; pk < end_j; ++pk) {
bo_jk = &( bonds->select.bond_list[pk].bo_data ); bo_jk = &( bonds->select.bond_list[pk].bo_data );
for (k = 0; k < nthreads; ++k) for (k = 0; k < nthreads; ++k)
bo_jk->CdboReduction[k] = 0.; bo_jk->CdboReduction[k] = 0.;
} }
} }
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
for (j = 0; j < natoms; ++j) { for (j = 0; j < natoms; ++j) {
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
Delta_j = workspace->Delta_boc[j]; Delta_j = workspace->Delta_boc[j];
start_j = Start_Index(j, bonds); start_j = Start_Index(j, bonds);
end_j = End_Index(j, bonds); end_j = End_Index(j, bonds);
for (pk = start_j; pk < end_j; ++pk) { for (pk = start_j; pk < end_j; ++pk) {
pbond_jk = &( bonds->select.bond_list[pk] ); pbond_jk = &( bonds->select.bond_list[pk] );
k = pbond_jk->nbr; k = pbond_jk->nbr;
bo_jk = &( pbond_jk->bo_data ); bo_jk = &( pbond_jk->bo_data );
BOA_jk = bo_jk->BO - control->thb_cut; BOA_jk = bo_jk->BO - control->thb_cut;
/* see if there are any 3-body interactions involving j&k /* see if there are any 3-body interactions involving j&k
where j is the central atom. Otherwise there is no point in where j is the central atom. Otherwise there is no point in
trying to form a 4-body interaction out of this neighborhood */ trying to form a 4-body interaction out of this neighborhood */
@ -160,27 +160,27 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
type_k = system->my_atoms[k].type; type_k = system->my_atoms[k].type;
Delta_k = workspace->Delta_boc[k]; Delta_k = workspace->Delta_boc[k];
r_jk = pbond_jk->d; r_jk = pbond_jk->d;
start_pk = Start_Index(pk, thb_intrs ); start_pk = Start_Index(pk, thb_intrs );
end_pk = End_Index(pk, thb_intrs ); end_pk = End_Index(pk, thb_intrs );
start_pj = Start_Index(pj, thb_intrs ); start_pj = Start_Index(pj, thb_intrs );
end_pj = End_Index(pj, thb_intrs ); end_pj = End_Index(pj, thb_intrs );
exp_tor2_jk = exp( -p_tor2 * BOA_jk ); exp_tor2_jk = exp( -p_tor2 * BOA_jk );
exp_cot2_jk = exp( -p_cot2 * SQR(BOA_jk - 1.5) ); exp_cot2_jk = exp( -p_cot2 * SQR(BOA_jk - 1.5) );
exp_tor3_DjDk = exp( -p_tor3 * (Delta_j + Delta_k) ); exp_tor3_DjDk = exp( -p_tor3 * (Delta_j + Delta_k) );
exp_tor4_DjDk = exp( p_tor4 * (Delta_j + Delta_k) ); exp_tor4_DjDk = exp( p_tor4 * (Delta_j + Delta_k) );
exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk);
f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv;
/* pick i up from j-k interaction where j is the central atom */ /* pick i up from j-k interaction where j is the central atom */
for (pi = start_pk; pi < end_pk; ++pi) { for (pi = start_pk; pi < end_pk; ++pi) {
p_ijk = &( thb_intrs->select.three_body_list[pi] ); p_ijk = &( thb_intrs->select.three_body_list[pi] );
pij = p_ijk->pthb; // pij is pointer to i on j's bond_list pij = p_ijk->pthb; // pij is pointer to i on j's bond_list
pbond_ij = &( bonds->select.bond_list[pij] ); pbond_ij = &( bonds->select.bond_list[pij] );
bo_ij = &( pbond_ij->bo_data ); bo_ij = &( pbond_ij->bo_data );
if (bo_ij->BO > control->thb_cut/*0*/) { if (bo_ij->BO > control->thb_cut/*0*/) {
i = p_ijk->thb; i = p_ijk->thb;
type_i = system->my_atoms[i].type; type_i = system->my_atoms[i].type;
@ -219,13 +219,13 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) {
++num_frb_intrs; ++num_frb_intrs;
//fprintf(stderr, //fprintf(stderr,
// "%5d: %6d %6d %6d %6d\n", num_frb_intrs, // "%5d: %6d %6d %6d %6d\n", num_frb_intrs,
// system->my_atoms[i].orig_id,system->my_atoms[j].orig_id, // system->my_atoms[i].orig_id,system->my_atoms[j].orig_id,
// system->my_atoms[k].orig_id,system->my_atoms[l].orig_id); // system->my_atoms[k].orig_id,system->my_atoms[l].orig_id);
r_kl = pbond_kl->d; r_kl = pbond_kl->d;
BOA_kl = bo_kl->BO - control->thb_cut; BOA_kl = bo_kl->BO - control->thb_cut;
theta_jkl = p_jkl->theta; theta_jkl = p_jkl->theta;
sin_jkl = sin( theta_jkl ); sin_jkl = sin( theta_jkl );
cos_jkl = cos( theta_jkl ); cos_jkl = cos( theta_jkl );
@ -235,12 +235,12 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
else if( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) else if( sin_jkl <= 0 && sin_jkl >= -MIN_SINE )
tan_jkl_i = cos_jkl / -MIN_SINE; tan_jkl_i = cos_jkl / -MIN_SINE;
else tan_jkl_i = cos_jkl /sin_jkl; else tan_jkl_i = cos_jkl /sin_jkl;
rvec_ScaledSum( dvec_li, 1., system->my_atoms[i].x, rvec_ScaledSum( dvec_li, 1., system->my_atoms[i].x,
-1., system->my_atoms[l].x ); -1., system->my_atoms[l].x );
r_li = rvec_Norm( dvec_li ); r_li = rvec_Norm( dvec_li );
/* omega and its derivative */ /* omega and its derivative */
omega = Calculate_Omega( pbond_ij->dvec, r_ij, omega = Calculate_Omega( pbond_ij->dvec, r_ij,
pbond_jk->dvec, r_jk, pbond_jk->dvec, r_jk,
@ -255,7 +255,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
cos2omega = cos( 2. * omega ); cos2omega = cos( 2. * omega );
cos3omega = cos( 3. * omega ); cos3omega = cos( 3. * omega );
/* end omega calculations */ /* end omega calculations */
/* torsion energy */ /* torsion energy */
exp_tor1 = exp( fbp->p_tor1 * exp_tor1 = exp( fbp->p_tor1 *
SQR(2.0 - bo_jk->BO_pi - f11_DjDk) ); SQR(2.0 - bo_jk->BO_pi - f11_DjDk) );
@ -360,35 +360,35 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
} }
else { else {
ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box); ivec_Sum(rel_box_jl, pbond_jk->rel_box, pbond_kl->rel_box);
/* dcos_theta_ijk */ /* dcos_theta_ijk */
rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk ); rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_dk );
rvec_Add( workspace->forceReduction[reductionOffset+i], force ); rvec_Add( workspace->forceReduction[reductionOffset+i], force );
rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); rvec_iMultiply( ext_press, pbond_ij->rel_box, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
rvec_ScaledAdd( workspace->f[j], rvec_ScaledAdd( workspace->f[j],
CEtors7 + CEconj4, p_ijk->dcos_dj ); CEtors7 + CEconj4, p_ijk->dcos_dj );
rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di ); rvec_Scale( force, CEtors7 + CEconj4, p_ijk->dcos_di );
rvec_Add( workspace->forceReduction[reductionOffset+k], force ); rvec_Add( workspace->forceReduction[reductionOffset+k], force );
rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); rvec_iMultiply( ext_press, pbond_jk->rel_box, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
/* dcos_theta_jkl */ /* dcos_theta_jkl */
rvec_ScaledAdd( workspace->f[j], rvec_ScaledAdd( workspace->f[j],
CEtors8 + CEconj5, p_jkl->dcos_di ); CEtors8 + CEconj5, p_jkl->dcos_di );
rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj ); rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dj );
rvec_Add( workspace->forceReduction[reductionOffset+k], force ); rvec_Add( workspace->forceReduction[reductionOffset+k], force );
rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); rvec_iMultiply( ext_press, pbond_jk->rel_box, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk ); rvec_Scale( force, CEtors8 + CEconj5, p_jkl->dcos_dk );
rvec_Add( workspace->forceReduction[reductionOffset+l], force ); rvec_Add( workspace->forceReduction[reductionOffset+l], force );
rvec_iMultiply( ext_press, rel_box_jl, force ); rvec_iMultiply( ext_press, rel_box_jl, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
/* dcos_omega */ /* dcos_omega */
rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di ); rvec_Scale( force, CEtors9 + CEconj6, dcos_omega_di );
rvec_Add( workspace->forceReduction[reductionOffset+i], force ); rvec_Add( workspace->forceReduction[reductionOffset+i], force );
@ -411,7 +411,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
/* tally into per-atom virials */ /* tally into per-atom virials */
if( system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { if( system->pair_ptr->vflag_atom || system->pair_ptr->evflag) {
// acquire vectors // acquire vectors
rvec_ScaledSum( delil, 1., system->my_atoms[l].x, rvec_ScaledSum( delil, 1., system->my_atoms[l].x,
-1., system->my_atoms[i].x ); -1., system->my_atoms[i].x );
@ -423,21 +423,21 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
rvec_Scale( fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk ); rvec_Scale( fi_tmp, CEtors7 + CEconj4, p_ijk->dcos_dk );
rvec_Scale( fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj ); rvec_Scale( fj_tmp, CEtors7 + CEconj4, p_ijk->dcos_dj );
rvec_Scale( fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di ); rvec_Scale( fk_tmp, CEtors7 + CEconj4, p_ijk->dcos_di );
// dcos_theta_jkl // dcos_theta_jkl
rvec_ScaledAdd( fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di ); rvec_ScaledAdd( fj_tmp, CEtors8 + CEconj5, p_jkl->dcos_di );
rvec_ScaledAdd( fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj ); rvec_ScaledAdd( fk_tmp, CEtors8 + CEconj5, p_jkl->dcos_dj );
// dcos_omega // dcos_omega
rvec_ScaledAdd( fi_tmp, CEtors9 + CEconj6, dcos_omega_di ); rvec_ScaledAdd( fi_tmp, CEtors9 + CEconj6, dcos_omega_di );
rvec_ScaledAdd( fj_tmp, CEtors9 + CEconj6, dcos_omega_dj ); rvec_ScaledAdd( fj_tmp, CEtors9 + CEconj6, dcos_omega_dj );
rvec_ScaledAdd( fk_tmp, CEtors9 + CEconj6, dcos_omega_dk ); rvec_ScaledAdd( fk_tmp, CEtors9 + CEconj6, dcos_omega_dk );
// tally // tally
eng_tmp = e_tor + e_con; eng_tmp = e_tor + e_con;
if (system->pair_ptr->evflag) if (system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, k, system->n, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, k, system->n, 1,
eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
// NEED TO MAKE AN OMP VERSION OF THIS CALL! // NEED TO MAKE AN OMP VERSION OF THIS CALL!
@ -445,7 +445,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
system->pair_ptr->v_tally4(i, j, k, l, fi_tmp, fj_tmp, fk_tmp, system->pair_ptr->v_tally4(i, j, k, l, fi_tmp, fj_tmp, fk_tmp,
delil, deljl, delkl ); delil, deljl, delkl );
} }
} // pl check ends } // pl check ends
} // pl loop ends } // pl loop ends
} // pi check ends } // pi check ends
@ -454,12 +454,12 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
} // j<k && j-k neighbor check ends } // j<k && j-k neighbor check ends
} // pk loop ends } // pk loop ends
} // j loop } // j loop
} // end omp parallel } // end omp parallel
data->my_en.e_tor = total_Etor; data->my_en.e_tor = total_Etor;
data->my_en.e_con = total_Econ; data->my_en.e_con = total_Econ;
#ifdef OMP_TIMING #ifdef OMP_TIMING
endTimeBase = MPI_Wtime(); endTimeBase = MPI_Wtime();
ompTimingData[COMPUTETORSIONANGLESBOINDEX] += (endTimeBase-startTimeBase); ompTimingData[COMPUTETORSIONANGLESBOINDEX] += (endTimeBase-startTimeBase);

View File

@ -54,7 +54,7 @@ void Calculate_dCos_ThetaOMP( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_
double csqr_jk = Cdot_inv3 * sqr_d_jk; double csqr_jk = Cdot_inv3 * sqr_d_jk;
double csqr_ji = Cdot_inv3 * sqr_d_ji; double csqr_ji = Cdot_inv3 * sqr_d_ji;
// Try to help compiler out by unrolling // Try to help compiler out by unrolling
// x-component // x-component
double dinv_jk = dvec_jk[0] * inv_dists; double dinv_jk = dvec_jk[0] * inv_dists;
@ -103,7 +103,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
double endTimeBase, startTimeBase; double endTimeBase, startTimeBase;
startTimeBase = MPI_Wtime(); startTimeBase = MPI_Wtime();
#endif #endif
reax_list *bonds = (*lists) + BONDS; reax_list *bonds = (*lists) + BONDS;
reax_list *thb_intrs = (*lists) + THREE_BODIES; reax_list *thb_intrs = (*lists) + THREE_BODIES;
@ -118,20 +118,20 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
double total_Eang = 0; double total_Eang = 0;
double total_Epen = 0; double total_Epen = 0;
double total_Ecoa = 0; double total_Ecoa = 0;
int per_atom = (thb_intrs->num_intrs / system->N); int per_atom = (thb_intrs->num_intrs / system->N);
int nthreads = control->nthreads; int nthreads = control->nthreads;
int chunksize = system->N/(nthreads*10); int chunksize = system->N/(nthreads*10);
int num_thb_intrs = 0; int num_thb_intrs = 0;
int TWICE = 2; int TWICE = 2;
#pragma omp parallel default(shared) reduction(+:total_Eang, total_Epen, total_Ecoa, num_thb_intrs) #pragma omp parallel default(shared) reduction(+:total_Eang, total_Epen, total_Ecoa, num_thb_intrs)
{ {
int i, j, pi, k, pk, t; int i, j, pi, k, pk, t;
int type_i, type_j, type_k; int type_i, type_j, type_k;
int start_j, end_j, start_pk, end_pk; int start_j, end_j, start_pk, end_pk;
int cnt, my_offset, mark; int cnt, my_offset, mark;
double temp, temp_bo_jt, pBOjt7; double temp, temp_bo_jt, pBOjt7;
double p_val1, p_val2, p_val3, p_val4, p_val5, p_val7; double p_val1, p_val2, p_val3, p_val4, p_val5, p_val7;
double p_pen1, p_pen2, p_pen3, p_pen4; double p_pen1, p_pen2, p_pen3, p_pen4;
@ -150,17 +150,17 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
double BOA_ij, BOA_jk; double BOA_ij, BOA_jk;
rvec force, ext_press; rvec force, ext_press;
// rtensor temp_rtensor, total_rtensor; // rtensor temp_rtensor, total_rtensor;
// Tallying variables // Tallying variables
double eng_tmp, f_scaler, fi_tmp[3], fj_tmp[3], fk_tmp[3]; double eng_tmp, f_scaler, fi_tmp[3], fj_tmp[3], fk_tmp[3];
double delij[3], delkj[3]; double delij[3], delkj[3];
three_body_header *thbh; three_body_header *thbh;
three_body_parameters *thbp; three_body_parameters *thbp;
three_body_interaction_data *p_ijk, *p_kji; three_body_interaction_data *p_ijk, *p_kji;
bond_data *pbond_ij, *pbond_jk, *pbond_jt; bond_data *pbond_ij, *pbond_jk, *pbond_jt;
bond_order_data *bo_ij, *bo_jk, *bo_jt; bond_order_data *bo_ij, *bo_jk, *bo_jt;
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
long reductionOffset = (system->N * tid); long reductionOffset = (system->N * tid);
class PairReaxCOMP *pair_reax_ptr; class PairReaxCOMP *pair_reax_ptr;
@ -174,7 +174,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
// Run through a minimal for(j<N) loop once to precompute offsets with safe number of threads // Run through a minimal for(j<N) loop once to precompute offsets with safe number of threads
const int per_thread = thb_intrs->num_intrs / nthreads; const int per_thread = thb_intrs->num_intrs / nthreads;
#pragma omp for schedule(dynamic,50) #pragma omp for schedule(dynamic,50)
@ -188,7 +188,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
// Always point to start of workspace to count angles // Always point to start of workspace to count angles
my_offset = tid * per_thread; my_offset = tid * per_thread;
for (pi = start_j; pi < end_j; ++pi) { for (pi = start_j; pi < end_j; ++pi) {
Set_Start_Index( pi, my_offset, thb_intrs ); Set_Start_Index( pi, my_offset, thb_intrs );
pbond_ij = &(bonds->select.bond_list[pi]); pbond_ij = &(bonds->select.bond_list[pi]);
@ -196,7 +196,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
BOA_ij = bo_ij->BO - control->thb_cut; BOA_ij = bo_ij->BO - control->thb_cut;
if (BOA_ij > 0.0) { if (BOA_ij > 0.0) {
i = pbond_ij->nbr; i = pbond_ij->nbr;
/* first copy 3-body intrs from previously computed ones where i>k. /* first copy 3-body intrs from previously computed ones where i>k.
in the second for-loop below, in the second for-loop below,
@ -204,13 +204,13 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
for (pk = start_j; pk < pi; ++pk) { for (pk = start_j; pk < pi; ++pk) {
start_pk = Start_Index( pk, thb_intrs ); start_pk = Start_Index( pk, thb_intrs );
end_pk = End_Index( pk, thb_intrs ); end_pk = End_Index( pk, thb_intrs );
for (t = start_pk; t < end_pk; ++t) for (t = start_pk; t < end_pk; ++t)
if (thb_intrs->select.three_body_list[t].thb == i) { if (thb_intrs->select.three_body_list[t].thb == i) {
p_ijk = &(thb_intrs->select.three_body_list[my_offset] ); p_ijk = &(thb_intrs->select.three_body_list[my_offset] );
p_ijk->thb = bonds->select.bond_list[pk].nbr; p_ijk->thb = bonds->select.bond_list[pk].nbr;
++my_offset; ++my_offset;
break; break;
} }
@ -225,11 +225,11 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
p_ijk = &( thb_intrs->select.three_body_list[my_offset] ); p_ijk = &( thb_intrs->select.three_body_list[my_offset] );
p_ijk->thb = k; p_ijk->thb = k;
++my_offset; // add this to the list of 3-body interactions ++my_offset; // add this to the list of 3-body interactions
} // for(pk) } // for(pk)
} // if() } // if()
Set_End_Index(pi, my_offset, thb_intrs ); Set_End_Index(pi, my_offset, thb_intrs );
} // for(pi) } // for(pi)
@ -246,7 +246,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
// Number of angles owned by this atom // Number of angles owned by this atom
_my_offset[j] = my_offset - tid * per_thread; _my_offset[j] = my_offset - tid * per_thread;
} // for(j) } // for(j)
// Wait for all threads to finish counting angles // Wait for all threads to finish counting angles
#pragma omp barrier #pragma omp barrier
@ -271,7 +271,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
// Original loop, but now using precomputed offsets // Original loop, but now using precomputed offsets
// Safe to use all threads available, regardless of threads tasked above // Safe to use all threads available, regardless of threads tasked above
// We also now skip over atoms that have no angles assigned // We also now skip over atoms that have no angles assigned
#pragma omp for schedule(dynamic,50)//(dynamic,chunksize)//(guided) #pragma omp for schedule(dynamic,50)//(dynamic,chunksize)//(guided)
for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
if(type_j < 0) continue; if(type_j < 0) continue;
@ -281,14 +281,14 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
start_j = Start_Index(j, bonds); start_j = Start_Index(j, bonds);
end_j = End_Index(j, bonds); end_j = End_Index(j, bonds);
type_j = system->my_atoms[j].type; type_j = system->my_atoms[j].type;
my_offset = _my_offset[j]; my_offset = _my_offset[j];
p_val3 = system->reax_param.sbp[ type_j ].p_val3; p_val3 = system->reax_param.sbp[ type_j ].p_val3;
p_val5 = system->reax_param.sbp[ type_j ].p_val5; p_val5 = system->reax_param.sbp[ type_j ].p_val5;
SBOp = 0, prod_SBO = 1; SBOp = 0, prod_SBO = 1;
for (t = start_j; t < end_j; ++t) { for (t = start_j; t < end_j; ++t) {
bo_jt = &(bonds->select.bond_list[t].bo_data); bo_jt = &(bonds->select.bond_list[t].bo_data);
@ -298,7 +298,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
temp *= temp; temp *= temp;
prod_SBO *= exp( -temp ); prod_SBO *= exp( -temp );
} }
// modifications to match Adri's code - 09/01/09 // modifications to match Adri's code - 09/01/09
if( workspace->vlpex[j] >= 0 ){ if( workspace->vlpex[j] >= 0 ){
vlpadj = 0; vlpadj = 0;
@ -308,10 +308,10 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
vlpadj = workspace->nlp[j]; vlpadj = workspace->nlp[j];
dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]); dSBO2 = (prod_SBO - 1) * (1 - p_val8 * workspace->dDelta_lp[j]);
} }
SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj); SBO = SBOp + (1 - prod_SBO) * (-workspace->Delta_boc[j] - p_val8 * vlpadj);
dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj ); dSBO1 = -8 * prod_SBO * ( workspace->Delta_boc[j] + p_val8 * vlpadj );
if( SBO <= 0 ) if( SBO <= 0 )
SBO2 = 0, CSBO2 = 0; SBO2 = 0, CSBO2 = 0;
else if( SBO > 0 && SBO <= 1 ) { else if( SBO > 0 && SBO <= 1 ) {
@ -324,16 +324,16 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
} }
else else
SBO2 = 2, CSBO2 = 0; SBO2 = 2, CSBO2 = 0;
expval6 = exp( p_val6 * workspace->Delta_boc[j] ); expval6 = exp( p_val6 * workspace->Delta_boc[j] );
for (pi = start_j; pi < end_j; ++pi) { for (pi = start_j; pi < end_j; ++pi) {
Set_Start_Index( pi, my_offset, thb_intrs ); Set_Start_Index( pi, my_offset, thb_intrs );
pbond_ij = &(bonds->select.bond_list[pi]); pbond_ij = &(bonds->select.bond_list[pi]);
bo_ij = &(pbond_ij->bo_data); bo_ij = &(pbond_ij->bo_data);
BOA_ij = bo_ij->BO - control->thb_cut; BOA_ij = bo_ij->BO - control->thb_cut;
if (BOA_ij > 0.0) { if (BOA_ij > 0.0) {
i = pbond_ij->nbr; i = pbond_ij->nbr;
r_ij = pbond_ij->d; r_ij = pbond_ij->d;
@ -346,19 +346,19 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
for (pk = start_j; pk < pi; ++pk) { for (pk = start_j; pk < pi; ++pk) {
start_pk = Start_Index( pk, thb_intrs ); start_pk = Start_Index( pk, thb_intrs );
end_pk = End_Index( pk, thb_intrs ); end_pk = End_Index( pk, thb_intrs );
for (t = start_pk; t < end_pk; ++t) for (t = start_pk; t < end_pk; ++t)
if (thb_intrs->select.three_body_list[t].thb == i) { if (thb_intrs->select.three_body_list[t].thb == i) {
p_ijk = &(thb_intrs->select.three_body_list[my_offset] ); p_ijk = &(thb_intrs->select.three_body_list[my_offset] );
p_kji = &(thb_intrs->select.three_body_list[t]); p_kji = &(thb_intrs->select.three_body_list[t]);
p_ijk->thb = bonds->select.bond_list[pk].nbr; p_ijk->thb = bonds->select.bond_list[pk].nbr;
p_ijk->pthb = pk; p_ijk->pthb = pk;
p_ijk->theta = p_kji->theta; p_ijk->theta = p_kji->theta;
rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk ); rvec_Copy( p_ijk->dcos_di, p_kji->dcos_dk );
rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj ); rvec_Copy( p_ijk->dcos_dj, p_kji->dcos_dj );
rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di ); rvec_Copy( p_ijk->dcos_dk, p_kji->dcos_di );
++my_offset; ++my_offset;
++num_thb_intrs; ++num_thb_intrs;
break; break;
@ -374,15 +374,15 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
k = pbond_jk->nbr; k = pbond_jk->nbr;
type_k = system->my_atoms[k].type; type_k = system->my_atoms[k].type;
p_ijk = &( thb_intrs->select.three_body_list[my_offset] ); p_ijk = &( thb_intrs->select.three_body_list[my_offset] );
// Fix by Sudhir // Fix by Sudhir
// if (BOA_jk <= 0) continue; // if (BOA_jk <= 0) continue;
if (j >= system->n && i >= system->n && k >= system->n) continue; if (j >= system->n && i >= system->n && k >= system->n) continue;
Calculate_Theta( pbond_ij->dvec, pbond_ij->d, Calculate_Theta( pbond_ij->dvec, pbond_ij->d,
pbond_jk->dvec, pbond_jk->d, pbond_jk->dvec, pbond_jk->d,
&theta, &cos_theta ); &theta, &cos_theta );
Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d, Calculate_dCos_ThetaOMP( pbond_ij->dvec, pbond_ij->d,
pbond_jk->dvec, pbond_jk->d, pbond_jk->dvec, pbond_jk->d,
&(p_ijk->dcos_di), &(p_ijk->dcos_dj), &(p_ijk->dcos_di), &(p_ijk->dcos_dj),
@ -390,23 +390,23 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
p_ijk->thb = k; p_ijk->thb = k;
p_ijk->pthb = pk; p_ijk->pthb = pk;
p_ijk->theta = theta; p_ijk->theta = theta;
sin_theta = sin( theta ); sin_theta = sin( theta );
if( sin_theta < 1.0e-5 ) if( sin_theta < 1.0e-5 )
sin_theta = 1.0e-5; sin_theta = 1.0e-5;
++my_offset; // add this to the list of 3-body interactions ++my_offset; // add this to the list of 3-body interactions
++num_thb_intrs; ++num_thb_intrs;
if ((j < system->n) && (BOA_jk > 0.0) && if ((j < system->n) && (BOA_jk > 0.0) &&
(bo_ij->BO > control->thb_cut) && (bo_ij->BO > control->thb_cut) &&
(bo_jk->BO > control->thb_cut) && (bo_jk->BO > control->thb_cut) &&
(bo_ij->BO * bo_jk->BO > control->thb_cutsq)) { (bo_ij->BO * bo_jk->BO > control->thb_cutsq)) {
r_jk = pbond_jk->d; r_jk = pbond_jk->d;
thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] ); thbh = &( system->reax_param.thbp[ type_i ][ type_j ][ type_k ] );
for (cnt = 0; cnt < thbh->cnt; ++cnt) { for (cnt = 0; cnt < thbh->cnt; ++cnt) {
if( fabs(thbh->prm[cnt].p_val1) > 0.001 ) { if( fabs(thbh->prm[cnt].p_val1) > 0.001 ) {
thbp = &( thbh->prm[cnt] ); thbp = &( thbh->prm[cnt] );
@ -456,7 +456,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
CEval7 = CEval5 * dSBO2; CEval7 = CEval5 * dSBO2;
CEval8 = -CEval4 / sin_theta; CEval8 = -CEval4 / sin_theta;
total_Eang += e_ang = total_Eang += e_ang =
f7_ij * f7_jk * f8_Dj * expval12theta; f7_ij * f7_jk * f8_Dj * expval12theta;
/* END ANGLE ENERGY*/ /* END ANGLE ENERGY*/
@ -533,9 +533,9 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
if( control->virial == 0 ) { if( control->virial == 0 ) {
rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj );
rvec_ScaledAdd( workspace->forceReduction[reductionOffset+i], rvec_ScaledAdd( workspace->forceReduction[reductionOffset+i],
CEval8, p_ijk->dcos_di ); CEval8, p_ijk->dcos_di );
rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k], rvec_ScaledAdd( workspace->forceReduction[reductionOffset+k],
CEval8, p_ijk->dcos_dk ); CEval8, p_ijk->dcos_dk );
} }
else { else {
@ -543,36 +543,36 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
added directly into forces and pressure vector/tensor */ added directly into forces and pressure vector/tensor */
rvec_Scale( force, CEval8, p_ijk->dcos_di ); rvec_Scale( force, CEval8, p_ijk->dcos_di );
rvec_Add( workspace->forceReduction[reductionOffset+i], force ); rvec_Add( workspace->forceReduction[reductionOffset+i], force );
rvec_iMultiply( ext_press, pbond_ij->rel_box, force ); rvec_iMultiply( ext_press, pbond_ij->rel_box, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj ); rvec_ScaledAdd( workspace->f[j], CEval8, p_ijk->dcos_dj );
rvec_Scale( force, CEval8, p_ijk->dcos_dk ); rvec_Scale( force, CEval8, p_ijk->dcos_dk );
rvec_Add( workspace->forceReduction[reductionOffset+k], force ); rvec_Add( workspace->forceReduction[reductionOffset+k], force );
rvec_iMultiply( ext_press, pbond_jk->rel_box, force ); rvec_iMultiply( ext_press, pbond_jk->rel_box, force );
rvec_Add( workspace->my_ext_pressReduction[tid], ext_press ); rvec_Add( workspace->my_ext_pressReduction[tid], ext_press );
} }
/* tally into per-atom virials */ /* tally into per-atom virials */
if( system->pair_ptr->vflag_atom || system->pair_ptr->evflag) { if( system->pair_ptr->vflag_atom || system->pair_ptr->evflag) {
/* Acquire vectors */ /* Acquire vectors */
rvec_ScaledSum( delij, 1., system->my_atoms[i].x, rvec_ScaledSum( delij, 1., system->my_atoms[i].x,
-1., system->my_atoms[j].x ); -1., system->my_atoms[j].x );
rvec_ScaledSum( delkj, 1., system->my_atoms[k].x, rvec_ScaledSum( delkj, 1., system->my_atoms[k].x,
-1., system->my_atoms[j].x ); -1., system->my_atoms[j].x );
rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di ); rvec_Scale( fi_tmp, -CEval8, p_ijk->dcos_di );
rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj ); rvec_Scale( fj_tmp, -CEval8, p_ijk->dcos_dj );
rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk ); rvec_Scale( fk_tmp, -CEval8, p_ijk->dcos_dk );
eng_tmp = e_ang + e_pen + e_coa; eng_tmp = e_ang + e_pen + e_coa;
if( system->pair_ptr->evflag) if( system->pair_ptr->evflag)
pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, j, system->N, 1, pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, j, j, system->N, 1,
eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr);
if( system->pair_ptr->vflag_atom) if( system->pair_ptr->vflag_atom)
// NEED TO MAKE AN OMP VERSION OF THIS CALL! // NEED TO MAKE AN OMP VERSION OF THIS CALL!
@ -588,7 +588,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
Set_End_Index(pi, my_offset, thb_intrs ); Set_End_Index(pi, my_offset, thb_intrs );
} // for(pi) } // for(pi)
} // for(j) } // for(j)
pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either, pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
system->pair_ptr->vflag_either, thr); system->pair_ptr->vflag_either, thr);
} // end omp parallel } // end omp parallel

View File

@ -230,7 +230,7 @@ void PairReaxC::settings(int narg, char **arg)
system->mincap = MIN_CAP; system->mincap = MIN_CAP;
system->safezone = SAFE_ZONE; system->safezone = SAFE_ZONE;
system->saferzone = SAFER_ZONE; system->saferzone = SAFER_ZONE;
// process optional keywords // process optional keywords
int iarg = 1; int iarg = 1;

View File

@ -199,7 +199,7 @@ void DeAllocate_Workspace( control_params *control, storage *workspace )
if(workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" ); if(workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" );
if(workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" ); if(workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" );
if(workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); if(workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset");
if (control->virial && workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce"); if (control->virial && workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce");
#endif #endif
} }
@ -297,12 +297,12 @@ int Allocate_Workspace( reax_system *system, control_params *control,
workspace->f = (rvec*) scalloc( total_cap, sizeof(rvec), "f", comm ); workspace->f = (rvec*) scalloc( total_cap, sizeof(rvec), "f", comm );
workspace->CdDelta = (double*) workspace->CdDelta = (double*)
scalloc( total_cap, sizeof(double), "CdDelta", comm ); scalloc( total_cap, sizeof(double), "CdDelta", comm );
// storage for reductions with multiple threads // storage for reductions with multiple threads
#ifdef LMP_USER_OMP #ifdef LMP_USER_OMP
workspace->CdDeltaReduction = (double *) scalloc(sizeof(double), total_cap*control->nthreads, workspace->CdDeltaReduction = (double *) scalloc(sizeof(double), total_cap*control->nthreads,
"cddelta_reduce", comm); "cddelta_reduce", comm);
workspace->forceReduction = (rvec *) scalloc(sizeof(rvec), total_cap*control->nthreads, workspace->forceReduction = (rvec *) scalloc(sizeof(rvec), total_cap*control->nthreads,
"forceReduction", comm); "forceReduction", comm);
@ -368,30 +368,30 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds,
*total_bonds += system->my_atoms[i].num_bonds; *total_bonds += system->my_atoms[i].num_bonds;
} }
*total_bonds = (int)(MAX( *total_bonds * safezone, mincap*MIN_BONDS )); *total_bonds = (int)(MAX( *total_bonds * safezone, mincap*MIN_BONDS ));
#ifdef LMP_USER_OMP #ifdef LMP_USER_OMP
for (i = 0; i < bonds->num_intrs; ++i) for (i = 0; i < bonds->num_intrs; ++i)
sfree(bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction"); sfree(bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction");
#endif #endif
Delete_List( bonds, comm ); Delete_List( bonds, comm );
if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) { if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds, comm)) {
fprintf( stderr, "not enough space for bonds list. terminating!\n" ); fprintf( stderr, "not enough space for bonds list. terminating!\n" );
MPI_Abort( comm, INSUFFICIENT_MEMORY ); MPI_Abort( comm, INSUFFICIENT_MEMORY );
} }
#ifdef LMP_USER_OMP #ifdef LMP_USER_OMP
#if defined(_OPENMP) #if defined(_OPENMP)
int nthreads = omp_get_num_threads(); int nthreads = omp_get_num_threads();
#else #else
int nthreads = 1; int nthreads = 1;
#endif #endif
for (i = 0; i < bonds->num_intrs; ++i) for (i = 0; i < bonds->num_intrs; ++i)
bonds->select.bond_list[i].bo_data.CdboReduction = bonds->select.bond_list[i].bo_data.CdboReduction =
(double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm); (double*) smalloc(sizeof(double)*nthreads, "CdboReduction", comm);
#endif #endif
return SUCCESS; return SUCCESS;
} }

View File

@ -486,7 +486,7 @@ typedef struct
int lgflag; int lgflag;
int enobondsflag; int enobondsflag;
} control_params; } control_params;