diff --git a/src/DPD-REACT/fix_eos_table.cpp b/src/DPD-REACT/fix_eos_table.cpp index c9c23b51f8..61b4e7501a 100644 --- a/src/DPD-REACT/fix_eos_table.cpp +++ b/src/DPD-REACT/fix_eos_table.cpp @@ -207,7 +207,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index b39e029c3e..5e950642d3 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -321,7 +321,7 @@ void FixEOStableRX::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -427,7 +427,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index f21914e2d5..165a3a6dbf 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -255,7 +255,7 @@ void FixRX::post_constructor() int eof = 0; char * word; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -804,7 +804,7 @@ void FixRX::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -858,7 +858,7 @@ void FixRX::read_file(char *file) nreactions=0; sign = -1.0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -1155,7 +1155,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/, // compute ydot at t=t0 rhs (t, y, ydot, v_params); - while (1) + while (true) { // Estimate y'' with finite-difference ... @@ -1254,7 +1254,7 @@ void FixRX::odeDiagnostics() double max_per_proc[numCounters]; double min_per_proc[numCounters]; - if (1) + if (true) { static bool firstStep = true; @@ -1285,7 +1285,7 @@ void FixRX::odeDiagnostics() printf("me= %d nst= %g nfc= %g time= %g nlocal= %g lmpnst= %g weight_idx= %d 1st= %d aveNeigh= %g\n", comm->me, this->diagnosticCounter[0], this->diagnosticCounter[1], this->diagnosticCounter[2], this->diagnosticCounter[3], this->diagnosticCounter[4], rx_weight_index, firstStep, averageNumNeighbors); - if (rx_weight_index != -1 && !firstStep && 0) + if (rx_weight_index != -1 && !firstStep && false) { double *rx_weight = atom->dvector[rx_weight_index]; diff --git a/src/DPD-REACT/pair_exp6_rx.cpp b/src/DPD-REACT/pair_exp6_rx.cpp index b0b9f97ca2..313e9f2583 100644 --- a/src/DPD-REACT/pair_exp6_rx.cpp +++ b/src/DPD-REACT/pair_exp6_rx.cpp @@ -731,7 +731,7 @@ void PairExp6rx::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -838,7 +838,7 @@ void PairExp6rx::read_file2(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 9f5e494991..4aaea3f81b 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -356,7 +356,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index c386abded4..eac047d9f7 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -496,7 +496,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/EXTRA-FIX/fix_gle.cpp b/src/EXTRA-FIX/fix_gle.cpp index 8f31613188..de225c6980 100644 --- a/src/EXTRA-FIX/fix_gle.cpp +++ b/src/EXTRA-FIX/fix_gle.cpp @@ -234,7 +234,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : char line[MAXLINE],*ptr; int n,nwords,ndone=0,eof=0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); if (ptr == nullptr) { @@ -300,7 +300,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ndone = eof = 0; const double cfac = force->boltz / force->mvv2e; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); if (ptr == nullptr) { diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index b73593b1d7..4c83e13a7b 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -851,7 +851,7 @@ void FixPour::xyz_random(double h, double *coord) coord[2] = h; } else { double r1,r2; - while (1) { + while (true) { r1 = random->uniform() - 0.5; r2 = random->uniform() - 0.5; if (r1*r1 + r2*r2 < 0.25) break; diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 9a3aee87c0..74ac40198c 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -293,7 +293,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con char line[MAXLINE], *ptr; int n, eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line, MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 9d3a06f18e..06d90e5d0e 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -983,7 +983,7 @@ void PPPM::set_grid_global() h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimensions diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 16e06ed13e..abadcc52be 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -783,7 +783,7 @@ void PPPMDipole::set_grid_global() h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimension diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index fa14cb23f0..85aceb8500 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -1471,7 +1471,7 @@ int PPPMDisp::qr_alg(double **A, double **Q, int n) // start loop for the matrix factorization int count = 0; int countmax = 100000; - while (1) { + while (true) { // make a Wilkinson shift an1 = A[n-2][n-2]; an = A[n-1][n-1]; @@ -2645,7 +2645,7 @@ void PPPMDisp::set_grid() if (!gridflag) { h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimension @@ -3663,7 +3663,7 @@ void PPPMDisp::set_n_pppm_6() // decrease grid spacing until required precision is obtained int count = 0; - while (1) { + while (true) { // set grid dimension nx_pppm_6 = static_cast (xprd/h_x); diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.cpp b/src/MANIFOLD/fix_nve_manifold_rattle.cpp index b4644a1350..8c3a9205e9 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nve_manifold_rattle.cpp @@ -498,7 +498,7 @@ void FixNVEManifoldRattle::rattle_manifold_x(double *x, double *v, const double c_inv = 1.0 / c; - while (1) { + while (true) { v[0] = vt[0] - l*no_dt[0]; v[1] = vt[1] - l*no_dt[1]; v[2] = vt[2] - l*no_dt[2]; diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index 51b38037ab..af2314b8b9 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -789,7 +789,7 @@ void PairEDIP::read_file(char *file) char line[MAXLINE], *ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line, MAXLINE, fp); if (ptr == nullptr) { diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index 3cabec4505..8017fa4f8e 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -602,7 +602,7 @@ void PairEDIPMulti::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/MANYBODY/pair_extep.cpp b/src/MANYBODY/pair_extep.cpp index bc96a40c57..68db444f31 100644 --- a/src/MANYBODY/pair_extep.cpp +++ b/src/MANYBODY/pair_extep.cpp @@ -540,7 +540,7 @@ void PairExTeP::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -669,7 +669,7 @@ void PairExTeP::read_file(char *file) F_corr_data[iel][jel][in][jn][ivar]=0; // loop until EOF - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); //fputs(line,stdout); diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 3c6f08a7e7..547fc75154 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -935,7 +935,7 @@ void PairLCBOP::read_file(char *filename) // skip initial comment lines - while (1) { + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } @@ -971,7 +971,7 @@ void PairLCBOP::read_file(char *filename) utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&eps); utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&delta); - while (1) { + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } @@ -988,7 +988,7 @@ void PairLCBOP::read_file(char *filename) &F_conj_data[i][2][k][l], &F_conj_data[i][3][k][l]); } - while (1) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } } } diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index 4be739d187..5194c44189 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -200,7 +200,7 @@ void MDIEngine::command(int narg, char ** /*arg*/) char *command; - while (1) { + while (true) { // mdi/engine command only recognizes three nodes // DEFAULT, INIT_MD, INIT_OPTG @@ -265,7 +265,7 @@ char *MDIEngine::mdi_md() // run MD one step at a time - while (1) { + while (true) { update->whichflag = 1; timer->init_timeout(); update->nsteps += 1; diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index b69d17f0a9..e8c6c942a4 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -517,7 +517,7 @@ void PairMEAM::read_user_meam_file(const std::string &userfile) char * line = nullptr; char buffer[MAXLINE]; - while (1) { + while (true) { int which; int nindex, index[3]; double value; diff --git a/src/MESONT/pair_mesont_tpm.cpp b/src/MESONT/pair_mesont_tpm.cpp index 425722a569..293e9d02f5 100644 --- a/src/MESONT/pair_mesont_tpm.cpp +++ b/src/MESONT/pair_mesont_tpm.cpp @@ -197,7 +197,7 @@ MESONTList::MESONTList(const Atom* atom, const NeighList* nblist) { index_list.push_back(i); index_list_b[i] = index_list.size() - 1; int idx = i; - while (1) { + while (true) { idx = chain_list[idx][1]; if (idx == cnt_end || idx == domain_end) break; else index_list.push_back(idx); diff --git a/src/MGPT/mgpt_readpot.cpp b/src/MGPT/mgpt_readpot.cpp index df62bf735d..dd196142f5 100644 --- a/src/MGPT/mgpt_readpot.cpp +++ b/src/MGPT/mgpt_readpot.cpp @@ -131,7 +131,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub exit(1); } - if (0) { + if (false) { printf("Before sort:\n"); for (int i = 0; i nvol = %d, vol0 = %.6f, x0= %.6f, x1 = %.6f, dx = %.6f\n", nvol,vol0,x0,x1,dx); } @@ -408,7 +408,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl double vpair_tmp = vpairtab[i*nr+j]; vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; - if (0) if (fabs(vol-ivol) < 0.01) { + if (false) if (fabs(vol-ivol) < 0.01) { static FILE *xfile = nullptr; if (j == 0) { xfile = fopen("mgpt5-pot.dat","w"); @@ -487,7 +487,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl evalspline(nx-1,x0,x1,C,x,&evol0,&devol0,&unused); devol0 *= dxdv; - if (1) { + if (true) { printf("%% READPOT PARAMETERS:\n"); printf("%% ddl = %15.5e %15.5e %15.5e %15.5e\n",ddl[1],ddl[2],ddl[3],ddl[4]); diff --git a/src/MGPT/mgpt_splinetab.cpp b/src/MGPT/mgpt_splinetab.cpp index e31572fe50..fd6d4541c2 100644 --- a/src/MGPT/mgpt_splinetab.cpp +++ b/src/MGPT/mgpt_splinetab.cpp @@ -105,7 +105,7 @@ void evalspline(int n,double x0,double x1,double C[][4], xhat = xhat - idx; p = C[idx]; - if (0) { + if (false) { *y = p[0] + xhat*(p[1] + xhat*(p[2] + xhat*p[3])); *dy = p[1] + xhat*(2*p[2] + xhat*3*p[3]); diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index 2bea1273c6..fde6fc7084 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -191,7 +191,7 @@ static inline double mtrace(int n,double A[8][8],double B[8][8]) { void PairMGPT::make_triplet(bond_data *ij_bond,bond_data *ik_bond, triplet_data *triptr) { - if (1) { + if (true) { const trmul_fun tr_mul = linalg.tr_mul; tr_mul(&(ij_bond->H.m[1][0]), &(ik_bond->H.m[1][0]) ,&(triptr->H1H2.m[1][0]) ); tr_mul(&(ij_bond->Hx.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1xH2.m[1][0])); @@ -289,7 +289,7 @@ double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if (0) { /* This bond doesn't change when i is perturbed */ + if (false) { /* This bond doesn't change when i is perturbed */ make_bond(xx,j,k,&Bjk); } make_bond(xx,k,i,&Bki); @@ -341,7 +341,7 @@ double PairMGPT::numderiv4(double xx[][3],int i,int j,int k,int m,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if (0) { /* Only the i coordinates changed... */ + if (false) { /* Only the i coordinates changed... */ make_bond(xx,j,k,&Bjk); make_bond(xx,k,m,&Bkm); } @@ -438,7 +438,7 @@ void PairMGPT::force_debug_4(double xx[][3], for (int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k,m */ double ndfi,ndfj,ndfk,ndfm; - if (1) { + if (true) { double ndf[] = {0.0,0.0,0.0,0.0}; for (int s = 0; s<4; s++) for (int t = 0; t<4; t++) @@ -765,7 +765,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, int c_p = 0, c_t = 0, c_q = 0; - if (0) + if (false) if (domain->triclinic) { if (comm->me == 0) printf("Can not handle triclinic box yet\n"); @@ -1690,7 +1690,7 @@ void PairMGPT::compute(int eflag, int vflag) compute_x(listfull->numneigh,listfull->firstneigh,&e_s,&e_p,&e_t,&e_q,evflag,newton_pair); - if (0) { // Stupid force calculation / verification + if (false) { // Stupid force calculation / verification int ii,nmax=-1; for (ii = 0; iiinum + listfull->gnum; ii++) { int i = listfull->ilist[ii]; @@ -1768,7 +1768,7 @@ void PairMGPT::compute(int eflag, int vflag) } - if (0) { + if (false) { printf("\nForces MGPT:\n"); const int iimax = (listfull->inum < 10) ? listfull->inum : 10; for (int ii = 0; iime == 0) { ptr = fgets(line,MAXLINE,fpparam); if (ptr == nullptr) { diff --git a/src/ML-IAP/mliap_descriptor_so3.cpp b/src/ML-IAP/mliap_descriptor_so3.cpp index d816bd0638..e8bedea377 100644 --- a/src/ML-IAP/mliap_descriptor_so3.cpp +++ b/src/ML-IAP/mliap_descriptor_so3.cpp @@ -93,7 +93,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename) int eof = 0; int n, nwords; - while (1) { + while (true) { if (comm->me == 0) { ptr = utils::fgets_trunc(line, MAXLINE, fpparam); if (ptr == nullptr) { diff --git a/src/ML-IAP/mliap_model_nn.cpp b/src/ML-IAP/mliap_model_nn.cpp index 10ef97300e..853f1d9c6c 100644 --- a/src/ML-IAP/mliap_model_nn.cpp +++ b/src/ML-IAP/mliap_model_nn.cpp @@ -125,7 +125,7 @@ void MLIAPModelNN::read_coeffs(char *coefffilename) int ielem = 0; int l = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); if (ptr == nullptr) { diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index fbc54e745f..3e97b638dc 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -440,7 +440,7 @@ void PairRANN::read_mass(const std::vector &line1, const std::vecto if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before mass in potential file."); for (int i=0;i line,std::vector l if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before fingerprints per element in potential file."); for (i=0;i line,std::vectorn_body_type!=nwords-1) {error->one(filename,linenum,"invalid fingerprint for element combination");} k++; - fingerprints[i][i1]->init(atomtypes,utils::inumeric(filename,linenum,line1[k++].c_str(),1,lmp)); + fingerprints[i][i1]->init(atomtypes,utils::inumeric(filename,linenum,line1[k++].c_str(),true,lmp)); fingerprintcount[i]++; } delete[] atomtypes; @@ -523,7 +523,7 @@ void PairRANN::read_fingerprint_constants(std::vector line,std::vec for (j=0;jatomtypes[j]!=atomtypes[j]) {break;} if (j==n_body_type-1) { - if (line[nwords-3].compare(fingerprints[i][k]->style)==0 && utils::inumeric(filename,linenum,line[nwords-2].c_str(),1,lmp)==fingerprints[i][k]->id) { + if (line[nwords-3].compare(fingerprints[i][k]->style)==0 && utils::inumeric(filename,linenum,line[nwords-2].c_str(),true,lmp)==fingerprints[i][k]->id) { found=true; i1 = k; break; @@ -542,7 +542,7 @@ void PairRANN::read_network_layers(std::vector line,std::vectorone(filename,linenum-1,"atom types must be defined before network layers in potential file."); for (i=0;ione(filename,linenum,"invalid number of network layers"); delete[] net[i].dimensions; weightdefined[i] = new bool [net[i].layers]; @@ -570,9 +570,9 @@ void PairRANN::read_layer_size(std::vector line,std::vectorone(filename,linenum-1,"networklayers for each atom type must be defined before the corresponding layer sizes."); - int j = utils::inumeric(filename,linenum,line[2].c_str(),1,lmp); + int j = utils::inumeric(filename,linenum,line[2].c_str(),true,lmp); if (j>=net[i].layers || j<0) {error->one(filename,linenum,"invalid layer in layer size definition");}; - net[i].dimensions[j]= utils::inumeric(filename,linenum,line1[0].c_str(),1,lmp); + net[i].dimensions[j]= utils::inumeric(filename,linenum,line1[0].c_str(),true,lmp); return; } } @@ -587,7 +587,7 @@ void PairRANN::read_weight(std::vector line,std::vectorone(filename,*linenum-1,"networklayers must be defined before weights."); - i=utils::inumeric(filename,*linenum,line[2].c_str(),1,lmp); + i=utils::inumeric(filename,*linenum,line[2].c_str(),true,lmp); if (i>=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid weight layer"); if (net[l].dimensions[i]==0 || net[l].dimensions[i+1]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding weight"); net[l].Weights[i] = new double[net[l].dimensions[i]*net[l].dimensions[i+1]]; @@ -595,7 +595,7 @@ void PairRANN::read_weight(std::vector line,std::vectorone(filename,*linenum,"invalid weights per line"); for (k=0;k line,std::vectorone(filename,*linenum,"invalid weights per line"); for (k=0;k line,std::vector for (l=0;lone(filename,*linenum-1,"networklayers must be defined before biases."); - i=utils::inumeric(filename,*linenum,line[2].c_str(),1,lmp); + i=utils::inumeric(filename,*linenum,line[2].c_str(),true,lmp); if (i>=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid bias layer"); if (net[l].dimensions[i]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding bias"); biasdefined[l][i] = true; net[l].Biases[i] = new double[net[l].dimensions[i+1]]; - net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); + net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),true,lmp); for (j=1;jone(filename,*linenum,"unexpected end of potential file!"); (*linenum)++; Tokenizer values1 = Tokenizer(linetemp,": ,\t_\n"); line1 = values1.as_vector(); - net[l].Biases[i][j] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); + net[l].Biases[i][j] = utils::numeric(filename,*linenum,line1[0].c_str(),true,lmp); } return; } @@ -680,10 +680,10 @@ void PairRANN::read_screening(std::vector line,std::vectorone(filename,linenum-1,"unrecognized screening keyword"); delete[] atomtypes; diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index d6da639734..1eb078bc61 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -640,7 +640,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) } eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); if (ptr == nullptr) { diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index fdd8ef7a18..201e40b5b8 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -954,7 +954,7 @@ void FixPOEMS::readfile(char *file) int nlocal = atom->nlocal; int i,id,nlen; - while (1) { + while (true) { if (me == 0) nlen = readline(fp,&line,&maxline); MPI_Bcast(&nlen,1,MPI_INT,0,world); if (nlen == 0) break; @@ -986,7 +986,7 @@ int FixPOEMS::readline(FILE *fp, char **pline, int *pmaxline) char *line = *pline; int maxline = *pmaxline; - while (1) { + while (true) { if (n+1 >= maxline) { maxline += DELTA; memory->grow(line,maxline,"fix_poems:line"); @@ -1246,7 +1246,7 @@ int FixPOEMS::loopcheck(int nvert, int nedge, tagint **elist) int *stack = new int[nvert]; ncluster = 0; - while (1) { + while (true) { for (i = 0; i < nvert; i++) if (mark[i] == 0) break; if (i == nvert) break; diff --git a/src/PTM/ptm_convex_hull_incremental.cpp b/src/PTM/ptm_convex_hull_incremental.cpp index 580d88c578..23b8e3a89d 100644 --- a/src/PTM/ptm_convex_hull_incremental.cpp +++ b/src/PTM/ptm_convex_hull_incremental.cpp @@ -263,7 +263,7 @@ int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, int ret = 0; int num_prev = ch->num_prev; ch->num_prev = num_points; - if (!ch->ok || 0) + if (!ch->ok || false) { ret = initialize_convex_hull(num_points, points, ch->facets, ch->plane_normal, ch->processed, ch->initial_vertices, ch->barycentre); if (ret != 0) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 79205f7c81..51262d7dc7 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -763,7 +763,7 @@ void FixQEq::read_file(char *file) " {}", file,utils::getsyserror())); TextFileReader reader(fp, "qeq parameter"); - while (1) { + while (true) { auto values = reader.next_values(0); if (values.count() == 0) continue; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index bddeb330e4..d106c858b4 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -3763,7 +3763,7 @@ void FixBondReact::read(int myrxn) // stop when read an unrecognized line ncreate = 0; - while (1) { + while (true) { readline(line); diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 3c8e808f93..a839469d35 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -416,12 +416,12 @@ void FixReaxFFSpecies::FindMolecule () } loop = 0; - while (1) { + while (true) { comm->forward_comm_fix(this); loop ++; change = 0; - while (1) { + while (true) { done = 1; for (ii = 0; ii < inum; ii++) { diff --git a/src/REAXFF/reaxff_allocate.cpp b/src/REAXFF/reaxff_allocate.cpp index cbb53420ba..b81b8ed222 100644 --- a/src/REAXFF/reaxff_allocate.cpp +++ b/src/REAXFF/reaxff_allocate.cpp @@ -232,13 +232,13 @@ namespace ReaxFF { reallocate_data *wsr = &(workspace->realloc); if (system->n >= DANGER_ZONE * system->local_cap || - (0 && system->n <= LOOSE_ZONE * system->local_cap)) { + (false && system->n <= LOOSE_ZONE * system->local_cap)) { system->local_cap = MAX((int)(system->n * safezone), mincap); } int Nflag = 0; if (system->N >= DANGER_ZONE * system->total_cap || - (0 && system->N <= LOOSE_ZONE * system->total_cap)) { + (false && system->N <= LOOSE_ZONE * system->total_cap)) { Nflag = 1; system->total_cap = MAX((int)(system->N * safezone), mincap); } @@ -272,7 +272,7 @@ namespace ReaxFF { if (control->hbond_cut > 0) { Hflag = 0; if (system->numH >= DANGER_ZONE * system->Hcap || - (0 && system->numH <= LOOSE_ZONE * system->Hcap)) { + (false && system->numH <= LOOSE_ZONE * system->Hcap)) { Hflag = 1; system->Hcap = int(MAX(system->numH * saferzone, mincap)); } diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index 2020e8a5c3..3ee7614366 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -81,7 +81,7 @@ namespace ReaxFF { LAMMPS_NS::TextFileReader reader(control_file, "ReaxFF control"); reader.ignore_comments = false; - while (1) { + while (true) { auto values = reader.next_values(0); // empty line diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index ba91644c53..b506ef4f4a 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -980,7 +980,7 @@ void FixHyperLocal::build_bond_list(int natom) "hyper/local:clist"); } - while (1) { + while (true) { if (firstflag) break; for (i = 0; i < nall; i++) numcoeff[i] = 0; for (i = 0; i < nall; i++) clist[i] = nullptr; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 8cfc4b5c24..e730aac351 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -392,7 +392,7 @@ void NEB::readfile(char *file, int flag) if (flag == 0) { if (me_universe == 0) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; @@ -408,7 +408,7 @@ void NEB::readfile(char *file, int flag) if (me == 0) { if (ireplica) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index db9767d01e..9c39518508 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -2281,7 +2281,7 @@ void FixRigid::readfile(int which, double *vec, if (fp == nullptr) error->one(FLERR,"Cannot open fix rigid file {}: {}", inpfile,utils::getsyserror()); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 0ef05d926c..5db24a96d5 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -2451,7 +2451,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (fp == nullptr) error->one(FLERR,"Cannot open fix rigid/small file {}: {}", inpfile,utils::getsyserror()); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid/small file"); diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 1c987f8e7e..0ed3ad28c3 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -387,7 +387,7 @@ void NEBSpin::readfile(char *file, int flag) if (flag == 0) { if (me_universe == 0) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; @@ -401,7 +401,7 @@ void NEBSpin::readfile(char *file, int flag) if (me == 0) { if (ireplica) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index f1e17eaa24..48d7d55663 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -1433,7 +1433,7 @@ void FixSRD::collisions_multi() jlast = -1; dt = dt_big; - while (1) { + while (true) { nbig = nbinbig[ibin]; if (ibounce == 0) ncheck += nbig; @@ -2263,7 +2263,7 @@ void FixSRD::slip(double *vs, double *vb, double *xb, Big *big, double *xsurf, d double tangent[3], vsurf[3]; double *omega = big->omega; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); @@ -2319,7 +2319,7 @@ void FixSRD::slip_wall(double *vs, int iwall, double *norm, double *vsnew) tangent2[1] = norm[2] * tangent1[0] - norm[0] * tangent1[2]; tangent2[2] = norm[0] * tangent1[1] - norm[1] * tangent1[0]; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); @@ -2370,7 +2370,7 @@ void FixSRD::noslip(double *vs, double *vb, double *xb, Big *big, int iwall, dou tangent2[1] = norm[2] * tangent1[0] - norm[0] * tangent1[2]; tangent2[2] = norm[0] * tangent1[1] - norm[1] * tangent1[0]; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); diff --git a/src/atom.cpp b/src/atom.cpp index 796c0ba156..8bf361ab95 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1904,7 +1904,7 @@ void Atom::add_molecule(int narg, char **arg) int ifile = 1; int index = 1; - while (1) { + while (true) { molecules = (Molecule **) memory->srealloc(molecules,(nmolecule+1)*sizeof(Molecule *), "atom::molecules"); diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index a1ef126069..6308153be6 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -105,7 +105,7 @@ void AtomVecBody::process_args(int narg, char **arg) if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); - if (0) { + if (false) { bptr = nullptr; #define BODY_CLASS diff --git a/src/balance.cpp b/src/balance.cpp index bd3ba007ef..3f325dffe6 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -930,7 +930,7 @@ int Balance::shift() // else add split I-1 or J+1 to set and try again // delta = size of expanded split set that will satisy criterion - while (1) { + while (true) { delta = (j-i) * close; midpt = 0.5 * (split[i]+split[j]); start = midpt - 0.5*delta; diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 482b90c4c2..28ef37b008 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -1884,7 +1884,7 @@ void CommTiled::box_drop_brick(int idim, double *lo, double *hi, int &indexme) if (index < 0 || index > procgrid[idim]) error->one(FLERR,"Comm tiled invalid index in box drop brick"); - while (1) { + while (true) { lower = boxlo[idim] + prd[idim]*split[index]; if (index < procgrid[idim]-1) upper = boxlo[idim] + prd[idim]*split[index+1]; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 818d8657b8..cb39f61ce0 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -166,7 +166,7 @@ void ComputeAggregateAtom::compute_peratom() int change,done,anychange; - while (1) { + while (true) { comm->forward_comm_compute(this); // reverse communication when bonds are not stored on every processor @@ -175,7 +175,7 @@ void ComputeAggregateAtom::compute_peratom() comm->reverse_comm_compute(this); change = 0; - while (1) { + while (true) { done = 1; for (i = 0; i < nlocal; i++) { if (!(mask[i] & groupbit)) continue; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 476af0bfa2..ca3fe1f453 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -164,11 +164,11 @@ void ComputeClusterAtom::compute_peratom() int change,done,anychange; - while (1) { + while (true) { comm->forward_comm_compute(this); change = 0; - while (1) { + while (true) { done = 1; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 9ed57fef60..d361e29d41 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -150,7 +150,7 @@ void ComputeFragmentAtom::compute_peratom() int iteration = 0; - while (1) { + while (true) { iteration++; comm->forward_comm_compute(this); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index e82be7d331..f21d1fc23d 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -693,7 +693,7 @@ void CreateAtoms::add_random() int valid; for (int i = 0; i < nrandom; i++) { - while (1) { + while (true) { xone[0] = xlo + random->uniform() * (xhi-xlo); xone[1] = ylo + random->uniform() * (yhi-ylo); xone[2] = zlo + random->uniform() * (zhi-zlo); diff --git a/src/input.cpp b/src/input.cpp index 21c092f356..08f62bdb42 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -180,7 +180,7 @@ void Input::file() { int m,n; - while (1) { + while (true) { // read a line from input script // n = length of line including str terminator, 0 if end of file @@ -189,7 +189,7 @@ void Input::file() if (me == 0) { m = 0; - while (1) { + while (true) { if (infile == nullptr) { n = 0; diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index a5d0aa326c..c4c10d8a1f 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -253,7 +253,7 @@ int MinLineSearch::linemin_backtrack(double eoriginal, double &alpha) // backtrack with alpha until energy decrease is sufficient - while (1) { + while (true) { ecurrent = alpha_step(alpha,1); // if energy change is better than ideal, exit with success @@ -412,7 +412,7 @@ int MinLineSearch::linemin_quadratic(double eoriginal, double &alpha) // etmp-eoriginal+alphatmp*fdothall); // alpha_step(0.0,1); - while (1) { + while (true) { ecurrent = alpha_step(alpha,1); // compute new fh, alpha, delfh @@ -708,7 +708,7 @@ int MinLineSearch::linemin_forcezero(double eoriginal, double &alpha) // main linesearch loop - while (1) { + while (true) { backtrack = false; fhPrev = fhCurr; engPrev = engCurr; diff --git a/src/molecule.cpp b/src/molecule.cpp index 2c9b03337d..40ca218ecc 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -412,7 +412,7 @@ void Molecule::read(int flag) // skip blank lines or lines that start with "#" // stop when read an unrecognized line - while (1) { + while (true) { readline(line); diff --git a/src/platform.cpp b/src/platform.cpp index 555026b2ac..f589efc318 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -231,7 +231,7 @@ std::string platform::os_info() if (platform::file_is_readable("/etc/os-release")) { try { TextFileReader reader("/etc/os-release",""); - while (1) { + while (true) { auto words = reader.next_values(0,"="); if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) { buf += " " + utils::trim(words.next_string()); diff --git a/src/procmap.cpp b/src/procmap.cpp index ed3839fe7b..3fc8a2263e 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -294,7 +294,7 @@ void ProcMap::custom_grid(char *cfile, int nprocs, char *ptr; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); - while (1) { + while (true) { if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) diff --git a/src/rcb.cpp b/src/rcb.cpp index b4d1c135ec..92eafebc28 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -285,7 +285,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, first_iteration = 1; indexlo = indexhi = 0; - while (1) { + while (true) { // choose bisector value // use old value on 1st iteration if old cut dimension is the same @@ -814,7 +814,7 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, first_iteration = 1; indexlo = indexhi = 0; - while (1) { + while (true) { // choose bisector value // use old value on 1st iteration if old cut dimension is the same diff --git a/src/read_data.cpp b/src/read_data.cpp index edbfc16696..0c7af243ac 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -430,7 +430,7 @@ void ReadData::command(int narg, char **arg) nlocal_previous = atom->nlocal; int firstpass = 1; - while (1) { + while (true) { // open file on proc 0 @@ -965,7 +965,7 @@ void ReadData::header(int firstpass) if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } - while (1) { + while (true) { // read a line and bcast length diff --git a/src/read_dump.cpp b/src/read_dump.cpp index c09bd38c87..71d302c4f1 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -233,7 +233,7 @@ void ReadDump::setup_reader(int narg, char **arg) // create Nreader reader classes per reader // match readerstyle to options in style_reader.h - if (0) { + if (false) { return; // dummy line to enable else-if macro expansion #define READER_CLASS @@ -289,7 +289,7 @@ bigint ReadDump::seek(bigint nrequest, int exact) readers[0]->open_file(multiname.c_str()); } else readers[0]->open_file(files[ifile]); - while (1) { + while (true) { eofflag = readers[0]->read_time(ntimestep); if (eofflag) break; if (ntimestep >= nrequest) break; @@ -333,7 +333,7 @@ bigint ReadDump::seek(bigint nrequest, int exact) readers[i]->open_file(multiname.c_str()); bigint step; - while (1) { + while (true) { eofflag = readers[i]->read_time(step); if (eofflag) break; if (step == ntimestep) break; @@ -382,7 +382,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip) } else readers[0]->open_file(files[ifile]); } - while (1) { + while (true) { eofflag = readers[0]->read_time(ntimestep); if (eofflag) break; if (ntimestep > nlast) break; @@ -435,7 +435,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip) readers[i]->open_file(multiname.c_str()); bigint step; - while (1) { + while (true) { eofflag = readers[i]->read_time(step); if (eofflag) break; if (step == ntimestep) break; diff --git a/src/rerun.cpp b/src/rerun.cpp index ce21fbc2b8..78b1a28cb6 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -156,7 +156,7 @@ void Rerun::command(int narg, char **arg) if (ntimestep < 0) error->all(FLERR,"Rerun dump file does not contain requested snapshot"); - while (1) { + while (true) { ndump++; rd->header(firstflag); update->reset_timestep(ntimestep); diff --git a/src/universe.cpp b/src/universe.cpp index 005a91fc6b..bd06300d12 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -98,7 +98,7 @@ void Universe::reorder(char *style, char *arg) char *ptr; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); - while (1) { + while (true) { if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) diff --git a/src/utils.cpp b/src/utils.cpp index 507500f116..b6c0908934 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -957,7 +957,7 @@ std::vector utils::split_words(const std::string &text) } // unquoted - while (1) { + while (true) { if ((c == '\'') || (c == '"')) goto quoted; // skip escaped quote if ((c == '\\') && ((buf[1] == '\'') || (buf[1] == '"'))) { diff --git a/src/variable.cpp b/src/variable.cpp index 22f792b5ec..0add581c48 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -692,7 +692,7 @@ int Variable::next(int narg, char **arg) if (!random) random = new RanMars(lmp,seed); int delay = (int) (1000000*random->uniform()); platform::usleep(delay); - while (1) { + while (true) { if (!rename("tmp.lammps.variable","tmp.lammps.variable.lock")) break; delay = (int) (1000000*random->uniform()); platform::usleep(delay); @@ -1234,7 +1234,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (str == nullptr) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); - while (1) { + while (true) { onechar = str[i]; // whitespace: just skip @@ -3214,7 +3214,7 @@ int Variable::find_matching_paren(char *str, int i, char *&contents, int ivar) int istart = i; int ilevel = 0; - while (1) { + while (true) { i++; if (!str[i]) break; if (str[i] == '(') ilevel++; @@ -4722,7 +4722,7 @@ double Variable::evaluate_boolean(char *str) int i = 0; int expect = ARG; - while (1) { + while (true) { onechar = str[i]; // whitespace: just skip @@ -5016,7 +5016,7 @@ int VarReader::read_scalar(char *str) // read one string from file if (me == 0) { - while (1) { + while (true) { ptr = fgets(str,MAXLINE,fp); if (!ptr) { n=0; break; } // end of file ptr[strcspn(ptr,"#")] = '\0'; // strip comment @@ -5059,7 +5059,7 @@ int VarReader::read_peratom() char str[MAXLINE]; if (me == 0) { - while (1) { + while (true) { ptr = fgets(str,MAXLINE,fp); if (!ptr) { n=0; break; } // end of file ptr[strcspn(ptr,"#")] = '\0'; // strip comment diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 6f53a97e8f..a21a2634fc 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -92,7 +92,7 @@ void WriteCoeff::command(int narg, char **arg) fprintf(two,"# LAMMPS coeff file via write_coeff, version %s\n", lmp->version); - while (1) { + while (true) { int coeff_mode = REGULAR_MODE; if (fgets(str,256,one) == nullptr) break; diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 89c976fe09..53ab80149a 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -57,7 +57,7 @@ void WriteDump::command(int narg, char **arg) for (int i = 2; i < modindex; ++i) dumpargs[i+2] = arg[i]; - if (0) { + if (false) { return; // dummy line to enable else-if macro expansion #define DUMP_CLASS diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index a7724ffbd2..dfa81e8a6e 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -97,7 +97,7 @@ int main(int narg, char **arg) // loop over snapshots in file - while (1) { + while (true) { int endian = 0x0001; int revision = 0x0001; diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index 945c16c649..65e9e4b0f6 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -83,7 +83,7 @@ void TestConfigReader::prerequisites(const yaml_event_t &event) std::stringstream data((char *)event.data.scalar.value); std::string key, value; - while (1) { + while (true) { data >> key >> value; if (data.eof()) break; config.prerequisites.emplace_back(key, value); @@ -138,7 +138,7 @@ void TestConfigReader::extract(const yaml_event_t &event) std::stringstream data((char *)event.data.scalar.value); std::string name; int value; - while (1) { + while (true) { data >> name >> value; if (data.eof()) break; config.extract.emplace_back(name, value);