From ff819be807ff71d92c424e985dd5273d28ff7f0e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 29 Mar 2019 10:21:44 -0400 Subject: [PATCH] more 'war on tabs' --- src/comm.cpp | 4 +- src/compute_angle_local.cpp | 76 +++++++++++++++---------------- src/compute_bond_local.cpp | 22 ++++----- src/compute_chunk_spread_atom.cpp | 56 +++++++++++------------ src/compute_dihedral_local.cpp | 26 +++++------ src/compute_property_atom.cpp | 2 +- src/compute_property_atom.h | 4 +- src/memory.h | 60 ++++++++++++------------ 8 files changed, 126 insertions(+), 124 deletions(-) diff --git a/src/comm.cpp b/src/comm.cpp index 8389e4993d..30fd7c243e 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -933,7 +933,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, "rendezvous:inbuf"); MPI_Alltoallv(inbuf_a2a,sendcount,sdispls,MPI_CHAR, - inbuf_rvous,recvcount,rdispls,MPI_CHAR,world); + inbuf_rvous,recvcount,rdispls,MPI_CHAR,world); if (!inorder) { memory->destroy(procs_a2a); @@ -1036,7 +1036,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, outbuf = (char *) memory->smalloc((bigint) nout*outsize,"rendezvous:outbuf"); MPI_Alltoallv(outbuf_a2a,sendcount,sdispls,MPI_CHAR, - outbuf,recvcount,rdispls,MPI_CHAR,world); + outbuf,recvcount,rdispls,MPI_CHAR,world); memory->destroy(procs_rvous); memory->sfree(outbuf_rvous); diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index 641784fe03..8f0606329f 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -88,7 +88,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : int n = strlen(arg[iarg+2]) + 1; tstr = new char[n]; strcpy(tstr,arg[iarg+2]); - tflag = 1; + tflag = 1; } else error->all(FLERR,"Illegal compute angle/local command"); iarg += 3; } else error->all(FLERR,"Illegal compute angle/local command"); @@ -102,9 +102,9 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR,"Variable name for copute angle/local does not exist"); + error->all(FLERR,"Variable name for copute angle/local does not exist"); if (!input->variable->equalstyle(vvar[i])) - error->all(FLERR,"Variable for compute angle/local is invalid style"); + error->all(FLERR,"Variable for compute angle/local is invalid style"); } if (tstr) { @@ -153,7 +153,7 @@ void ComputeAngleLocal::init() for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR,"Variable name for compute angle/local does not exist"); + error->all(FLERR,"Variable name for compute angle/local does not exist"); } if (tstr) { @@ -261,53 +261,53 @@ int ComputeAngleLocal::compute_angles(int flag) // theta needed by one or more outputs if (tflag) { - delx1 = x[atom1][0] - x[atom2][0]; - dely1 = x[atom1][1] - x[atom2][1]; - delz1 = x[atom1][2] - x[atom2][2]; - domain->minimum_image(delx1,dely1,delz1); + delx1 = x[atom1][0] - x[atom2][0]; + dely1 = x[atom1][1] - x[atom2][1]; + delz1 = x[atom1][2] - x[atom2][2]; + domain->minimum_image(delx1,dely1,delz1); - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - r1 = sqrt(rsq1); - - delx2 = x[atom3][0] - x[atom2][0]; - dely2 = x[atom3][1] - x[atom2][1]; - delz2 = x[atom3][2] - x[atom2][2]; - domain->minimum_image(delx2,dely2,delz2); + rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; + r1 = sqrt(rsq1); + + delx2 = x[atom3][0] - x[atom2][0]; + dely2 = x[atom3][1] - x[atom2][1]; + delz2 = x[atom3][2] - x[atom2][2]; + domain->minimum_image(delx2,dely2,delz2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - r2 = sqrt(rsq2); + rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; + r2 = sqrt(rsq2); - // c = cosine of angle - // theta = angle in radians + // c = cosine of angle + // theta = angle in radians - c = delx1*delx2 + dely1*dely2 + delz1*delz2; - c /= r1*r2; - if (c > 1.0) c = 1.0; - if (c < -1.0) c = -1.0; - theta = acos(c); + c = delx1*delx2 + dely1*dely2 + delz1*delz2; + c /= r1*r2; + if (c > 1.0) c = 1.0; + if (c < -1.0) c = -1.0; + theta = acos(c); } if (nvalues == 1) ptr = &vlocal[m]; else ptr = alocal[m]; if (nvar) { - ivar = 0; - if (tstr) input->variable->internal_set(tvar,theta); + ivar = 0; + if (tstr) input->variable->internal_set(tvar,theta); } for (n = 0; n < nvalues; n++) { - switch (bstyle[n]) { - case THETA: - ptr[n] = 180.0*theta/MY_PI; - break; - case ENG: - if (atype > 0) ptr[n] = angle->single(atype,atom1,atom2,atom3); - else ptr[n] = 0.0; - break; - case VARIABLE: - ptr[n] = input->variable->compute_equal(vvar[ivar]); - ivar++; - break; + switch (bstyle[n]) { + case THETA: + ptr[n] = 180.0*theta/MY_PI; + break; + case ENG: + if (atype > 0) ptr[n] = angle->single(atype,atom1,atom2,atom3); + else ptr[n] = 0.0; + break; + case VARIABLE: + ptr[n] = input->variable->compute_equal(vvar[ivar]); + ivar++; + break; } } diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index adbbde1a0c..ccdd3ee77c 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -105,9 +105,9 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR,"Variable name for copute bond/local does not exist"); + error->all(FLERR,"Variable name for copute bond/local does not exist"); if (!input->variable->equalstyle(vvar[i])) - error->all(FLERR,"Variable for compute bond/local is invalid style"); + error->all(FLERR,"Variable for compute bond/local is invalid style"); } if (dstr) { @@ -168,7 +168,7 @@ void ComputeBondLocal::init() for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR,"Variable name for compute bond/local does not exist"); + error->all(FLERR,"Variable name for compute bond/local does not exist"); } if (dstr) { @@ -377,10 +377,10 @@ int ComputeBondLocal::compute_bonds(int flag) if (nvalues == 1) ptr = &vlocal[m]; else ptr = alocal[m]; - if (nvar) { - ivar = 0; - if (dstr) input->variable->internal_set(dvar,sqrt(rsq)); - } + if (nvar) { + ivar = 0; + if (dstr) input->variable->internal_set(dvar,sqrt(rsq)); + } for (n = 0; n < nvalues; n++) { switch (bstyle[n]) { @@ -408,10 +408,10 @@ int ComputeBondLocal::compute_bonds(int flag) case VELVIB: ptr[n] = vvib; break; - case VARIABLE: - ptr[n] = input->variable->compute_equal(vvar[ivar]); - ivar++; - break; + case VARIABLE: + ptr[n] = input->variable->compute_equal(vvar[ivar]); + ivar++; + break; } } } diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 36fad5cca1..3d0cea1add 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -71,7 +71,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : ids[nvalues] = NULL; if (strncmp(arg[iarg],"c_",2) == 0 || - strncmp(arg[iarg],"f_",2) == 0) { + strncmp(arg[iarg],"f_",2) == 0) { if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE; else if (arg[iarg][0] == 'f') which[nvalues] = FIX; @@ -123,15 +123,15 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : "does not calculate per-chunk values"); if (argindex[i] == 0) { - if (!modify->compute[icompute]->vector_flag) - error->all(FLERR,"Compute chunk/spread/atom compute " + if (!modify->compute[icompute]->vector_flag) + error->all(FLERR,"Compute chunk/spread/atom compute " "does not calculate global vector"); } else { - if (!modify->compute[icompute]->array_flag) - error->all(FLERR,"Compute chunk/spread/atom compute " + if (!modify->compute[icompute]->array_flag) + error->all(FLERR,"Compute chunk/spread/atom compute " "does not calculate global array"); - if (argindex[i] > modify->compute[icompute]->size_array_cols) - error->all(FLERR,"Compute chunk/spread/atom compute array " + if (argindex[i] > modify->compute[icompute]->size_array_cols) + error->all(FLERR,"Compute chunk/spread/atom compute array " "is accessed out-of-range"); } @@ -140,15 +140,15 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : if (ifix < 0) error->all(FLERR,"Fix ID for compute chunk/spread/atom does not exist"); if (argindex[i] == 0) { - if (!modify->fix[ifix]->vector_flag) - error->all(FLERR,"Compute chunk/spread/atom fix " + if (!modify->fix[ifix]->vector_flag) + error->all(FLERR,"Compute chunk/spread/atom fix " "does not calculate global vector"); } else { - if (!modify->fix[ifix]->array_flag) - error->all(FLERR,"Compute chunk/spread/atom fix " + if (!modify->fix[ifix]->array_flag) + error->all(FLERR,"Compute chunk/spread/atom fix " "does not calculate global array"); - if (argindex[i] > modify->fix[ifix]->size_array_cols) - error->all(FLERR,"Compute chunk/spread/atom fix array " + if (argindex[i] > modify->fix[ifix]->size_array_cols) + error->all(FLERR,"Compute chunk/spread/atom fix array " "is accessed out-of-range"); } } @@ -281,14 +281,14 @@ void ComputeChunkSpreadAtom::compute_peratom() compute->compute_vector(); compute->invoked_flag |= INVOKED_VECTOR; } - double *cvector = compute->vector; - for (i = 0; i < nlocal; i++, ptr += nstride) { - *ptr = 0.0; - if (!(mask[i] & groupbit)) continue; - index = ichunk[i]-1; - if (index < 0 || index >= nchunk) continue; - *ptr = cvector[index]; - } + double *cvector = compute->vector; + for (i = 0; i < nlocal; i++, ptr += nstride) { + *ptr = 0.0; + if (!(mask[i] & groupbit)) continue; + index = ichunk[i]-1; + if (index < 0 || index >= nchunk) continue; + *ptr = cvector[index]; + } } else { if (!(compute->invoked_flag & INVOKED_ARRAY)) { @@ -297,13 +297,13 @@ void ComputeChunkSpreadAtom::compute_peratom() } int icol = argindex[m]-1; double **carray = compute->array; - for (i = 0; i < nlocal; i++, ptr += nstride) { - *ptr = 0.0; - if (!(mask[i] & groupbit)) continue; - index = ichunk[i]-1; - if (index < 0 || index >= nchunk) continue; - *ptr = carray[index][icol]; - } + for (i = 0; i < nlocal; i++, ptr += nstride) { + *ptr = 0.0; + if (!(mask[i] & groupbit)) continue; + index = ichunk[i]-1; + if (index < 0 || index >= nchunk) continue; + *ptr = carray[index][icol]; + } } // access fix data, check if fix frequency is a match diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index 9e18d03f9f..9efdd61cb8 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -101,10 +101,10 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR, + error->all(FLERR, "Variable name for copute dihedral/local does not exist"); if (!input->variable->equalstyle(vvar[i])) - error->all(FLERR,"Variable for compute dihedral/local is invalid style"); + error->all(FLERR,"Variable for compute dihedral/local is invalid style"); } if (pstr) { @@ -154,7 +154,7 @@ void ComputeDihedralLocal::init() for (int i = 0; i < nvar; i++) { vvar[i] = input->variable->find(vstr[i]); if (vvar[i] < 0) - error->all(FLERR, + error->all(FLERR, "Variable name for compute dihedral/local does not exist"); } @@ -307,19 +307,19 @@ int ComputeDihedralLocal::compute_dihedrals(int flag) else ptr = alocal[m]; if (nvar) { - ivar = 0; - if (pstr) input->variable->internal_set(pvar,phi); + ivar = 0; + if (pstr) input->variable->internal_set(pvar,phi); } for (n = 0; n < nvalues; n++) { - switch (bstyle[n]) { - case PHI: - ptr[n] = 180.0*phi/MY_PI; - break; - case VARIABLE: - ptr[n] = input->variable->compute_equal(vvar[ivar]); - ivar++; - break; + switch (bstyle[n]) { + case PHI: + ptr[n] = 180.0*phi/MY_PI; + break; + case VARIABLE: + ptr[n] = input->variable->compute_equal(vvar[ivar]); + ivar++; + break; } } diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 862a66e3f9..0b57840696 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -141,7 +141,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_mu; - } else if (strcmp(arg[iarg],"spx") == 0) { // pack magnetic variables + } else if (strcmp(arg[iarg],"spx") == 0) { // pack magnetic variables if (!atom->sp_flag) error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h index 0c1ed7e305..eb002457fb 100644 --- a/src/compute_property_atom.h +++ b/src/compute_property_atom.h @@ -84,7 +84,9 @@ class ComputePropertyAtom : public Compute { void pack_radius(int); void pack_diameter(int); - void pack_spx(int); // pack magnetic variables + // pack magnetic variables + + void pack_spx(int); void pack_spy(int); void pack_spz(int); void pack_sp(int); diff --git a/src/memory.h b/src/memory.h index df942387fa..b5d70b977f 100644 --- a/src/memory.h +++ b/src/memory.h @@ -443,44 +443,44 @@ class Memory : protected Pointers { template TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4, - const char *name) + const char *name) { - if (array == NULL) return create(array, n1, n2, n3, n4, name); + if (array == NULL) return create(array, n1, n2, n3, n4, name); - bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; - TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name); - nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3; - TYPE **cube = (TYPE **)srealloc(array[0][0], nbytes, name); - nbytes = ((bigint) sizeof(TYPE **)) * n1*n2; - TYPE ***plane = (TYPE ***)srealloc(array[0], nbytes, name); - nbytes = ((bigint) sizeof(TYPE ***)) * n1; - array = (TYPE ****)srealloc(array, nbytes, name); + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; + TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name); + nbytes = ((bigint) sizeof(TYPE *)) * n1*n2*n3; + TYPE **cube = (TYPE **)srealloc(array[0][0], nbytes, name); + nbytes = ((bigint) sizeof(TYPE **)) * n1*n2; + TYPE ***plane = (TYPE ***)srealloc(array[0], nbytes, name); + nbytes = ((bigint) sizeof(TYPE ***)) * n1; + array = (TYPE ****)srealloc(array, nbytes, name); - int i, j, k; - bigint m1, m2; - bigint n = 0; - for (i = 0; i < n1; i++) { - m2 = ((bigint)i) * n2; - array[i] = &plane[m2]; - for (j = 0; j < n2; j++) { - m1 = ((bigint)i) * n2 + j; - m2 = ((bigint)i) * n2*n3 + j*n3; - plane[m1] = &cube[m2]; - for (k = 0; k < n3; k++) { - m1 = ((bigint)i) * n2*n3 + j*n3 + k; - cube[m1] = &data[n]; - n += n4; - } - } - } - return array; + int i, j, k; + bigint m1, m2; + bigint n = 0; + for (i = 0; i < n1; i++) { + m2 = ((bigint)i) * n2; + array[i] = &plane[m2]; + for (j = 0; j < n2; j++) { + m1 = ((bigint)i) * n2 + j; + m2 = ((bigint)i) * n2*n3 + j*n3; + plane[m1] = &cube[m2]; + for (k = 0; k < n3; k++) { + m1 = ((bigint)i) * n2*n3 + j*n3 + k; + cube[m1] = &data[n]; + n += n4; + } + } + } + return array; } template TYPE *****grow(TYPE *****&array, int n1, int n2, int n3, int n4, - const char *name) + const char *name) { - fail(name); return NULL; + fail(name); return NULL; } /* ----------------------------------------------------------------------