diff --git a/src/atom.cpp b/src/atom.cpp index a850c66f587176a4f627f6e182f99ac0193876ed..2280943a33b0f13cc6c42c4982e2ab8dabeb5a96 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -620,7 +620,7 @@ int Atom::count_words(const char *line) strcpy(copy,line); char *ptr; - if (ptr = strchr(copy,'#')) *ptr = '\0'; + if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); diff --git a/src/dump.cpp b/src/dump.cpp index a94ba4af92d476713137782904f6034bff666ccf..878304addfec5af01a1e9b5444fafe227724a9c3 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -105,7 +105,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) multiname = NULL; char *ptr; - if (ptr = strchr(filename,'%')) { + if ((ptr = strchr(filename,'%'))) { if (strstr(style,"mpiio")) error->all(FLERR, "Dump file MPI-IO output not allowed with % in filename"); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index c7bfd868d45f6a626a3218fcbb778a8a091e30d1..1c2326b474a474673d73f4f7febb8bf1b76f5d3d 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -969,14 +969,14 @@ int DumpImage::modify_param(int narg, char **arg) int ncount = 1; char *nextptr; char *ptr = arg[2]; - while (nextptr = strchr(ptr,'/')) { + while ((nextptr = strchr(ptr,'/'))) { ptr = nextptr + 1; ncount++; } char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while (ptrs[ncount++] = strtok(NULL,"/")); + while ((ptrs[ncount++] = strtok(NULL,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1029,14 +1029,14 @@ int DumpImage::modify_param(int narg, char **arg) int ncount = 1; char *nextptr; char *ptr = arg[2]; - while (nextptr = strchr(ptr,'/')) { + while ((nextptr = strchr(ptr,'/'))) { ptr = nextptr + 1; ncount++; } char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while (ptrs[ncount++] = strtok(NULL,"/")); + while ((ptrs[ncount++] = strtok(NULL,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types diff --git a/src/fix_move.cpp b/src/fix_move.cpp index ca0f84cdcaabeb16f6bdb38f04a0d43e004c06a8..c39646fee069f7e81c1fce529c9b47a5d90932bb 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -752,7 +752,7 @@ void FixMove::final_integrate() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (xflag) + if (xflag) { if (rmass) { dtfm = dtf / rmass[i]; v[i][0] += dtfm * f[i][0]; @@ -760,8 +760,9 @@ void FixMove::final_integrate() dtfm = dtf / mass[type[i]]; v[i][0] += dtfm * f[i][0]; } + } - if (yflag) + if (yflag) { if (rmass) { dtfm = dtf / rmass[i]; v[i][1] += dtfm * f[i][1]; @@ -769,8 +770,9 @@ void FixMove::final_integrate() dtfm = dtf / mass[type[i]]; v[i][1] += dtfm * f[i][1]; } + } - if (zflag) + if (zflag) { if (rmass) { dtfm = dtf / rmass[i]; v[i][2] += dtfm * f[i][2]; @@ -778,6 +780,7 @@ void FixMove::final_integrate() dtfm = dtf / mass[type[i]]; v[i][2] += dtfm * f[i][2]; } + } } } } diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 0d456cd04e147d55bf651caf3335adb32ee302fe..a63f3d322b3621d007c4215a2cc1fc4556f57535 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -1534,20 +1534,22 @@ double FixNH::compute_vector(int n) n -= ilen; } else if (pstyle == ANISO) { ilen = 3; - if (n < ilen) + if (n < ilen) { if (p_flag[n]) return p_hydro*(volume-vol0) / (pdim*nktv2p); else return 0.0; + } n -= ilen; } else { ilen = 6; - if (n < ilen) + if (n < ilen) { if (n > 2) return 0.0; else if (p_flag[n]) return p_hydro*(volume-vol0) / (pdim*nktv2p); else return 0.0; + } n -= ilen; } @@ -1558,17 +1560,19 @@ double FixNH::compute_vector(int n) n -= ilen; } else if (pstyle == ANISO) { ilen = 3; - if (n < ilen) + if (n < ilen) { if (p_flag[n]) return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n]; else return 0.0; + } n -= ilen; } else { ilen = 6; - if (n < ilen) + if (n < ilen) { if (p_flag[n]) return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n]; else return 0.0; + } n -= ilen; } @@ -2139,7 +2143,7 @@ void FixNH::nh_omega_dot() if (deviatoric_flag) compute_deviatoric(); mtk_term1 = 0.0; - if (mtk_flag) + if (mtk_flag) { if (pstyle == ISO) { mtk_term1 = tdof * boltz * t_current; mtk_term1 /= pdim * atom->natoms; @@ -2150,6 +2154,7 @@ void FixNH::nh_omega_dot() mtk_term1 += mvv_current[i]; mtk_term1 /= pdim * atom->natoms; } + } for (int i = 0; i < 3; i++) if (p_flag[i]) { diff --git a/src/molecule.cpp b/src/molecule.cpp index ea1fa6b73a48dc9f854b1049e1e70b31491a591b..3fe25e6195603aed18cb0abbef003bac4e3a77f4 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -313,7 +313,7 @@ void Molecule::read(int flag) // trim anything from '#' onward // if line is blank, continue - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") == strlen(line)) continue; // search line for header keywords and set corresponding variable @@ -1325,7 +1325,7 @@ int Molecule::parse(char *line, char **words, int max) int nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while (ptr = strtok(NULL," \t\n\r\f")) { + while ((ptr = strtok(NULL," \t\n\r\f"))) { if (nwords < max) words[nwords] = ptr; nwords++; } diff --git a/src/neigh_respa.cpp b/src/neigh_respa.cpp index 239db4b2496a2f56507a2ff3ca203b7c564dc3ec..91f85de6ea412e9432da56ff8c87471de3c167c7 100644 --- a/src/neigh_respa.cpp +++ b/src/neigh_respa.cpp @@ -131,7 +131,7 @@ void Neighbor::respa_nsq_no_newton(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -309,7 +309,7 @@ void Neighbor::respa_nsq_newton(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -478,7 +478,7 @@ void Neighbor::respa_bin_no_newton(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -651,7 +651,7 @@ void Neighbor::respa_bin_newton(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -695,7 +695,7 @@ void Neighbor::respa_bin_newton(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -873,7 +873,7 @@ void Neighbor::respa_bin_newton_tri(NeighList *list) tag[j]-tagprev); else which = 0; if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; diff --git a/src/procmap.cpp b/src/procmap.cpp index 6703b08d25477d8dd87bb1fa4365e89b34217f11..b24e59421bfe2768def2c0f69fea1d4effbf86a2 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -291,7 +291,7 @@ void ProcMap::custom_grid(char *cfile, int nprocs, if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); while (1) { - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); diff --git a/src/read_data.cpp b/src/read_data.cpp index 44def025dffdb40031f50c12eb37712c0794a9c8..5f3633ddbdb687c9a4634a50ec6eba0ddaf3fd89 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -619,7 +619,7 @@ void ReadData::header() // trim anything from '#' onward // if line is blank, continue - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") == strlen(line)) continue; // allow special fixes first chance to match and process the line @@ -1556,7 +1556,7 @@ void ReadData::skip_lines(bigint n) void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag) { char *ptr; - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; narg = 0; char *word = strtok(line," \t\n\r\f"); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 978b2d2bc98b850a8af0ba1f999193736abdabf5..aeeec98e26eff479ff1c06e7cdf12bdb21f09194 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -549,7 +549,7 @@ void ReadRestart::file_search(char *infile, char *outfile) char *pattern = new char[strlen(filename) + 16]; - if (ptr = strchr(filename,'%')) { + if ((ptr = strchr(filename,'%'))) { *ptr = '\0'; sprintf(pattern,"%s%s%s",filename,"base",ptr+1); *ptr = '%'; @@ -574,7 +574,7 @@ void ReadRestart::file_search(char *infile, char *outfile) DIR *dp = opendir(dirname); if (dp == NULL) error->one(FLERR,"Cannot open dir to search for restart file"); - while (ep = readdir(dp)) { + while ((ep = readdir(dp))) { if (strstr(ep->d_name,begin) != ep->d_name) continue; if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue; if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); diff --git a/src/universe.cpp b/src/universe.cpp index 35d8f2cf24e56253bea3e4242f1fb11464bb51db..d1665599cfcf943bbe6f84e4f6d903baa1a74526 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -100,7 +100,7 @@ void Universe::reorder(char *style, char *arg) if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); while (1) { - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); diff --git a/src/variable.cpp b/src/variable.cpp index a6f5c6915885e0330ae2199dc72afa1d935d148a..b13b4d95157011ce0e33383a891861de5179f1c9 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4088,7 +4088,7 @@ int VarReader::read_scalar(char *str) else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline - if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment + if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank n = strlen(str) + 1; break; @@ -4131,7 +4131,7 @@ int VarReader::read_peratom() else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline - if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment + if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank n = strlen(str) + 1; break; diff --git a/src/write_data.cpp b/src/write_data.cpp index c3b038ee413ac33db88d9080446d8de80efaa870..899edacdc2736b8ccea0687e1c60dc2ad3b87258 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -65,7 +65,7 @@ void WriteData::command(int narg, char **arg) int n = strlen(arg[0]) + 16; char *file = new char[n]; - if (ptr = strchr(arg[0],'*')) { + if ((ptr = strchr(arg[0],'*'))) { *ptr = '\0'; sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]); @@ -152,11 +152,11 @@ void WriteData::write(char *file) // sum up bond,angle counts // may be different than atom->nbonds,nangles if broken/turned-off - if (atom->molecular == 1 && atom->nbonds || atom->nbondtypes) { + if (atom->molecular == 1 && (atom->nbonds || atom->nbondtypes)) { nbonds_local = atom->avec->pack_bond(NULL); MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); } - if (atom->molecular == 1 && atom->nangles || atom->nangletypes) { + if (atom->molecular == 1 && (atom->nangles || atom->nangletypes)) { nangles_local = atom->avec->pack_angle(NULL); MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); } diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 422462c2bd8dbecc238e90f08b1db6d2f123c0be..5c5bd066ed48d00abcbb47b7836dcdb52d0e8a34 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -89,7 +89,7 @@ void WriteRestart::command(int narg, char **arg) int n = strlen(arg[0]) + 16; char *file = new char[n]; - if (ptr = strchr(arg[0],'*')) { + if ((ptr = strchr(arg[0],'*'))) { *ptr = '\0'; sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]);