From 51a20175c91b6dbf3306c0df78cb001048dace7f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 30 Dec 2020 09:27:47 -0500 Subject: [PATCH] more code formatting consistency changes for loops and conditionals --- src/COLLOID/pair_lubricate_poly.cpp | 2 +- src/COMPRESS/zstd_file_writer.cpp | 6 +- src/KOKKOS/atom_vec_angle_kokkos.cpp | 2 +- src/KOKKOS/atom_vec_dpd_kokkos.cpp | 2 +- src/KOKKOS/atom_vec_kokkos.cpp | 6 +- src/KOKKOS/atom_vec_molecular_kokkos.cpp | 2 +- src/KOKKOS/atom_vec_sphere_kokkos.cpp | 4 +- .../compute_orientorder_atom_kokkos.cpp | 6 +- src/KOKKOS/fix_enforce2d_kokkos.cpp | 2 +- src/KOKKOS/fix_eos_table_rx_kokkos.cpp | 2 +- src/KOKKOS/fix_qeq_reax_kokkos.cpp | 16 ++--- src/KOKKOS/fix_rx_kokkos.cpp | 12 ++-- src/KOKKOS/nbin_kokkos.cpp | 2 +- src/KOKKOS/nbin_ssa_kokkos.cpp | 2 +- src/KOKKOS/npair_kokkos.cpp | 2 +- src/KOKKOS/npair_ssa_kokkos.cpp | 2 +- src/KOKKOS/pair_exp6_rx_kokkos.cpp | 2 +- src/KOKKOS/pair_reaxc_kokkos.cpp | 38 +++++------ src/KOKKOS/pair_table_rx_kokkos.cpp | 4 +- src/KOKKOS/verlet_kokkos.cpp | 12 ++-- src/KSPACE/pair_lj_long_tip4p_long.cpp | 4 +- src/KSPACE/pppm_disp.cpp | 8 +-- src/MANYBODY/fix_qeq_comb.cpp | 2 +- src/MANYBODY/pair_comb.cpp | 6 +- src/MANYBODY/pair_comb3.cpp | 18 ++--- src/MANYBODY/pair_eam_cd.cpp | 4 +- src/MANYBODY/pair_eim.cpp | 4 +- src/MANYBODY/pair_gw.cpp | 2 +- src/MANYBODY/pair_gw_zbl.cpp | 2 +- src/MANYBODY/pair_lcbop.cpp | 52 +++++++------- src/MANYBODY/pair_nb3b_harmonic.cpp | 2 +- src/MANYBODY/pair_sw.cpp | 2 +- src/MANYBODY/pair_tersoff.cpp | 2 +- src/MANYBODY/pair_tersoff_mod.cpp | 2 +- src/MANYBODY/pair_tersoff_mod_c.cpp | 2 +- src/MANYBODY/pair_tersoff_zbl.cpp | 2 +- src/MANYBODY/pair_vashishta.cpp | 2 +- src/MC/fix_gcmc.cpp | 3 +- src/MC/fix_widom.cpp | 3 +- src/MISC/dump_xtc.cpp | 6 +- src/MPIIO/dump_cfg_mpiio.cpp | 2 +- src/MSCG/fix_mscg.cpp | 2 +- src/OPT/pair_eam_opt.cpp | 4 +- src/QEQ/fix_qeq.cpp | 38 +++++------ src/QEQ/fix_qeq_dynamic.cpp | 4 +- src/QEQ/fix_qeq_fire.cpp | 4 +- src/QEQ/fix_qeq_point.cpp | 6 +- src/QEQ/fix_qeq_shielded.cpp | 10 +-- src/QEQ/fix_qeq_slater.cpp | 8 +-- src/SHOCK/fix_append_atoms.cpp | 4 +- src/SHOCK/fix_msst.cpp | 58 ++++++++-------- src/SHOCK/fix_nphug.cpp | 6 +- src/SHOCK/fix_wall_piston.cpp | 4 +- src/USER-BOCS/compute_pressure_bocs.cpp | 4 +- src/USER-BOCS/fix_bocs.cpp | 12 ++-- src/USER-COLVARS/colvarproxy_lammps.cpp | 4 +- src/USER-COLVARS/fix_colvars.cpp | 2 +- src/USER-DIFFRACTION/compute_saed.cpp | 16 ++--- src/USER-DIFFRACTION/compute_xrd.cpp | 16 ++--- src/USER-DIFFRACTION/fix_saed_vtk.cpp | 26 +++---- src/USER-DPD/fix_rx.cpp | 6 +- src/USER-DPD/pair_table_rx.cpp | 4 +- src/USER-INTEL/fix_intel.cpp | 6 +- src/USER-INTEL/pair_buck_coul_cut_intel.cpp | 2 +- src/USER-INTEL/pair_buck_coul_long_intel.cpp | 2 +- src/USER-INTEL/pair_buck_intel.cpp | 2 +- .../pair_lj_charmm_coul_long_intel.cpp | 2 +- .../pair_lj_cut_coul_long_intel.cpp | 2 +- src/USER-INTEL/pair_tersoff_intel.cpp | 2 +- src/USER-MANIFOLD/fix_manifoldforce.cpp | 2 +- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 16 ++--- src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp | 21 +++--- src/USER-MANIFOLD/manifold_gaussian_bump.cpp | 6 +- src/USER-MANIFOLD/manifold_thylakoid.cpp | 10 +-- .../manifold_thylakoid_shared.cpp | 2 +- src/USER-MESODPD/pair_edpd.cpp | 2 +- src/USER-MESODPD/pair_mdpd.cpp | 2 +- src/USER-MESODPD/pair_tdpd.cpp | 2 +- src/USER-MGPT/mgpt_readpot.cpp | 6 +- src/USER-MGPT/pair_mgpt.cpp | 30 ++++---- src/USER-MISC/angle_fourier.cpp | 4 +- src/USER-MISC/angle_fourier_simple.cpp | 4 +- src/USER-MISC/angle_gaussian.cpp | 2 +- src/USER-MISC/bond_gaussian.cpp | 2 +- src/USER-MISC/compute_entropy_atom.cpp | 2 +- src/USER-MISC/compute_stress_mop.cpp | 8 +-- src/USER-MISC/compute_stress_mop_profile.cpp | 8 +-- src/USER-MISC/dihedral_fourier.cpp | 10 +-- src/USER-MISC/dihedral_nharmonic.cpp | 4 +- src/USER-MISC/dihedral_spherical.cpp | 20 +++--- src/USER-MISC/fix_flow_gauss.cpp | 8 +-- src/USER-MISC/fix_imd.cpp | 4 +- src/USER-MISC/fix_ipi.cpp | 2 +- src/USER-MISC/fix_propel_self.cpp | 6 +- src/USER-MISC/fix_rhok.cpp | 10 +-- src/USER-MISC/fix_ti_spring.cpp | 4 +- src/USER-MISC/improper_fourier.cpp | 6 +- src/USER-MISC/pair_e3b.cpp | 2 +- src/USER-MISC/pair_extep.cpp | 8 +-- src/USER-MISC/pair_list.cpp | 4 +- src/USER-MISC/pair_local_density.cpp | 14 ++-- src/USER-MISC/pair_meam_spline.cpp | 2 +- src/USER-MISC/pair_meam_sw_spline.cpp | 2 +- src/USER-MISC/pair_tersoff_table.cpp | 2 +- src/USER-MOLFILE/molfile_interface.cpp | 6 +- src/USER-MOLFILE/reader_molfile.cpp | 4 +- src/USER-OMP/angle_fourier_simple_omp.cpp | 4 +- src/USER-OMP/fix_qeq_comb_omp.cpp | 2 +- src/USER-OMP/improper_fourier_omp.cpp | 2 +- src/USER-OMP/pair_comb_omp.cpp | 2 +- src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp | 4 +- src/USER-OMP/pair_reaxc_omp.cpp | 12 ++-- src/USER-OMP/pair_tersoff_zbl_omp.cpp | 2 +- src/USER-OMP/reaxc_bond_orders_omp.cpp | 14 ++-- src/USER-OMP/reaxc_forces_omp.cpp | 10 +-- src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 10 +-- src/USER-OMP/reaxc_multi_body_omp.cpp | 6 +- src/USER-OMP/reaxc_nonbonded_omp.cpp | 4 +- src/USER-OMP/reaxc_torsion_angles_omp.cpp | 4 +- src/USER-PTM/ptm_voronoi_cell.cpp | 68 +++++++++---------- src/USER-QMMM/fix_qmmm.cpp | 2 +- src/USER-QTB/fix_qbmsst.cpp | 54 +++++++-------- src/USER-QUIP/pair_quip.cpp | 2 +- src/USER-REACTION/fix_bond_react.cpp | 6 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 4 +- src/USER-REAXC/pair_reaxc.cpp | 20 +++--- src/USER-REAXC/reaxc_allocate.cpp | 26 +++---- src/USER-REAXC/reaxc_bond_orders.cpp | 18 ++--- src/USER-REAXC/reaxc_bonds.cpp | 6 +- src/USER-REAXC/reaxc_control.cpp | 6 +- src/USER-REAXC/reaxc_ffield.cpp | 50 +++++++------- src/USER-REAXC/reaxc_forces.cpp | 36 +++++----- src/USER-REAXC/reaxc_hydrogen_bonds.cpp | 8 +-- src/USER-REAXC/reaxc_io_tools.cpp | 6 +- src/USER-REAXC/reaxc_lookup.cpp | 36 +++++----- src/USER-REAXC/reaxc_multi_body.cpp | 14 ++-- src/USER-REAXC/reaxc_nonbonded.cpp | 10 +-- src/USER-REAXC/reaxc_reset_tools.cpp | 6 +- src/USER-REAXC/reaxc_tool_box.cpp | 2 +- src/USER-REAXC/reaxc_torsion_angles.cpp | 18 ++--- src/USER-REAXC/reaxc_traj.cpp | 44 ++++++------ src/USER-REAXC/reaxc_valence_angles.cpp | 24 +++---- src/USER-REAXC/reaxc_vector.cpp | 6 +- .../compute_smd_triangle_vertices.cpp | 2 +- src/USER-SMTBQ/pair_smtbq.cpp | 24 +++---- src/USER-TALLY/compute_force_tally.cpp | 2 +- src/USER-TALLY/compute_heat_flux_tally.cpp | 2 +- src/USER-TALLY/compute_pe_mol_tally.cpp | 2 +- src/USER-TALLY/compute_pe_tally.cpp | 2 +- src/USER-TALLY/compute_stress_tally.cpp | 2 +- src/USER-VTK/dump_vtk.cpp | 2 +- src/VORONOI/compute_voronoi_atom.cpp | 20 +++--- src/compute_orientorder_atom.cpp | 6 +- src/dump_cfg.cpp | 4 +- src/finish.cpp | 2 +- src/fix_adapt.cpp | 6 +- src/fix_halt.cpp | 2 +- src/info.cpp | 56 +++++++-------- src/library.cpp | 4 +- src/min_hftn.cpp | 4 +- src/min_linesearch.cpp | 2 +- src/molecule.cpp | 6 +- src/pair_coul_streitz.cpp | 4 +- src/pair_hybrid.cpp | 4 +- src/reader_native.cpp | 2 +- src/reader_xyz.cpp | 2 +- src/replicate.cpp | 12 ++-- src/text_file_reader.cpp | 4 +- src/tokenizer.cpp | 2 +- src/utils.cpp | 2 +- src/write_coeff.cpp | 2 +- 171 files changed, 744 insertions(+), 747 deletions(-) diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index a395f8c67e..b437bc2bfb 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -480,7 +480,7 @@ void PairLubricatePoly::init_style() if (strstr(modify->fix[i]->style,"wall") != nullptr) { flagwall = 1; // Walls exist - if (((FixWall *) modify->fix[i])->xflag ) { + if (((FixWall *) modify->fix[i])->xflag) { flagwall = 2; // Moving walls exist wallfix = (FixWall *) modify->fix[i]; } diff --git a/src/COMPRESS/zstd_file_writer.cpp b/src/COMPRESS/zstd_file_writer.cpp index 9f69f95395..f82ade605c 100644 --- a/src/COMPRESS/zstd_file_writer.cpp +++ b/src/COMPRESS/zstd_file_writer.cpp @@ -81,7 +81,7 @@ size_t ZstdFileWriter::write(const void * buffer, size_t length) ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; ZSTD_compressStream2(cctx, &output, &input, mode); fwrite(out_buffer, sizeof(char), output.pos, fp); - } while(input.pos < input.size); + } while (input.pos < input.size); return length; } @@ -100,7 +100,7 @@ void ZstdFileWriter::flush() ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; remaining = ZSTD_compressStream2(cctx, &output, &input, mode); fwrite(out_buffer, sizeof(char), output.pos, fp); - } while(remaining); + } while (remaining); fflush(fp); } @@ -119,7 +119,7 @@ void ZstdFileWriter::close() ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; remaining = ZSTD_compressStream2(cctx, &output, &input, mode); fwrite(out_buffer, sizeof(char), output.pos, fp); - } while(remaining); + } while (remaining); ZSTD_freeCCtx(cctx); cctx = nullptr; diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index 39897018ec..05f2661e64 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -491,7 +491,7 @@ struct AtomVecAngleKokkos_UnpackComm { /* ---------------------------------------------------------------------- */ void AtomVecAngleKokkos::unpack_comm_kokkos(const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index 26fcda983b..5ab3691b16 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -526,7 +526,7 @@ struct AtomVecDPDKokkos_UnpackComm { /* ---------------------------------------------------------------------- */ void AtomVecDPDKokkos::unpack_comm_kokkos(const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); atomKK->modified(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index 86c79141c0..4251a63b12 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -420,7 +420,7 @@ struct AtomVecKokkos_UnpackComm { /* ---------------------------------------------------------------------- */ void AtomVecKokkos::unpack_comm_kokkos(const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { sync(Host,X_MASK); modified(Host,X_MASK); @@ -691,7 +691,7 @@ struct AtomVecKokkos_UnpackCommVel { /* ---------------------------------------------------------------------- */ void AtomVecKokkos::unpack_comm_vel_kokkos(const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { sync(Host,X_MASK|V_MASK); modified(Host,X_MASK|V_MASK); @@ -864,7 +864,7 @@ struct AtomVecKokkos_PackReverse { /* ---------------------------------------------------------------------- */ int AtomVecKokkos::pack_reverse_kokkos(const int &n, const int &first, - const DAT::tdual_ffloat_2d &buf ) { + const DAT::tdual_ffloat_2d &buf) { if (commKK->reverse_comm_on_host) { sync(Host,F_MASK); struct AtomVecKokkos_PackReverse f(atomKK->k_f,buf,first); diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.cpp b/src/KOKKOS/atom_vec_molecular_kokkos.cpp index 2fb33e02b7..fb328584ff 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.cpp +++ b/src/KOKKOS/atom_vec_molecular_kokkos.cpp @@ -563,7 +563,7 @@ struct AtomVecMolecularKokkos_UnpackComm { /* ---------------------------------------------------------------------- */ void AtomVecMolecularKokkos::unpack_comm_kokkos(const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index 451e9d737e..0b7a74966b 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -917,7 +917,7 @@ struct AtomVecSphereKokkos_UnpackComm { void AtomVecSphereKokkos::unpack_comm_kokkos( const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { // Fallback to AtomVecKokkos if radvary == 0 if (radvary == 0) { AtomVecKokkos::unpack_comm_kokkos(n,first,buf); @@ -994,7 +994,7 @@ struct AtomVecSphereKokkos_UnpackCommVel { void AtomVecSphereKokkos::unpack_comm_vel_kokkos( const int &n, const int &first, - const DAT::tdual_xfloat_2d &buf ) { + const DAT::tdual_xfloat_2d &buf) { if (commKK->forward_comm_on_host) { atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK); if (radvary == 0) { diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp index 8cac92240f..2325288c8c 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp @@ -341,17 +341,17 @@ void ComputeOrientOrderAtomKokkos::operator() (TagComputeOrientOrder #define SWAP(view,i,j) do { \ tmp = view(i); view(i) = view(j); view(j) = tmp; \ - } while(0) + } while (0) #define ISWAP(view,i,j) do { \ itmp = view(i); view(i) = view(j); view(j) = itmp; \ - } while(0) + } while (0) #define SWAP3(view,i,j) do { \ tmp = view(i,0); view(i,0) = view(j,0); view(j,0) = tmp; \ tmp = view(i,1); view(i,1) = view(j,1); view(j,1) = tmp; \ tmp = view(i,2); view(i,2) = view(j,2); view(j,2) = tmp; \ - } while(0) + } while (0) /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index 8608b90543..e4cf0e5309 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -77,7 +77,7 @@ void FixEnforce2DKokkos::post_force(int /*vflag*/) if (atomKK->torque_flag) flag_mask |= 4; copymode = 1; - switch( flag_mask ) { + switch (flag_mask) { case 0:{ FixEnforce2DKokkosPostForceFunctor functor(this); Kokkos::parallel_for(nlocal,functor); diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp index a14e301bfa..4d181c2b41 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp @@ -303,7 +303,7 @@ void FixEOStableRXKokkos::energy_lookup(int id, double thetai, doubl nPG = 0; if (rx_flag) { - for (int ispecies = 0; ispecies < nspecies; ispecies++ ) { + for (int ispecies = 0; ispecies < nspecies; ispecies++) { nTotal += dvector(ispecies,id); if (fabs(d_moleculeCorrCoeff[ispecies]) > tolerance) { nPG++; diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index e81579061b..e607bea3e3 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -139,8 +139,8 @@ void FixQEqReaxKokkos::init_shielding_k() k_shield = DAT::tdual_ffloat_2d("qeq/kk:shield",ntypes+1,ntypes+1); d_shield = k_shield.template view(); - for ( i = 1; i <= ntypes; ++i ) - for ( j = 1; j <= ntypes; ++j ) + for (i = 1; i <= ntypes; ++i) + for (j = 1; j <= ntypes; ++j) k_shield.h_view(i,j) = pow( gamma[i] * gamma[j], -1.5 ); k_shield.template modify(); @@ -1371,11 +1371,11 @@ void FixQEqReaxKokkos::operator()(TagFixQEqReaxPackForwardComm, cons if (pack_flag == 1) d_buf[i] = d_d[j]; - else if ( pack_flag == 2 ) + else if (pack_flag == 2) d_buf[i] = d_s[j]; - else if ( pack_flag == 3 ) + else if (pack_flag == 3) d_buf[i] = d_t[j]; - else if ( pack_flag == 4 ) + else if (pack_flag == 4) d_buf[i] = q[j]; } @@ -1413,11 +1413,11 @@ int FixQEqReaxKokkos::pack_forward_comm(int n, int *list, double *bu if (pack_flag == 1) for (m = 0; m < n; m++) buf[m] = h_d[list[m]]; - else if ( pack_flag == 2 ) + else if (pack_flag == 2) for (m = 0; m < n; m++) buf[m] = h_s[list[m]]; - else if ( pack_flag == 3 ) + else if (pack_flag == 3) for (m = 0; m < n; m++) buf[m] = h_t[list[m]]; - else if ( pack_flag == 4 ) + else if (pack_flag == 4) for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; return n; diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 7a8bfbf9dd..036ecd1788 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -417,7 +417,7 @@ int FixRxKokkos::k_rkf45_h0 (const int neq, const double t, const do // compute ydot at t=t0 k_rhs (t, y, ydot, userData); - while(1) + while (1) { // Estimate y'' with finite-difference ... @@ -455,11 +455,11 @@ int FixRxKokkos::k_rkf45_h0 (const int neq, const double t, const do double hrat = hnew / hg; // Accept this value ... the bias factor should bring it within range. - if ( (hrat > 0.5) && (hrat < 2.0) ) + if ((hrat > 0.5) && (hrat < 2.0)) hnew_is_ok = true; // If y'' is still bad after a few iterations, just accept h and give up. - if ( (iter > 1) && hrat > 2.0 ) { + if ((iter > 1) && hrat > 2.0) { hnew = hg; hnew_is_ok = true; } @@ -736,7 +736,7 @@ int FixRxKokkos::rkf45_h0(const int neq, const double t, const doubl // compute ydot at t=t0 rhs (t, y, ydot, v_params); - while(1) + while (1) { // Estimate y'' with finite-difference ... @@ -774,11 +774,11 @@ int FixRxKokkos::rkf45_h0(const int neq, const double t, const doubl double hrat = hnew / hg; // Accept this value ... the bias factor should bring it within range. - if ( (hrat > 0.5) && (hrat < 2.0) ) + if ((hrat > 0.5) && (hrat < 2.0)) hnew_is_ok = true; // If y'' is still bad after a few iterations, just accept h and give up. - if ( (iter > 1) && hrat > 2.0 ) { + if ((iter > 1) && hrat > 2.0) { hnew = hg; hnew_is_ok = true; } diff --git a/src/KOKKOS/nbin_kokkos.cpp b/src/KOKKOS/nbin_kokkos.cpp index 8234ceea6f..abe5b740f1 100644 --- a/src/KOKKOS/nbin_kokkos.cpp +++ b/src/KOKKOS/nbin_kokkos.cpp @@ -92,7 +92,7 @@ void NBinKokkos::bin_atoms() h_resize() = 1; - while(h_resize() > 0) { + while (h_resize() > 0) { h_resize() = 0; deep_copy(d_resize, h_resize); diff --git a/src/KOKKOS/nbin_ssa_kokkos.cpp b/src/KOKKOS/nbin_ssa_kokkos.cpp index 276c3bee36..e38c7be8f2 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.cpp +++ b/src/KOKKOS/nbin_ssa_kokkos.cpp @@ -293,7 +293,7 @@ void NBinSSAKokkos::sortBin( child = parent*2+1; /* Find the next child */ } gbins(ibin, parent) = t; /* We save t in the heap */ - } while(1); + } while (1); } namespace LAMMPS_NS { diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 564e1b0b98..20e819deaf 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -207,7 +207,7 @@ void NPairKokkos::build(NeighList *list_) data.special_flag[3] = special_flag[3]; data.h_resize()=1; - while(data.h_resize()) { + while (data.h_resize()) { data.h_new_maxneighs() = list->maxneighs; data.h_resize() = 0; diff --git a/src/KOKKOS/npair_ssa_kokkos.cpp b/src/KOKKOS/npair_ssa_kokkos.cpp index a3608fd35a..62be4a7d31 100644 --- a/src/KOKKOS/npair_ssa_kokkos.cpp +++ b/src/KOKKOS/npair_ssa_kokkos.cpp @@ -452,7 +452,7 @@ fprintf(stdout, "tota%03d total %3d could use %6d inums, expected %6d inums. inu bool firstTry = true; data.h_resize()=1; - while(data.h_resize()) { + while (data.h_resize()) { data.h_new_maxneighs() = list->maxneighs; data.h_resize() = 0; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 855d2b259a..4d89169c21 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -2227,7 +2227,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int #endif for (int id = idx_begin; id < idx_end; ++id) { - if ( nTotal[id] < MY_EPSILON || nTotalold[id] < MY_EPSILON ) + if (nTotal[id] < MY_EPSILON || nTotalold[id] < MY_EPSILON) errorFlag1 = 1; // Compute the mole fraction of molecules within the fluid portion of the particle (One Fluid Approximation) diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 5d48b429cc..12eea720ba 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -375,7 +375,7 @@ void PairReaxCKokkos::init_md() k_tap.template sync(); - if ( control->tabulate ) { + if (control->tabulate) { int ntypes = atom->ntypes; Init_Lookup_Tables(); @@ -462,12 +462,12 @@ int PairReaxCKokkos::Init_Lookup_Tables() LR = (LR_lookup_table**) scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR"); - for ( i = 0; i < num_atom_types+1; ++i ) + for (i = 0; i < num_atom_types+1; ++i) LR[i] = (LR_lookup_table*) scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]"); - for ( i = 1; i <= num_atom_types; ++i ) { - for ( j = i; j <= num_atom_types; ++j ) { + for (i = 1; i <= num_atom_types; ++i) { + for (j = i; j <= num_atom_types; ++j) { LR[i][j].xmin = 0; LR[i][j].xmax = control->nonb_cut; LR[i][j].n = control->tabulate + 2; @@ -487,7 +487,7 @@ int PairReaxCKokkos::Init_Lookup_Tables() smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb"); - for ( r = 1; r <= control->tabulate; ++r ) { + for (r = 1; r <= control->tabulate; ++r) { LR_vdW_Coulomb(i, j, r * dr, &(LR[i][j].y[r]) ); h[r] = LR[i][j].dx; fh[r] = LR[i][j].y[r].H; @@ -546,9 +546,9 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() ntypes = atom->ntypes; - for ( i = 0; i <= ntypes; ++i ) { + for (i = 0; i <= ntypes; ++i) { if (map[i] == -1) continue; - for ( j = i; j <= ntypes; ++j ) { + for (j = i; j <= ntypes; ++j) { if (map[i] == -1) continue; if (LR[i][j].n) { sfree( control->error_ptr, LR[i][j].y, "LR[i,j].y" ); @@ -2301,8 +2301,8 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular::operator()(PairReaxComputeAngular::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion= 0 && sin_ijk <= 1e-10) tan_ijk_i = cos_ijk / 1e-10; - else if ( sin_ijk <= 0 && sin_ijk >= -1e-10 ) + else if (sin_ijk <= 0 && sin_ijk >= -1e-10) tan_ijk_i = -cos_ijk / 1e-10; else tan_ijk_i = cos_ijk / sin_ijk; @@ -2643,7 +2643,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion= 0 && sin_jil <= 1e-10) tan_jil_i = cos_jil / 1e-10; - else if ( sin_jil <= 0 && sin_jil >= -1e-10 ) + else if (sin_jil <= 0 && sin_jil >= -1e-10) tan_jil_i = -cos_jil / 1e-10; else tan_jil_i = cos_jil / sin_jil; @@ -2703,9 +2703,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion= 0 && sin_ijk <= 1e-10) sin_ijk_rnd = 1e-10; - else if ( sin_ijk <= 0 && sin_ijk >= -1e-10 ) sin_ijk_rnd = -1e-10; + else if (sin_ijk <= 0 && sin_ijk >= -1e-10) sin_ijk_rnd = -1e-10; if (sin_jil >= 0 && sin_jil <= 1e-10) sin_jil_rnd = 1e-10; - else if ( sin_jil <= 0 && sin_jil >= -1e-10 ) sin_jil_rnd = -1e-10; + else if (sin_jil <= 0 && sin_jil >= -1e-10) sin_jil_rnd = -1e-10; // dcos_omega_di for (int d = 0; d < 3; d++) dcos_omega_dk[d] = ((htra-arg*hnra)/rik) * delik[d] - dellk[d]; @@ -2944,7 +2944,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeHydrogen::operator()(PairReaxComputeBond1= 1.00) { if (gp[37] == 2 || (imass == 12.0000 && jmass == 15.9990) || - (jmass == 12.0000 && imass == 15.9990) ) { + (jmass == 12.0000 && imass == 15.9990)) { const F_FLOAT exphu = exp(-gp[7] * SQR(BO_i - 2.50) ); const F_FLOAT exphua1 = exp(-gp[3] * (d_total_bo[i]-BO_i)); const F_FLOAT exphub1 = exp(-gp[3] * (d_total_bo[j]-BO_i)); @@ -3905,7 +3905,7 @@ void PairReaxCKokkos::operator()(PairReaxFindBondSpecies, const int double bo_tmp = d_BO(i,j_index); - if (bo_tmp >= 0.10 ) { // Why is this a hardcoded value? + if (bo_tmp >= 0.10) { // Why is this a hardcoded value? k_tmpid.view()(i,nj) = j; k_tmpbo.view()(i,nj) = bo_tmp; nj++; diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 0c81090a39..162448416c 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -1117,7 +1117,7 @@ void PairTableRXKokkos::coeff(int narg, char **arg) ntables++; { - if ( strcmp(site1,"1fluid") == 0 ) + if (strcmp(site1,"1fluid") == 0) isite1 = OneFluidValue; else { isite1 = nspecies; @@ -1132,7 +1132,7 @@ void PairTableRXKokkos::coeff(int narg, char **arg) if (isite1 == nspecies) error->all(FLERR,"isite1 == nspecies"); } - if ( strcmp(site2,"1fluid") == 0 ) + if (strcmp(site2,"1fluid") == 0) isite2 = OneFluidValue; else { isite2 = nspecies; diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 02cde691d2..3aa7a3575a 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -408,7 +408,7 @@ void VerletKokkos::run(int n) unsigned int datamask_modify_device = 0; unsigned int datamask_read_host = 0; - if ( pair_compute_flag ) { + if (pair_compute_flag) { if (force->pair->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->pair->datamask_read; @@ -418,7 +418,7 @@ void VerletKokkos::run(int n) datamask_modify_device |= force->pair->datamask_modify; } } - if ( atomKK->molecular && force->bond ) { + if (atomKK->molecular && force->bond) { if (force->bond->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->bond->datamask_read; @@ -428,7 +428,7 @@ void VerletKokkos::run(int n) datamask_modify_device |= force->bond->datamask_modify; } } - if ( atomKK->molecular && force->angle ) { + if (atomKK->molecular && force->angle) { if (force->angle->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->angle->datamask_read; @@ -438,7 +438,7 @@ void VerletKokkos::run(int n) datamask_modify_device |= force->angle->datamask_modify; } } - if ( atomKK->molecular && force->dihedral ) { + if (atomKK->molecular && force->dihedral) { if (force->dihedral->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->dihedral->datamask_read; @@ -448,7 +448,7 @@ void VerletKokkos::run(int n) datamask_modify_device |= force->dihedral->datamask_modify; } } - if ( atomKK->molecular && force->improper ) { + if (atomKK->molecular && force->improper) { if (force->improper->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->improper->datamask_read; @@ -458,7 +458,7 @@ void VerletKokkos::run(int n) datamask_modify_device |= force->improper->datamask_modify; } } - if ( kspace_compute_flag ) { + if (kspace_compute_flag) { if (force->kspace->execution_space==Host) { execute_on_host = true; datamask_read_host |= force->kspace->datamask_read; diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index 3421381d37..a6949fe085 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -566,7 +566,7 @@ void PairLJLongTIP4PLong::compute_inner() rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq ) { // lj + if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq) { // lj r2inv = 1.0/rsq; double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); @@ -819,7 +819,7 @@ void PairLJLongTIP4PLong::compute_middle() rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq ) { // lj + if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq) { // lj r2inv = 1.0/rsq; double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 2500336e8f..6621f5bdf3 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -1289,7 +1289,7 @@ void PPPMDisp::init_coeffs() // local pair coeffs // allocate data for eigenvalue decomposition double **A=nullptr; double **Q=nullptr; - if ( n > 1 ) { + if (n > 1) { // get dispersion coefficients double **b = (double **) force->pair->extract("B",tmp); memory->create(A,n,n,"pppm/disp:A"); @@ -1364,7 +1364,7 @@ void PPPMDisp::init_coeffs() // local pair coeffs // check if the function should preferably be [1] or [2] or [3] if (nsplit == 1) { - if ( B ) delete [] B; + if (B) delete [] B; function[3] = 0; function[2] = 0; function[1] = 1; @@ -1380,7 +1380,7 @@ void PPPMDisp::init_coeffs() // local pair coeffs } if (function[2] && (nsplit > 6)) { if (me == 0) utils::logmesg(lmp," Using 7 structure factors\n"); - if ( B ) delete [] B; + if (B) delete [] B; } if (function[3]) { if (me == 0) @@ -2130,7 +2130,7 @@ void PPPMDisp::allocate_peratom() } if (function[2]) { - if (differentiation_flag != 1 ) { + if (differentiation_flag != 1) { memory->create3d_offset(u_brick_a0,nzlo_out_6,nzhi_out_6,nylo_out_6,nyhi_out_6, nxlo_out_6,nxhi_out_6,"pppm/disp:u_brick_a0"); memory->create3d_offset(u_brick_a1,nzlo_out_6,nzhi_out_6,nylo_out_6,nyhi_out_6, diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 75abba2f09..1241d9905c 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -217,7 +217,7 @@ void FixQEQComb::post_force(int /*vflag*/) q1[i] = q2[i] = qf[i] = 0.0; } - for (iloop = 0; iloop < loopmax; iloop ++ ) { + for (iloop = 0; iloop < loopmax; iloop ++) { for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 5a724f7520..f6595f379c 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -283,7 +283,7 @@ void PairComb::compute(int eflag, int vflag) jtype = map[type[j]]; iparam_ij = elem2param[itype][jtype][jtype]; - if (params[iparam_ij].hfocor > 0.0 ) { + if (params[iparam_ij].hfocor > 0.0) { delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -595,7 +595,7 @@ void PairComb::read_file(char *file) PotentialFileReader reader(lmp, file, "comb"); char * line; - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); @@ -842,7 +842,7 @@ void PairComb::repulsive(Param *param, double rsq, double &fforce, Asi = param->biga1 * exp(param->lam11*Di); Asj = param->biga2 * exp(param->lam12*Dj); - if ( Asi > 0.0 && Asj > 0.0 ) + if (Asi > 0.0 && Asj > 0.0) bigA = sqrt(Asi*Asj)*param->romiga; else bigA = 0.0; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 30abb43dfc..f4434d9d76 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -531,7 +531,7 @@ void PairComb3::read_file(char *file) PotentialFileReader reader(lmp, file, "COMB3"); char * line; - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); @@ -1085,7 +1085,7 @@ void PairComb3::compute(int eflag, int vflag) sht_lnum = sht_num[j]; jtag = tag[j]; - if ( jtag <= itag ) continue ; + if (jtag <= itag) continue ; ycn = NCo[j]; jtype = map[type[j]]; @@ -1402,7 +1402,7 @@ void PairComb3::compute(int eflag, int vflag) // radical i-j-l-p: apply to all CC,CO,OC bonds if ( params[iparam_jil].rad_flag >= 1 && params[iparam_jil].ielementgp == 1 && - params[iparam_jil].kelementgp == 1 ) { + params[iparam_jil].kelementgp == 1) { iparam_lj = elem2param[ltype][jtype][jtype]; lcn=NCo[l]; double rjl=sqrt(rsq2); @@ -1667,7 +1667,7 @@ void PairComb3::force_zeta(Param *parami, Param *paramj, double rsq, // radical energy - if ( parami->rad_flag>0 ) { + if (parami->rad_flag>0) { rad_calc( r, parami, paramj, kconjug, lconjug, i, j, xcn, ycn); bij += brad[0]; pradx = brad[1]*att_eng; @@ -1701,7 +1701,7 @@ void PairComb3::force_zeta(Param *parami, Param *paramj, double rsq, prefac_ji5 = -0.5*att_eng*dbji5; // prefac_ji5 = -pfji4 // combines com6 & com7 below - if ( parami->rad_flag>0 || parami->tor_flag!=0 ) { + if (parami->rad_flag>0 || parami->tor_flag!=0) { prefac_ij2-=pradx; prefac_ji2-=prady; } @@ -1859,7 +1859,7 @@ void PairComb3::comb_fa(double r, Param *parami, Param *paramj, double iq, YYBn = (parami->aB-fabs(pow(parami->bB*(qi-parami->Qo),10))); YYBj = (paramj->aB-fabs(pow(paramj->bB*(qj-paramj->Qo),10))); - if (YYBn*YYBj > 0.0 ) { + if (YYBn*YYBj > 0.0) { AlfDiAlfDj = exp(0.5*(parami->alfi*Di+paramj->alfi*Dj)); Bsi = (pbij1*exp(-alfij1*r)+pbij2*exp(-alfij2*r)+pbij3*exp(-alfij3*r))* sqrt(YYBn*YYBj)*AlfDiAlfDj; // Bsi is cbj @@ -1894,7 +1894,7 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, zeta = pow(zetang,pow_n)+pcorn; tmp_tbij=pow_n*pow(zetang,(pow_n-1.0)); - if ((1.0 + zeta) < 0.1 ) { + if ((1.0 + zeta) < 0.1) { zeta=0.1-1.0; tbij = pow(1.0 + zeta, -0.5/pow_n); tbij1=0.0; @@ -2933,7 +2933,7 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, vec3_scale(-1.0,delrl,delrl); rmul = sqrt(1.0-rmul*rmul); - if (rmul > 0.1 ) { + if (rmul > 0.1) { double fc1k, fc1l, TT1, TT2, rmut, btt, tork[3], torl[3]; fc1k = comb_fc(rik,paramk); @@ -3065,7 +3065,7 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, srmul = sqrt(1.0-rmul*rmul); if (acos(rmul) > MY_PI) srmul = -srmul; - if (srmul > 0.1 ) { + if (srmul > 0.1) { double fc1k, fcp1k, fc1l, fcp1l, srmul2, dt1dik, dt1djl; double TT1, TT2, rmut, btt, tork[3], torl[3]; double dt2dik[3], dt2djl[3], dt2dij[3], AA, AA2; diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index e028e53bb8..b56166424c 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -512,7 +512,7 @@ void PairEAMCD::read_h_coeff(char *filename) // h coefficients are stored at the end of the file. // Skip to last line of file. - while(fgets(nextline, MAXLINE, fptr) != nullptr) { + while (fgets(nextline, MAXLINE, fptr) != nullptr) { strcpy(line, nextline); } @@ -527,7 +527,7 @@ void PairEAMCD::read_h_coeff(char *filename) hcoeff = new double[nhcoeff]; int i = 0; - while(values.has_next()) { + while (values.has_next()) { hcoeff[i++] = values.next_double(); } diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index f95a43ed67..db673611e2 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -1108,7 +1108,7 @@ char * EIMPotentialFileReader::next_line(FILE * fp) { n = strlen(line); } - while(n == 0 || concat) { + while (n == 0 || concat) { char *ptr = fgets(&line[n], MAXLINE - n, fp); if (ptr == nullptr) { @@ -1143,7 +1143,7 @@ void EIMPotentialFileReader::parse(FILE * fp) char * line = nullptr; bool found_global = false; - while((line = next_line(fp))) { + while ((line = next_line(fp))) { ValueTokenizer values(line); std::string type = values.next_string(); diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 32ace05546..2f2b9922cb 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -385,7 +385,7 @@ void PairGW::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index bee8efb692..e166b1f1de 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -75,7 +75,7 @@ void PairGWZBL::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 09ea20df52..070f23dbb9 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -535,12 +535,12 @@ void PairLCBOP::FLR(int eflag, int /*vflag*/) forces for Nij and Mij ------------------------------------------------------------------------- */ -void PairLCBOP::FNij( int i, int j, double factor, double **f, int vflag_atom ) { +void PairLCBOP::FNij( int i, int j, double factor, double **f, int vflag_atom) { int atomi = i; int atomj = j; int *SR_neighs = SR_firstneigh[i]; double **x = atom->x; - for( int k=0; kx; - for( int k=0; k( floor( N_ij ) ), 2 ); // 2 is the highest number of field size_t N_ji_int = MIN( static_cast( floor( N_ji ) ), 2 ); // cast to suppress warning double x = N_ij - N_ij_int; @@ -1096,9 +1096,9 @@ void PairLCBOP::read_file(char *filename) ------------------------------------------------------------------------- */ void PairLCBOP::spline_init() { - for( size_t N_conj_ij=0; N_conj_ij<2; N_conj_ij++ ) // N_conj_ij - for( size_t N_ij=0; N_ij<4-1; N_ij++ ) - for( size_t N_ji=0; N_ji<4-1; N_ji++ ) { + for (size_t N_conj_ij=0; N_conj_ij<2; N_conj_ij++) // N_conj_ij + for (size_t N_ij=0; N_ij<4-1; N_ij++) + for (size_t N_ji=0; N_ji<4-1; N_ji++) { TF_conj_field &field = F_conj_field[N_ij][N_ji][N_conj_ij]; field.f_00 = F_conj_data[N_ij ][N_ji ][N_conj_ij][0]; field.f_01 = F_conj_data[N_ij ][N_ji+1][N_conj_ij][0]; @@ -1126,7 +1126,7 @@ void PairLCBOP::spline_init() { // << gX[4] << " " // << gX[5] << std::endl; // file << "gC:\n"; -// for( int i=0; i<6; i++ ) +// for (int i=0; i<6; i++) // file << gC[i][0] << " " // << gC[i][1] << " " // << gC[i][2] << " " @@ -1170,7 +1170,7 @@ void PairLCBOP::spline_init() { // double x_1 = 1, x_0 = -1; // int n=1000; // double dx = (x_1-x_0)/n; -// for( double x=x_0; x<=x_1+0.0001; x+=dx ) { +// for (double x=x_0; x<=x_1+0.0001; x+=dx) { // double g, dg; // g = gSpline(x, &dg); // file << x << " " << g << " " << dg << std::endl; @@ -1181,7 +1181,7 @@ void PairLCBOP::spline_init() { // double x_1 = 1, x_0 = -1; // int n=1000; // double dx = (x_1-x_0)/n; -// for( double x=x_0; x<=x_1+0.0001; x+=dx ) { +// for (double x=x_0; x<=x_1+0.0001; x+=dx) { // double h, dh; // h = hSpline(x, &dh); // file << x << " " << h << " " << dh << std::endl; @@ -1193,7 +1193,7 @@ void PairLCBOP::spline_init() { // double x_1 = 4, x_0 = 0; // int n=1000; // double dx = (x_1-x_0)/n; -// for( double x=x_0; x<=x_1+0.0001; x+=dx ) { +// for (double x=x_0; x<=x_1+0.0001; x+=dx) { // double f, df; // f = f_c(x, r_1, r_2, &df); // file << x << " " << f << " " << df << std::endl; @@ -1217,23 +1217,23 @@ void PairLCBOP::spline_init() { // // file << "F_conj_0 "; // double dummy; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) +// for (double y=0; y<=3.0+0.0001; y+=0.1) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { +// for (double x=0; x<=3.0+0.0001; x+=0.1) { // file << x << " "; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) +// for (double y=0; y<=3.0+0.0001; y+=0.1) // file << F_conj( x, y, 0, &dummy, &dummy, &dummy ) << " "; // file << std::endl; // } // // file << "dF0_dx "; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) +// for (double y=0; y<=3.0+0.0001; y+=0.1) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { +// for (double x=0; x<=3.0+0.0001; x+=0.1) { // file << x << " "; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) { +// for (double y=0; y<=3.0+0.0001; y+=0.1) { // double dF_dx; // F_conj( x, y, 0, &dF_dx, &dummy, &dummy ); // file << dF_dx << " "; @@ -1244,12 +1244,12 @@ void PairLCBOP::spline_init() { // // // file << "F_conj_1 "; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) +// for (double y=0; y<=3.0+0.0001; y+=0.1) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { +// for (double x=0; x<=3.0+0.0001; x+=0.1) { // file << x << " "; -// for( double y=0; y<=3.0+0.0001; y+=0.1 ) +// for (double y=0; y<=3.0+0.0001; y+=0.1) // file << F_conj( x, y, 0, &dummy, &dummy, &dummy ) << " "; // file << std::endl; // } diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 7e53dcc39c..a1dc903a43 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -301,7 +301,7 @@ void PairNb3bHarmonic::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index c94e75b4a2..e7a334d9a9 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -365,7 +365,7 @@ void PairSW::read_file(char *file) double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index bcfcb149b4..3759932d9d 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -408,7 +408,7 @@ void PairTersoff::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index f5e4d21ffc..a25845196a 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -58,7 +58,7 @@ void PairTersoffMOD::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index c2cbcdd2d9..25bc735b9b 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -49,7 +49,7 @@ void PairTersoffMODC::read_file(char *file) int unit_convert = reader.get_unit_convert(); double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index aee9eda71f..404868f969 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -77,7 +77,7 @@ void PairTersoffZBL::read_file(char *file) double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 32f3212d75..94f211dd95 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -372,7 +372,7 @@ void PairVashishta::read_file(char *file) double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 1587849ab7..79cfd09f96 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -485,8 +485,7 @@ void FixGCMC::init() (force->pair->single_enable == 0) || (force->pair_match("^hybrid",0)) || (force->pair_match("^eam",0)) || - (force->pair->tail_flag) - ) { + (force->pair->tail_flag)) { full_flag = true; if (comm->me == 0) error->warning(FLERR,"Fix gcmc using full_energy option"); diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 202fd03dd1..c06573ab1a 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -287,8 +287,7 @@ void FixWidom::init() (force->pair->single_enable == 0) || (force->pair_match("hybrid",0)) || (force->pair_match("eam",0)) || - (force->pair->tail_flag) - ) { + (force->pair->tail_flag)) { full_flag = true; if (comm->me == 0) error->warning(FLERR,"Fix widom using full_energy option"); diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 1f95220442..87eac61673 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -809,7 +809,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) /* when the number of coordinates is small, don't try to compress; just * write them as floats using xdr_vector */ - if (*size <= 9 ) { + if (*size <= 9) { return (xdr_vector(xdrs, (char *) fp, size3, sizeof(*fp), (xdrproc_t)xdr_float)); } @@ -851,7 +851,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) lip = ip; mindiff = INT_MAX; oldlint1 = oldlint2 = oldlint3 = 0; - while(lfp < fp + size3 ) { + while (lfp < fp + size3) { /* find nearest integer */ if (*lfp >= 0.0) lf = *lfp * *precision + 0.5; @@ -1131,7 +1131,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) run = 0; i = 0; lip = ip; - while ( i < lsize ) { + while (i < lsize) { thiscoord = (int *)(lip) + i * 3; if (bitsize == 0) { diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index eb9de685e3..07fb86d31c 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -416,7 +416,7 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) unwrap_coord = (mybuf[bufOffset[tid]+m] - 0.5)/UNWRAPEXPAND + 0.5; //offset += sprintf(&sbuf[offset],vformat[j],unwrap_coord); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],unwrap_coord); - } else if (j >= 5 ) { + } else if (j >= 5) { if (vtype[j] == Dump::INT) //offset += // sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index de17ae45be..38635b0891 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -73,7 +73,7 @@ FixMSCG::FixMSCG(LAMMPS *lmp, int narg, char **arg) : // parse remaining arguments int iarg = 4; - while(iarg < narg) { + while (iarg < narg) { if (strcmp(arg[iarg],"range") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix mscg command"); if (strcmp(arg[iarg+1],"on") == 0) diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index c89afad705..c7d3541e67 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -202,7 +202,7 @@ void PairEAMOpt::eval() jtype = type[j] - 1; double p = sqrt(rsq)*tmp_rdr; - if ( (int)p <= nr2 ) { + if ((int)p <= nr2) { int m = (int)p + 1; p -= (double)((int)p); fast_alpha_t& a = tabeighti[jtype*nr+m]; @@ -289,7 +289,7 @@ void PairEAMOpt::eval() double r = sqrt(rsq); double rhoip,rhojp,z2,z2p; double p = r*tmp_rdr; - if ( (int)p <= nr2 ) { + if ((int)p <= nr2) { int m = (int) p + 1; m = MIN(m,nr-1); p -= (double)((int) p); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 555b9d2770..733d566b7d 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -103,7 +103,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - for ( int i = 0; i < atom->nmax; i++ ) + for (int i = 0; i < atom->nmax; i++) for (int j = 0; j < nprev; ++j ) s_hist[i][j] = t_hist[i][j] = atom->q[i]; @@ -234,7 +234,7 @@ void FixQEq::allocate_matrix() numneigh = list->numneigh; m = 0; - for ( ii = 0; ii < inum; ii++ ) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; m += numneigh[i]; } @@ -306,7 +306,7 @@ void FixQEq::init_storage() nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; - for ( int i = 0; i < nall; i++ ) { + for (int i = 0; i < nall; i++) { Hdia_inv[i] = 1. / eta[atom->type[i]]; b_s[i] = -chi[atom->type[i]]; b_t[i] = -1.0; @@ -352,7 +352,7 @@ int FixQEq::CG( double *b, double *x ) vector_sum( r , 1., b, -1., q, inum ); - for ( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) d[i] = r[i] * Hdia_inv[i]; @@ -362,7 +362,7 @@ int FixQEq::CG( double *b, double *x ) b_norm = parallel_norm( b, inum ); sig_new = parallel_dot( r, d, inum); - for ( loop = 1; loop < maxiter && sqrt(sig_new)/b_norm > tolerance; ++loop ) { + for (loop = 1; loop < maxiter && sqrt(sig_new)/b_norm > tolerance; ++loop) { comm->forward_comm_fix(this); sparse_matvec( &H, d, q ); comm->reverse_comm_fix(this); @@ -373,7 +373,7 @@ int FixQEq::CG( double *b, double *x ) vector_add( x, alfa, d, inum ); vector_add( r, -alfa, q, inum ); - for ( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) p[i] = r[i] * Hdia_inv[i]; @@ -406,17 +406,17 @@ void FixQEq::sparse_matvec( sparse_matrix *A, double *x, double *b ) nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; - for ( i = 0; i < nlocal; ++i ) { + for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) b[i] = eta[ atom->type[i] ] * x[i]; } - for ( i = nlocal; i < nall; ++i ) { + for (i = nlocal; i < nall; ++i) { if (atom->mask[i] & groupbit) b[i] = 0; } - for ( i = 0; i < nlocal; ++i ) { + for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) { for ( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; @@ -444,12 +444,12 @@ void FixQEq::calculate_Q() t_sum = parallel_vector_acc( t, inum); u = s_sum / t_sum; - for ( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { q[i] = s[i] - u * t[i]; - for ( k = 4; k > 0; --k ) { + for (k = 4; k > 0; --k) { s_hist[i][k] = s_hist[i][k-1]; t_hist[i][k] = t_hist[i][k-1]; } @@ -471,11 +471,11 @@ int FixQEq::pack_forward_comm(int n, int *list, double *buf, if (pack_flag == 1) for (m = 0; m < n; m++) buf[m] = d[list[m]]; - else if ( pack_flag == 2 ) + else if (pack_flag == 2) for (m = 0; m < n; m++) buf[m] = s[list[m]]; - else if ( pack_flag == 3 ) + else if (pack_flag == 3) for (m = 0; m < n; m++) buf[m] = t[list[m]]; - else if ( pack_flag == 4 ) + else if (pack_flag == 4) for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; else m = 0; @@ -591,7 +591,7 @@ double FixQEq::parallel_norm( double *v, int n ) my_sum = 0.0; norm_sqr = 0.0; - for ( ii = 0; ii < n; ++ii ) { + for (ii = 0; ii < n; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_sum += v[i]*v[i]; @@ -616,7 +616,7 @@ double FixQEq::parallel_dot( double *v1, double *v2, int n) my_dot = 0.0; res = 0.0; - for ( ii = 0; ii < n; ++ii ) { + for (ii = 0; ii < n; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_dot += v1[i] * v2[i]; @@ -641,7 +641,7 @@ double FixQEq::parallel_vector_acc( double *v, int n ) my_acc = 0.0; res = 0.0; - for ( ii = 0; ii < n; ++ii ) { + for (ii = 0; ii < n; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_acc += v[i]; @@ -662,7 +662,7 @@ void FixQEq::vector_sum( double* dest, double c, double* v, ilist = list->ilist; - for ( --k; k>=0; --k ) { + for (--k; k>=0; --k) { kk = ilist[k]; if (atom->mask[kk] & groupbit) dest[kk] = c * v[kk] + d * y[kk]; @@ -678,7 +678,7 @@ void FixQEq::vector_add( double* dest, double c, double* v, int k ) ilist = list->ilist; - for ( --k; k>=0; --k ) { + for (--k; k>=0; --k) { kk = ilist[k]; if (atom->mask[kk] & groupbit) dest[kk] += c * v[kk]; diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 6fc98410eb..2bd63b718d 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -113,7 +113,7 @@ void FixQEqDynamic::pre_force(int /*vflag*/) q1[i] = q2[i] = qf[i] = 0.0; } - for (iloop = 0; iloop < maxiter; iloop ++ ) { + for (iloop = 0; iloop < maxiter; iloop ++) { for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { @@ -250,7 +250,7 @@ int FixQEqDynamic::pack_forward_comm(int n, int *list, double *buf, if (pack_flag == 1) for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; - else if ( pack_flag == 2 ) + else if (pack_flag == 2) for (m = 0; m < n; m++) buf[m] = qf[list[m]]; return m; diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 613d6998aa..6e51c906bc 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -132,7 +132,7 @@ void FixQEqFire::pre_force(int /*vflag*/) dt = qstep; dtmax = TMAX * dt; - for (iloop = 0; iloop < maxiter; iloop ++ ) { + for (iloop = 0; iloop < maxiter; iloop ++) { pack_flag = 1; comm->forward_comm_fix(this); @@ -314,7 +314,7 @@ int FixQEqFire::pack_forward_comm(int n, int *list, double *buf, if (pack_flag == 1) for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; - else if ( pack_flag == 2 ) + else if (pack_flag == 2) for (m = 0; m < n; m++) buf[m] = qf[list[m]]; return m; diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 0c9b918647..f112c4859f 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -95,7 +95,7 @@ void FixQEqPoint::init_matvec() inum = list->inum; ilist = list->ilist; - for( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { Hdia_inv[i] = 1. / eta[ atom->type[i] ]; @@ -131,14 +131,14 @@ void FixQEqPoint::compute_H() // fill in the H matrix m_fill = 0; - for( ii = 0; ii < inum; ii++ ) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { jlist = firstneigh[i]; jnum = numneigh[i]; H.firstnbr[i] = m_fill; - for( jj = 0; jj < jnum; jj++ ) { + for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 5cea54b4cb..decfe69ccc 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -97,8 +97,8 @@ void FixQEqShielded::init_shielding() double d7, swa2, swa3, swb2, swb3; int ntypes = atom->ntypes; - for( i = 1; i <= ntypes; ++i ) - for( j = 1; j <= ntypes; ++j ) + for (i = 1; i <= ntypes; ++i) + for (j = 1; j <= ntypes; ++j) shld[i][j] = pow( gamma[i] * gamma[j], -1.5 ); if (fabs(swa) > 0.01 && comm->me == 0) @@ -158,7 +158,7 @@ void FixQEqShielded::init_matvec() inum = list->inum; ilist = list->ilist; - for( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { Hdia_inv[i] = 1. / eta[ atom->type[i] ]; @@ -196,14 +196,14 @@ void FixQEqShielded::compute_H() // fill in the H matrix m_fill = 0; r_sqr = 0; - for( ii = 0; ii < inum; ii++ ) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { jlist = firstneigh[i]; jnum = numneigh[i]; H.firstnbr[i] = m_fill; - for( jj = 0; jj < jnum; jj++ ) { + for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 6860fab26b..5cab1f1979 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -136,7 +136,7 @@ void FixQEqSlater::init_matvec() inum = list->inum; ilist = list->ilist; - for( ii = 0; ii < inum; ++ii ) { + for (ii = 0; ii < inum; ++ii) { i = ilist[ii]; if (atom->mask[i] & groupbit) { Hdia_inv[i] = 1. / eta[ atom->type[i] ]; @@ -353,17 +353,17 @@ void FixQEqSlater::sparse_matvec( sparse_matrix *A, double *x, double *b ) double r = cutoff; double woself = 0.50*erfc(alpha*r)/r + alpha/MY_PIS; - for( i = 0; i < nlocal; ++i ) { + for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) b[i] = (eta[atom->type[i]] - 2.0*force->qqr2e*woself) * x[i]; } - for( i = nlocal; i < nall; ++i ) { + for (i = nlocal; i < nall; ++i) { if (atom->mask[i] & groupbit) b[i] = 0; } - for( i = 0; i < nlocal; ++i ) { + for (i = 0; i < nlocal; ++i) { if (atom->mask[i] & groupbit) { for( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index f15831a498..cfff02d292 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -358,7 +358,7 @@ void FixAppendAtoms::post_force(int /*vflag*/) } for (int i = 0; i < nlocal; i++) { // SET TEMP AHEAD OF SHOCK - if (tempflag && x[i][2] >= domain->boxhi[2] - t_extent ) { + if (tempflag && x[i][2] >= domain->boxhi[2] - t_extent) { gamma1 = gfactor1[type[i]]; gamma2 = gfactor2[type[i]] * tsqrt; f[i][0] += gamma1*v[i][0] + gamma2*(randomt->uniform()-0.5); @@ -386,7 +386,7 @@ void FixAppendAtoms::post_force(int /*vflag*/) // set temp ahead of shock - if (tempflag && x[i][2] >= domain->boxhi[2] - t_extent ) { + if (tempflag && x[i][2] >= domain->boxhi[2] - t_extent) { gamma1 = -rmass[i] / t_period / ftm2v; gamma2 = sqrt(rmass[i]) * sqrt(24.0*boltz/t_period/dt/mvv2e) / ftm2v; gamma2 *= tsqrt; diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index dabe4c425c..a73409e584 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -324,33 +324,33 @@ void FixMSST::setup(int /*vflag*/) couple(); velocity_sum = compute_vsum(); - if ( v0_set == 0 ) { + if (v0_set == 0) { v0 = compute_vol(); v0_set = 1; if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix MSST v0 = {:.8g}\n", v0)); } - if ( p0_set == 0 ) { + if (p0_set == 0) { p0 = p_current[direction]; p0_set = 1; - if ( comm->me == 0 ) + if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix MSST p0 = {:.8g}\n", p0)); } - if ( e0_set == 0 ) { + if (e0_set == 0) { e0 = compute_etotal(); e0_set = 1; - if ( comm->me == 0 ) + if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix MSST e0 = {:.8g}\n", e0)); } temperature->compute_vector(); double *ke_tensor = temperature->vector; double ke_temp = ke_tensor[0]+ke_tensor[1]+ke_tensor[2]; - if (ke_temp > 0.0 && tscale > 0.0 ) { + if (ke_temp > 0.0 && tscale > 0.0) { // transfer energy from atom velocities to cell volume motion // to bias initial compression @@ -371,7 +371,7 @@ void FixMSST::setup(int /*vflag*/) fac2,tscale)); for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - for (int k = 0; k < 3; k++ ) { + for (int k = 0; k < 3; k++) { v[i][k]*=sqrt_initial_temperature_scaling; } } @@ -453,7 +453,7 @@ void FixMSST::initial_integrate(int /*vflag*/) // use Taylor expansion to avoid singularity at B = 0 - if ( B * dthalf > 1.0e-06 ) { + if (B * dthalf > 1.0e-06) { omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { @@ -469,7 +469,7 @@ void FixMSST::initial_integrate(int /*vflag*/) if (dftb) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; const double TS_term = TS_dot/(mass[type[i]]*velocity_sum); const double escale_term = force->ftm2v*beta*(e0-e_scale) / @@ -478,8 +478,8 @@ void FixMSST::initial_integrate(int /*vflag*/) (velocity_sum * mass[type[i]] * vol ); D += escale_term - TS_term; old_velocity[i][k] = v[i][k]; - if ( k == direction ) D -= 2.0 * omega[sd] / vol; - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (k == direction) D -= 2.0 * omega[sd] / vol; + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -492,15 +492,15 @@ void FixMSST::initial_integrate(int /*vflag*/) } else { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ); old_velocity[i][k] = v[i][k]; - if ( k == direction ) { + if (k == direction) { D -= 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -529,7 +529,7 @@ void FixMSST::initial_integrate(int /*vflag*/) if (dftb) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; const double TS_term = TS_dot/(mass[type[i]]*velocity_sum); const double escale_term = force->ftm2v*beta*(e0-e_scale) / @@ -537,8 +537,8 @@ void FixMSST::initial_integrate(int /*vflag*/) double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ); D += escale_term - TS_term; - if ( k == direction ) D -= 2.0 * omega[sd] / vol; - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (k == direction) D -= 2.0 * omega[sd] / vol; + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -551,14 +551,14 @@ void FixMSST::initial_integrate(int /*vflag*/) } else { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ); - if ( k == direction ) { + if (k == direction) { D -= 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -647,7 +647,7 @@ void FixMSST::final_integrate() if (dftb) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( int k = 0; k < 3; k++ ) { + for (int k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; const double TS_term = TS_dot/(mass[type[i]]*velocity_sum); const double escale_term = force->ftm2v*beta*(e0-e_scale) / @@ -655,8 +655,8 @@ void FixMSST::final_integrate() double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ); D += escale_term - TS_term; - if ( k == direction ) D -= 2.0 * omega[sd] / vol; - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (k == direction) D -= 2.0 * omega[sd] / vol; + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -669,14 +669,14 @@ void FixMSST::final_integrate() } else { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( int k = 0; k < 3; k++ ) { + for (int k = 0; k < 3; k++) { const double C = f[i][k] * force->ftm2v / mass[type[i]]; double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ); - if ( k == direction ) { + if (k == direction) { D -= 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { const double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -707,11 +707,11 @@ void FixMSST::final_integrate() // prevent blow-up of the volume - if ( vol > v0 && A > 0.0 ) A = -A; + if (vol > v0 && A > 0.0) A = -A; // use taylor expansion to avoid singularity at B == 0. - if ( B * dthalf > 1.0e-06 ) { + if (B * dthalf > 1.0e-06) { omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { @@ -766,7 +766,7 @@ void FixMSST::remap(int flag) // reset global and local box to new size/shape for (i = 0; i < 3; i++) { - if ( direction == i ) { + if (direction == i) { oldlo = domain->boxlo[i]; oldhi = domain->boxhi[i]; ctr = 0.5 * (oldlo + oldhi); diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index b8df9d7014..744f9d89cb 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -205,12 +205,12 @@ void FixNPHug::setup(int vflag) { FixNH::setup(vflag); - if ( v0_set == 0 ) { + if (v0_set == 0) { v0 = compute_vol(); v0_set = 1; } - if ( p0_set == 0 ) { + if (p0_set == 0) { p0_set = 1; if (uniaxial == 1) p0 = p_current[idir]; @@ -218,7 +218,7 @@ void FixNPHug::setup(int vflag) p0 = (p_current[0]+p_current[1]+p_current[2])/3.0; } - if ( e0_set == 0 ) { + if (e0_set == 0) { e0 = compute_etotal(); e0_set = 1; } diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index bddfcaa3cb..66c97bccda 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -307,7 +307,7 @@ void FixWallPiston::post_integrate() } for (int i = 0; i < nlocal; i++) { // SET TEMP AHEAD OF PISTON - if (tempflag && x[i][2] <= domain->boxlo[2] + t_extent ) { + if (tempflag && x[i][2] <= domain->boxlo[2] + t_extent) { gamma1 = gfactor1[type[i]]; gamma2 = gfactor2[type[i]] * tsqrt; f[i][0] += gamma1*v[i][0] + gamma2*(randomt->uniform()-0.5); @@ -324,7 +324,7 @@ void FixWallPiston::post_integrate() for (int i = 0; i < nlocal; i++) { // SET TEMP AHEAD OF PISTON - if (tempflag && x[i][2] <= domain->boxlo[2] + t_extent ) { + if (tempflag && x[i][2] <= domain->boxlo[2] + t_extent) { gamma1 = -rmass[i] / t_period / ftm2v; gamma2 = sqrt(rmass[i]) * sqrt(24.0*boltz/t_period/dt/mvv2e) / ftm2v; gamma2 *= tsqrt; diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index 856dc3d6f5..f97edfeaa1 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -320,11 +320,11 @@ double ComputePressureBocs::compute_scalar() volume = (domain->xprd * domain->yprd * domain->zprd); /* MRD NJD if block */ - if ( p_basis_type == BASIS_ANALYTIC ) + if (p_basis_type == BASIS_ANALYTIC) { correction = get_cg_p_corr(N_basis,phi_coeff,N_mol,vavg,volume); } - else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) + else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE) { correction = get_cg_p_corr(splines, p_basis_type, volume); } diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 438766e351..81bf3538df 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -186,7 +186,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : } iarg += 4; - if ( strcmp(arg[iarg], "analytic") == 0 ) { + if (strcmp(arg[iarg], "analytic") == 0) { if (iarg + 4 > narg) { error->all(FLERR,"Illegal fix bocs command. Basis type analytic" " must be followed by: avg_vol n_mol n_pmatch_coeff"); @@ -202,13 +202,13 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : for (int pmatchi = 0; pmatchi < N_p_match; pmatchi++) p_match_coeffs[pmatchi] = utils::numeric(FLERR,arg[iarg+pmatchi],false,lmp); iarg += (N_p_match); - } else if (strcmp(arg[iarg], "linear_spline") == 0 ) { + } else if (strcmp(arg[iarg], "linear_spline") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command. " "Supply a file name after linear_spline."); p_basis_type = BASIS_LINEAR_SPLINE; spline_length = read_F_table( arg[iarg+1], p_basis_type ); iarg += 2; - } else if (strcmp(arg[iarg], "cubic_spline") == 0 ) { + } else if (strcmp(arg[iarg], "cubic_spline") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command. " "Supply a file name after cubic_spline."); p_basis_type = BASIS_CUBIC_SPLINE; @@ -551,7 +551,7 @@ void FixBocs::init() ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } - else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) + else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, spline_length); @@ -1592,12 +1592,12 @@ int FixBocs::modify_param(int narg, char **arg) if (p_match_flag) // NJD MRD { - if ( p_basis_type == BASIS_ANALYTIC ) + if (p_basis_type == BASIS_ANALYTIC) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } - else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) + else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, spline_length ); } diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp b/src/USER-COLVARS/colvarproxy_lammps.cpp index 44b0b8b5ed..eb7d1820e5 100644 --- a/src/USER-COLVARS/colvarproxy_lammps.cpp +++ b/src/USER-COLVARS/colvarproxy_lammps.cpp @@ -207,7 +207,7 @@ double colvarproxy_lammps::compute() first_timestep = false; } else { // Use the time step number from LAMMPS Update object - if ( _lmp->update->ntimestep - previous_step == 1 ) { + if (_lmp->update->ntimestep - previous_step == 1) { colvars->it++; b_simulation_continuing = false; } else { @@ -412,7 +412,7 @@ int colvarproxy_lammps::check_atom_id(int atom_number) " for collective variables calculation.\n"); // TODO add upper boundary check? - if ( (aid < 0) ) { + if ((aid < 0)) { cvm::error("Error: invalid atom number specified, "+ cvm::to_str(atom_number)+"\n", INPUT_ERROR); return INPUT_ERROR; diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index 4d47f19ccc..841e2e0099 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -132,7 +132,7 @@ static void rebuild_table_int(inthash_t *tptr) { inthash_init(tptr, old_size<<1); for (i=0; inext; h=inthash(tptr, tmp->key); diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index a241d084be..c0be61dafe 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -88,7 +88,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : ztype[i] = j; } } - if ( ztype[i] == SAEDmaxType + 1 ) + if (ztype[i] == SAEDmaxType + 1) error->all(FLERR,"Compute SAED: Invalid ASF atom type"); iarg++; } @@ -148,7 +148,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : } // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { } else { R_Ewald = (1 / lambda); double Rnorm = R_Ewald/ sqrt(Zone[0] * Zone[0] + @@ -213,7 +213,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : double K[3]; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { for (int i = -Knmax[0]; i <= Knmax[0]; i++) { @@ -239,7 +239,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : r2 += pow(K[m] - Zone[m],2.0); EmdR2 = pow(R_Ewald - dR_Ewald,2); EpdR2 = pow(R_Ewald + dR_Ewald,2); - if ( (r2 > EmdR2 ) && (r2 < EpdR2 ) ) { + if ((r2 > EmdR2) && (r2 < EpdR2)) { n++; } } @@ -293,7 +293,7 @@ void ComputeSAED::init() int n = 0; // Zone 0 0 0 flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { for (int i = -Knmax[0]; i <= Knmax[0]; i++) { @@ -324,7 +324,7 @@ void ComputeSAED::init() r2 += pow(K[m] - Zone[m],2.0); EmdR2 = pow(R_Ewald - dR_Ewald,2); EpdR2 = pow(R_Ewald + dR_Ewald,2); - if ( (r2 > EmdR2 ) && (r2 < EpdR2 ) ) { + if ((r2 > EmdR2) && (r2 < EpdR2)) { store_tmp[3*n] = i; store_tmp[3*n+1] = j; store_tmp[3*n+2] = k; @@ -473,13 +473,13 @@ void ComputeSAED::compute_vector() Fvec[2*n+1] = Fatom2; // reporting progress of calculation - if ( echo ) { + if (echo) { #if defined(_OPENMP) #pragma omp critical // TODO use VMD timer style incrementer #endif { - if ( m == round(frac * nRows) ) { + if (m == round(frac * nRows)) { if (me == 0 && screen) fprintf(screen," %0.0f%% -",frac*100); frac += 0.1; } diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index 3d3bc17c74..0cb47fc2a2 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -89,7 +89,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : ztype[i] = j; } } - if ( ztype[i] == XRDmaxType + 1 ) + if (ztype[i] == XRDmaxType + 1) error->all(FLERR,"Compute XRD: Invalid ASF atom type"); iarg++; } @@ -109,7 +109,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : if (iarg+3 > narg) error->all(FLERR,"Illegal Compute XRD Command"); Min2Theta = atof(arg[iarg+1]) / 2; Max2Theta = atof(arg[iarg+2]) / 2; - if (Max2Theta > MY_PI ) { + if (Max2Theta > MY_PI) { Min2Theta = Min2Theta * MY_PI / 180; // converting to radians if necessary Max2Theta = Max2Theta * MY_PI / 180; radflag = 0; @@ -215,7 +215,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : K[1] = j * dK[1]; K[2] = k * dK[2]; dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); - if (4 >= dinv2 * lambda * lambda ) { + if (4 >= dinv2 * lambda * lambda) { ang = asin(lambda * sqrt(dinv2) * 0.5); if ((ang <= Max2Theta) && (ang >= Min2Theta)) { nRows++; @@ -276,7 +276,7 @@ void ComputeXRD::init() K[1] = j * dK[1]; K[2] = k * dK[2]; dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); - if (4 >= dinv2 * lambda * lambda ) { + if (4 >= dinv2 * lambda * lambda) { ang = asin(lambda * sqrt(dinv2) * 0.5); if ((ang <= Max2Theta) && (ang >= Min2Theta)) { store_tmp[3*n] = k; @@ -422,12 +422,12 @@ void ComputeXRD::compute_array() Fvec[2*n+1] = Fatom2 * sqrt_lp; // reporting progress of calculation - if ( echo ) { + if (echo) { #if defined(_OPENMP) #pragma omp critical #endif { - if ( m == round(frac * size_array_rows) ) { + if (m == round(frac * size_array_rows)) { if (me == 0 && screen) fprintf(screen," %0.0f%% -",frac*100); frac += 0.1; } @@ -476,12 +476,12 @@ void ComputeXRD::compute_array() Fvec[2*n+1] = Fatom2; // reporting progress of calculation - if ( echo ) { + if (echo) { #if defined(_OPENMP) #pragma omp critical #endif { - if ( m == round(frac * size_array_rows) ) { + if (m == round(frac * size_array_rows)) { if (me == 0 && screen) fprintf(screen," %0.0f%% -",frac*100 ); frac += 0.1; } diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index 0791b25aaa..9c3666b426 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -72,7 +72,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : iarg = 6; while (iarg < narg) { - if (strncmp(arg[iarg],"c_",2) == 0 ) { + if (strncmp(arg[iarg],"c_",2) == 0) { int n = strlen(arg[iarg]); char *suffix = new char[n]; @@ -153,7 +153,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // SAED specific paramaters needed int *periodicity = domain->periodicity; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { } else { R_Ewald = (1 / lambda); double Rnorm = R_Ewald/ sqrt(Zone[0] * Zone[0] + @@ -200,7 +200,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : } // Find integer dimensions of the reciprocal lattice box bounds - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; Knmax[i] = ceil(Kmax / dK[i]); @@ -233,15 +233,15 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : r=0.0; for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0); r = sqrt(r); - if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ) { + if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) )) { - if ( i < Knmin[0] ) Knmin[0] = i; - if ( j < Knmin[1] ) Knmin[1] = j; - if ( k < Knmin[2] ) Knmin[2] = k; + if (i < Knmin[0]) Knmin[0] = i; + if (j < Knmin[1]) Knmin[1] = j; + if (k < Knmin[2]) Knmin[2] = k; - if ( i > Knmax[0] ) Knmax[0] = i; - if ( j > Knmax[1] ) Knmax[1] = j; - if ( k > Knmax[2] ) Knmax[2] = k; + if (i > Knmax[0]) Knmax[0] = i; + if (j > Knmax[1]) Knmax[1] = j; + if (k > Knmax[2]) Knmax[2] = k; } } } @@ -251,7 +251,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // Finding dimensions for vtk files for (int i=0; i<3; i++) { - if ( ( (Knmin[i] > 0) && (Knmax[i] > 0) ) || ( (Knmin[i] < 0) && (Knmax[i] < 0) ) ) { + if (( (Knmin[i] > 0) && (Knmax[i] > 0) ) || ( (Knmin[i] < 0) && (Knmax[i] < 0) )) { Dim[i] = abs( (int) Knmin[i] ) + abs( (int) Knmax[i] ); } else Dim[i] = abs( (int) Knmin[i] ) + abs( (int) Knmax[i] ) + 1; } @@ -452,7 +452,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) double K[3]; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { + if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { for (int k = Knmin[2]; k <= Knmax[2]; k++) { for (int j = Knmin[1]; j <= Knmax[1]; j++) { for (int i = Knmin[0]; i <= Knmax[0]; i++) { @@ -485,7 +485,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) r=0.0; for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0); r = sqrt(r); - if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ) { + if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) )) { fprintf(fp,"%g\n",vector_total[NROW1]/norm); fflush(fp); NROW2++; diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index ad3bf7c30c..c9d12506ab 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -1220,7 +1220,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 (1) { // Estimate y'' with finite-difference ... @@ -1258,11 +1258,11 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/, double hrat = hnew / hg; // Accept this value ... the bias factor should bring it within range. - if ( (hrat > 0.5) && (hrat < 2.0) ) + if ((hrat > 0.5) && (hrat < 2.0)) hnew_is_ok = true; // If y'' is still bad after a few iterations, just accept h and give up. - if ( (iter > 1) && hrat > 2.0 ) { + if ((iter > 1) && hrat > 2.0) { hnew = hg; hnew_is_ok = true; } diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index 6c975c97f3..cefbe5a73d 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -400,7 +400,7 @@ void PairTableRX::coeff(int narg, char **arg) ntables++; { - if ( strcmp(site1,"1fluid") == 0 ) + if (strcmp(site1,"1fluid") == 0) isite1 = OneFluidValue; else { isite1 = nspecies; @@ -415,7 +415,7 @@ void PairTableRX::coeff(int narg, char **arg) if (isite1 == nspecies) error->all(FLERR,"isite1 == nspecies"); } - if ( strcmp(site2,"1fluid") == 0 ) + if (strcmp(site2,"1fluid") == 0) isite2 = OneFluidValue; else { isite2 = nspecies; diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index ea65a91953..31bd63160f 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -1170,7 +1170,7 @@ int FixIntel::set_host_affinity(const int nomp) p = popen(cmd, "r"); if (p == nullptr) return -1; ncores = 0; - while(fgets(readbuf, 512, p)) { + while (fgets(readbuf, 512, p)) { proc_list[ncores] = atoi(readbuf); ncores++; } @@ -1224,7 +1224,7 @@ int FixIntel::set_host_affinity(const int nomp) p = popen(cmd, "r"); if (p == nullptr) return -1; - while(fgets(readbuf, 512, p)) { + while (fgets(readbuf, 512, p)) { lwp = atoi(readbuf); int first = coi_cores + node_rank * mpi_cores; CPU_ZERO(&cpuset); @@ -1260,7 +1260,7 @@ int FixIntel::set_host_affinity(const int nomp) p = popen(cmd, "r"); if (p == nullptr) return -1; - while(fgets(readbuf, 512, p)) { + while (fgets(readbuf, 512, p)) { lwp = atoi(readbuf); nlwp++; if (nlwp <= plwp) continue; diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index 1aec1dcbf7..010237dcdf 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -493,7 +493,7 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ( (ntypes != _ntypes || ntable != _ntable) ) { + if ((ntypes != _ntypes || ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index d56b0dfd24..72d78fb6c7 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -604,7 +604,7 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ( (ntypes != _ntypes || ntable != _ntable) ) { + if ((ntypes != _ntypes || ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index 77f6a1136c..df81b6852f 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -442,7 +442,7 @@ template void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, Memory *memory, const int cop) { - if ( (ntypes != _ntypes ) ) { + if ((ntypes != _ntypes )) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index ad15c045ab..b89deacc0b 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -640,7 +640,7 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ( (ntypes != _ntypes || ntable != _ntable) ) { + if ((ntypes != _ntypes || ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index d6d763677c..111f5610b6 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -599,7 +599,7 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ( (ntypes != _ntypes || ntable != _ntable) ) { + if ((ntypes != _ntypes || ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index bce2045f26..4284309b74 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -566,7 +566,7 @@ template void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, Memory *memory, const int cop) { - if ( (ntypes != _ntypes) ) { + if ((ntypes != _ntypes)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD c_first_loop_t * oc_first_loop = c_first_loop[0]; diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index bcb14ce1f9..d389b9787e 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -86,7 +86,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : // equal style vars (so that they are not overwritten each time step). double *params = ptr_m->params; - for( int i = 0; i < nvars; ++i ) { + for (int i = 0; i < nvars; ++i) { if (was_var( arg[i+4] )) error->all(FLERR,"Equal-style variables not allowed with fix manifoldforce"); diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index bea7955d33..229dfd2433 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -117,7 +117,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, error->all(FLERR, msg); } // Loop over manifold args: - for( int i = 0; i < nvars; ++i ) { + for (int i = 0; i < nvars; ++i) { int len = 0, offset = 0; if (was_var( arg[i+6] )) { len = strlen(arg[i+6]) - 1; // -1 because -2 for v_, +1 for \0. @@ -135,7 +135,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, ptr_m->params = new double[nvars]; if (!ptr_m->params ) error->all(FLERR,"Failed to allocate params!"); - for( int i = 0; i < nvars; ++i ) { + for (int i = 0; i < nvars; ++i) { // If param i was variable type, it will be set later... ptr_m->params[i] = is_var[i] ? 0.0 : utils::numeric( FLERR, arg[i+6] ,false,lmp); } @@ -144,7 +144,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, // Loop over rest of args: int argi = 6 + nvars; - while( argi < narg ) { + while ( argi < narg) { if (strcmp(arg[argi], "every") == 0) { nevery = utils::inumeric(FLERR,arg[argi+1],false,lmp); next_output = update->ntimestep + nevery; @@ -170,7 +170,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, FixNVEManifoldRattle::~FixNVEManifoldRattle() { if (tstrs) { - for( int i = 0; i < nvars; ++i ) { + for (int i = 0; i < nvars; ++i) { delete [] tstrs[i]; } delete [] tstrs; @@ -277,7 +277,7 @@ void FixNVEManifoldRattle::update_var_params() double *ptr_params = ptr_m->params; - for( int i = 0; i < nvars; ++i ) { + for (int i = 0; i < nvars; ++i) { if (is_var[i]) { tvars[i] = input->variable->find(tstrs[i]); if (tvars[i] < 0) { @@ -306,7 +306,7 @@ int FixNVEManifoldRattle::dof(int /*igroup*/) int *mask = atom->mask; int nlocal = atom->nlocal; int natoms = 0; - for( int i = 0; i < nlocal; ++i ) { + for (int i = 0; i < nlocal; ++i) { if (mask[i] & groupbit) ++natoms; } @@ -508,7 +508,7 @@ void FixNVEManifoldRattle::rattle_manifold_x(double *x, double *v, const double c_inv = 1.0 / c; - while ( 1 ) { + while (1) { v[0] = vt[0] - l*no_dt[0]; v[1] = vt[1] - l*no_dt[1]; v[2] = vt[2] - l*no_dt[2]; @@ -643,7 +643,7 @@ void FixNVEManifoldRattle::rattle_manifold_v(double *v, double *f, res = infnorm<4>(R); ++iters; - }while( (res > tolerance) && (iters < max_iter) ); + } while ((res > tolerance) && (iters < max_iter)); if (iters >= max_iter && res >= tolerance) { char msg[2048]; diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp index d8a5360506..9ac81aafb0 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -95,8 +95,7 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, which = got_temp = 0; int argi = 6 + ptr_m->nparams(); - while( argi < narg ) - { + while (argi < narg) { if (strcmp( arg[argi], "temp") == 0) { if (argi+3 >= narg) error->all(FLERR,"Keyword 'temp' needs 3 arguments"); @@ -165,7 +164,7 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, eta_dot[mtchain] = 0.0; eta_dot[mtchain] = 0.0; - for( int ich = 0; ich < mtchain; ++ich ) { + for (int ich = 0; ich < mtchain; ++ich) { eta[ich] = eta_dot[ich] = eta_dotdot[ich] = 0.0; } @@ -232,11 +231,11 @@ void FixNVTManifoldRattle::setup(int /*vflag*/) // Compute/set eta-masses: double inv_t_freq2 = 1.0 / (t_freq*t_freq); eta_mass[0] = tdof * boltz * t_target * inv_t_freq2; - for( int ich = 1; ich < mtchain; ++ich ) { + for (int ich = 1; ich < mtchain; ++ich) { eta_mass[ich] = boltz * t_target * inv_t_freq2; } - for( int ich = 1; ich < mtchain; ++ich ) { + for (int ich = 1; ich < mtchain; ++ich) { eta_dotdot[ich] = (eta_mass[ich-1]*eta_dot[ich-1]*eta_dot[ich-1] - boltz * t_target ) / eta_mass[ich]; } @@ -268,7 +267,7 @@ void FixNVTManifoldRattle::nhc_temp_integrate() double expfac, kecurrent = tdof * boltz * t_current; double inv_t_freq2 = 1.0 / (t_freq*t_freq); eta_mass[0] = tdof * boltz * t_target * inv_t_freq2; - for( int ich = 1; ich < mtchain; ++ich ) { + for (int ich = 1; ich < mtchain; ++ich) { eta_mass[ich] = boltz * t_target * inv_t_freq2; } @@ -278,7 +277,7 @@ void FixNVTManifoldRattle::nhc_temp_integrate() eta_dotdot[0] = 0; } - for( ich = mtchain-1; ich > 0; --ich ) { + for (ich = mtchain-1; ich > 0; --ich) { expfac = exp(-dt8*eta_dot[ich+1]); eta_dot[ich] *= expfac; eta_dot[ich] += eta_dotdot[ich] * dt4; @@ -311,14 +310,14 @@ void FixNVTManifoldRattle::nhc_temp_integrate() eta_dotdot[0] = 0.0; } - for( int ich = 1; ich < mtchain; ++ich ) { + for (int ich = 1; ich < mtchain; ++ich) { eta[ich] += dthalf*eta_dot[ich]; } eta_dot[0] *= expfac; eta_dot[0] += eta_dotdot[0]*dt4; eta_dot[0] *= expfac; - for( int ich = 1; ich < mtchain; ++ich ) { + for (int ich = 1; ich < mtchain; ++ich) { expfac = exp(-dt8*eta_dot[ich+1]); eta_dot[ich] *= expfac; eta_dotdot[ich] = (eta_mass[ich-1]*eta_dot[ich-1]*eta_dot[ich-1] @@ -340,7 +339,7 @@ void FixNVTManifoldRattle::nh_v_temp() if (which == NOBIAS) { - for( int i = 0; i < nlocal; ++i ) { + for (int i = 0; i < nlocal; ++i) { if (mask[i] & groupbit) { v[i][0] *= factor_eta; v[i][1] *= factor_eta; @@ -348,7 +347,7 @@ void FixNVTManifoldRattle::nh_v_temp() } } } else if (which == BIAS) { - for( int i = 0; i < nlocal; ++i ) { + for (int i = 0; i < nlocal; ++i) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); v[i][0] *= factor_eta; diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index 0864e1e2f2..79d0185d1b 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -69,7 +69,7 @@ public: double ff = x(t) - xx; double ffp = xp(t); // double l = 1.0 / ( 1 + res*res ); - for( int i = 0; i < maxit; ++i ) { + for (int i = 0; i < maxit; ++i) { t -= ff / ffp; ff = x(t) - xx; ffp = xp(t); @@ -294,7 +294,7 @@ void manifold_gaussian_bump::make_lut() cubic_hermite pchip( lut_x0, lut_x1, f_at_rc, 0.0, fp_at_rc, 0.0, error ); double xx = lut_x0; - for( int i = 0; i <= lut_Nbins; ++i ) { + for (int i = 0; i <= lut_Nbins; ++i) { lut_z[i] = pchip.y_from_x( xx ); lut_zp[i] = pchip.yp_from_x( xx ); xx += lut_dx; @@ -355,7 +355,7 @@ void manifold_gaussian_bump::test_lut() FILE *fp = fopen( "test_lut_gaussian.dat", "w" ); double dx = 0.1; - for( double xx = 0; xx < 20; xx += dx ) { + for (double xx = 0; xx < 20; xx += dx) { x[0] = xx; x[1] = 0.0; x[2] = 0.0; diff --git a/src/USER-MANIFOLD/manifold_thylakoid.cpp b/src/USER-MANIFOLD/manifold_thylakoid.cpp index c4dfd33c30..b7eab17fe1 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid.cpp @@ -57,17 +57,17 @@ void manifold_thylakoid::post_param_init() void manifold_thylakoid::checkup() { - if (comm->me == 0 ) { + if (comm->me == 0) { fprintf(screen,"This is checkup of thylakoid %p\n", this); fprintf(screen,"I have %ld parts. They are:\n", parts.size()); - for ( int i = 0; i < (int)parts.size(); ++i ) { + for (int i = 0; i < (int)parts.size(); ++i) { fprintf(screen, "[%f, %f] x [%f, %f] x [%f, %f]\n", parts[i]->xlo, parts[i]->xhi, parts[i]->ylo, parts[i]->yhi, parts[i]->zlo, parts[i]->zhi ); } fprintf(screen,"My params are:\n"); - for ( int i = 0; i < NPARAMS; ++i ) { + for (int i = 0; i < NPARAMS; ++i) { fprintf(screen,"%f\n", params[i]); } } @@ -120,7 +120,7 @@ void manifold_thylakoid::n( const double *x, double *n ) thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_flag*/, std::size_t *idx ) { - for ( std::size_t i = 0; i < parts.size(); ++i ) { + for (std::size_t i = 0; i < parts.size(); ++i) { thyla_part *p = parts[i]; if (is_in_domain(p,x)) { if (idx != nullptr) *idx = i; @@ -604,7 +604,7 @@ thyla_part *manifold_thylakoid::make_cyl_to_plane_part(double X0, double R0, dou void manifold_thylakoid::print_part_data( FILE *fp_doms, FILE *fp_coms ) { - for ( std::size_t i = 0; i < parts.size(); ++i ) { + for (std::size_t i = 0; i < parts.size(); ++i) { thyla_part *p = parts[i]; fprintf(fp_doms, "%f %f\n", p->xlo, p->ylo); fprintf(fp_doms, "%f %f\n", p->xlo, p->yhi); diff --git a/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp b/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp index c0b6871ea8..29e0ee82e9 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp @@ -40,7 +40,7 @@ thyla_part::thyla_part( int type, double *args, double xlo, double ylo, double z // The others should be 1. if ( (args[0] != 1.0) && (args[0] != 0.0) && (args[1] != 1.0) && (args[1] != 0.0) && - (args[2] != 1.0) && (args[2] != 0.0) ) { + (args[2] != 1.0) && (args[2] != 0.0)) { err_flag = -1; } break; diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index f7201052ff..04307429b4 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -275,7 +275,7 @@ void PairEDPD::settings(int narg, char **arg) // initialize Marsaglia RNG with processor-unique seed - if (seed <= 0 ) { + if (seed <= 0) { struct timespec time; clock_gettime( CLOCK_REALTIME, &time ); seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 4dc42eb56a..30589e19bd 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -217,7 +217,7 @@ void PairMDPD::settings(int narg, char **arg) // initialize Marsaglia RNG with processor-unique seed - if (seed <= 0 ) { + if (seed <= 0) { struct timespec time; clock_gettime( CLOCK_REALTIME, &time ); seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index a416d94a00..a57b682c1c 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -239,7 +239,7 @@ void PairTDPD::settings(int narg, char **arg) // initialize Marsaglia RNG with processor-unique seed - if (seed <= 0 ) { + if (seed <= 0) { struct timespec time; clock_gettime( CLOCK_REALTIME, &time ); seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed diff --git a/src/USER-MGPT/mgpt_readpot.cpp b/src/USER-MGPT/mgpt_readpot.cpp index 773c3d0fe9..9b89894f6f 100644 --- a/src/USER-MGPT/mgpt_readpot.cpp +++ b/src/USER-MGPT/mgpt_readpot.cpp @@ -75,7 +75,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub vsize = 10; volarr = (double *) malloc(sizeof(double) * vsize); n = 0; - while(fgets(line,sizeof(line),in) != nullptr) { + while (fgets(line,sizeof(line),in) != nullptr) { double zval,ivol,rws,mass; double r0x,r1x,drx; int nrx,i; @@ -185,7 +185,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl in = fopen(parmin_file,"r"); do { fgets(line,sizeof(line),in); - } while(line[strspn(line," \t")] == '#'); + } while (line[strspn(line," \t")] == '#'); /* Test to see whether this is a one-line or two-line version of parmin */ if (sscanf(line,"%lf %lf %lf %lf %d",&ddl[1],&ddl[2],&ddl[3],&ddl[4],&L) == 5) { @@ -244,7 +244,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl do { fgets(line,sizeof(line),in); - } while(line[strspn(line," \t")] == '#'); + } while (line[strspn(line," \t")] == '#'); metalx[0] = 0; diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index b358b12857..75f870e1b2 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -481,7 +481,7 @@ void PairMGPT::force_debug_4(double xx[][3], trd2 = transtrace(T12->H1H2##coord,T45->H1H2 ); \ trd3 = transtrace(T12->H1H2 ,T45->H1##coord##H2); \ trd4 = transtrace(T12->H1H2 ,T45->H1H2##coord ); \ - } while(0) + } while (0) */ #define trd_update_4(T12,T45) \ do { \ @@ -510,7 +510,7 @@ void PairMGPT::force_debug_4(double xx[][3], trd1y = utr1y.d; trd2y = utr2y.d; trd3y = utr3y.d; trd4y = utr4y.d; \ trd1z = utr1z.d; trd2z = utr2z.d; trd3z = utr3z.d; trd4z = utr4z.d; \ } \ - } while(0) + } while (0) #define dfix_update_4a(coord) \ do { \ @@ -518,7 +518,7 @@ void PairMGPT::force_debug_4(double xx[][3], dfj##coord = ( ( sij)*trd1##coord + (-sjk)*trd2##coord ) * (ve / anorm4); \ dfk##coord = ( ( sjk)*trd2##coord + (-skm)*trd4##coord ) * (ve / anorm4); \ dfm##coord = ( ( sim)*trd3##coord + ( skm)*trd4##coord ) * (ve / anorm4); \ - } while(0) + } while (0) #define dfix_update_4b(coord) \ @@ -527,7 +527,7 @@ void PairMGPT::force_debug_4(double xx[][3], dfj##coord = ( (-sjk)*trd2##coord + (-sjm)*trd4##coord ) * (ve / anorm4); \ dfk##coord = ( (-ski)*trd1##coord + ( sjk)*trd2##coord ) * (ve / anorm4); \ dfm##coord = ( ( sim)*trd3##coord + ( sjm)*trd4##coord ) * (ve / anorm4); \ - } while(0); + } while (0); #define dfix_update_4c(coord) \ do { \ @@ -535,7 +535,7 @@ void PairMGPT::force_debug_4(double xx[][3], dfj##coord = ( ( sij)*trd1##coord + (-sjm)*trd3##coord ) * (ve / anorm4); \ dfk##coord = ( (-ski)*trd2##coord + (-skm)*trd4##coord ) * (ve / anorm4); \ dfm##coord = ( ( sjm)*trd3##coord + ( skm)*trd4##coord ) * (ve / anorm4); \ - } while(0); + } while (0); #define accumulate_forces_2(w) \ do { \ @@ -546,7 +546,7 @@ void PairMGPT::force_debug_4(double xx[][3], fjx = fjx + dfjx*(w); \ fjy = fjy + dfjy*(w); \ fjz = fjz + dfjz*(w); \ - } while(0) + } while (0) #define accumulate_forces_3(w) \ do { \ @@ -554,7 +554,7 @@ void PairMGPT::force_debug_4(double xx[][3], fkx = fkx + dfkx*(w); \ fky = fky + dfky*(w); \ fkz = fkz + dfkz*(w); \ - } while(0) + } while (0) #define accumulate_forces_4(w) \ do { \ @@ -562,7 +562,7 @@ void PairMGPT::force_debug_4(double xx[][3], fmx = fmx + dfmx*(w); \ fmy = fmy + dfmy*(w); \ fmz = fmz + dfmz*(w); \ - } while(0) + } while (0) @@ -868,7 +868,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, */ p = first[i+1]-1; - while(p >= first[i] && nlist_short[p] > j) { + while (p >= first[i] && nlist_short[p] > j) { nlist_short[p+1] = nlist_short[p]; p = p - 1; } @@ -941,7 +941,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, Since i is in the j-list, and i > k and the list is sorted, the loop below terminates:-) */ - while(mj < first[j+1] && nlist_short[mj] < k) mj = mj + 1; + while (mj < first[j+1] && nlist_short[mj] < k) mj = mj + 1; if (mj < first[j+1] && nlist_short[mj] == k) { /* Closed triplet */ c_jk = 1; @@ -1265,7 +1265,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, i is in both the j-list and the k-list, and i > k, and lists are sorted, so the loop terminates. */ - while(nlist_short[mj] < i && nlist_short[mk] < i) { + while (nlist_short[mj] < i && nlist_short[mk] < i) { if (mj >= first[j+1] || mk >= first[k+1]) { printf("Illegal quad...\n" @@ -1291,7 +1291,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, /* Alrady know ij,jk,ki,jm,km bonds. Look for im bond. */ mi = first[i]; - while(mi < first[i+1] && nlist_short[mi] < m) mi = mi + 1; + while (mi < first[i+1] && nlist_short[mi] < m) mi = mi + 1; if (mi < first[i+1] && nlist_short[mi] == m) c_im = 1; else @@ -1613,7 +1613,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, { Hash::Iterator iter = bond_hash.begin(); int nitem = 0,nhit = 0; - while(iter != bond_hash.end()) { + while (iter != bond_hash.end()) { nitem++; nhit += iter.link()->hits; iter.next(); @@ -2149,7 +2149,7 @@ void PairMGPT::fl_deriv_new(double r,double ri,double xhat,double yhat,double zh Mx[j][i] = Mx[i][j] = fl_x*tmp + fl_ri*(tmpx - x*tmpsum); \ My[j][i] = My[i][j] = fl_y*tmp + fl_ri*(tmpy - y*tmpsum); \ Mz[j][i] = Mz[i][j] = fl_z*tmp + fl_ri*(tmpz - z*tmpsum); \ - } while(0) + } while (0) #define MAKE_ELEMENT_7(i,j) \ do { \ @@ -2168,7 +2168,7 @@ void PairMGPT::fl_deriv_new(double r,double ri,double xhat,double yhat,double zh Mx[j][i] = Mx[i][j] = fl_x*tmp + fl_ri*(tmpx - x*tmpsum); \ My[j][i] = My[i][j] = fl_y*tmp + fl_ri*(tmpy - y*tmpsum); \ Mz[j][i] = Mz[i][j] = fl_z*tmp + fl_ri*(tmpz - z*tmpsum); \ - } while(0) + } while (0) /* End of bond matrix macros */ diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index 0194626e81..47b74fad99 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -204,9 +204,9 @@ void AngleFourier::coeff(int narg, char **arg) double AngleFourier::equilibrium_angle(int i) { double ret=MY_PI; - if ( C2[i] != 0.0 ) { + if (C2[i] != 0.0) { ret = (C1[i]/4.0/C2[i]); - if ( fabs(ret) <= 1.0 ) ret = acos(-ret); + if (fabs(ret) <= 1.0) ret = acos(-ret); } return ret; } diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index 4a3e64c6a9..2b40c2f12f 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -118,10 +118,10 @@ void AngleFourierSimple::compute(int eflag, int vflag) // handle sin(n th)/sin(th) singulatiries - if ( fabs(c)-1.0 > 0.0001 ) { + if (fabs(c)-1.0 > 0.0001) { a = k[type]*C[type]*N[type]*sin(nth)/sin(th); } else { - if ( c >= 0.0 ) { + if (c >= 0.0) { term = 1.0 - c; sgn = 1.0; } else { diff --git a/src/USER-MISC/angle_gaussian.cpp b/src/USER-MISC/angle_gaussian.cpp index 66da9e792e..2150ef7a4b 100644 --- a/src/USER-MISC/angle_gaussian.cpp +++ b/src/USER-MISC/angle_gaussian.cpp @@ -217,7 +217,7 @@ void AngleGaussian::coeff(int narg, char **arg) alpha[i] = new double [n]; width[i] = new double [n]; theta0[i] = new double [n]; - for (int j = 0; j < n; j++ ) { + for (int j = 0; j < n; j++) { alpha[i][j] = utils::numeric(FLERR,arg[3+3*j],false,lmp); width[i][j] = utils::numeric(FLERR,arg[4+3*j],false,lmp); theta0[i][j] = utils::numeric(FLERR,arg[5+3*j],false,lmp)* MY_PI / 180.0; diff --git a/src/USER-MISC/bond_gaussian.cpp b/src/USER-MISC/bond_gaussian.cpp index 42f76eda75..dcb8d7a4ad 100644 --- a/src/USER-MISC/bond_gaussian.cpp +++ b/src/USER-MISC/bond_gaussian.cpp @@ -171,7 +171,7 @@ void BondGaussian::coeff(int narg, char **arg) alpha[i] = new double [n]; width[i] = new double [n]; r0[i] = new double [n]; - for (int j = 0; j < n; j++ ) { + for (int j = 0; j < n; j++) { alpha[i][j] = utils::numeric(FLERR,arg[3+3*j],false,lmp); width[i][j] = utils::numeric(FLERR,arg[4+3*j],false,lmp); r0[i][j] = utils::numeric(FLERR,arg[5+3*j],false,lmp); diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index 1362da447b..2fea708a71 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -122,7 +122,7 @@ void ComputeEntropyAtom::init() error->all(FLERR,"Compute entropy/atom requires a pair style be" " defined"); - if ( (cutoff+cutoff2) > (force->pair->cutforce + neighbor->skin) ) + if ((cutoff+cutoff2) > (force->pair->cutforce + neighbor->skin)) { error->all(FLERR,"Compute entropy/atom cutoff is longer than the" " pairwise cutoff. Increase the neighbor list skin" diff --git a/src/USER-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index a1f88aadaf..87de00cedd 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -67,7 +67,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); } else pos = utils::numeric(FLERR,arg[4],false,lmp); - if ( pos < (domain->boxlo[dir]+domain->prd_half[dir]) ) { + if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { pos1 = pos - domain->prd[dir]; @@ -319,7 +319,7 @@ void ComputeStressMop::compute_pairs() if (newton_pair || j < nlocal) { //check if ij pair is across plane, add contribution to pressure - if ( ((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]pos) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -327,7 +327,7 @@ void ComputeStressMop::compute_pairs() values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; } - else if ( ((xi[dir]pos)) || ((xi[dir]pos1)) ) { + else if (((xi[dir]pos)) || ((xi[dir]pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -338,7 +338,7 @@ void ComputeStressMop::compute_pairs() } else { - if ( ((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]pos) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 3bd0139dea..4861e49e7e 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -336,7 +336,7 @@ void ComputeStressMopProfile::compute_pairs() //check if ij pair is across plane, add contribution to pressure if ( ((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -345,7 +345,7 @@ void ComputeStressMopProfile::compute_pairs() values_local[ibin][m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; } else if ( ((xi[dir]pos)) - || ((xi[dir]pos1)) ) { + || ((xi[dir]pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -363,7 +363,7 @@ void ComputeStressMopProfile::compute_pairs() //check if ij pair is across plane, add contribution to pressure if ( ((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir]pos1) && (xj[dir]single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -499,7 +499,7 @@ void ComputeStressMopProfile::setup_bins() // set bin coordinates for (i = 0; i < nbins; i++) { coord[i][0] = offset + i*delta; - if ( coord[i][0] < (domain->boxlo[dir]+domain->prd_half[dir]) ) { + if (coord[i][0] < (domain->boxlo[dir]+domain->prd_half[dir])) { coordp[i][0] = coord[i][0] + domain->prd[dir]; } else { coordp[i][0] = coord[i][0] - domain->prd[dir]; diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index e4a61787a2..7ca8260bfe 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -50,11 +50,11 @@ DihedralFourier::~DihedralFourier() memory->destroy(nterms); for (int i=1; i<= atom->ndihedraltypes; i++) { - if ( k[i] ) delete [] k[i]; - if ( multiplicity[i] ) delete [] multiplicity[i]; - if ( shift[i] ) delete [] shift[i]; - if ( cos_shift[i] ) delete [] cos_shift[i]; - if ( sin_shift[i] ) delete [] sin_shift[i]; + if (k[i]) delete [] k[i]; + if (multiplicity[i]) delete [] multiplicity[i]; + if (shift[i]) delete [] shift[i]; + if (cos_shift[i]) delete [] cos_shift[i]; + if (sin_shift[i]) delete [] sin_shift[i]; } delete [] k; delete [] multiplicity; diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index 1041062530..03f235b166 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -47,7 +47,7 @@ DihedralNHarmonic::~DihedralNHarmonic() if (allocated) { memory->destroy(setflag); for (int i = 1; i <= atom->ndihedraltypes; i++) - if ( a[i] ) delete [] a[i]; + if (a[i]) delete [] a[i]; delete [] a; delete [] nterms; } @@ -290,7 +290,7 @@ void DihedralNHarmonic::coeff(int narg, char **arg) for (int i = ilo; i <= ihi; i++) { a[i] = new double [n]; nterms[i] = n; - for (int j = 0; j < n; j++ ) { + for (int j = 0; j < n; j++) { a[i][j] = utils::numeric(FLERR,arg[2+j],false,lmp); setflag[i] = 1; } diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 2f77887de9..4d753423f5 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -52,16 +52,16 @@ DihedralSpherical::~DihedralSpherical() memory->destroy(nterms); for (int i=1; i<= atom->ndihedraltypes; i++) { - if ( Ccoeff[i] ) delete [] Ccoeff[i]; - if ( phi_mult[i] ) delete [] phi_mult[i]; - if ( phi_shift[i] ) delete [] phi_shift[i]; - if ( phi_offset[i] ) delete [] phi_offset[i]; - if ( theta1_mult[i] ) delete [] theta1_mult[i]; - if ( theta1_shift[i] ) delete [] theta1_shift[i]; - if ( theta1_offset[i] ) delete [] theta1_offset[i]; - if ( theta2_mult[i] ) delete [] theta2_mult[i]; - if ( theta2_shift[i] ) delete [] theta2_shift[i]; - if ( theta2_offset[i] ) delete [] theta2_offset[i]; + if (Ccoeff[i]) delete [] Ccoeff[i]; + if (phi_mult[i]) delete [] phi_mult[i]; + if (phi_shift[i]) delete [] phi_shift[i]; + if (phi_offset[i]) delete [] phi_offset[i]; + if (theta1_mult[i]) delete [] theta1_mult[i]; + if (theta1_shift[i]) delete [] theta1_shift[i]; + if (theta1_offset[i]) delete [] theta1_offset[i]; + if (theta2_mult[i]) delete [] theta2_mult[i]; + if (theta2_shift[i]) delete [] theta2_shift[i]; + if (theta2_offset[i]) delete [] theta2_offset[i]; } delete [] Ccoeff; delete [] phi_mult; diff --git a/src/USER-MISC/fix_flow_gauss.cpp b/src/USER-MISC/fix_flow_gauss.cpp index 0dabf82436..b1b4174352 100644 --- a/src/USER-MISC/fix_flow_gauss.cpp +++ b/src/USER-MISC/fix_flow_gauss.cpp @@ -84,10 +84,10 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) : // process optional keyword int iarg = 6; while (iarg < narg) { - if ( strcmp(arg[iarg],"energy") == 0 ) { - if ( iarg+2 > narg ) error->all(FLERR,"Illegal energy keyword"); - if ( strcmp(arg[iarg+1],"yes") == 0 ) workflag = 1; - else if ( strcmp(arg[iarg+1],"no") != 0 ) + if (strcmp(arg[iarg],"energy") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal energy keyword"); + if (strcmp(arg[iarg+1],"yes") == 0) workflag = 1; + else if (strcmp(arg[iarg+1],"no") != 0) error->all(FLERR,"Illegal energy keyword"); iarg += 2; } else error->all(FLERR,"Illegal fix flow/gauss command"); diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 0f0f601584..0da5b29b62 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -146,7 +146,7 @@ static void rebuild_table_tagint(taginthash_t *tptr) { taginthash_init(tptr, old_size<<1); for (i=0; inext; h=taginthash(tptr, tmp->key); @@ -349,7 +349,7 @@ static void id_sort(tagint *idmap, tagint left, tagint right) #include -#if ( INT_MAX == 2147483647 ) +#if (INT_MAX == 2147483647) typedef int int32; #else typedef short int32; diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index 7fb696ce8c..1f1b527816 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -155,7 +155,7 @@ static void readbuffer(int sockfd, char *data, int len, Error* error) n = nr = read(sockfd,data,len); - while (nr>0 && n0 && nmask; int nlocal = atom->nlocal; - for( int i = 0; i < nlocal; i++ ) { // Iterate through all atoms on this CPU + for (int i = 0; i < nlocal; i++) { // Iterate through all atoms on this CPU if (mask[i] & groupbit) { // ...only those affected by this fix nThisLocal++; } @@ -156,7 +156,7 @@ FixRhok::post_force( int /*inVFlag*/ ) mRhoKLocal[0] = 0.0; mRhoKLocal[1] = 0.0; - for( int i = 0; i < nlocal; i++ ) { // Iterate through all atoms on this CPU + for (int i = 0; i < nlocal; i++) { // Iterate through all atoms on this CPU if (mask[i] & groupbit) { // ...only those affected by this fix // rho_k = sum_i exp( - i k.r_i ) @@ -179,7 +179,7 @@ FixRhok::post_force( int /*inVFlag*/ ) double rhoK = sqrt( mRhoKGlobal[0]*mRhoKGlobal[0] + mRhoKGlobal[1]*mRhoKGlobal[1] ); - for( int i = 0; i < nlocal; i++ ) { // Iterate through all atoms on this CPU + for (int i = 0; i < nlocal; i++) { // Iterate through all atoms on this CPU if (mask[i] & groupbit) { // ...only those affected by this fix // Calculate forces @@ -235,9 +235,9 @@ FixRhok::compute_vector( int inI ) { if (inI == 0) return mRhoKGlobal[0]; // Real part - else if ( inI == 1 ) + else if (inI == 1) return mRhoKGlobal[1]; // Imagniary part - else if ( inI == 2 ) + else if (inI == 2) return sqrt( mRhoKGlobal[0]*mRhoKGlobal[0] + mRhoKGlobal[1]*mRhoKGlobal[1] ); else diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 3a87dfa96d..5aac36a47b 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -222,12 +222,12 @@ void FixTISpring::initial_integrate(int /*vflag*/) const bigint t = update->ntimestep - (t0+t_equil); const double r_switch = 1.0/t_switch; - if ( (t >= 0) && (t <= t_switch) ) { + if ((t >= 0) && (t <= t_switch)) { lambda = switch_func(t*r_switch); dlambda = dswitch_func(t*r_switch); } - if ( (t >= t_equil+t_switch) && (t <= (t_equil+2*t_switch)) ) { + if ((t >= t_equil+t_switch) && (t <= (t_equil+2*t_switch))) { lambda = switch_func(1.0 - (t - t_switch - t_equil)*r_switch); dlambda = - dswitch_func(1.0 - (t - t_switch - t_equil)*r_switch); } diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index 89b2333e1c..e03ef33cda 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -92,7 +92,7 @@ void ImproperFourier::compute(int eflag, int vflag) vb1x, vb1y, vb1z, vb2x, vb2y, vb2z, vb3x, vb3y, vb3z); - if ( all[type] ) { + if (all[type]) { addone(i1,i4,i2,i3, type,evflag,eflag, vb3x, vb3y, vb3z, vb1x, vb1y, vb1z, @@ -274,7 +274,7 @@ void ImproperFourier::allocate() void ImproperFourier::coeff(int narg, char **arg) { - if ( narg != 5 && narg != 6 ) error->all(FLERR,"Incorrect args for improper coefficients"); + if (narg != 5 && narg != 6) error->all(FLERR,"Incorrect args for improper coefficients"); if (!allocated) allocate(); @@ -286,7 +286,7 @@ void ImproperFourier::coeff(int narg, char **arg) double C1_one = utils::numeric(FLERR,arg[3],false,lmp); double C2_one = utils::numeric(FLERR,arg[4],false,lmp); int all_one = 1; - if ( narg == 6 ) all_one = utils::inumeric(FLERR,arg[5],false,lmp); + if (narg == 6) all_one = utils::inumeric(FLERR,arg[5],false,lmp); // convert w0 from degrees to radians diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index dceed1fc57..ae65d68d89 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -418,7 +418,7 @@ void PairE3B::coeff(int narg, char **arg) rs=rc3=rc2=0.0; int iarg = 2; //beginning of keyword/value pairs - while(iarg < narg) { + while (iarg < narg) { char *keyword = arg[iarg++]; if (checkKeyword(keyword,"Ea",1,narg-iarg)) ea=utils::numeric(FLERR,arg[iarg++],false,lmp); diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 2d0001c680..00ab46e697 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -362,7 +362,7 @@ void PairExTeP::compute(int eflag, int vflag) f[k][0] -= fc_prefac_ik * delr2[0]; f[k][1] -= fc_prefac_ik * delr2[1]; f[k][2] -= fc_prefac_ik * delr2[2]; - if ( itype != ktype ) { + if (itype != ktype) { fc_prefac_ik = dFc_dNdij * fc_prefac_ik_0; f[i][0] += fc_prefac_ik * delr2[0]; f[i][1] += fc_prefac_ik * delr2[1]; @@ -1094,8 +1094,8 @@ void PairExTeP::costheta_d(double *rij_hat, double rij, void PairExTeP::spline_init() { for ( int iel=0; ielcreate(style,num,"pair_list:style"); memory->create(params,num,"pair_list:params"); @@ -227,7 +227,7 @@ void PairList::settings(int narg, char **arg) tagint id1, id2; int nharm=0, nmorse=0, nlj126=0; - while(fgets(line,1024,fp)) { + while (fgets(line,1024,fp)) { ptr = strtok(line," \t\n\r\f"); // skip empty lines diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index 3da1fcbed2..dc4e694995 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -594,7 +594,7 @@ void PairLocalDensity::interpolate_cbspl(int n, double delta, fpa = 0.; fpb = 0.; - for ( i = 0; i < n-1; i++ ) { + for (i = 0; i < n-1; i++) { dl[i] = du[i] = delta; } @@ -602,32 +602,32 @@ void PairLocalDensity::interpolate_cbspl(int n, double delta, dd[n-1] = 2.0 * delta; coeff_c[0] = ( 3.0 / delta ) * ( f[1] - f[0] ) - 3.0 * fpa; coeff_c[n-1] = 3.0 * fpb - ( 3.0 / delta ) * ( f[n-1] - f[n-2] ); - for ( i = 0; i < n-2; i++ ) { + for (i = 0; i < n-2; i++) { dd[i+1] = 4.0 * delta; coeff_c[i+1] = ( 3.0 / delta ) * ( f[i+2] - f[i+1] ) - ( 3.0 / delta ) * ( f[i+1] - f[i] ); } // tridiagonal solver - for ( i = 0; i < n-1; i++ ) { + for (i = 0; i < n-1; i++) { du[i] /= dd[i]; dd[i+1] -= dl[i]*du[i]; } coeff_c[0] /= dd[0]; - for ( i = 1; i < n; i++ ) + for (i = 1; i < n; i++) coeff_c[i] = ( coeff_c[i] - dl[i-1] * coeff_c[i-1] ) / dd[i]; - for ( i = n-2; i >= 0; i-- ) + for (i = n-2; i >= 0; i--) coeff_c[i] -= coeff_c[i+1] * du[i]; - for ( i = 0; i < n-1; i++ ) { + for (i = 0; i < n-1; i++) { coeff_d[i] = ( coeff_c[i+1] - coeff_c[i] ) / ( 3.0 * delta ); coeff_b[i] = ( f[i+1] - f[i] ) / delta - delta * ( coeff_c[i+1] + 2.0*coeff_c[i] ) / 3.0; } // normalize - for ( i = 0; i < n-1; i++ ) { + for (i = 0; i < n-1; i++) { coeff_b[i] = coeff_b[i] * delta ; coeff_c[i] = coeff_c[i] * delta*delta ; coeff_d[i] = coeff_d[i] * delta*delta*delta; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 57981e8922..a6bf602c70 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -632,7 +632,7 @@ int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf, { int* list_iter = list; int* list_iter_end = list + n; - while(list_iter != list_iter_end) + while (list_iter != list_iter_end) *buf++ = Uprime_values[*list_iter++]; return n; } diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 09f5fa436d..58c0f75546 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -562,7 +562,7 @@ int PairMEAMSWSpline::pack_forward_comm(int n, int *list, double *buf, { int* list_iter = list; int* list_iter_end = list + n; - while(list_iter != list_iter_end) + while (list_iter != list_iter_end) *buf++ = Uprime_values[*list_iter++]; return n; } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 9eae918128..0d5bbc1147 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -860,7 +860,7 @@ void PairTersoffTable::read_file(char *file) double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index ecc2b7468f..1ced86da86 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -54,7 +54,7 @@ extern "C" { // make sure we have the proper plugin type (native reader) // for the desired file type (called "name" at this level) if ((strcmp(MOLFILE_PLUGIN_TYPE,p->type) == 0) - && (strcmp(r->name, p->name) == 0) ) { + && (strcmp(r->name, p->name) == 0)) { r->p = static_cast(p); } return 0; @@ -408,7 +408,7 @@ int MolfileInterface::find_plugin(const char *pluginpath) retval = (retval > E_DIR) ? retval : E_DIR; // search for suitable file names and try to inspect them - while(dir) { + while (dir) { char *fullname; int len; @@ -515,7 +515,7 @@ int MolfileInterface::load_plugin(const char *filename) // check if the new plugin is of a newer minor version } else if ( (p->majorv == plugin->majorv) && - (p->minorv >= plugin->minorv) ) { + (p->minorv >= plugin->minorv)) { retval = E_VERSION; } } diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index 458f9190f1..4820d9a861 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -302,11 +302,11 @@ bigint ReaderMolfile::read_header(double box[3][3], int &boxinfo, int &triclinic (fieldtype[i] == Y) || (fieldtype[i] == Z) || (fieldtype[i] == ID) || - (fieldtype[i] == TYPE) ) { + (fieldtype[i] == TYPE)) { fieldindex[i] = fieldtype[i]; } else if ( (fieldtype[i] == VX) || (fieldtype[i] == VY) || - (fieldtype[i] == VZ) ) { + (fieldtype[i] == VZ)) { fieldindex[i] = fieldtype[i]; needvels = 1; } else { diff --git a/src/USER-OMP/angle_fourier_simple_omp.cpp b/src/USER-OMP/angle_fourier_simple_omp.cpp index 9ccf078342..0be602f3b0 100644 --- a/src/USER-OMP/angle_fourier_simple_omp.cpp +++ b/src/USER-OMP/angle_fourier_simple_omp.cpp @@ -135,10 +135,10 @@ void AngleFourierSimpleOMP::eval(int nfrom, int nto, ThrData * const thr) // handle sin(n th)/sin(th) singulatiries - if ( fabs(c)-1.0 > 0.0001 ) { + if (fabs(c)-1.0 > 0.0001) { a = k[type]*C[type]*N[type]*sin(nth)/sin(th); } else { - if ( c >= 0.0 ) { + if (c >= 0.0) { term = 1.0 - c; sgn = 1.0; } else { diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 957c49abe6..aceff62ebc 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -125,7 +125,7 @@ void FixQEQCombOMP::post_force(int /* vflag */) q1[i] = q2[i] = qf[i] = 0.0; } - for (iloop = 0; iloop < loopmax; iloop ++ ) { + for (iloop = 0; iloop < loopmax; iloop ++) { for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { diff --git a/src/USER-OMP/improper_fourier_omp.cpp b/src/USER-OMP/improper_fourier_omp.cpp index 5d2a03ccd3..b38b642dbc 100644 --- a/src/USER-OMP/improper_fourier_omp.cpp +++ b/src/USER-OMP/improper_fourier_omp.cpp @@ -120,7 +120,7 @@ void ImproperFourierOMP::eval(int nfrom, int nto, ThrData * const thr) vb1x,vb1y,vb1z, vb2x,vb2y,vb2z, vb3x,vb3y,vb3z,thr); - if ( all[type] ) { + if (all[type]) { add1_thr(i1,i4,i2,i3,type, vb3x,vb3y,vb3z, vb1x,vb1y,vb1z, diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 045db5d402..2da9ca8d8f 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -242,7 +242,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) jtype = map[type[j]]; iparam_ij = elem2param[itype][jtype][jtype]; - if (params[iparam_ij].hfocor > 0.0 ) { + if (params[iparam_ij].hfocor > 0.0) { delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index 0b8efe25ef..4dadd0a1ea 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -1189,7 +1189,7 @@ void PairLJLongTIP4PLongOMP::eval_inner(int iifrom, int iito, ThrData * const th rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq ) { // lj + if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq) { // lj r2inv = 1.0/rsq; double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); @@ -1443,7 +1443,7 @@ void PairLJLongTIP4PLongOMP::eval_middle(int iifrom, int iito, ThrData * const t rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq ) { // lj + if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq) { // lj r2inv = 1.0/rsq; double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index b717f87d0f..d10a4573f1 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -365,7 +365,7 @@ void PairReaxCOMP::init_style( ) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - for ( int i = 0; i < LIST_N; ++i ) + for (int i = 0; i < LIST_N; ++i) lists[i].allocated = 0; if (fix_reax == nullptr) { @@ -433,7 +433,7 @@ void PairReaxCOMP::setup( ) InitializeOMP( system, control, data, workspace, &lists, out_control, mpi_data, world ); - 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_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -472,7 +472,7 @@ void PairReaxCOMP::write_reax_atoms() #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - 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].type = map[atom->type[i]]; system->my_atoms[i].x[0] = atom->x[i][0]; @@ -596,7 +596,7 @@ void PairReaxCOMP::read_reax_forces(int /* vflag */) #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for ( int i = 0; i < system->N; ++i ) { + for (int i = 0; i < system->N; ++i) { system->my_atoms[i].f[0] = workspace->f[i][0]; system->my_atoms[i].f[1] = workspace->f[i][1]; system->my_atoms[i].f[2] = workspace->f[i][2]; @@ -622,14 +622,14 @@ void PairReaxCOMP::FindBond() bond_data *bo_ij; nj = 0; - for ( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { + for (pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj) { bo_ij = &( lists->select.bond_list[pj] ); j = bo_ij->nbr; if (j < i) continue; bo_tmp = bo_ij->bo_data.BO; - if (bo_tmp >= bo_cut ) { + if (bo_tmp >= bo_cut) { tmpid[i][nj] = j; tmpbo[i][nj] = bo_tmp; nj ++; diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index 44d7994c9e..5dd411760c 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -95,7 +95,7 @@ void PairTersoffZBLOMP::read_file(char *file) double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index ec93d9478d..499c5f2933 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -46,7 +46,7 @@ using namespace LAMMPS_NS; void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, - storage *workspace, reax_list **lists ) { + storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; @@ -164,7 +164,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, } // forces on k: i neighbor - 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]); k = nbr_k->nbr; @@ -194,7 +194,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, } // 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]); k = nbr_k->nbr; @@ -229,7 +229,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, simulation_data * /* data */, - storage *workspace, reax_list **lists ) { + storage *workspace, reax_list **lists) { reax_list *bonds = (*lists) + BONDS; bond_data *nbr_j, *nbr_k; bond_order_data *bo_ij, *bo_ji; @@ -274,7 +274,7 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, * forces related to atom i * * first neighbors of atom i * ************************************/ - 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]); k = nbr_k->nbr; @@ -307,7 +307,7 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, /* force */ rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); - 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]); k = nbr_k->nbr; @@ -692,7 +692,7 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (j = 0; j < system->N; ++j ) { + for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; sbp_j = &(system->reax_param.sbp[ type_j ]); diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 68ab6f933d..7fe6a41e9d 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -92,7 +92,7 @@ void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control, #endif /* Implement all force calls as function pointers */ - for ( i = 0; i < NUM_INTRS; i++ ) { + for (i = 0; i < NUM_INTRS; i++) { (Interaction_Functions[i])( system, control, data, workspace, lists, out_control ); } @@ -284,7 +284,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (int i = 0; i < N; ++i ) { + for (int i = 0; i < N; ++i) { system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); if (i < N-1) @@ -308,7 +308,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for (int i = 0; i < n; ++i ) { + for (int i = 0; i < n; ++i) { Hindex = system->my_atoms[i].Hindex; if (Hindex > -1) { system->my_atoms[i].num_hbonds = @@ -335,7 +335,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls * /* out_control */, - MPI_Comm comm ) { + MPI_Comm comm) { #ifdef OMP_TIMING double startTimeBase, endTimeBase; startTimeBase = MPI_Wtime(); @@ -395,7 +395,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, start_i = Start_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] ); if (nbr_pj->d <= cutoff) { int j = nbr_pj->nbr; diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index 0070fbc7c2..c0fe4e3792 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -111,8 +111,8 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, Hydrogen bond is between j and k. so in this function i->X, j->H, k->Z when we map variables onto the ones in the handout.*/ - // for( j = 0; j < system->n; ++j ) - for( j = ifrom; j < ito; ++j ) { + // for (j = 0; j < system->n; ++j) + for (j = ifrom; j < ito; ++j) { /* j has to be of type H */ if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { /*set j's variables */ @@ -124,7 +124,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, if (type_j < 0) continue; top = 0; - for( pi = start_j; pi < end_j; ++pi ) { + for (pi = start_j; pi < end_j; ++pi) { pbond_ij = &( bond_list[pi] ); i = pbond_ij->nbr; type_i = system->my_atoms[i].type; @@ -136,7 +136,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, hblist[top++] = pi; } - for( pk = hb_start_j; pk < hb_end_j; ++pk ) { + for (pk = hb_start_j; pk < hb_end_j; ++pk) { /* set k's varibles */ k = hbond_list[pk].nbr; type_k = system->my_atoms[k].type; @@ -145,7 +145,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, r_jk = nbr_jk->d; rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - for( itr = 0; itr < top; ++itr ) { + for (itr = 0; itr < top; ++itr) { pi = hblist[itr]; pbond_ij = &( bonds->select.bond_list[pi] ); i = pbond_ij->nbr; diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp index 52ef7048d6..e2af2d96ad 100644 --- a/src/USER-OMP/reaxc_multi_body_omp.cpp +++ b/src/USER-OMP/reaxc_multi_body_omp.cpp @@ -116,7 +116,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, numbonds = 0; e_lp = 0.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) numbonds ++; /* calculate the energy */ @@ -137,7 +137,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, /* correction for C2 */ 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) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; if (type_j < 0) continue; @@ -227,7 +227,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, numbonds = 0; e_un = 0.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) numbonds ++; if (numbonds > 0) total_Eun += e_un = diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index ce463c39ff..7abcb5b42a 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -96,13 +96,13 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for( i = 0; i < natoms; ++i ) { + for (i = 0; i < natoms; ++i) { if (system->my_atoms[i].type < 0) continue; start_i = Start_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs); 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]); j = nbr_pj->nbr; orig_j = system->my_atoms[j].orig_id; diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index 79fa9e0f47..cb92a9a68c 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -202,7 +202,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, //tan_ijk_i = 1. / tan( theta_ijk ); if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) tan_ijk_i = cos_ijk / MIN_SINE; - else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) tan_ijk_i = cos_ijk / -MIN_SINE; else tan_ijk_i = cos_ijk / sin_ijk; @@ -241,7 +241,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, //tan_jkl_i = 1. / tan( theta_jkl ); if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) tan_jkl_i = cos_jkl / MIN_SINE; - 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; else tan_jkl_i = cos_jkl /sin_jkl; diff --git a/src/USER-PTM/ptm_voronoi_cell.cpp b/src/USER-PTM/ptm_voronoi_cell.cpp index 5b29706b82..ab0b9172aa 100644 --- a/src/USER-PTM/ptm_voronoi_cell.cpp +++ b/src/USER-PTM/ptm_voronoi_cell.cpp @@ -103,9 +103,9 @@ voronoicell_base::~voronoicell_base() { * \param[in] vb a pointered to the class to be copied. */ template void voronoicell_base::check_memory_for_copy(vc_class &vc,voronoicell_base* vb) { - while(current_vertex_ordercurrent_vertex_order) add_memory_vorder(vc); - for (int i=0;imec[i]) add_memory(vc,i,ds2); - while(current_verticesp) add_memory_vertices(vc); + while (current_vertex_ordercurrent_vertex_order) add_memory_vorder(vc); + for (int i=0;imec[i]) add_memory(vc,i,ds2); + while (current_verticesp) add_memory_vertices(vc); } /** Increases the memory storage for a particular vertex order, by increasing @@ -139,7 +139,7 @@ void voronoicell_base::add_memory(vc_class &vc,int i,int *stackp2) { l=new int[s*mem[i]]; int m=0; vc.n_allocate_aux1(i); - while(j=0) { ed[k]=l+j; @@ -211,14 +211,14 @@ void voronoicell_base::add_memory_vorder(vc_class &vc) { #endif p1=new int[i]; for (j=0;j=p) throw true; u=l;up=lp; for (us=0;us=p) throw true; u=q;up=qp; @@ -410,7 +410,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq } if (us==qs) { us++; - while(us=current_vertex_order) add_memory_vorder(vc); + while (nu[p]>=current_vertex_order) add_memory_vorder(vc); if (mec[nu[p]]==mem[nu[p]]) add_memory(vc,nu[p],stackp2); // Copy the edges of the original vertex into the new @@ -651,7 +651,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq ed[p]=mep[nu[p]]+((nu[p]<<1)+1)*mec[nu[p]]++; ed[p][nu[p]<<1]=p; us=i++; - while(i=current_vertex_order) add_memory_vorder(vc); + while (k>=current_vertex_order) add_memory_vorder(vc); if (mec[k]==mem[k]) add_memory(vc,k,stackp2); // Now create a new vertex with order k, or augment @@ -903,7 +903,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq vc.n_set_aux1(k); edp=mep[k]+((k<<1)+1)*mec[k]++; i=0; - while(ids) { + while (stackp>ds) { --p; - while(ed[p][nu[p]]==-1) { + while (ed[p][nu[p]]==-1) { j=nu[p]; edp=ed[p];edd=(mep[j]+((j<<1)+1)*--mec[j]); - while(edp inline bool voronoicell_base::collapse_order2(vc_class &vc) { if (!collapse_order1(vc)) return false; int a,b,i,j,k,l; - while(mec[2]>0) { + while (mec[2]>0) { // Pick a order 2 vertex and read in its edges i=--mec[2]; @@ -1142,7 +1142,7 @@ inline bool voronoicell_base::collapse_order2(vc_class &vc) { template inline bool voronoicell_base::collapse_order1(vc_class &vc) { int i,j,k; - while(mec[1]>0) { + while (mec[1]>0) { up=0; #if VOROPP_VERBOSE >=1 fputs("Order one collapse\n",stderr); @@ -1187,7 +1187,7 @@ inline bool voronoicell_base::delete_connection(vc_class &vc,int j,int k,bool ha if (mec[i]==mem[i]) add_memory(vc,i,ds2); vc.n_set_aux1(i); for (l=0;l &v) { ed[i][j]=-1-k; l=cycle_up(ed[i][nu[i]+j],k); m=ed[k][l];ed[k][l]=-1-m; - while(m!=i) { + while (m!=i) { n=cycle_up(ed[k][nu[k]+l],m); ux=pts[3*k]-pts[3*i]; uy=pts[3*k+1]-pts[3*i+1]; diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 32b77aaf80..f352cce827 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -108,7 +108,7 @@ static void rebuild_table_tagint(taginthash_t *tptr) { taginthash_init(tptr, old_size<<1); for (i=0; inext; h=taginthash(tptr, tmp->key); diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 82dd76a1b5..2257c9992e 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -49,20 +49,20 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : { if (narg < 5) error->all(FLERR,"Illegal fix qbmsst command"); - if ( strcmp(arg[3],"x") == 0 ) { + if (strcmp(arg[3],"x") == 0) { direction = 0; box_change |= BOX_CHANGE_X; - } else if ( strcmp(arg[3],"y") == 0 ) { + } else if (strcmp(arg[3],"y") == 0) { direction = 1; box_change |= BOX_CHANGE_Y; - } else if ( strcmp(arg[3],"z") == 0 ) { + } else if (strcmp(arg[3],"z") == 0) { direction = 2; box_change |= BOX_CHANGE_Z; } else { error->all(FLERR,"Illegal fix qbmsst command"); } velocity = atof(arg[4]); - if ( velocity < 0 ) + if (velocity < 0) error->all(FLERR,"Illegal fix qbmsst command"); // default parameters @@ -431,34 +431,34 @@ void FixQBMSST::setup(int /*vflag*/) couple(); velocity_sum = compute_vsum(); - if ( v0_set == 0 ) { + if (v0_set == 0) { v0 = compute_vol(); v0_set = 1; if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix QBMSST v0 = {:12.5e}\n", v0)); } - if ( p0_set == 0 ) { + if (p0_set == 0) { p0 = p_current[direction]; p0_set = 1; - if ( comm->me == 0 ) + if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix QBMSST p0 = {:12.5e}\n", p0)); } - if ( e0_set == 0 ) { + if (e0_set == 0) { e0 = compute_etotal(); e0_set = 1; old_eavg = e0; - if ( comm->me == 0 ) + if (comm->me == 0) utils::logmesg(lmp,fmt::format("Fix QBMSST e0 = to be {:12.5e}\n",e0)); } temperature->compute_vector(); double *ke_tensor = temperature->vector; double ke_temp = ke_tensor[0]+ke_tensor[1]+ke_tensor[2]; - if (ke_temp > 0.0 && tscale > 0.0 ) { + if (ke_temp > 0.0 && tscale > 0.0) { // transfer energy from atom velocities to cell volume motion // to bias initial compression @@ -477,7 +477,7 @@ void FixQBMSST::setup(int /*vflag*/) "factor of {:12.5e}\n",fac2,tscale)); for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - for (int k = 0; k < 3; k++ ) { + for (int k = 0; k < 3; k++) { v[i][k]*=sqrt_initial_temperature_scaling; } } @@ -596,12 +596,12 @@ void FixQBMSST::initial_integrate(int /*vflag*/) double B = total_mass * mu / ( qmass * vol ); // prevent blow-up of the volume. - if ( vol > v0 && A > 0.0 ) { + if (vol > v0 && A > 0.0) { A = -A; } // use taylor expansion to avoid singularity at B == 0. - if ( B * dthalf > 1.0e-06 ) { + if (B * dthalf > 1.0e-06) { omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { @@ -614,15 +614,15 @@ void FixQBMSST::initial_integrate(int /*vflag*/) velocity_sum = compute_vsum(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { double C = (f[i][k] + fran[i][k])* force->ftm2v / mass[type[i]];// this term now has a random force part double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; old_velocity[i][k] = v[i][k]; - if ( k == direction ) { + if (k == direction) { D = D - 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -638,7 +638,7 @@ void FixQBMSST::initial_integrate(int /*vflag*/) // reset the velocities. for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { v[i][k] = old_velocity[i][k]; } } @@ -647,15 +647,15 @@ void FixQBMSST::initial_integrate(int /*vflag*/) // propagate velocities 1/2 step using the new velocity sum. for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( k = 0; k < 3; k++ ) { + for (k = 0; k < 3; k++) { double C = (f[i][k] + fran[i][k])* force->ftm2v / mass[type[i]];// this term now has a random force part double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; - if ( k == direction ) { + if (k == direction) { D = D - 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -715,15 +715,15 @@ void FixQBMSST::final_integrate() for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( int k = 0; k < 3; k++ ) { + for (int k = 0; k < 3; k++) { double C = (f[i][k] + fran[i][k]) * force->ftm2v / mass[type[i]];// this term now has a random force part double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; - if ( k == direction ) { + if (k == direction) { D = D - 2.0 * omega[sd] / vol; } - if ( fabs(dthalf * D) > 1.0e-06 ) { + if (fabs(dthalf * D) > 1.0e-06) { double expd = exp(D * dthalf); v[i][k] = expd * ( C + D * v[i][k] - C / expd ) / D; } else { @@ -753,13 +753,13 @@ void FixQBMSST::final_integrate() // prevent blow-up of the volume. - if ( vol > v0 && A > 0.0 ) { + if (vol > v0 && A > 0.0) { A = -A; } // use taylor expansion to avoid singularity at B == 0. - if ( B * dthalf > 1.0e-06 ) { + if (B * dthalf > 1.0e-06) { omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { @@ -814,7 +814,7 @@ void FixQBMSST::remap(int flag) // reset global and local box to new size/shape for (i = 0; i < 3; i++) { - if ( direction == i ) { + if (direction == i) { oldlo = domain->boxlo[i]; oldhi = domain->boxhi[i]; ctr = 0.5 * (oldlo + oldhi); @@ -1084,7 +1084,7 @@ double FixQBMSST::compute_vol() ------------------------------------------------------------------------- */ void FixQBMSST::check_alloc(int n) { - if ( atoms_allocated < n ) { + if (atoms_allocated < n) { memory->destroy(old_velocity); memory->create(old_velocity,n,3,"qbmsst:old_velocity"); atoms_allocated = n; diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 3ca19285f6..f850925764 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -162,7 +162,7 @@ void PairQUIP::compute(int eflag, int vflag) iquip = 0; for (ii = 0; ii < ntotal; ii++) { - for ( jj = 0; jj < 3; jj++ ) { + for (jj = 0; jj < 3; jj++) { f[ii][jj] += quip_force[iquip]; iquip++; } diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 8d6b1b27ac..483bd1c0f6 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -334,7 +334,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : strcpy(files[rxn],arg[iarg]); iarg++; - while (iarg < narg && strcmp(arg[iarg],"react") != 0 ) { + while (iarg < narg && strcmp(arg[iarg],"react") != 0) { if (strcmp(arg[iarg],"prob") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'prob' keyword has too few arguments"); @@ -1293,7 +1293,7 @@ void FixBondReact::superimpose_algorithm() nxspecial[local_atom2][0] == nxspecial[local_atom1][0]) && (nxspecial[local_atom1][0] == 0 || xspecial[local_atom1][0] == atom->tag[local_atom2]) && - check_constraints() ) { + check_constraints()) { status = ACCEPT; glove_ghostcheck(); } else @@ -2772,7 +2772,7 @@ void FixBondReact::update_everything() for (int p = 0; p < twomol->natoms; p++) { int pp = equivalences[p][1][rxnID]-1; if (p!=j && special[atom->map(update_mega_glove[jj+1][i])][k] == update_mega_glove[pp+1][i] - && landlocked_atoms[p][rxnID] == 1 ) { + && landlocked_atoms[p][rxnID] == 1) { for (int n = k; n < nspecial[atom->map(update_mega_glove[jj+1][i])][2]-1; n++) { special[atom->map(update_mega_glove[jj+1][i])][n] = special[atom->map(update_mega_glove[jj+1][i])][n+1]; } diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index fa115e343e..6d90ef5fae 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -195,7 +195,7 @@ void FixReaxCBonds::FindBond(struct _reax_list * /*lists*/, int &numbonds) i = ilist[ii]; nj = 0; - for( pj = Start_Index(i, reaxc->lists); pj < End_Index(i, reaxc->lists); ++pj ) { + for (pj = Start_Index(i, reaxc->lists); pj < End_Index(i, reaxc->lists); ++pj) { bo_ij = &( reaxc->lists->select.bond_list[pj] ); j = bo_ij->nbr; jtag = tag[j]; @@ -262,7 +262,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, double cutof3 = reaxc->control->bg_cut; MPI_Request irequest, irequest2; - if (me == 0 ) { + if (me == 0) { fprintf(fp,"# Timestep " BIGINT_FORMAT " \n",ntimestep); fprintf(fp,"# \n"); fprintf(fp,"# Number of particles %d \n",natoms); diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 1fb6eb9005..bfe9330819 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -420,7 +420,7 @@ void PairReaxC::init_style( ) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - for ( int i = 0; i < LIST_N; ++i ) + for (int i = 0; i < LIST_N; ++i) if (lists[i].allocated != 1) lists[i].allocated = 0; @@ -478,7 +478,7 @@ void PairReaxC::setup( ) write_reax_lists(); Initialize( system, control, data, workspace, &lists, out_control, mpi_data, world ); - 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_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -645,7 +645,7 @@ void PairReaxC::write_reax_atoms() if (system->N > system->total_cap) error->all(FLERR,"Too many ghost atoms"); - 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].type = map[atom->type[i]]; system->my_atoms[i].x[0] = atom->x[i][0]; @@ -703,13 +703,13 @@ int PairReaxC::estimate_reax_lists() int numall = list->inum + list->gnum; - for ( itr_i = 0; itr_i < numall; ++itr_i ) { + for (itr_i = 0; itr_i < numall; ++itr_i) { i = ilist[itr_i]; marked[i] = 1; ++num_marked; jlist = firstneigh[i]; - 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 &= NEIGHMASK; get_distance( x[j], x[i], &d_sqr, &dvec ); @@ -751,7 +751,7 @@ int PairReaxC::write_reax_lists() int numall = list->inum + list->gnum; - for ( itr_i = 0; itr_i < numall; ++itr_i ) { + for (itr_i = 0; itr_i < numall; ++itr_i) { i = ilist[itr_i]; jlist = firstneigh[i]; Set_Start_Index( i, num_nbrs, far_nbrs ); @@ -761,7 +761,7 @@ int PairReaxC::write_reax_lists() else cutoff_sqr = control->bond_cut*control->bond_cut; - 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 &= NEIGHMASK; get_distance( x[j], x[i], &d_sqr, &dvec ); @@ -784,7 +784,7 @@ int PairReaxC::write_reax_lists() void PairReaxC::read_reax_forces(int /*vflag*/) { - for ( int i = 0; i < system->N; ++i ) { + for (int i = 0; i < system->N; ++i) { system->my_atoms[i].f[0] = workspace->f[i][0]; system->my_atoms[i].f[1] = workspace->f[i][1]; system->my_atoms[i].f[2] = workspace->f[i][2]; @@ -864,14 +864,14 @@ void PairReaxC::FindBond() for (i = 0; i < system->n; i++) { nj = 0; - for ( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { + for (pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj) { bo_ij = &( lists->select.bond_list[pj] ); j = bo_ij->nbr; if (j < i) continue; bo_tmp = bo_ij->bo_data.BO; - if (bo_tmp >= bo_cut ) { + if (bo_tmp >= bo_cut) { tmpid[i][nj] = j; tmpbo[i][nj] = bo_tmp; nj ++; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index f017eae41e..f043dc85d6 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -96,9 +96,9 @@ void DeAllocate_System( reax_system *system ) sfree(system->error_ptr, ff_params->gp.l, "ff:globals" ); - for( i = 0; i < ntypes; ++i ) { - for( j = 0; j < ntypes; ++j ) { - for( k = 0; k < ntypes; ++k ) { + for (i = 0; i < ntypes; ++i) { + for (j = 0; j < ntypes; ++j) { + for (k = 0; k < ntypes; ++k) { sfree(system->error_ptr, ff_params->fbp[i][j][k], "ff:fbp[i,j,k]" ); } sfree(system->error_ptr, ff_params->fbp[i][j], "ff:fbp[i,j]" ); @@ -129,7 +129,7 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) workspace->allocated = 0; /* communication storage */ - for( i = 0; i < MAX_NBRS; ++i ) { + for (i = 0; i < MAX_NBRS; ++i) { sfree(control->error_ptr, workspace->tmp_dbl[i], "tmp_dbl[i]" ); sfree(control->error_ptr, workspace->tmp_rvec[i], "tmp_rvec[i]" ); sfree(control->error_ptr, workspace->tmp_rvec2[i], "tmp_rvec2[i]" ); @@ -169,7 +169,7 @@ void DeAllocate_Workspace( control_params * control, storage *workspace ) sfree(control->error_ptr, workspace->x, "x" ); /* GMRES storage */ - for( i = 0; i < RESTART+1; ++i ) { + for (i = 0; i < RESTART+1; ++i) { sfree(control->error_ptr, workspace->h[i], "h[i]" ); sfree(control->error_ptr, workspace->v[i], "v[i]" ); } @@ -219,7 +219,7 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, local_rvec = local_cap * sizeof(rvec); /* communication storage */ - for( i = 0; i < MAX_NBRS; ++i ) { + for (i = 0; i < MAX_NBRS; ++i) { workspace->tmp_dbl[i] = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "tmp_dbl"); workspace->tmp_rvec[i] = (rvec*) @@ -277,7 +277,7 @@ int Allocate_Workspace( reax_system * /*system*/, control_params * control, workspace->hc = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "hc"); workspace->v = (double**) scalloc(control->error_ptr, RESTART+1, sizeof(double*), "v"); - for( i = 0; i < RESTART+1; ++i ) { + for (i = 0; i < RESTART+1; ++i) { workspace->h[i] = (double*) scalloc(control->error_ptr, RESTART+1, sizeof(double), "h[i]"); workspace->v[i] = (double*) scalloc(control->error_ptr, total_cap, sizeof(double), "v[i]"); } @@ -336,7 +336,7 @@ static int Reallocate_HBonds_List( reax_system *system, reax_list *hbonds ) double saferzone = system->saferzone; total_hbonds = 0; - for( i = 0; i < system->n; ++i ) + for (i = 0; i < system->n; ++i) if ((system->my_atoms[i].Hindex) >= 0) { total_hbonds += system->my_atoms[i].num_hbonds; } @@ -361,7 +361,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, *total_bonds = 0; *est_3body = 0; - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { *est_3body += SQR(system->my_atoms[i].num_bonds); *total_bonds += system->my_atoms[i].num_bonds; } @@ -411,13 +411,13 @@ void ReAllocate( reax_system *system, control_params *control, realloc = &(workspace->realloc); if ( system->n >= DANGER_ZONE * system->local_cap || - (0 && system->n <= LOOSE_ZONE * system->local_cap) ) { + (0 && 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) ) { + (0 && system->N <= LOOSE_ZONE * system->total_cap)) { Nflag = 1; system->total_cap = MAX( (int)(system->N * safezone), mincap ); } @@ -467,7 +467,7 @@ void ReAllocate( reax_system *system, control_params *control, if (control->hbond_cut > 0) { Hflag = 0; if ( system->numH >= DANGER_ZONE * system->Hcap || - (0 && system->numH <= LOOSE_ZONE * system->Hcap) ) { + (0 && system->numH <= LOOSE_ZONE * system->Hcap)) { Hflag = 1; system->Hcap = int(MAX( system->numH * saferzone, mincap )); } @@ -497,7 +497,7 @@ void ReAllocate( reax_system *system, control_params *control, realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); if ( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, - (*lists)+THREE_BODIES ) ) { + (*lists)+THREE_BODIES )) { system->error_ptr->one(FLERR, "Problem in initializing angles list"); } realloc->num_3body = -1; diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index a9985d79f3..6a854e1805 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -67,7 +67,7 @@ void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, coef.C2dDelta = bo_ij->C2dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); coef.C3dDelta = bo_ij->C3dbo * (workspace->CdDelta[i]+workspace->CdDelta[j]); - 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]); k = nbr_k->nbr; @@ -100,7 +100,7 @@ void Add_dBond_to_Forces_NPT( int i, int pj, simulation_data *data, /* force */ rvec_Add( workspace->f[i], temp ); - 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]); k = nbr_k->nbr; @@ -217,7 +217,7 @@ void Add_dBond_to_Forces( reax_system *system, int i, int pj, } // forces on k: i neighbor - 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]); k = nbr_k->nbr; @@ -237,7 +237,7 @@ void Add_dBond_to_Forces( reax_system *system, int i, int pj, } // 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]); k = nbr_k->nbr; @@ -262,7 +262,7 @@ void Add_dBond_to_Forces( reax_system *system, int i, int pj, int BOp( storage *workspace, reax_list *bonds, double bo_cut, int i, int btop_i, far_neighbor_data *nbr_pj, single_body_parameters *sbp_i, single_body_parameters *sbp_j, - two_body_parameters *twbp ) { + two_body_parameters *twbp) { int j, btop_j; double r2, C12, C34, C56; double Cln_BOp_s, Cln_BOp_pi, Cln_BOp_pi2; @@ -383,7 +383,7 @@ void BO( reax_system *system, control_params * /*control*/, simulation_data * /* p_boc2 = system->reax_param.gp.l[1]; /* Calculate Deltaprime, Deltaprime_boc values */ - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[type_i]); @@ -395,7 +395,7 @@ void BO( reax_system *system, control_params * /*control*/, simulation_data * /* } /* Corrected Bond Order calculations */ - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[type_i]); @@ -405,7 +405,7 @@ void BO( reax_system *system, control_params * /*control*/, simulation_data * /* start_i = Start_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; type_j = system->my_atoms[j].type; if (type_j < 0) continue; @@ -558,7 +558,7 @@ void BO( reax_system *system, control_params * /*control*/, simulation_data * /* } p_lp1 = system->reax_param.gp.l[15]; - for( j = 0; j < system->N; ++j ) { + for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; sbp_j = &(system->reax_param.sbp[ type_j ]); diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index 91dc38d56d..c706a2fd79 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -54,11 +54,11 @@ void Bonds( reax_system *system, control_params * /*control*/, gp37 = (int) system->reax_param.gp.l[37]; natoms = system->n; - for( i = 0; i < natoms; ++i ) { + for (i = 0; i < natoms; ++i) { start_i = Start_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; if (system->my_atoms[i].orig_id > system->my_atoms[j].orig_id) @@ -106,7 +106,7 @@ void Bonds( reax_system *system, control_params * /*control*/, if (bo_ij->BO >= 1.00) { if ( gp37 == 2 || (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || - (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990) ) { + (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990)) { exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); exphua1 = exp(-gp3 * (workspace->total_bond_order[i]-bo_ij->BO)); exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index ab183bdaa4..b717b6b97f 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -41,7 +41,7 @@ char Read_Control_File( char *control_file, control_params* control, double val; /* open control file */ - if ( (fp = fopen( control_file, "r" ) ) == nullptr ) { + if ((fp = fopen( control_file, "r" ) ) == nullptr) { control->error_ptr->all(FLERR, "The control file cannot be opened"); } @@ -343,7 +343,7 @@ char Read_Control_File( char *control_file, control_params* control, } else if (strcmp(tmp[0], "ignore") == 0) { control->num_ignored = atoi(tmp[1]); - for( i = 0; i < control->num_ignored; ++i ) + for (i = 0; i < control->num_ignored; ++i) control->ignore[atoi(tmp[i+2])] = 1; } else if (strcmp(tmp[0], "dipole_anal") == 0) { @@ -379,7 +379,7 @@ char Read_Control_File( char *control_file, control_params* control, else control->T = control->T_init; /* free memory allocations at the top */ - for( i = 0; i < MAX_TOKENS; i++ ) + for (i = 0; i < MAX_TOKENS; i++) free( tmp[i] ); free( tmp ); free( s ); diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 13e01c3a53..e54b3b75e0 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -109,7 +109,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, tor_flag = (char****) scalloc(control->error_ptr, reax->num_atom_types, sizeof(char***), "tor_flag"); - for( i = 0; i < reax->num_atom_types; i++ ) { + for (i = 0; i < reax->num_atom_types; i++) { reax->tbp[i] = (two_body_parameters*) scalloc(control->error_ptr, reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]"); reax->thbp[i]= (three_body_header**) @@ -121,7 +121,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, tor_flag[i] = (char***) scalloc(control->error_ptr, reax->num_atom_types, sizeof(char**), "tor_flag[i]"); - for( j = 0; j < reax->num_atom_types; j++ ) { + for (j = 0; j < reax->num_atom_types; j++) { reax->thbp[i][j]= (three_body_header*) scalloc(control->error_ptr, reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]"); reax->hbp[i][j] = (hbond_parameters*) @@ -144,7 +144,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, char errmsg[1024]; - for( i = 0; i < reax->num_atom_types; i++ ) { + for (i = 0; i < reax->num_atom_types; i++) { /* line one */ fgets( s, MAX_LINE, fp ); c = Tokenize( s, &tmp ); @@ -158,7 +158,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, control->error_ptr->all(FLERR, errmsg); } - for( j = 0; j < (int)(strlen(tmp[0])); ++j ) + for (j = 0; j < (int)(strlen(tmp[0])); ++j) reax->sbp[i].name[j] = toupper( tmp[0][j] ); val = atof(tmp[1]); reax->sbp[i].r_s = val; @@ -302,9 +302,9 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } /* Equate vval3 to valf for first-row elements (25/10/2004) */ - for( i = 0; i < reax->num_atom_types; i++ ) + for (i = 0; i < reax->num_atom_types; i++) if ( reax->sbp[i].mass < 21 && - reax->sbp[i].valency_val != reax->sbp[i].valency_boc ) { + reax->sbp[i].valency_val != reax->sbp[i].valency_boc) { if (me == 0) { char errmsg[256]; snprintf(errmsg, 256, "Changed valency_val to valency_boc for %s", @@ -542,16 +542,16 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } } - for( i = 0; i < reax->num_atom_types; ++i ) - for( j = 0; j < reax->num_atom_types; ++j ) - for( k = 0; k < reax->num_atom_types; ++k ) + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) reax->thbp[i][j][k].cnt = 0; fgets( s, MAX_LINE, fp ); c = Tokenize( s, &tmp ); l = atoi( tmp[0] ); - for( i = 0; i < l; i++ ) { + for (i = 0; i < l; i++) { fgets(s,MAX_LINE,fp); c=Tokenize(s,&tmp); @@ -598,10 +598,10 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } /* clear all entries first */ - for( i = 0; i < reax->num_atom_types; ++i ) - for( j = 0; j < reax->num_atom_types; ++j ) - for( k = 0; k < reax->num_atom_types; ++k ) - for( m = 0; m < reax->num_atom_types; ++m ) { + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) + for (m = 0; m < reax->num_atom_types; ++m) { reax->fbp[i][j][k][m].cnt = 0; tor_flag[i][j][k][m] = 0; } @@ -611,7 +611,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, c = Tokenize( s, &tmp ); l = atoi( tmp[0] ); - for( i = 0; i < l; i++ ) { + for (i = 0; i < l; i++) { fgets( s, MAX_LINE, fp ); c = Tokenize( s, &tmp ); @@ -653,8 +653,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } } else { /* This means the entry is of the form 0-X-Y-0 */ if (k < reax->num_atom_types && m < reax->num_atom_types) - for( p = 0; p < reax->num_atom_types; p++ ) - for( o = 0; o < reax->num_atom_types; o++ ) { + for (p = 0; p < reax->num_atom_types; p++) + for (o = 0; o < reax->num_atom_types; o++) { reax->fbp[p][k][m][o].cnt = 1; reax->fbp[o][m][k][p].cnt = 1; @@ -682,12 +682,12 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, c = Tokenize( s, &tmp ); l = atoi( tmp[0] ); - for( i = 0; i < reax->num_atom_types; ++i ) - for( j = 0; j < reax->num_atom_types; ++j ) - for( k = 0; k < reax->num_atom_types; ++k ) + for (i = 0; i < reax->num_atom_types; ++i) + for (j = 0; j < reax->num_atom_types; ++j) + for (k = 0; k < reax->num_atom_types; ++k) reax->hbp[i][j][k].r0_hb = -1.0; - for( i = 0; i < l; i++ ) { + for (i = 0; i < l; i++) { fgets( s, MAX_LINE, fp ); c = Tokenize( s, &tmp ); @@ -713,16 +713,16 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, } /* deallocate helper storage */ - for( i = 0; i < MAX_TOKENS; i++ ) + for (i = 0; i < MAX_TOKENS; i++) free( tmp[i] ); free( tmp ); free( s ); /* deallocate tor_flag */ - for( i = 0; i < reax->num_atom_types; i++ ) { - for( j = 0; j < reax->num_atom_types; j++ ) { - for( k = 0; k < reax->num_atom_types; k++ ) { + for (i = 0; i < reax->num_atom_types; i++) { + for (j = 0; j < reax->num_atom_types; j++) { + for (k = 0; k < reax->num_atom_types; k++) { free( tor_flag[i][j][k] ); } free( tor_flag[i][j] ); diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 3cc66b7530..cde80e9866 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -74,7 +74,7 @@ void Compute_Bonded_Forces( reax_system *system, control_params *control, int i; /* Implement all force calls as function pointers */ - for( i = 0; i < NUM_INTRS; i++ ) { + for (i = 0; i < NUM_INTRS; i++) { (Interaction_Functions[i])( system, control, data, workspace, lists, out_control ); } @@ -104,8 +104,8 @@ void Compute_Total_Force( reax_system *system, control_params *control, int i, pj; reax_list *bonds = (*lists) + BONDS; - for( i = 0; i < system->N; ++i ) - for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) + for (i = 0; i < system->N; ++i) + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) if (i < bonds->select.bond_list[pj].nbr) { if (control->virial == 0) Add_dBond_to_Forces( system, i, pj, workspace, lists ); @@ -127,7 +127,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l if (N > 0) { bonds = *lists + BONDS; - for( i = 0; i < N; ++i ) { + for (i = 0; i < N; ++i) { system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); if (i < N-1) @@ -148,7 +148,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l if (numH > 0) { hbonds = *lists + HBONDS; - for( i = 0; i < N; ++i ) { + for (i = 0; i < N; ++i) { Hindex = system->my_atoms[i].Hindex; if (Hindex > -1) { system->my_atoms[i].num_hbonds = @@ -176,7 +176,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l void Init_Forces_noQEq( reax_system *system, control_params *control, simulation_data *data, storage *workspace, - reax_list **lists, output_controls * /*out_control*/ ) { + reax_list **lists, output_controls * /*out_control*/) { int i, j, pj; int start_i, end_i; int type_i, type_j; @@ -194,9 +194,9 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, bonds = *lists + BONDS; hbonds = *lists + HBONDS; - for( i = 0; i < system->n; ++i ) + for (i = 0; i < system->n; ++i) workspace->bond_mark[i] = 0; - for( i = system->n; i < system->N; ++i ) { + for (i = system->n; i < system->N; ++i) { workspace->bond_mark[i] = 1000; // put ghost atoms to an infinite distance } @@ -205,7 +205,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, btop_i = 0; renbr = (data->step-data->prev_steps) % control->reneighbor == 0; - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { atom_i = &(system->my_atoms[i]); type_i = atom_i->type; if (type_i < 0) continue; @@ -232,7 +232,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, } /* update i-j distance - check if j is within cutoff */ - 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] ); j = nbr_pj->nbr; atom_j = &(system->my_atoms[j]); @@ -263,7 +263,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, if (local) { /* hydrogen bond lists */ if (control->hbond_cut > 0 && (ihb==1 || ihb==2) && - nbr_pj->d <= control->hbond_cut ) { + nbr_pj->d <= control->hbond_cut) { // fprintf( stderr, "%d %d\n", atom1, atom2 ); jhb = sbp_j->p_hbond; if (ihb == 1 && jhb == 2) { @@ -287,7 +287,7 @@ void Init_Forces_noQEq( reax_system *system, control_params *control, if (//(workspace->bond_mark[i] < 3 || workspace->bond_mark[j] < 3) && nbr_pj->d <= control->bond_cut && BOp( workspace, bonds, control->bo_cut, - i , btop_i, nbr_pj, sbp_i, sbp_j, twbp ) ) { + i , btop_i, nbr_pj, sbp_i, sbp_j, twbp )) { num_bonds += 2; ++btop_i; @@ -343,7 +343,7 @@ void Estimate_Storages( reax_system *system, control_params *control, memset( bond_top, 0, sizeof(int) * system->total_cap ); *num_3body = 0; - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { atom_i = &(system->my_atoms[i]); type_i = atom_i->type; if (type_i < 0) continue; @@ -362,7 +362,7 @@ void Estimate_Storages( reax_system *system, control_params *control, ihb = -1; } - 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] ); j = nbr_pj->nbr; atom_j = &(system->my_atoms[j]); @@ -380,11 +380,11 @@ void Estimate_Storages( reax_system *system, control_params *control, /* hydrogen bond lists */ if (control->hbond_cut > 0.1 && (ihb==1 || ihb==2) && - nbr_pj->d <= control->hbond_cut ) { + nbr_pj->d <= control->hbond_cut) { jhb = sbp_j->p_hbond; if (ihb == 1 && jhb == 2) ++hb_top[i]; - else if ( j < system->n && ihb == 2 && jhb == 1 ) + else if (j < system->n && ihb == 2 && jhb == 1) ++hb_top[j]; } } @@ -422,10 +422,10 @@ void Estimate_Storages( reax_system *system, control_params *control, } *Htop = (int)(MAX( *Htop * safezone, mincap * MIN_HENTRIES )); - for( i = 0; i < system->n; ++i ) + for (i = 0; i < system->n; ++i) hb_top[i] = (int)(MAX(hb_top[i] * saferzone, system->minhbonds)); - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { *num_3body += SQR(bond_top[i]); bond_top[i] = MAX( bond_top[i] * 2, MIN_BONDS ); } diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index 680f069bab..ac94d7b62c 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -63,7 +63,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, hbonds = (*lists) + HBONDS; hbond_list = hbonds->select.hbond_list; - for( j = 0; j < system->n; ++j ) + for (j = 0; j < system->n; ++j) if (system->reax_param.sbp[system->my_atoms[j].type].p_hbond == 1) { type_j = system->my_atoms[j].type; start_j = Start_Index(j, bonds); @@ -73,7 +73,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, if (type_j < 0) continue; top = 0; - for( pi = start_j; pi < end_j; ++pi ) { + for (pi = start_j; pi < end_j; ++pi) { pbond_ij = &( bond_list[pi] ); i = pbond_ij->nbr; type_i = system->my_atoms[i].type; @@ -85,7 +85,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, hblist[top++] = pi; } - for( pk = hb_start_j; pk < hb_end_j; ++pk ) { + for (pk = hb_start_j; pk < hb_end_j; ++pk) { /* set k's varibles */ k = hbond_list[pk].nbr; type_k = system->my_atoms[k].type; @@ -94,7 +94,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, r_jk = nbr_jk->d; rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); - for( itr = 0; itr < top; ++itr ) { + for (itr = 0; itr < top; ++itr) { pi = hblist[itr]; pbond_ij = &( bonds->select.bond_list[pi] ); i = pbond_ij->nbr; diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 6ac64a17bc..5864ab6a15 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -63,7 +63,7 @@ int Init_Output_Files( reax_system *system, control_params *control, /* init pressure file */ if ( control->ensemble == NPT || control->ensemble == iNPT || - control->ensemble == sNPT ) { + control->ensemble == sNPT) { sprintf( temp, "%s.prs", control->sim_name ); if ((out_control->prs = fopen( temp, "w" )) != nullptr) { fprintf(out_control->prs,"%8s%13s%13s%13s%13s%13s%13s%13s\n", @@ -119,7 +119,7 @@ void Output_Results( reax_system *system, control_params *control, /* output energies */ if ( system->my_rank == MASTER_NODE && out_control->energy_update_freq > 0 && - data->step % out_control->energy_update_freq == 0 ) { + data->step % out_control->energy_update_freq == 0) { if (control->virial && out_control->prs) { fprintf( out_control->prs, @@ -142,7 +142,7 @@ void Output_Results( reax_system *system, control_params *control, /* write current frame */ if ( out_control->write_steps > 0 && - (data->step-data->prev_steps) % out_control->write_steps == 0 ) { + (data->step-data->prev_steps) % out_control->write_steps == 0) { Append_Frame( system, control, data, lists, out_control, mpi_data ); } } diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index 980e6e0fb6..b45a6da265 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -64,26 +64,26 @@ void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const d /* build the linear system */ a[0] = a[1] = a[n-1] = 0; - for ( i = 2; i < (int)n-1; ++i ) + for (i = 2; i < (int)n-1; ++i) a[i] = h[i-1]; b[0] = b[n-1] = 0; - for ( i = 1; i < (int)n-1; ++i ) + for (i = 1; i < (int)n-1; ++i) b[i] = 2 * (h[i-1] + h[i]); c[0] = c[n-2] = c[n-1] = 0; - for ( i = 1; i < (int)n-2; ++i ) + for (i = 1; i < (int)n-2; ++i) c[i] = h[i]; d[0] = d[n-1] = 0; - for ( i = 1; i < (int)n-1; ++i ) + for (i = 1; i < (int)n-1; ++i) d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); v[0] = 0; v[n-1] = 0; Tridiagonal_Solve( &(a[1]), &(b[1]), &(c[1]), &(d[1]), &(v[1]), n-2 ); - for ( i = 1; i < (int)n; ++i ) { + for (i = 1; i < (int)n; ++i) { coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); coef[i-1].c = v[i]/2; coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; @@ -114,25 +114,25 @@ void Complete_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const /* build the linear system */ a[0] = 0; - for ( i = 1; i < (int)n; ++i ) + for (i = 1; i < (int)n; ++i) a[i] = h[i-1]; b[0] = 2*h[0]; - for ( i = 1; i < (int)n; ++i ) + for (i = 1; i < (int)n; ++i) b[i] = 2 * (h[i-1] + h[i]); c[n-1] = 0; - for ( i = 0; i < (int)n-1; ++i ) + for (i = 0; i < (int)n-1; ++i) c[i] = h[i]; d[0] = 6 * (f[1]-f[0])/h[0] - 6 * v0; d[n-1] = 6 * vlast - 6 * (f[n-1]-f[n-2]/h[n-2]); - for ( i = 1; i < (int)n-1; ++i ) + for (i = 1; i < (int)n-1; ++i) d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); Tridiagonal_Solve( &(a[0]), &(b[0]), &(c[0]), &(d[0]), &(v[0]), n ); - for ( i = 1; i < (int)n; ++i ) { + for (i = 1; i < (int)n; ++i) { coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); coef[i-1].c = v[i]/2; coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; @@ -181,21 +181,21 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, LR = (LR_lookup_table**) scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR"); - for ( i = 0; i < num_atom_types; ++i ) + for (i = 0; i < num_atom_types; ++i) LR[i] = (LR_lookup_table*) scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); - for ( i = 0; i < REAX_MAX_ATOM_TYPES; ++i ) + for (i = 0; i < REAX_MAX_ATOM_TYPES; ++i) existing_types[i] = 0; - for ( i = 0; i < system->n; ++i ) + for (i = 0; i < system->n; ++i) existing_types[ system->my_atoms[i].type ] = 1; MPI_Allreduce( existing_types, aggregated, REAX_MAX_ATOM_TYPES, MPI_INT, MPI_SUM, mpi_data->world ); - for ( i = 0; i < num_atom_types; ++i ) { + for (i = 0; i < num_atom_types; ++i) { if (aggregated[i]) { - for ( j = i; j < num_atom_types; ++j ) { + for (j = i; j < num_atom_types; ++j) { if (aggregated[j]) { LR[i][j].xmin = 0; LR[i][j].xmax = control->nonb_cut; @@ -216,7 +216,7 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb"); - for ( r = 1; r <= control->tabulate; ++r ) { + for (r = 1; r <= control->tabulate; ++r) { LR_vdW_Coulomb( system, workspace, control, i, j, r * dr, &(LR[i][j].y[r]) ); h[r] = LR[i][j].dx; fh[r] = LR[i][j].y[r].H; @@ -277,8 +277,8 @@ void Deallocate_Lookup_Tables( reax_system *system ) ntypes = system->reax_param.num_atom_types; - for ( i = 0; i < ntypes; ++i ) { - for ( j = i; j < ntypes; ++j ) + for (i = 0; i < ntypes; ++i) { + for (j = i; j < ntypes; ++j) if (LR[i][j].n) { sfree(system->error_ptr, LR[i][j].y, "LR[i,j].y" ); sfree(system->error_ptr, LR[i][j].H, "LR[i,j].H" ); diff --git a/src/USER-REAXC/reaxc_multi_body.cpp b/src/USER-REAXC/reaxc_multi_body.cpp index 00c8fbab2d..ab66e3352a 100644 --- a/src/USER-REAXC/reaxc_multi_body.cpp +++ b/src/USER-REAXC/reaxc_multi_body.cpp @@ -63,7 +63,7 @@ void Atom_Energy( reax_system *system, control_params *control, p_ovun7 = system->reax_param.gp.l[8]; p_ovun8 = system->reax_param.gp.l[9]; - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { /* set the parameter pointer */ type_i = system->my_atoms[i].type; if (type_i < 0) continue; @@ -76,7 +76,7 @@ void Atom_Energy( reax_system *system, control_params *control, numbonds = 0; e_lp = 0.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) numbonds ++; /* calculate the energy */ @@ -97,7 +97,7 @@ void Atom_Energy( reax_system *system, control_params *control, /* correction for C2 */ 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) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; if (type_j < 0) continue; @@ -127,7 +127,7 @@ void Atom_Energy( reax_system *system, control_params *control, } - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[ type_i ]); @@ -139,7 +139,7 @@ void Atom_Energy( reax_system *system, control_params *control, p_ovun2 = sbp_i->p_ovun2; 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) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; if (type_j < 0) continue; @@ -186,7 +186,7 @@ void Atom_Energy( reax_system *system, control_params *control, numbonds = 0; e_un = 0.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) numbonds ++; if (numbonds > 0 || control->enobondsflag) @@ -214,7 +214,7 @@ void Atom_Energy( reax_system *system, control_params *control, if (numbonds > 0 || control->enobondsflag) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term - for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { pbond = &(bonds->select.bond_list[pj]); j = pbond->nbr; bo_ij = &(pbond->bo_data); diff --git a/src/USER-REAXC/reaxc_nonbonded.cpp b/src/USER-REAXC/reaxc_nonbonded.cpp index 7c3350fd40..97790aa997 100644 --- a/src/USER-REAXC/reaxc_nonbonded.cpp +++ b/src/USER-REAXC/reaxc_nonbonded.cpp @@ -62,13 +62,13 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, e_vdW = 0; e_lg = de_lg = 0.0; - for( i = 0; i < natoms; ++i ) { + for (i = 0; i < natoms; ++i) { if (system->my_atoms[i].type < 0) continue; start_i = Start_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs); 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]); j = nbr_pj->nbr; if (system->my_atoms[j].type < 0) continue; @@ -228,14 +228,14 @@ void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control, e_ele = e_vdW = 0; - for( i = 0; i < natoms; ++i ) { + for (i = 0; i < natoms; ++i) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; start_i = Start_Index(i,far_nbrs); end_i = End_Index(i,far_nbrs); 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]); j = nbr_pj->nbr; type_j = system->my_atoms[j].type; @@ -322,7 +322,7 @@ void Compute_Polarization_Energy( reax_system *system, simulation_data *data ) double q, en_tmp; data->my_en.e_pol = 0.0; - for( i = 0; i < system->n; i++ ) { + for (i = 0; i < system->n; i++) { type_i = system->my_atoms[i].type; if (type_i < 0) continue; q = system->my_atoms[i].q; diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index e400f38970..5caaf860e7 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -41,7 +41,7 @@ void Reset_Atoms( reax_system* system, control_params *control ) system->numH = 0; if (control->hbond_cut > 0) - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { atom = &(system->my_atoms[i]); if (atom->type < 0) continue; if (system->reax_param.sbp[ atom->type ].p_hbond == 1) @@ -135,7 +135,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, total_bonds = 0; /* reset start-end indexes */ - for( i = 0; i < system->N; ++i ) { + for (i = 0; i < system->N; ++i) { Set_Start_Index( i, total_bonds, bonds ); Set_End_Index( i, total_bonds, bonds ); total_bonds += system->my_atoms[i].num_bonds; @@ -158,7 +158,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, total_hbonds = 0; /* reset start-end indexes */ - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { Hindex = system->my_atoms[i].Hindex; if (Hindex > -1) { Set_Start_Index( Hindex, total_hbonds, hbonds ); diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index b27a1635fe..b559a362f4 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -62,7 +62,7 @@ int Tokenize( char* s, char*** tok ) strncpy( test, s, MAX_LINE-1); - for( word = strtok(test, sep); word; word = strtok(nullptr, sep) ) { + for (word = strtok(test, sep); word; word = strtok(nullptr, sep)) { strncpy( (*tok)[count], word, MAX_LINE ); count++; } diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index c49b095b20..305e83707d 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -85,9 +85,9 @@ double Calculate_Omega( rvec dvec_ij, double r_ij, if (arg < -1.0) arg = -1.0; if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) sin_ijk = MIN_SINE; - else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) sin_ijk = -MIN_SINE; + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) sin_ijk = -MIN_SINE; if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) sin_jkl = MIN_SINE; - else if ( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) sin_jkl = -MIN_SINE; + else if (sin_jkl <= 0 && sin_jkl >= -MIN_SINE) sin_jkl = -MIN_SINE; // dcos_omega_di rvec_ScaledSum( dcos_omega_di, (htra-arg*hnra)/r_ij, dvec_ij, -1., dvec_li ); @@ -169,13 +169,13 @@ void Torsion_Angles( reax_system *system, control_params *control, natoms = system->n; - for( j = 0; j < natoms; ++j ) { + for (j = 0; j < natoms; ++j) { type_j = system->my_atoms[j].type; Delta_j = workspace->Delta_boc[j]; start_j = Start_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] ); k = pbond_jk->nbr; bo_jk = &( pbond_jk->bo_data ); @@ -212,7 +212,7 @@ void Torsion_Angles( reax_system *system, control_params *control, exp_tor34_inv = 1.0 / (1.0 + exp_tor3_DjDk + exp_tor4_DjDk); f11_DjDk = (2.0 + exp_tor3_DjDk) * exp_tor34_inv; - 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] ); pij = p_ijk->pthb; // pij is pointer to i on j's bond_list pbond_ij = &( bonds->select.bond_list[pij] ); @@ -230,14 +230,14 @@ void Torsion_Angles( reax_system *system, control_params *control, //tan_ijk_i = 1. / tan( theta_ijk ); if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) tan_ijk_i = cos_ijk / MIN_SINE; - else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) + else if (sin_ijk <= 0 && sin_ijk >= -MIN_SINE) tan_ijk_i = cos_ijk / -MIN_SINE; else tan_ijk_i = cos_ijk / sin_ijk; exp_tor2_ij = exp( -p_tor2 * BOA_ij ); exp_cot2_ij = exp( -p_cot2 * SQR(BOA_ij -1.5) ); - for( pl = start_pj; pl < end_pj; ++pl ) { + for (pl = start_pj; pl < end_pj; ++pl) { p_jkl = &( thb_intrs->select.three_body_list[pl] ); l = p_jkl->thb; plk = p_jkl->pthb; //pointer to l on k's bond_list! @@ -251,7 +251,7 @@ void Torsion_Angles( reax_system *system, control_params *control, if ( i != l && fbh->cnt && bo_kl->BO > control->thb_cut/*0*/ && - 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; r_kl = pbond_kl->d; BOA_kl = bo_kl->BO - control->thb_cut; @@ -262,7 +262,7 @@ void Torsion_Angles( reax_system *system, control_params *control, //tan_jkl_i = 1. / tan( theta_jkl ); if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) tan_jkl_i = cos_jkl / MIN_SINE; - 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; else tan_jkl_i = cos_jkl /sin_jkl; diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 2d56722aba..66a1c70b0e 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -285,7 +285,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, out_control->line[0] = 0; out_control->buffer[0] = 0; - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { p_atom = &( system->my_atoms[i] ); sprintf( out_control->line, INIT_DESC, p_atom->orig_id, p_atom->type, p_atom->name, @@ -299,7 +299,7 @@ int Write_Init_Desc( reax_system *system, control_params * /*control*/, np * INIT_DESCS + me, mpi_data->world ); } else { buffer_len = system->n * INIT_DESC_LEN; - for( i = 0; i < np; ++i ) + for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, MPI_CHAR, i, np*INIT_DESCS+i, mpi_data->world, &status ); @@ -508,10 +508,10 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, /* fill in buffer */ out_control->line[0] = 0; out_control->buffer[0] = 0; - for( i = 0; i < system->n; ++i ) { + for (i = 0; i < system->n; ++i) { p_atom = &( system->my_atoms[i] ); - switch( out_control->atom_info ) { + switch (out_control->atom_info) { case OPT_ATOM_BASIC: sprintf( out_control->line, ATOM_BASIC, p_atom->orig_id, p_atom->x[0], p_atom->x[1], p_atom->x[2], @@ -545,7 +545,7 @@ int Write_Atoms( reax_system *system, control_params * /*control*/, np*ATOM_LINES+me, mpi_data->world ); } else { buffer_len = system->n * line_len; - for( i = 0; i < np; ++i ) + for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, MPI_CHAR, i, np*ATOM_LINES+i, mpi_data->world, &status ); @@ -575,8 +575,8 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, /* count the number of bonds I will write */ my_bonds = 0; - for( i=0; i < system->n; ++i ) - for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { + for (i=0; i < system->n; ++i) + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { j = bonds->select.bond_list[pj].nbr; if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut ) @@ -600,14 +600,14 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, out_control->buffer[0] = 0; my_bonds = 0; - for( i=0; i < system->n; ++i ) { - for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { + for (i=0; i < system->n; ++i) { + for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { bo_ij = &( bonds->select.bond_list[pj] ); j = bo_ij->nbr; if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && - bo_ij->bo_data.BO >= control->bg_cut ) { - switch( out_control->bond_info ) { + bo_ij->bo_data.BO >= control->bg_cut) { + switch (out_control->bond_info) { case OPT_BOND_BASIC: sprintf( out_control->line, BOND_BASIC, system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, @@ -634,7 +634,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, np*BOND_LINES+me, mpi_data->world ); } else { buffer_len = my_bonds * line_len; - for( i = 0; i < np; ++i ) + for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, MPI_CHAR, i, np*BOND_LINES+i, mpi_data->world, &status ); @@ -666,14 +666,14 @@ int Write_Angles( reax_system *system, control_params *control, /* count the number of valence angles I will output */ my_angles = 0; - for( j = 0; j < system->n; ++j ) - for( pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi ) { + for (j = 0; j < system->n; ++j) + for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { bo_ij = &(bonds->select.bond_list[pi]); i = bo_ij->nbr; if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for( pk = Start_Index( pi, thb_intrs ); - pk < End_Index( pi, thb_intrs ); ++pk ) { + for (pk = Start_Index( pi, thb_intrs); + pk < End_Index( pi, thb_intrs ); ++pk) { angle_ijk = &(thb_intrs->select.three_body_list[pk]); k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); @@ -699,20 +699,20 @@ int Write_Angles( reax_system *system, control_params *control, my_angles = 0; out_control->line[0] = 0; out_control->buffer[0] = 0; - for( j = 0; j < system->n; ++j ) - for( pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi ) { + for (j = 0; j < system->n; ++j) + for (pi = Start_Index(j, bonds); pi < End_Index(j, bonds); ++pi) { bo_ij = &(bonds->select.bond_list[pi]); i = bo_ij->nbr; if (bo_ij->bo_data.BO >= control->bg_cut) // physical j&i bond - for( pk = Start_Index( pi, thb_intrs ); - pk < End_Index( pi, thb_intrs ); ++pk ) { + for (pk = Start_Index( pi, thb_intrs); + pk < End_Index( pi, thb_intrs ); ++pk) { angle_ijk = &(thb_intrs->select.three_body_list[pk]); k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); if ( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && - bo_jk->bo_data.BO >= control->bg_cut ) { // physical j&k bond + bo_jk->bo_data.BO >= control->bg_cut) { // physical j&k bond sprintf( out_control->line, ANGLE_BASIC, system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, system->my_atoms[k].orig_id, RAD2DEG( angle_ijk->theta ) ); @@ -729,7 +729,7 @@ int Write_Angles( reax_system *system, control_params *control, np*ANGLE_LINES+me, mpi_data->world ); } else { buffer_len = my_angles * line_len; - for( i = 0; i < np; ++i ) + for (i = 0; i < np; ++i) if (i != MASTER_NODE) { MPI_Recv( out_control->buffer + buffer_len, buffer_req - buffer_len, MPI_CHAR, i, np*ANGLE_LINES+i, mpi_data->world, &status ); diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index b545fa93a9..9aec0a1f05 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -37,7 +37,7 @@ static double Dot( double* v1, double* v2, int k ) { double ret = 0.0; - for( int i=0; i < k; ++i ) + for (int i=0; i < k; ++i) ret += v1[i] * v2[i]; return ret; @@ -66,7 +66,7 @@ void Calculate_dCos_Theta( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_jk, double dot_dvecs = Dot( dvec_ji, dvec_jk, 3 ); double Cdot_inv3 = dot_dvecs * inv_dists3; - for( t = 0; t < 3; ++t ) { + for (t = 0; t < 3; ++t) { (*dcos_theta_di)[t] = dvec_jk[t] * inv_dists - Cdot_inv3 * sqr_d_jk * dvec_ji[t]; (*dcos_theta_dj)[t] = -(dvec_jk[t] + dvec_ji[t]) * inv_dists + @@ -124,7 +124,7 @@ void Valence_Angles( reax_system *system, control_params *control, num_thb_intrs = 0; - 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; if (type_j < 0) continue; start_j = Start_Index(j, bonds); @@ -134,7 +134,7 @@ void Valence_Angles( reax_system *system, control_params *control, p_val5 = system->reax_param.sbp[ type_j ].p_val5; 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); SBOp += (bo_jt->BO_pi + bo_jt->BO_pi2); temp = SQR( bo_jt->BO ); @@ -169,7 +169,7 @@ void Valence_Angles( reax_system *system, control_params *control, 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, num_thb_intrs, thb_intrs ); pbond_ij = &(bonds->select.bond_list[pi]); bo_ij = &(pbond_ij->bo_data); @@ -177,15 +177,15 @@ void Valence_Angles( reax_system *system, control_params *control, if ( BOA_ij/*bo_ij->BO*/ > 0.0 && - ( j < system->n || pbond_ij->nbr < system->n ) ) { + ( j < system->n || pbond_ij->nbr < system->n )) { i = pbond_ij->nbr; type_i = system->my_atoms[i].type; - for( pk = start_j; pk < pi; ++pk ) { + for (pk = start_j; pk < pi; ++pk) { start_pk = Start_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) { p_ijk = &(thb_intrs->select.three_body_list[num_thb_intrs] ); p_kji = &(thb_intrs->select.three_body_list[t]); @@ -202,7 +202,7 @@ void Valence_Angles( reax_system *system, control_params *control, } } - for( pk = pi+1; pk < end_j; ++pk ) { + for (pk = pi+1; pk < end_j; ++pk) { pbond_jk = &(bonds->select.bond_list[pk]); bo_jk = &(pbond_jk->bo_data); BOA_jk = bo_jk->BO - control->thb_cut; @@ -232,10 +232,10 @@ void Valence_Angles( reax_system *system, control_params *control, if ((j < system->n) && (BOA_jk > 0.0) && (bo_ij->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)) { 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) { thbp = &( thbh->prm[cnt] ); @@ -345,7 +345,7 @@ void Valence_Angles( reax_system *system, control_params *control, workspace->CdDelta[i] += CEcoa4; workspace->CdDelta[k] += CEcoa5; - for( t = start_j; t < end_j; ++t ) { + for (t = start_j; t < end_j; ++t) { pbond_jt = &( bonds->select.bond_list[t] ); bo_jt = &(pbond_jt->bo_data); temp_bo_jt = bo_jt->BO; diff --git a/src/USER-REAXC/reaxc_vector.cpp b/src/USER-REAXC/reaxc_vector.cpp index edee65d637..e0e3a14782 100644 --- a/src/USER-REAXC/reaxc_vector.cpp +++ b/src/USER-REAXC/reaxc_vector.cpp @@ -107,15 +107,15 @@ void rtensor_MatVec( rvec ret, rtensor m, rvec v ) if (ret == v) { - for( i = 0; i < 3; ++i ) + for (i = 0; i < 3; ++i) temp[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2]; - for( i = 0; i < 3; ++i ) + for (i = 0; i < 3; ++i) ret[i] = temp[i]; } else { - for( i = 0; i < 3; ++i ) + for (i = 0; i < 3; ++i) ret[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2]; } } diff --git a/src/USER-SMD/compute_smd_triangle_vertices.cpp b/src/USER-SMD/compute_smd_triangle_vertices.cpp index f621029a47..c487e60872 100644 --- a/src/USER-SMD/compute_smd_triangle_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_vertices.cpp @@ -95,7 +95,7 @@ void ComputeSMDTriangleVertices::compute_peratom() { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if ((mask[i] & groupbit) && (mol[i] >= 65535) ) { + if ((mask[i] & groupbit) && (mol[i] >= 65535)) { outputVector[i][0] = smd_data_9[i][0]; outputVector[i][1] = smd_data_9[i][1]; outputVector[i][2] = smd_data_9[i][2]; diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 5f416955cf..6989be8376 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -153,9 +153,9 @@ PairSMTBQ::~PairSMTBQ() if (elements) { for ( i = 0; i < nelements; i++) delete [] elements[i]; - for( i = 0; i < atom->ntypes ; i++ ) free( params[i].nom ); - for( i = 1; i <= maxintparam ; i++ ) free( intparams[i].typepot ); - for( i = 1; i <= maxintparam ; i++ ) free( intparams[i].mode ); + for (i = 0; i < atom->ntypes ; i++ ) free( params[i].nom); + for (i = 1; i <= maxintparam ; i++ ) free( intparams[i].typepot); + for (i = 1; i <= maxintparam ; i++ ) free( intparams[i].mode); } free(QEqMode); @@ -400,7 +400,7 @@ void PairSMTBQ::read_file(char *file) // open file on all processors FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if ( fp == nullptr ) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open SMTBQ potential file %s",file); error->one(FLERR,str); @@ -572,7 +572,7 @@ void PairSMTBQ::read_file(char *file) // if (test == 0) printf (" on a %s -> %d = %s\n",words[2],j,params[j].nom); - if ( test == 1 ) { + if (test == 1) { if (verbose) printf ("========== fin des interaction ==========\n"); break ; } @@ -766,7 +766,7 @@ void PairSMTBQ::read_file(char *file) } else if (strcmp(QEqMode,"QEqAll") != 0 && strcmp(QEqMode,"QEqAllParallel") != 0 && - strcmp(QEqMode,"Surface") != 0 ) { + strcmp(QEqMode,"Surface") != 0) { error->all(FLERR,"The QEq Mode is not known. QEq mode should be :\n" " Possible QEq modes | parameters\n" " QEqAll | no parameters\n" @@ -809,7 +809,7 @@ void PairSMTBQ::read_file(char *file) /* ======================================================== */ /* deallocate helper storage */ - for( i = 0; i < MAXTOKENS ; i++ ) free( words[i] ); + for (i = 0; i < MAXTOKENS ; i++ ) free( words[i]); free( words ); free( ptr ); fclose(fp); @@ -1055,7 +1055,7 @@ void PairSMTBQ::compute(int eflag, int vflag) // ---------------------------------------------- if ( strcmp(intparams[m].typepot,"buck") == 0 || - strcmp(intparams[m].typepot,"buckPlusAttr") ==0 ) { + strcmp(intparams[m].typepot,"buckPlusAttr") ==0) { // ---------------------------------------------- evdwl = 0.0; fpair =0.0; @@ -1079,7 +1079,7 @@ void PairSMTBQ::compute(int eflag, int vflag) } // ----------------------------------- Rep O-O - if (strcmp(intparams[m].typepot,"buckPlusAttr") == 0 ) { + if (strcmp(intparams[m].typepot,"buckPlusAttr") == 0) { // ---------------------------------------------- evdwl = 0.0; fpair =0.0; @@ -2577,7 +2577,7 @@ void PairSMTBQ::Charge() // Init_charge(nQEq,nQEqa,nQEqc); // --------------------------------- - if (update->ntimestep == 0 && (strcmp(QInitMode,"true") == 0) ) { + if (update->ntimestep == 0 && (strcmp(QInitMode,"true") == 0)) { //Carefull here it won't be fine if there are more than 2 species!!! QOxInit=max(QOxInit, -0.98* params[1].qform *nQEqcall[gp]/nQEqaall[gp]) ; @@ -2622,7 +2622,7 @@ void PairSMTBQ::Charge() // -------------------------------------------- - for (iloop = 0; iloop < loopmax; iloop ++ ) { + for (iloop = 0; iloop < loopmax; iloop ++) { // -------------------------------------------- qtot = qtotll = Transf[3*cluster] = 0.0 ; @@ -3556,7 +3556,7 @@ int PairSMTBQ::Tokenize( char* s, char*** tok ) strncpy( test, s, MAXLINE-1 ); - for( mot = strtok(test, sep); mot; mot = strtok(nullptr, sep) ) { + for (mot = strtok(test, sep); mot; mot = strtok(nullptr, sep)) { strncpy( (*tok)[count], mot, MAXLINE ); count++; } diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index e9b507ff11..21c518f3d7 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -122,7 +122,7 @@ void ComputeForceTally::pair_tally_callback(int i, int j, int nlocal, int newton const int * const mask = atom->mask; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { + || ((mask[i] & groupbit2) && (mask[j] & groupbit))) { if (newton || i < nlocal) { if (mask[i] & groupbit) { diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 18edae46ea..002d0e3238 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -131,7 +131,7 @@ void ComputeHeatFluxTally::pair_tally_callback(int i, int j, int nlocal, int new const int * const mask = atom->mask; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { + || ((mask[i] & groupbit2) && (mask[j] & groupbit))) { const double epairhalf = 0.5 * (evdwl + ecoul); fpair *= 0.5; diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index 7cc0f95d80..97c1a7ffbe 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -100,7 +100,7 @@ void ComputePEMolTally::pair_tally_callback(int i, int j, int nlocal, int newton const tagint * const molid = atom->molecule; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { + || ((mask[i] & groupbit2) && (mask[j] & groupbit))) { evdwl *= 0.5; ecoul *= 0.5; if (newton || i < nlocal) { diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index 3d589aed70..451c785b13 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -119,7 +119,7 @@ void ComputePETally::pair_tally_callback(int i, int j, int nlocal, int newton, const int * const mask = atom->mask; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { + || ((mask[i] & groupbit2) && (mask[j] & groupbit))) { evdwl *= 0.5; ecoul *= 0.5; if (newton || i < nlocal) { diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index c2c474fb1c..e32a134ec3 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -124,7 +124,7 @@ void ComputeStressTally::pair_tally_callback(int i, int j, int nlocal, int newto const int * const mask = atom->mask; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { + || ((mask[i] & groupbit2) && (mask[j] & groupbit))) { fpair *= 0.5; const double v0 = dx*dx*fpair; diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index a2bf1fb4bf..518015d688 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -1910,7 +1910,7 @@ void DumpVTK::identify_vectors() continue; // assume components are grouped together and in correct order - if (name.count(it->first + 1) && name.count(it->first + 2) ) { // more attributes? + if (name.count(it->first + 1) && name.count(it->first + 2)) { // more attributes? if (it->second.compare(0,it->second.length()-3,name[it->first + 1],0,it->second.length()-3) == 0 && // same attributes? it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0 ) { diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index 50ebe8b7cf..2c3dac06f8 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -68,7 +68,7 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : faces = nullptr; int iarg = 3; - while ( iarg 0 ) { + if (maxedge > 0) { vector_flag = 1; size_vector = maxedge+1; memory->create(edge,maxedge+1,"voronoi/atom:edge"); @@ -269,7 +269,7 @@ void ComputeVoronoi::buildCells() // cutghost is in lamda coordinates for triclinic boxes, use subxx_lamda double *h = domain->h; - for( i=0; i<3; ++i ) { + for (i=0; i<3; ++i) { sublo_bound[i] = sublo_lamda[i]-cut[i]-e; subhi_bound[i] = subhi_lamda[i]+cut[i]+e; if (domain->periodicity[i]==0) { @@ -290,7 +290,7 @@ void ComputeVoronoi::buildCells() } else { // orthogonal box - for( i=0; i<3; ++i ) { + for (i=0; i<3; ++i) { sublo_bound[i] = sublo[i]-cut[i]-e; subhi_bound[i] = subhi[i]+cut[i]+e; if (domain->periodicity[i]==0) { @@ -307,15 +307,15 @@ void ComputeVoronoi::buildCells() // n = # of voro++ spatial hash cells (with approximately cubic cells) int nall = nlocal + atom->nghost; double n[3], V; - for( i=0; i<3; ++i ) n[i] = subhi_bound[i] - sublo_bound[i]; + for (i=0; i<3; ++i) n[i] = subhi_bound[i] - sublo_bound[i]; V = n[0]*n[1]*n[2]; - for( i=0; i<3; ++i ) { + for (i=0; i<3; ++i) { n[i] = round( n[i]*pow( double(nall)/(V*8.0), 0.333333 ) ); n[i] = n[i]==0 ? 1 : n[i]; } // clear edge statistics - if ( maxedge > 0 ) + if (maxedge > 0) for (i = 0; i <= maxedge; ++i) edge[i]=0; // initialize voro++ container @@ -543,10 +543,10 @@ void ComputeVoronoi::processCell(voronoicell_neighbor &c, int i) c.vertices(vcell); c.face_vertices(vlist); // for each face: vertex count followed list of vertex indices (n_1,v1_1,v2_1,v3_1,..,vn_1,n_2,v2_1,...) double dx, dy, dz, r2, t2 = ethresh*ethresh; - for( j=0; j < (int)vlist.size(); j+=vlist[j]+1 ) { + for (j=0; j < (int)vlist.size(); j+=vlist[j]+1) { int a, b, nedge = 0; // vlist[j] contains number of vertex indices for the current face - for( k=0; k < vlist[j]; ++k ) { + for (k=0; k < vlist[j]; ++k) { a = vlist[j+1+k]; // first vertex in edge b = vlist[j+1+(k+1)%vlist[j]]; // second vertex in edge (possible wrap around to first vertex in list) dx = vcell[a*3] - vcell[b*3]; @@ -625,7 +625,7 @@ void ComputeVoronoi::compute_vector() invoked_vector = update->ntimestep; if (invoked_peratom < invoked_vector) compute_peratom(); - for( int i=0; i= 2 && j <= 4) { unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; offset += sprintf(&sbuf[offset],vformat[j],unwrap_coord); - } else if (j >= 5 ) { + } else if (j >= 5) { if (vtype[j] == Dump::INT) offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); @@ -279,7 +279,7 @@ void DumpCFG::write_lines(int n, double *mybuf) } else if (j >= 2 && j <= 4) { unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; fprintf(fp,vformat[j],unwrap_coord); - } else if (j >= 5 ) { + } else if (j >= 5) { if (vtype[j] == Dump::INT) fprintf(fp,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) diff --git a/src/finish.cpp b/src/finish.cpp index c3d921f3c4..810155f1b0 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -134,7 +134,7 @@ void Finish::end(int flag) (strcmp(update->unit_style,"micro") == 0) || (strcmp(update->unit_style,"nano") == 0) || (strcmp(update->unit_style,"electron") == 0) || - (strcmp(update->unit_style,"real") == 0)) ) { + (strcmp(update->unit_style,"real") == 0))) { double one_fs = force->femtosecond; double t_step = ((double) time_loop) / ((double) update->nsteps); double step_t = 1.0/t_step; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 16e2ade2af..657323802d 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -70,7 +70,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) if (iarg+3 > narg) error->all(FLERR,"Illegal fix adapt command"); nadapt++; iarg += 3; - } else if (strcmp(arg[iarg],"bond") == 0 ) { + } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix adapt command"); nadapt++; iarg += 5; @@ -110,7 +110,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) nadapt++; iarg += 6; - } else if (strcmp(arg[iarg],"bond") == 0 ) { + } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+5 > narg) error->all(FLERR, "Illegal fix adapt command"); adapt[nadapt].which = BOND; int n = strlen(arg[iarg+1]) + 1; @@ -651,7 +651,7 @@ void FixAdapt::change_settings() } } if (anybond) { - for (int m = 0; m < nadapt; ++m ) { + for (int m = 0; m < nadapt; ++m) { Adapt *ad = &adapt[m]; if (ad->which == BOND) { ad->bond->reinit(); diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index f09a8c4464..76941dc176 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -107,7 +107,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : dlimit_path = new char[len]; // strip off quotes, if present if ( ((arg[iarg][0] == '"') || (arg[iarg][0] == '\'')) - && (arg[iarg][0] == arg[iarg][len-2]) ) { + && (arg[iarg][0] == arg[iarg][len-2])) { strcpy(dlimit_path,&arg[iarg][1]); dlimit_path[len-3] = '\0'; } else strcpy(dlimit_path,arg[iarg]); diff --git a/src/info.cpp b/src/info.cpp index 5202610f9a..bb3111cb69 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -933,33 +933,33 @@ bool Info::is_defined(const char *category, const char *name) bool Info::has_style(const std::string &category, const std::string &name) { - if ( category == "atom" ) { + if (category == "atom") { return find_style(lmp, atom->avec_map, name, false); - } else if ( category == "integrate" ) { + } else if (category == "integrate") { return find_style(lmp, update->integrate_map, name, true); - } else if ( category == "minimize" ) { + } else if (category == "minimize") { return find_style(lmp, update->minimize_map, name, true); - } else if ( category == "pair" ) { + } else if (category == "pair") { return find_style(lmp, force->pair_map, name, true); - } else if ( category == "bond" ) { + } else if (category == "bond") { return find_style(lmp, force->bond_map, name, true); - } else if ( category == "angle" ) { + } else if (category == "angle") { return find_style(lmp, force->angle_map, name, true); - } else if ( category == "dihedral" ) { + } else if (category == "dihedral") { return find_style(lmp, force->dihedral_map, name, true); - } else if ( category == "improper" ) { + } else if (category == "improper") { return find_style(lmp, force->improper_map, name, true); - } else if ( category == "kspace" ) { + } else if (category == "kspace") { return find_style(lmp, force->kspace_map, name, true); - } else if ( category == "fix" ) { + } else if (category == "fix") { return find_style(lmp, modify->fix_map, name, true); - } else if ( category == "compute" ) { + } else if (category == "compute") { return find_style(lmp, modify->compute_map, name, true); - } else if ( category == "region" ) { + } else if (category == "region") { return find_style(lmp, domain->region_map, name, false); - } else if ( category == "dump" ) { + } else if (category == "dump") { return find_style(lmp, output->dump_map, name, false); - } else if ( category == "command" ) { + } else if (category == "command") { return find_style(lmp, input->command_map, name, false); } return false; @@ -967,33 +967,33 @@ bool Info::has_style(const std::string &category, const std::string &name) std::vector Info::get_available_styles(const std::string &category) { - if ( category == "atom" ) { + if (category == "atom") { return get_style_names(atom->avec_map); - } else if ( category == "integrate" ) { + } else if (category == "integrate") { return get_style_names(update->integrate_map); - } else if ( category == "minimize" ) { + } else if (category == "minimize") { return get_style_names(update->minimize_map); - } else if ( category == "pair" ) { + } else if (category == "pair") { return get_style_names(force->pair_map); - } else if ( category == "bond" ) { + } else if (category == "bond") { return get_style_names(force->bond_map); - } else if ( category == "angle" ) { + } else if (category == "angle") { return get_style_names(force->angle_map); - } else if ( category == "dihedral" ) { + } else if (category == "dihedral") { return get_style_names(force->dihedral_map); - } else if ( category == "improper" ) { + } else if (category == "improper") { return get_style_names(force->improper_map); - } else if ( category == "kspace" ) { + } else if (category == "kspace") { return get_style_names(force->kspace_map); - } else if ( category == "fix" ) { + } else if (category == "fix") { return get_style_names(modify->fix_map); - } else if ( category == "compute" ) { + } else if (category == "compute") { return get_style_names(modify->compute_map); - } else if ( category == "region" ) { + } else if (category == "region") { return get_style_names(domain->region_map); - } else if ( category == "dump" ) { + } else if (category == "dump") { return get_style_names(output->dump_map); - } else if ( category == "command" ) { + } else if (category == "command") { return get_style_names(input->command_map); } return std::vector(); diff --git a/src/library.cpp b/src/library.cpp index 00a922f98b..7d3f2f8996 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -2758,7 +2758,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) } // property / atom if ( (vptr == nullptr) && ((strstr(name,"d_") == name) - || (strstr(name,"i_") == name)) ) { + || (strstr(name,"i_") == name))) { fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { if (lmp->comm->me == 0) @@ -4269,7 +4269,7 @@ included in the LAMMPS library in use. */ int lammps_config_package_count() { int i = 0; - while(LAMMPS::installed_packages[i] != nullptr) { + while (LAMMPS::installed_packages[i] != nullptr) { ++i; } return i; diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index beca1a839a..c554981835 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -410,7 +410,7 @@ int MinHFTN::execute_hftn_(const bool bPrintProgress, double dMag = 0.5 * (fabs (dCurrentEnergy) + fabs (dNewEnergy)); dMag = MAX (dMag, MIN_ETOL_MAG); if ( (fabs (dAred) < (update->etol * dMag)) - || (dStepLengthInf == 0.0) ) { + || (dStepLengthInf == 0.0)) { if (bPrintProgress) hftn_print_line_ (true, niter+1, neval, dNewEnergy, dNewForce2, @@ -1267,7 +1267,7 @@ double MinHFTN::compute_to_tr_(const double dPP, //---- CHECK FOR ERRONEOUS DATA. if ( (dDD <= 0.0) || (dPP < 0.0) || (dTrustRadius < 0.0) - || (dTrustRadius * dTrustRadius < dPP) ) { + || (dTrustRadius * dTrustRadius < dPP)) { printf ("HFTN internal error - bad data given to compute_to_tr_()\n"); return( 0.0 ); } diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 8856359bcb..0c6dd46408 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -545,7 +545,7 @@ pseudo code: bactrack = true // GRAD_TOL = 0.1 - if ( (not backtrack) && (fabs(fhCurr/fh0) <= GRAD_TOL) ): + if ((not backtrack) && (fabs(fhCurr/fh0) <= GRAD_TOL)): // forces sufficiently reduced without energy increase EXIT with success diff --git a/src/molecule.cpp b/src/molecule.cpp index d85cf47c71..819083e0b3 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -796,7 +796,7 @@ void Molecule::fragments(char *line) fragmentnames[i] = values.next_string(); - while(values.has_next()) { + while (values.has_next()) { int atomID = values.next_int(); if (atomID <= 0 || atomID > natoms) error->one(FLERR,"Invalid atom ID in Fragments section of molecule file"); @@ -1630,11 +1630,11 @@ void Molecule::body(int flag, int pflag, char *line) if (flag) { if (pflag == 0) { - while(values.has_next()) { + while (values.has_next()) { ibodyparams[nword++] = values.next_int(); } } else { - while(values.has_next()) { + while (values.has_next()) { dbodyparams[nword++] = values.next_double(); } } diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 01fc0adac3..de2f180d44 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -247,7 +247,7 @@ void PairCoulStreitz::read_file(char *file) PotentialFileReader reader(lmp, file, "coul/streitz"); char * line; - while((line = reader.next_line(NPARAMS_PER_LINE))) { + while ((line = reader.next_line(NPARAMS_PER_LINE))) { try { ValueTokenizer values(line); @@ -318,7 +318,7 @@ void PairCoulStreitz::setup_params() for (i = 0; i < nelements; i++) { n = -1; for (m = 0; m < nparams; m++) { - if (i == params[m].ielement ) { + if (i == params[m].ielement) { if (n >= 0) error->all(FLERR,"Potential file has duplicate entry"); n = m; } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 7e4c1d2781..3026c9c741 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -775,14 +775,14 @@ void PairHybrid::read_restart(FILE *fp) special_lj[m] = special_coul[m] = nullptr; if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); - if (n > 0 ) { + if (n > 0) { special_lj[m] = new double[4]; if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_lj[m],4,MPI_DOUBLE,0,world); } if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); - if (n > 0 ) { + if (n > 0) { special_coul[m] = new double[4]; if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_coul[m],4,MPI_DOUBLE,0,world); diff --git a/src/reader_native.cpp b/src/reader_native.cpp index a185f5ab3a..7c8bd9c3a8 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -165,7 +165,7 @@ bigint ReaderNative::read_header(double box[3][3], int &boxinfo, int &triclinic, Tokenizer tokens(labelline); nwords = 0; - while(tokens.has_next()) { + while (tokens.has_next()) { labels[tokens.next()] = nwords++; } diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index 6a51849a5e..b144857879 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -148,7 +148,7 @@ bigint ReaderXYZ::read_header(double /*box*/[3][3], int &boxinfo, int &/*triclin (fieldtype[i] == Y) || (fieldtype[i] == Z) || (fieldtype[i] == ID) || - (fieldtype[i] == TYPE) ) { + (fieldtype[i] == TYPE)) { fieldindex[i] = fieldtype[i]; } else { fieldflag = 1; diff --git a/src/replicate.cpp b/src/replicate.cpp index 296e099208..9e91c30612 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -510,12 +510,12 @@ void Replicate::command(int narg, char **arg) if (!xoverlap) { if (xboxlo < 0) { _xoverlap1 = 1; - if ( _lo[0] > (subhi[0] - EPSILON) ) _xoverlap1 = 0; + if (_lo[0] > (subhi[0] - EPSILON)) _xoverlap1 = 0; } if (xboxhi > 0) { _xoverlap2 = 1; - if ( _hi[0] < (sublo[0] + EPSILON) ) _xoverlap2 = 0; + if (_hi[0] < (sublo[0] + EPSILON)) _xoverlap2 = 0; } if (_xoverlap1 || _xoverlap2) xoverlap = 1; @@ -526,12 +526,12 @@ void Replicate::command(int narg, char **arg) if (!yoverlap) { if (yboxlo < 0) { _yoverlap1 = 1; - if ( _lo[1] > (subhi[1] - EPSILON) ) _yoverlap1 = 0; + if (_lo[1] > (subhi[1] - EPSILON)) _yoverlap1 = 0; } if (yboxhi > 0) { _yoverlap2 = 1; - if ( _hi[1] < (sublo[1] + EPSILON) ) _yoverlap2 = 0; + if (_hi[1] < (sublo[1] + EPSILON)) _yoverlap2 = 0; } if (_yoverlap1 || _yoverlap2) yoverlap = 1; @@ -543,12 +543,12 @@ void Replicate::command(int narg, char **arg) if (!zoverlap) { if (zboxlo < 0) { _zoverlap1 = 1; - if ( _lo[2] > (subhi[2] - EPSILON) ) _zoverlap1 = 0; + if (_lo[2] > (subhi[2] - EPSILON)) _zoverlap1 = 0; } if (zboxhi > 0) { _zoverlap2 = 1; - if ( _hi[2] < (sublo[2] + EPSILON) ) _zoverlap2 = 0; + if (_hi[2] < (sublo[2] + EPSILON)) _zoverlap2 = 0; } if (_zoverlap1 || _zoverlap2) zoverlap = 1; diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 23ef4a5568..19f15d8522 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -101,7 +101,7 @@ char *TextFileReader::next_line(int nparams) { n = strlen(line); } - while(nwords == 0 || nwords < nparams) { + while (nwords == 0 || nwords < nparams) { char *ptr = fgets(&line[n], MAXLINE - n, fp); if (ptr == nullptr) { @@ -148,7 +148,7 @@ void TextFileReader::next_dvector(double * list, int n) { } ValueTokenizer values(line); - while(values.has_next()) { + while (values.has_next()) { list[i++] = values.next_double(); } } diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 37ebcd07fb..a9d82ca913 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -145,7 +145,7 @@ std::vector Tokenizer::as_vector() { // generate vector std::vector tokens; - while(has_next()) { + while (has_next()) { tokens.emplace_back(next()); } diff --git a/src/utils.cpp b/src/utils.cpp index 64283aa9c5..a58b384225 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1091,7 +1091,7 @@ void utils::merge_sort(int *index, int num, void *ptr, // copy all indices not handled by the chunked merge sort loop - for ( ; i < num ; i++ ) dest[i] = hold[i]; + for (; i < num ; i++) dest[i] = hold[i]; chunk *= 2; } diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index f84e1a2e33..8f1f6140ed 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -97,7 +97,7 @@ void WriteCoeff::command(int narg, char **arg) fprintf(two,"# LAMMPS coeff file via write_coeff, version %s\n", lmp->version); - while(1) { + while (1) { int coeff_mode = REGULAR_MODE; if (fgets(str,256,one) == nullptr) break;