diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index e3d4e71b15..a8b3c6258d 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -305,8 +305,8 @@ void AnswerT::get_answers(double **f, double **tor) { if (_ilist==nullptr) { typedef struct { double x,y,z; } vec3d; typedef struct { acctyp x,y,z,w; } vec4d_t; - vec3d *fp=reinterpret_cast(&(f[0][0])); - vec4d_t *forcep=reinterpret_cast(&(force[0])); + auto fp=reinterpret_cast(&(f[0][0])); + auto forcep=reinterpret_cast(&(force[0])); #if (LAL_USE_OMP == 1) #pragma omp parallel @@ -329,8 +329,8 @@ void AnswerT::get_answers(double **f, double **tor) { fp[i].z+=forcep[i].z; } if (_rot) { - vec3d *torp=reinterpret_cast(&(tor[0][0])); - vec4d_t *torquep=reinterpret_cast(&(force[_inum*4])); + auto torp=reinterpret_cast(&(tor[0][0])); + auto torquep=reinterpret_cast(&(force[_inum*4])); for (int i=ifrom; i(_cutoff); + const auto cutoff_cast=static_cast(_cutoff); if (_maxspecial>0) { time_nbor.start(); @@ -741,12 +741,12 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum, // If binning on GPU, do this now if (_gpu_nbor==1) { mn = _max_nbors; - const numtyp i_cell_size=static_cast(1.0/_cell_size); + const auto i_cell_size=static_cast(1.0/_cell_size); const int neigh_block=_block_cell_id; const int GX=(int)ceil((double)nall/neigh_block); - const numtyp sublo0=static_cast(sublo[0]); - const numtyp sublo1=static_cast(sublo[1]); - const numtyp sublo2=static_cast(sublo[2]); + const auto sublo0=static_cast(sublo[0]); + const auto sublo1=static_cast(sublo[1]); + const auto sublo2=static_cast(sublo[2]); _shared->k_cell_id.set_size(GX,neigh_block); _shared->k_cell_id.run(&atom.x, &atom.dev_cell_id, &atom.dev_particle_id, &sublo0, &sublo1, diff --git a/src/ADIOS/dump_atom_adios.cpp b/src/ADIOS/dump_atom_adios.cpp index 7588b6775b..e6e486e096 100644 --- a/src/ADIOS/dump_atom_adios.cpp +++ b/src/ADIOS/dump_atom_adios.cpp @@ -134,10 +134,10 @@ void DumpAtomADIOS::write() // Now we know the global size and the local subset size and offset // of the atoms table - size_t nAtomsGlobal = static_cast(ntotal); - size_t startRow = static_cast(atomOffset); - size_t nAtomsLocal = static_cast(nme); - size_t nColumns = static_cast(size_one); + auto nAtomsGlobal = static_cast(ntotal); + auto startRow = static_cast(atomOffset); + auto nAtomsLocal = static_cast(nme); + auto nColumns = static_cast(size_one); internal->varAtoms.SetShape({nAtomsGlobal, nColumns}); internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}}); @@ -296,7 +296,7 @@ void DumpAtomADIOS::init_style() int *boundaryptr = reinterpret_cast(domain->boundary); internal->io.DefineAttribute("boundary", boundaryptr, 6); - size_t nColumns = static_cast(size_one); + auto nColumns = static_cast(size_one); internal->io.DefineAttribute("columns", columnNames.data(), nColumns); internal->io.DefineAttribute("columnstr", columns); internal->io.DefineAttribute("boundarystr", boundstr); diff --git a/src/ADIOS/dump_custom_adios.cpp b/src/ADIOS/dump_custom_adios.cpp index 82cc4a9c0c..40d06c15d8 100644 --- a/src/ADIOS/dump_custom_adios.cpp +++ b/src/ADIOS/dump_custom_adios.cpp @@ -146,10 +146,10 @@ void DumpCustomADIOS::write() // Now we know the global size and the local subset size and offset // of the atoms table - size_t nAtomsGlobal = static_cast(ntotal); - size_t startRow = static_cast(atomOffset); - size_t nAtomsLocal = static_cast(nme); - size_t nColumns = static_cast(size_one); + auto nAtomsGlobal = static_cast(ntotal); + auto startRow = static_cast(atomOffset); + auto nAtomsLocal = static_cast(nme); + auto nColumns = static_cast(size_one); internal->varAtoms.SetShape({nAtomsGlobal, nColumns}); internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}}); @@ -316,7 +316,7 @@ void DumpCustomADIOS::init_style() int *boundaryptr = reinterpret_cast(domain->boundary); internal->io.DefineAttribute("boundary", boundaryptr, 6); - size_t nColumns = static_cast(size_one); + auto nColumns = static_cast(size_one); internal->io.DefineAttribute("columns", internal->columnNames.data(), nColumns); internal->io.DefineAttribute("columnstr", columns); internal->io.DefineAttribute("boundarystr", boundstr); diff --git a/src/ADIOS/reader_adios.cpp b/src/ADIOS/reader_adios.cpp index 6b017599f2..893346ec71 100644 --- a/src/ADIOS/reader_adios.cpp +++ b/src/ADIOS/reader_adios.cpp @@ -450,7 +450,7 @@ void ReaderADIOS::read_atoms(int n, int nfield, double **fields) int ReaderADIOS::find_label(const std::string &label, const std::map &labels) { - std::map::const_iterator it = labels.find(label); + auto it = labels.find(label); if (it != labels.end()) { return it->second; } return -1; } diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp index 61339cd31a..ff4b51e95a 100644 --- a/src/BOCS/fix_bocs.cpp +++ b/src/BOCS/fix_bocs.cpp @@ -1452,7 +1452,7 @@ int FixBocs::pack_restart_data(double *list) void FixBocs::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index d8837fa1ea..b66a324a21 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -153,7 +153,7 @@ int ComputeBodyLocal::compute_body(int flag) // perform computation and fill output vector/array int m,n,ibonus; - double *values = new double[bptr->noutcol()]; + auto values = new double[bptr->noutcol()]; double **x = atom->x; tagint *tag = atom->tag; diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index da4296c1e4..3a485ea361 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -116,7 +116,7 @@ void FixPolarizeBEMICC::init() int *mask = atom->mask; int nlocal = atom->nlocal; - RanPark *random = new RanPark(lmp, seed_charge + comm->me); + auto random = new RanPark(lmp, seed_charge + comm->me); for (i = 0; i < 100; i++) random->uniform(); double sum, tmp = 0; for (i = 0; i < nlocal; i++) { diff --git a/src/DIFFRACTION/compute_saed.cpp b/src/DIFFRACTION/compute_saed.cpp index e2df7fe3b8..e21570d76d 100644 --- a/src/DIFFRACTION/compute_saed.cpp +++ b/src/DIFFRACTION/compute_saed.cpp @@ -348,7 +348,7 @@ void ComputeSAED::compute_vector() utils::logmesg(lmp,"-----\nComputing SAED intensities"); double t0 = platform::walltime(); - double *Fvec = new double[2*nRows]; // Strct factor (real & imaginary) + auto Fvec = new double[2*nRows]; // Strct factor (real & imaginary) // -- Note, vector entries correspond to different RELP ntypes = atom->ntypes; @@ -364,7 +364,7 @@ void ComputeSAED::compute_vector() } } - double *xlocal = new double [3*nlocalgroup]; + auto xlocal = new double [3*nlocalgroup]; int *typelocal = new int [nlocalgroup]; nlocalgroup = 0; @@ -413,7 +413,7 @@ void ComputeSAED::compute_vector() #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(offset,ASFSAED,typelocal,xlocal,Fvec,m,frac) #endif { - double *f = new double[ntypes]; // atomic structure factor by type + auto f = new double[ntypes]; // atomic structure factor by type int typei = 0; double Fatom1 = 0.0; // structure factor per atom double Fatom2 = 0.0; // structure factor per atom (imaginary) @@ -481,7 +481,7 @@ void ComputeSAED::compute_vector() delete [] f; } - double *scratch = new double[2*nRows]; + auto scratch = new double[2*nRows]; // Sum intensity for each ang-hkl combination across processors MPI_Allreduce(Fvec,scratch,2*nRows,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index d798c2f4db..aef4d932a9 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -301,7 +301,7 @@ void ComputeXRD::compute_array() double t0 = platform::walltime(); - double *Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary) + auto Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary) // -- Note: array rows correspond to different RELP ntypes = atom->ntypes; @@ -317,7 +317,7 @@ void ComputeXRD::compute_array() } } - double *xlocal = new double [3*nlocalgroup]; + auto xlocal = new double [3*nlocalgroup]; int *typelocal = new int [nlocalgroup]; nlocalgroup = 0; @@ -350,7 +350,7 @@ void ComputeXRD::compute_array() #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(typelocal,xlocal,Fvec,m,frac,ASFXRD) #endif { - double *f = new double[ntypes]; // atomic structure factor by type + auto f = new double[ntypes]; // atomic structure factor by type int n,typei = 0; double Fatom1 = 0.0; // structure factor per atom (real) @@ -486,7 +486,7 @@ void ComputeXRD::compute_array() delete [] f; } // End of pragma omp parallel region - double *scratch = new double[2*size_array_rows]; + auto scratch = new double[2*size_array_rows]; // Sum intensity for each ang-hkl combination across processors MPI_Allreduce(Fvec,scratch,2*size_array_rows,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/DPD-MESO/pair_tdpd.cpp b/src/DPD-MESO/pair_tdpd.cpp index 35f440426e..76f4b59108 100644 --- a/src/DPD-MESO/pair_tdpd.cpp +++ b/src/DPD-MESO/pair_tdpd.cpp @@ -279,9 +279,9 @@ void PairTDPD::coeff(int narg, char **arg) double power_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = utils::numeric(FLERR,arg[5],false,lmp); double cutcc_one = utils::numeric(FLERR,arg[6],false,lmp); - double *kappa_one = new double[cc_species]; - double *epsilon_one = new double[cc_species]; - double *powercc_one = new double[cc_species]; + auto kappa_one = new double[cc_species]; + auto epsilon_one = new double[cc_species]; + auto powercc_one = new double[cc_species]; for (int k=0; k 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index 26defddc45..a2f8893b82 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -301,7 +301,7 @@ void FixEOStableRX::read_file(char *file) { int min_params_per_line = 2; int max_params_per_line = 5; - char **words = new char*[max_params_per_line+1]; + auto words = new char*[max_params_per_line+1]; // open file on proc 0 @@ -641,7 +641,7 @@ void FixEOStableRX::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index dd8eacccc7..f20dd8963f 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -233,7 +233,7 @@ void FixRX::post_constructor() int nUniqueSpecies = 0; bool match; - char **tmpspecies = new char*[maxspecies]; + auto tmpspecies = new char*[maxspecies]; for (int jj=0; jj < maxspecies; jj++) tmpspecies[jj] = nullptr; @@ -625,7 +625,7 @@ void FixRX::setup_pre_force(int /*vflag*/) userData.kFor = new double[nreactions]; userData.rxnRateLaw = new double[nreactions]; - double *rwork = new double[8*nspecies]; + auto rwork = new double[8*nspecies]; if (localTempFlag) { int count = nlocal + (newton_pair ? nghost : 0); @@ -695,7 +695,7 @@ void FixRX::pre_force(int /*vflag*/) } { - double *rwork = new double[8*nspecies]; + auto rwork = new double[8*nspecies]; UserRHSData userData; userData.kFor = new double[nreactions]; @@ -1575,7 +1575,7 @@ int FixRX::rhs(double t, const double *y, double *dydt, void *params) int FixRX::rhs_dense(double /*t*/, const double *y, double *dydt, void *params) { - UserRHSData *userData = (UserRHSData *) params; + auto userData = (UserRHSData *) params; double *rxnRateLaw = userData->rxnRateLaw; double *kFor = userData->kFor; @@ -1609,7 +1609,7 @@ int FixRX::rhs_dense(double /*t*/, const double *y, double *dydt, void *params) int FixRX::rhs_sparse(double /*t*/, const double *y, double *dydt, void *v_params) const { - UserRHSData *userData = (UserRHSData *) v_params; + auto userData = (UserRHSData *) v_params; const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; diff --git a/src/DPD-REACT/npair_half_bin_newton_ssa.cpp b/src/DPD-REACT/npair_half_bin_newton_ssa.cpp index 1dfeaac6bb..2f36b467e0 100644 --- a/src/DPD-REACT/npair_half_bin_newton_ssa.cpp +++ b/src/DPD-REACT/npair_half_bin_newton_ssa.cpp @@ -97,12 +97,12 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - NStencilSSA *ns_ssa = dynamic_cast(ns); + auto ns_ssa = dynamic_cast(ns); if (!ns_ssa) error->one(FLERR, "NStencil wasn't a NStencilSSA object"); int *nstencil_ssa = &(ns_ssa->nstencil_ssa[0]); int nstencil_full = ns_ssa->nstencil; - NBinSSA *nb_ssa = dynamic_cast(nb); + auto nb_ssa = dynamic_cast(nb); if (!nb_ssa) error->one(FLERR, "NBin wasn't a NBinSSA object"); int *bins = nb_ssa->bins; int *binhead = nb_ssa->binhead; diff --git a/src/DPD-REACT/pair_exp6_rx.cpp b/src/DPD-REACT/pair_exp6_rx.cpp index 313e9f2583..02d4e84e9e 100644 --- a/src/DPD-REACT/pair_exp6_rx.cpp +++ b/src/DPD-REACT/pair_exp6_rx.cpp @@ -705,7 +705,7 @@ double PairExp6rx::init_one(int i, int j) void PairExp6rx::read_file(char *file) { int params_per_line = 5; - char **words = new char*[params_per_line+1]; + auto words = new char*[params_per_line+1]; memory->sfree(params); params = nullptr; @@ -820,7 +820,7 @@ void PairExp6rx::read_file(char *file) void PairExp6rx::read_file2(char *file) { int params_per_line = 7; - char **words = new char*[params_per_line+1]; + auto words = new char*[params_per_line+1]; // open file on proc 0 diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 41c9d9fb66..009ebfc21f 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -623,7 +623,7 @@ void PairMultiLucy::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index 8b348810fd..bd508707dd 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -763,7 +763,7 @@ void PairMultiLucyRX::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-SMOOTH/fix_meso_move.cpp b/src/DPD-SMOOTH/fix_meso_move.cpp index ba32962b3c..078274416d 100644 --- a/src/DPD-SMOOTH/fix_meso_move.cpp +++ b/src/DPD-SMOOTH/fix_meso_move.cpp @@ -818,7 +818,7 @@ void FixMesoMove::write_restart (FILE *fp) { void FixMesoMove::restart (char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; time_origin = static_cast (list[n++]); } diff --git a/src/DRUDE/fix_drude.cpp b/src/DRUDE/fix_drude.cpp index 20d6749c8a..70b36a63ee 100644 --- a/src/DRUDE/fix_drude.cpp +++ b/src/DRUDE/fix_drude.cpp @@ -174,7 +174,7 @@ void FixDrude::build_drudeid() { ------------------------------------------------------------------------- */ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { // Search for the drude partner of my cores - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int *type = atom->type; @@ -182,7 +182,7 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::set drude_set(first, last); std::set::iterator it; @@ -204,11 +204,11 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { ------------------------------------------------------------------------- */ void FixDrude::ring_build_partner(int size, char *cbuf, void *ptr) { // Add partners from incoming list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; std::set *partner_set = fdptr->partner_set; - tagint *it = (tagint *) cbuf; + auto it = (tagint *) cbuf; tagint *last = it + size; while (it < last) { @@ -375,13 +375,13 @@ void FixDrude::rebuild_special() { ------------------------------------------------------------------------- */ void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr) { // Remove all drude particles from special list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; tagint **special = atom->special; int *type = atom->type; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::set drude_set(first, last); int *drudetype = fdptr->drudetype; @@ -412,7 +412,7 @@ void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr) { void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { // Assume special array size is big enough // Add all particle just after their core in the special list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; @@ -421,7 +421,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::map core_drude_map; @@ -468,7 +468,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { ------------------------------------------------------------------------- */ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) { // Copy special list of drude from its core (except itself) - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; @@ -477,7 +477,7 @@ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::map core_special_map; diff --git a/src/DRUDE/fix_drude_transform.cpp b/src/DRUDE/fix_drude_transform.cpp index 8f04578627..076bf1b963 100644 --- a/src/DRUDE/fix_drude_transform.cpp +++ b/src/DRUDE/fix_drude_transform.cpp @@ -79,7 +79,7 @@ void FixDrudeTransform::setup(int) { if (!rmass) { if (!mcoeff) mcoeff = new double[ntypes+1]; - double *mcoeff_loc = new double[ntypes+1]; + auto mcoeff_loc = new double[ntypes+1]; for (int itype=0; itype<=ntypes; itype++) mcoeff_loc[itype] = 2.; // an impossible value: mcoeff is at most 1. for (int i=0; icreate(v_mol_tmp, n_mol + 1, 3, "fix_tgnh_drude::v_mol_tmp"); memory->create(mass_mol, n_mol + 1, "fix_tgnh_drude::mass_mol"); - double *mass_tmp = new double[n_mol + 1]; + auto mass_tmp = new double[n_mol + 1]; memset(mass_tmp, 0, sizeof(double) * (n_mol + 1)); for (int i = 0; i < atom->nlocal; i++) { id_mol = molecule[i]; @@ -1364,7 +1364,7 @@ int FixTGNHDrude::pack_restart_data(double *list) void FixTGNHDrude::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index aad949530e..a16c4f8330 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -200,9 +200,9 @@ void ComputeBasalAtom::compute_peratom() chi[0] = chi[1] = chi[2] = chi[3] = chi[4] = chi[5] = chi[6] = chi[7] = 0; double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik, xmean5, ymean5, zmean5, xmean6, ymean6, zmean6, xmean7, ymean7, zmean7; - double *x3 = new double[n0]; - double *y3 = new double[n0]; - double *z3 = new double[n0]; + auto x3 = new double[n0]; + auto y3 = new double[n0]; + auto z3 = new double[n0]; for (j = 0; j < n0; j++) { x_ij = x[i][0]-x[nearest_n0[j]][0]; y_ij = x[i][1]-x[nearest_n0[j]][1]; diff --git a/src/EXTRA-COMPUTE/compute_entropy_atom.cpp b/src/EXTRA-COMPUTE/compute_entropy_atom.cpp index 20de069d50..b2fcee7ae4 100644 --- a/src/EXTRA-COMPUTE/compute_entropy_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_entropy_atom.cpp @@ -150,8 +150,8 @@ void ComputeEntropyAtom::compute_peratom() int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; - double *rbin = new double[nbin]; - double *rbinsq = new double[nbin]; + auto rbin = new double[nbin]; + auto rbinsq = new double[nbin]; invoked_peratom = update->ntimestep; @@ -199,8 +199,8 @@ void ComputeEntropyAtom::compute_peratom() double **x = atom->x; int *mask = atom->mask; - double *gofr = new double[nbin]; - double *integrand = new double[nbin]; + auto gofr = new double[nbin]; + auto integrand = new double[nbin]; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; diff --git a/src/EXTRA-COMPUTE/compute_hma.cpp b/src/EXTRA-COMPUTE/compute_hma.cpp index 23dbb07aa8..2f11e91ec4 100644 --- a/src/EXTRA-COMPUTE/compute_hma.cpp +++ b/src/EXTRA-COMPUTE/compute_hma.cpp @@ -190,7 +190,7 @@ void ComputeHMA::setup() int dummy=0; int ifix = modify->find_fix(id_temp); if (ifix < 0) error->all(FLERR,"Could not find compute hma temperature ID"); - double * temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); + auto temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); if (temperat==nullptr) error->all(FLERR,"Could not find compute hma temperature ID"); finaltemp = * temperat; @@ -198,7 +198,7 @@ void ComputeHMA::setup() int ifix2 = modify->find_fix(id_fix); if (ifix2 < 0) error->all(FLERR,"Could not find hma store fix ID"); - fix = (FixStore *) modify->fix[ifix2]; + fix = dynamic_cast( modify->fix[ifix2]); } /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index 856cda90c2..3987449279 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -739,7 +739,7 @@ void FixAveCorrelateLong::write_restart(FILE *fp) { void FixAveCorrelateLong::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int npairin = static_cast (list[n++]); int numcorrelatorsin = static_cast (list[n++]); int pin = static_cast (list[n++]); diff --git a/src/EXTRA-FIX/fix_filter_corotate.cpp b/src/EXTRA-FIX/fix_filter_corotate.cpp index 1ffa03cca5..08485ddad3 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.cpp +++ b/src/EXTRA-FIX/fix_filter_corotate.cpp @@ -1275,7 +1275,7 @@ void FixFilterCorotate::find_clusters() void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; double *rmass = atom->rmass; double *mass = atom->mass; @@ -1284,7 +1284,7 @@ void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) int nlocal = atom->nlocal; int nmass = ffptr->nmass; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m,n; double massone; @@ -1313,13 +1313,13 @@ void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) void FixFilterCorotate::ring_nshake(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; int nlocal = atom->nlocal; int *nshake = ffptr->nshake; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m; for (int i = 0; i < ndatum; i += 3) { @@ -1335,7 +1335,7 @@ void FixFilterCorotate::ring_nshake(int ndatum, char *cbuf, void *ptr) void FixFilterCorotate::ring_shake(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; int nlocal = atom->nlocal; @@ -1343,7 +1343,7 @@ void FixFilterCorotate::ring_shake(int ndatum, char *cbuf, void *ptr) tagint **shake_atom = ffptr->shake_atom; int **shake_type = ffptr->shake_type; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m; for (int i = 0; i < ndatum; i += 11) { @@ -1399,9 +1399,9 @@ void FixFilterCorotate::general_cluster(int index, int index_in_list) int* list_cluster = new int[N]; // contains local IDs of cluster atoms, // 0 = center - double* m = new double[N]; //contains local mass - double *r = new double[N]; //contains r[i] = 1/||del[i]|| - double** del = new double*[N]; //contains del[i] = x_i-x_0 + auto m = new double[N]; //contains local mass + auto r = new double[N]; //contains r[i] = 1/||del[i]|| + auto del = new double*[N]; //contains del[i] = x_i-x_0 for (int i = 0; idt*0.5*gle_every; @@ -406,10 +406,10 @@ void FixGLE::init_gles() int *mask = atom->mask; int nlocal = atom->nlocal; - double *rootC = new double[ns1sq]; - double *rootCT = new double[ns1sq]; - double *newg = new double[3*(ns+1)*nlocal]; - double *news = new double[3*(ns+1)*nlocal]; + auto rootC = new double[ns1sq]; + auto rootCT = new double[ns1sq]; + auto newg = new double[3*(ns+1)*nlocal]; + auto news = new double[3*(ns+1)*nlocal]; GLE::StabCholesky(ns+1, C, rootC); GLE::MyTrans(ns+1,rootC,rootCT); diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp index d9a0f850db..12a197fdd1 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.cpp +++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp @@ -1374,7 +1374,7 @@ int FixNPTCauchy::pack_restart_data(double *list) void FixNPTCauchy::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/EXTRA-FIX/fix_smd.cpp b/src/EXTRA-FIX/fix_smd.cpp index 047f40c2a3..d581744f31 100644 --- a/src/EXTRA-FIX/fix_smd.cpp +++ b/src/EXTRA-FIX/fix_smd.cpp @@ -451,7 +451,7 @@ void FixSMD::write_restart(FILE *fp) void FixSMD::restart(char *buf) { - double *list = (double *)buf; + auto list = (double *)buf; r_old = list[0]; xn=list[1]; yn=list[2]; diff --git a/src/EXTRA-FIX/fix_spring_rg.cpp b/src/EXTRA-FIX/fix_spring_rg.cpp index a6bdbd3631..d10c60c07f 100644 --- a/src/EXTRA-FIX/fix_spring_rg.cpp +++ b/src/EXTRA-FIX/fix_spring_rg.cpp @@ -175,7 +175,7 @@ void FixSpringRG::write_restart(FILE *fp) void FixSpringRG::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; rg0 = list[n++]; rg0_flag = 0; diff --git a/src/EXTRA-FIX/fix_temp_csld.cpp b/src/EXTRA-FIX/fix_temp_csld.cpp index f4da7a3c5b..e83eca424e 100644 --- a/src/EXTRA-FIX/fix_temp_csld.cpp +++ b/src/EXTRA-FIX/fix_temp_csld.cpp @@ -323,7 +323,7 @@ void FixTempCSLD::write_restart(FILE *fp) void FixTempCSLD::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; int nprocs = (int) list[1]; diff --git a/src/EXTRA-FIX/fix_temp_csvr.cpp b/src/EXTRA-FIX/fix_temp_csvr.cpp index ca9e4b8684..0c4742018a 100644 --- a/src/EXTRA-FIX/fix_temp_csvr.cpp +++ b/src/EXTRA-FIX/fix_temp_csvr.cpp @@ -357,7 +357,7 @@ void FixTempCSVR::write_restart(FILE *fp) void FixTempCSVR::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; int nprocs = (int) list[1]; diff --git a/src/EXTRA-FIX/fix_tmd.cpp b/src/EXTRA-FIX/fix_tmd.cpp index 8ee6e3e141..df26f01e34 100644 --- a/src/EXTRA-FIX/fix_tmd.cpp +++ b/src/EXTRA-FIX/fix_tmd.cpp @@ -389,7 +389,7 @@ void FixTMD::readfile(char *file) int *mask = atom->mask; int nlocal = atom->nlocal; - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; char *next,*bufptr; int i,m,nlines,imageflag,ix,iy,iz; tagint itag; diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index 752610fd08..f06a0f64c6 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -597,7 +597,7 @@ void FixTTM::write_restart(FILE *fp) void FixTTM::restart(char *buf) { int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index 8890750818..4188025525 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -280,7 +280,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) // read electron temperature values from file, one chunk at a time - char *buffer = new char[CHUNK * MAXLINE]; + auto buffer = new char[CHUNK * MAXLINE]; bigint ntotal = (bigint) nxgrid * nygrid * nzgrid; bigint nread = 0; @@ -372,7 +372,7 @@ void FixTTMGrid::write_electron_temperatures(const std::string &filename) void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *src = &T_electron[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) buf[i] = src[list[i]]; @@ -384,7 +384,7 @@ void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *lis void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *dest = &T_electron[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] = buf[i]; @@ -396,7 +396,7 @@ void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *l void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *src = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) buf[i] = src[list[i]]; @@ -408,7 +408,7 @@ void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *lis void FixTTMGrid::unpack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *dest = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] += buf[i]; @@ -535,7 +535,7 @@ void FixTTMGrid::restart(char *buf) int ix, iy, iz; int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size @@ -578,7 +578,7 @@ void FixTTMGrid::pack_gather_grid(int /*which*/, void *vbuf) { int ix, iy, iz; - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int m = 0; for (iz = nzlo_in; iz <= nzhi_in; iz++) @@ -596,8 +596,8 @@ void FixTTMGrid::unpack_gather_grid(int which, void *vbuf, void *vgbuf, int xlo, { int ix, iy, iz; - double *buf = (double *) vbuf; - double *gbuf = (double *) vgbuf; + auto buf = (double *) vbuf; + auto gbuf = (double *) vgbuf; if (which == 0) { int iglobal; diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index a2c03db762..549e83f87c 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -789,9 +789,9 @@ void FixTTMMod::end_of_step() if (left_x == -1) left_x = nxgrid - 1; if (left_y == -1) left_y = nygrid - 1; if (left_z == -1) left_z = nzgrid - 1; - double skin_layer_d = double(skin_layer); - double ix_d = double(ix); - double surface_d = double(t_surface_l); + auto skin_layer_d = double(skin_layer); + auto ix_d = double(ix); + auto surface_d = double(t_surface_l); mult_factor = 0.0; if (duration < width) { if (ix >= t_surface_l) mult_factor = (intensity/(dx*skin_layer_d))*exp((-1.0)*(ix_d - surface_d)/skin_layer_d); @@ -937,7 +937,7 @@ void FixTTMMod::write_restart(FILE *fp) void FixTTMMod::restart(char *buf) { int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index 522eff8626..5ac3ab6ebb 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -523,9 +523,9 @@ void DihedralTableCut::coeff(int narg, char **arg) // We also want the angles to be sorted in increasing order. // This messy code fixes these problems with the user's data: { - double *phifile_tmp = new double[tb->ninput]; //temporary arrays - double *ffile_tmp = new double[tb->ninput]; //used for sorting - double *efile_tmp = new double[tb->ninput]; + auto phifile_tmp = new double[tb->ninput]; //temporary arrays + auto ffile_tmp = new double[tb->ninput]; //used for sorting + auto efile_tmp = new double[tb->ninput]; // After re-imaging, does the range of angles cross the 0 or 2*PI boundary? // If so, find the discontinuity: diff --git a/src/GPU/fix_nh_gpu.cpp b/src/GPU/fix_nh_gpu.cpp index b6305d3f61..9a24c79766 100644 --- a/src/GPU/fix_nh_gpu.cpp +++ b/src/GPU/fix_nh_gpu.cpp @@ -83,7 +83,7 @@ void FixNHGPU::remap() double oldlo,oldhi; double expfac; - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; int *mask = atom->mask; int nlocal = atom->nlocal; double *h = domain->h; @@ -420,7 +420,7 @@ void FixNHGPU::nh_v_press() return; } - dbl3_t * _noalias const v = (dbl3_t *)atom->v[0]; + auto * _noalias const v = (dbl3_t *)atom->v[0]; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index d3a22bf1cc..20e4212017 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -239,13 +239,13 @@ int PairEAMAlloyGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -264,10 +264,10 @@ void PairEAMAlloyGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 09d2b03be4..493163d537 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -239,13 +239,13 @@ int PairEAMFSGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc_fl m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -264,10 +264,10 @@ void PairEAMFSGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 1fbba6dd6b..dec56c8687 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -236,13 +236,13 @@ int PairEAMGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc_flag m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -261,10 +261,10 @@ void PairEAMGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index c388db4a2c..d0fd3e66ea 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -514,7 +514,7 @@ void PPPMGPU::poisson_ik() void PPPMGPU::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -574,7 +574,7 @@ void PPPMGPU::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -634,7 +634,7 @@ void PPPMGPU::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO_GPU) { FFT_SCALAR *src = &density_brick_gpu[nzlo_out][nylo_out][nxlo_out]; @@ -653,7 +653,7 @@ void PPPMGPU::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO_GPU) { FFT_SCALAR *dest = &density_brick_gpu[nzlo_out][nylo_out][nxlo_out]; @@ -679,9 +679,9 @@ FFT_SCALAR ***PPPMGPU::create_3d_offset(int n1lo, int n1hi, int n2lo, int n2hi, int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; - FFT_SCALAR **plane = (FFT_SCALAR **) + auto plane = (FFT_SCALAR **) memory->smalloc(n1*n2*sizeof(FFT_SCALAR *),name); - FFT_SCALAR ***array = (FFT_SCALAR ***) + auto array = (FFT_SCALAR ***) memory->smalloc(n1*sizeof(FFT_SCALAR **),name); int n = 0; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 256f6d6611..7c65248feb 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -577,7 +577,7 @@ void FixWallGran::post_force(int /*vflag*/) if (neighbor->ago == 0 && fix_rigid) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 45905aea1c..f04b03b340 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -134,7 +134,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (neighbor->ago == 0 && fix_rigid) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 2320b7a8fb..3901fa6a31 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -68,7 +68,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 5d3724f668..efac93c0fc 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -59,7 +59,7 @@ void PairGranHooke::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 49eb1be89b..918f595f87 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -126,7 +126,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body", tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal", tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal", tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index e1719853a4..93f73cc395 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -199,7 +199,7 @@ void PairGranular::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/INTEL/dihedral_charmm_intel.cpp b/src/INTEL/dihedral_charmm_intel.cpp index fc416537fe..b36e5ab505 100644 --- a/src/INTEL/dihedral_charmm_intel.cpp +++ b/src/INTEL/dihedral_charmm_intel.cpp @@ -266,7 +266,7 @@ void DihedralCharmmIntel::eval(const int vflag, const flt_t tk = fc.fc[type].k; const int m = fc.fc[type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; @@ -384,7 +384,7 @@ void DihedralCharmmIntel::eval(const int vflag, } if (EFLAG || VFLAG) { - flt_t ev_pre = (flt_t)0; + auto ev_pre = (flt_t)0; if (NEWTON_BOND || i1 < nlocal) ev_pre += (flt_t)0.5; if (NEWTON_BOND || i4 < nlocal) diff --git a/src/INTEL/dihedral_fourier_intel.cpp b/src/INTEL/dihedral_fourier_intel.cpp index ec15afe8e1..68e9fedd44 100644 --- a/src/INTEL/dihedral_fourier_intel.cpp +++ b/src/INTEL/dihedral_fourier_intel.cpp @@ -221,7 +221,7 @@ void DihedralFourierIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; flt_t deng; - flt_t df = (flt_t)0.0; + auto df = (flt_t)0.0; if (EFLAG) deng = (flt_t)0.0; for (int j = 0; j < nterms[type]; j++) { @@ -230,7 +230,7 @@ void DihedralFourierIntel::eval(const int vflag, const flt_t tk = fc.fc[j][type].k; const int m = fc.fc[j][type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; diff --git a/src/INTEL/dihedral_harmonic_intel.cpp b/src/INTEL/dihedral_harmonic_intel.cpp index cb23d9dcaa..9b504be3ca 100644 --- a/src/INTEL/dihedral_harmonic_intel.cpp +++ b/src/INTEL/dihedral_harmonic_intel.cpp @@ -225,7 +225,7 @@ void DihedralHarmonicIntel::eval(const int vflag, const flt_t tk = fc.fc[type].k; const int m = fc.fc[type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; diff --git a/src/INTEL/fix_nh_intel.cpp b/src/INTEL/fix_nh_intel.cpp index 902302c58b..ada9b4113c 100644 --- a/src/INTEL/fix_nh_intel.cpp +++ b/src/INTEL/fix_nh_intel.cpp @@ -76,7 +76,7 @@ void FixNHIntel::remap() double oldlo,oldhi; double expfac; - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; int *mask = atom->mask; int nlocal = atom->nlocal; double *h = domain->h; @@ -416,7 +416,7 @@ void FixNHIntel::nh_v_press() return; } - dbl3_t * _noalias const v = (dbl3_t *)atom->v[0]; + auto * _noalias const v = (dbl3_t *)atom->v[0]; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index c13a9308fc..535fa5605e 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -303,7 +303,7 @@ void IntelBuffers::grow_data3(NeighList *list, int *&numneighhalf, if (list_num == _n_list_ptrs) { if (_n_list_ptrs == _max_list_ptrs) { _max_list_ptrs *= 2; - IntelNeighListPtrs *new_list = new IntelNeighListPtrs[_max_list_ptrs]; + auto new_list = new IntelNeighListPtrs[_max_list_ptrs]; for (int i = 0; i < _n_list_ptrs; i++) new_list[i] = _neigh_list_ptrs[i]; delete []_neigh_list_ptrs; _neigh_list_ptrs = new_list; diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index 1f4e41be49..b0c052d35b 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -118,7 +118,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const ATOM_T * _noalias const x = buffers->get_x(); int * _noalias const intel_list = buffers->intel_list(list); - int ** _noalias const firstneigh = list->firstneigh; + int ** _noalias const firstneigh = list->firstneigh; // NOLINT const int e_nall = nall_t; const int molecular = atom->molecular; diff --git a/src/INTEL/npair_halffull_newton_intel.cpp b/src/INTEL/npair_halffull_newton_intel.cpp index fe2ddb375a..6755ffc799 100644 --- a/src/INTEL/npair_halffull_newton_intel.cpp +++ b/src/INTEL/npair_halffull_newton_intel.cpp @@ -54,8 +54,7 @@ void NPairHalffullNewtonIntel::build_t(NeighList *list, int ** _noalias const firstneigh = list->firstneigh; const int * _noalias const ilist_full = list->listfull->ilist; const int * _noalias const numneigh_full = list->listfull->numneigh; - const int ** _noalias const firstneigh_full = - (const int ** const)list->listfull->firstneigh; + const int ** _noalias const firstneigh_full = (const int ** const)list->listfull->firstneigh; // NOLINT #if defined(_OPENMP) #pragma omp parallel @@ -141,8 +140,7 @@ void NPairHalffullNewtonIntel::build_t3(NeighList *list, int *numhalf) int ** _noalias const firstneigh = list->firstneigh; const int * _noalias const ilist_full = list->listfull->ilist; const int * _noalias const numneigh_full = numhalf; - const int ** _noalias const firstneigh_full = - (const int ** const)list->listfull->firstneigh; + const int ** _noalias const firstneigh_full = (const int ** const)list->listfull->firstneigh; // NOLINT int packthreads = 1; if (comm->nthreads > INTEL_HTHREADS) packthreads = comm->nthreads; diff --git a/src/INTEL/npair_skip_intel.cpp b/src/INTEL/npair_skip_intel.cpp index a890a60154..80751b0667 100644 --- a/src/INTEL/npair_skip_intel.cpp +++ b/src/INTEL/npair_skip_intel.cpp @@ -76,13 +76,12 @@ void NPairSkipIntel::build_t(NeighList *list, int *numhalf, int *cnumneigh, const int * _noalias const type = atom->type; int * _noalias const ilist = list->ilist; int * _noalias const numneigh = list->numneigh; - int ** _noalias const firstneigh = (int ** const)list->firstneigh; + int ** _noalias const firstneigh = (int ** const)list->firstneigh; // NOLINT const int * _noalias const ilist_skip = list->listskip->ilist; const int * _noalias const numneigh_skip = list->listskip->numneigh; - const int ** _noalias const firstneigh_skip = - (const int ** const)list->listskip->firstneigh; + const int ** _noalias const firstneigh_skip = (const int ** const)list->listskip->firstneigh; // NOLINT const int * _noalias const iskip = list->iskip; - const int ** _noalias const ijskip = (const int ** const)list->ijskip; + const int ** _noalias const ijskip = (const int ** const)list->ijskip; // NOLINT int num_skip = list->listskip->inum; if (list->ghost) num_skip += list->listskip->gnum; diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index bde0541bbc..939a1873a9 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -409,7 +409,7 @@ void PairAIREBOIntel::eval( ATOM_T * _noalias const x = buffers->get_x(offload); const int * _noalias const numneighhalf = buffers->get_atombin(); const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT tagint * const tag = atom->tag; const int ntypes = atom->ntypes + 1; @@ -919,7 +919,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, if (pass == 0) { sum_pij += wik * g * ex_lam; sum_dpij_dN += wik * dgdN * ex_lam; - flt_t cutN = Sp(Nki, Nmin, Nmax, nullptr); + auto cutN = Sp(Nki, Nmin, Nmax, nullptr); *sum_N += (1 - ktype) * wik * cutN; } else { flt_t tmp = -0.5 * pij * pij * pij; @@ -1501,17 +1501,17 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, flt_t Nji = ka->nH[j] + ka->nC[j] - wij; flt_t NconjtmpI; acc_t fijc[3] = {0}, fjic[3] = {0}; - flt_t pij = frebo_pij(ka, i, j, delx * scale, dely * scale, + auto pij = frebo_pij(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, wij, 0.0, &NconjtmpI, fijc); flt_t NconjtmpJ; - flt_t pji = frebo_pij(ka, j, i, -delx * scale, -dely * scale, + auto pji = frebo_pij(ka, j, i, -delx * scale, -dely * scale, -delz * scale, the_r, wij, 0.0, &NconjtmpJ, fjic); flt_t Nijconj = 1.0 + (NconjtmpI * NconjtmpI) + (NconjtmpJ * NconjtmpJ); flt_t dN3_pi_rc[3]; - flt_t pi_rc = frebo_pi_rc(ka, itype, jtype, Nij, Nji, Nijconj, + auto pi_rc = frebo_pi_rc(ka, itype, jtype, Nij, Nji, Nijconj, dN3_pi_rc); flt_t dN3_Tij[3]; - flt_t Tij = frebo_Tij(ka, itype, jtype, Nij, Nji, Nijconj, + auto Tij = frebo_Tij(ka, itype, jtype, Nij, Nji, Nijconj, dN3_Tij); flt_t sum_omega = 0; if (fabs(Tij) > TOL) { @@ -1522,12 +1522,12 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, flt_t pi_dh = Tij * sum_omega; flt_t bij = 0.5 * (pij + pji) + pi_rc + pi_dh; flt_t dStb; - flt_t Stb = Sp2(bij, ka->params.bLJmin[itype][jtype], + auto Stb = Sp2(bij, ka->params.bLJmin[itype][jtype], ka->params.bLJmax[itype][jtype], &dStb); if (dStb != 0) { - flt_t pij_reverse = frebo_pij(ka, i, j, delx * scale, + auto pij_reverse = frebo_pij(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, wij, VA * dStb, &NconjtmpI, fijc); - flt_t pji_reverse = frebo_pij(ka, j, i, -delx * scale, + auto pji_reverse = frebo_pij(ka, j, i, -delx * scale, -dely * scale, -delz * scale, the_r, wij, VA * dStb, &NconjtmpJ, fjic); fijc[0] -= fjic[0]; fijc[1] -= fjic[1]; @@ -1537,7 +1537,7 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, frebo_N_spline_force(ka, j, i, VA * dStb, dN3_pi_rc[1], dN3_pi_rc[2], NconjtmpJ); if (fabs(Tij) > TOL) { - flt_t sum_omega_reverse = frebo_sum_omega(ka, i, j, + auto sum_omega_reverse = frebo_sum_omega(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, VA * dStb * Tij, fijc); frebo_N_spline_force(ka, i, j, VA * dStb * sum_omega, dN3_Tij[0], dN3_Tij[2], NconjtmpI); diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 3245ac474c..d113b913d1 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -145,7 +145,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index a230223a5c..23ff301a81 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -146,7 +146,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index f3634c398a..4472e91793 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -141,7 +141,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const C_FORCE_T * _noalias const c_force = fc.c_force[0]; diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index b1ecd6002d..06801b0ce0 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -179,12 +179,12 @@ void PairDPDIntel::eval(const int offload, const int vflag, ATOM_T * _noalias const x = buffers->get_x(offload); typedef struct { double x, y, z; } lmp_vt; - lmp_vt *v = (lmp_vt *)atom->v[0]; + auto *v = (lmp_vt *)atom->v[0]; const flt_t dtinvsqrt = 1.0/sqrt(update->dt); const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const FC_PACKED1_T * _noalias const param = fc.param[0]; const flt_t * _noalias const special_lj = fc.special_lj; int * _noalias const rngi_thread = fc.rngi; diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index 7ff7ed16ce..2a491e66c9 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -197,7 +197,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const FC_PACKED1_T * _noalias const rhor_spline_f = fc.rhor_spline_f; const FC_PACKED1_T * _noalias const rhor_spline_e = fc.rhor_spline_e; const FC_PACKED2_T * _noalias const z2r_spline_t = fc.z2r_spline_t; @@ -306,7 +306,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const flt_t ytmp = x[i].y; const flt_t ztmp = x[i].z; - acc_t rhoi = (acc_t)0.0; + auto rhoi = (acc_t)0.0; int ej = 0; #if defined(LMP_SIMD_COMPILER) #pragma vector aligned diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index cad1f7e372..c3ce8a8d43 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -235,7 +235,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const FC_PACKED1_T * _noalias const ijc = fc.ijc[0]; diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index 3dfe62ff77..721108f8f1 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -145,7 +145,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 462af11485..e78797deb0 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -149,7 +149,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index a70fedfeca..2ab2e35a56 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -148,7 +148,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; diff --git a/src/INTEL/pair_lj_cut_intel.cpp b/src/INTEL/pair_lj_cut_intel.cpp index 89f649b0c7..1f3169ab26 100644 --- a/src/INTEL/pair_lj_cut_intel.cpp +++ b/src/INTEL/pair_lj_cut_intel.cpp @@ -157,7 +157,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const FC_PACKED1_T * _noalias const ljc12o = fc.ljc12o[0]; const FC_PACKED2_T * _noalias const lj34 = fc.lj34[0]; diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index b42a4b7598..c3fce2a753 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -1119,9 +1119,9 @@ FFT_SCALAR *** PPPMIntel::create3d_offset(FFT_SCALAR ***&array, int n1lo, bigint nbytes = ((bigint) sizeof(FFT_SCALAR)) * n1*n2*n3 + INTEL_P3M_ALIGNED_MAXORDER*2; - FFT_SCALAR *data = (FFT_SCALAR *) memory->smalloc(nbytes,name); + auto data = (FFT_SCALAR *) memory->smalloc(nbytes,name); nbytes = ((bigint) sizeof(FFT_SCALAR *)) * n1*n2; - FFT_SCALAR **plane = (FFT_SCALAR **) memory->smalloc(nbytes,name); + auto plane = (FFT_SCALAR **) memory->smalloc(nbytes,name); nbytes = ((bigint) sizeof(FFT_SCALAR **)) * n1; array = (FFT_SCALAR ***) memory->smalloc(nbytes,name); diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index a1db19ca30..b5476fd523 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -388,7 +388,7 @@ void VerletLRTIntel::run(int n) ------------------------------------------------------------------------- */ void * VerletLRTIntel::k_launch_loop(void *context) { - VerletLRTIntel * const c = (VerletLRTIntel *)context; + auto const c = (VerletLRTIntel *)context; if (c->kspace_compute_flag) c->_intel_kspace->compute_first(c->eflag, c->vflag); diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 3d2306c654..e57f759e87 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -83,25 +83,25 @@ FixStoreKIM::~FixStoreKIM() // free associated storage if (simulator_model) { - KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; + auto sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); simulator_model = nullptr; } if (model_name) { - char *mn = (char *)model_name; + auto mn = (char *)model_name; delete[] mn; model_name = nullptr; } if (model_units) { - char *mu = (char *)model_units; + auto mu = (char *)model_units; delete[] mu; model_units = nullptr; } if (user_units) { - char *uu = (char *)user_units; + auto uu = (char *)user_units; delete[] uu; user_units = nullptr; } @@ -121,25 +121,25 @@ void FixStoreKIM::setptr(const std::string &name, void *ptr) { if (name == "simulator_model") { if (simulator_model) { - KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; + auto sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); } simulator_model = ptr; } else if (name == "model_name") { if (model_name) { - char *mn = (char *)model_name; + auto mn = (char *)model_name; delete[] mn; } model_name = ptr; } else if (name == "model_units") { if (model_units) { - char *mu = (char *)model_units; + auto mu = (char *)model_units; delete[] mu; } model_units = ptr; } else if (name == "user_units") { if (user_units) { - char *uu = (char *)user_units; + auto uu = (char *)user_units; delete[] uu; } user_units = ptr; diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index f0d320c21a..06b651e377 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -112,24 +112,24 @@ void KimCommand::command(int narg, char **arg) if (lmp->citeme) lmp->citeme->add(cite_openkim); if (subcmd == "init") { - KimInit *cmd = new KimInit(lmp); + auto cmd = new KimInit(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "interactions") { - KimInteractions *cmd = new KimInteractions(lmp); + auto cmd = new KimInteractions(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "param") { - KimParam *cmd = new KimParam(lmp); + auto cmd = new KimParam(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "property") { - KimProperty *cmd = new KimProperty(lmp); + auto cmd = new KimProperty(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "query") { if (lmp->citeme) lmp->citeme->add(cite_openkim_query); - KimQuery *cmd = new KimQuery(lmp); + auto cmd = new KimQuery(lmp); cmd->command(narg, arg); delete cmd; } else error->all(FLERR,"Unknown kim subcommand {}", subcmd); diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index d538ff3c8e..2d82b18352 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -163,7 +163,7 @@ void KimParam::command(int narg, char **arg) int const ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { - FixStoreKIM *fix_store = reinterpret_cast(modify->fix[ifix]); + auto fix_store = reinterpret_cast(modify->fix[ifix]); KIM_SimulatorModel *simulatorModel = reinterpret_cast( @@ -185,7 +185,7 @@ void KimParam::command(int narg, char **arg) if (isPairStyleAssigned) { Pair *pair = force->pair_match("kim", 1, 0); if (pair) { - PairKIM *pairKIM = reinterpret_cast(pair); + auto pairKIM = reinterpret_cast(pair); pkim = pairKIM->get_kim_model(); if (!pkim) diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 3e891468a6..3a65936cdf 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -277,7 +277,7 @@ namespace { // copy data to the user provided data structure, optionally in increments size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) { - WriteBuf *buf = (WriteBuf *) userp; + auto buf = (WriteBuf *) userp; // copy chunks into the buffer for as long as there is space left if (buf->sizeleft) { diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index d3e1c2ee9a..0109ce4e52 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -774,8 +774,7 @@ int PairKIM::get_neigh(void const * const dataObject, int * const numberOfNeighbors, int const ** const neighborsOfParticle) { - PairKIM const * const Model - = reinterpret_cast(dataObject); + auto const Model = reinterpret_cast(dataObject); if (numberOfNeighborLists != Model->kim_number_of_neighbor_lists) return true; diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index fbdd24af1d..2f787c54fe 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -121,7 +121,7 @@ void Ewald::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 5c7835bd51..2aeacd3609 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -112,7 +112,7 @@ void EwaldDipole::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 1f08205f21..8bad7b87a0 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -96,7 +96,7 @@ void EwaldDipoleSpin::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 670da1610d..cff419de76 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -543,7 +543,7 @@ void EwaldDisp::init_coeffs() int n = atom->ntypes; if (function[1]) { // geometric 1/r^6 - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); delete [] B; B = new double[n+1]; B[0] = 0.0; @@ -551,8 +551,8 @@ void EwaldDisp::init_coeffs() for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i])); } if (function[2]) { // arithmetic 1/r^6 - double **epsilon = (double **) force->pair->extract("epsilon",tmp); - double **sigma = (double **) force->pair->extract("sigma",tmp); + auto epsilon = (double **) force->pair->extract("epsilon",tmp); + auto sigma = (double **) force->pair->extract("sigma",tmp); delete [] B; double eps_i, sigma_i, sigma_n, *bi = B = new double[7*n+7]; double c[7] = { @@ -772,7 +772,7 @@ void EwaldDisp::compute_ek() int lbytes = (2*nbox+1)*sizeof(cvector); hvector *h = nullptr; kvector *k, *nk = kvec+nkvec; - cvector *z = new cvector[2*nbox+1]; + auto z = new cvector[2*nbox+1]; cvector z1, *zx, *zy, *zz, *zn = z+2*nbox; complex *cek, zxyz, zxy = COMPLEX_NULL, cx = COMPLEX_NULL; double mui[3]; diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 6b3b969a7f..e2e0e4d622 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -104,7 +104,7 @@ void FixTuneKspace::init() acc_str = std::to_string(old_acc); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); pair_cut_coul = *p_cutoff; } @@ -120,7 +120,7 @@ void FixTuneKspace::pre_exchange() if (next_reneighbor != update->ntimestep) return; next_reneighbor = update->ntimestep + nevery; - Info *info = new Info(lmp); + auto info = new Info(lmp); bool has_msm = info->has_style("pair", base_pair_style + "/msm"); delete info; @@ -230,7 +230,7 @@ void FixTuneKspace::update_pair_style(const std::string &new_pair_style, double pair_cut_coul) { int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); *p_cutoff = pair_cut_coul; // check to see if we need to change pair styles @@ -250,7 +250,7 @@ void FixTuneKspace::update_pair_style(const std::string &new_pair_style, // restore current pair settings from temporary file force->pair->read_restart(p_pair_settings_file); - double *pcutoff = (double *) force->pair->extract("cut_coul",itmp); + auto pcutoff = (double *) force->pair->extract("cut_coul",itmp); double current_cutoff = *pcutoff; if (comm->me == 0) utils::logmesg(lmp,"Coulomb cutoff for real space: {}\n",current_cutoff); @@ -268,7 +268,7 @@ void FixTuneKspace::update_kspace_style(const std::string &new_kspace_style, { // delete old kspace style and create new one - char *tmp_acc_str = (char *)new_acc_str.c_str(); + auto tmp_acc_str = (char *)new_acc_str.c_str(); force->create_kspace(new_kspace_style.c_str(),1); force->kspace->settings(1,&tmp_acc_str); force->kspace->differentiation_flag = old_differentiation_flag; @@ -305,7 +305,7 @@ void FixTuneKspace::adjust_rcut(double time) // get the current cutoff int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); double current_cutoff = *p_cutoff; if (comm->me == 0) utils::logmesg(lmp,"Old Coulomb cutoff for real space: {}\n",current_cutoff); @@ -376,7 +376,7 @@ void FixTuneKspace::adjust_rcut(double time) *p_cutoff = pair_cut_coul; // report the new cutoff - double *new_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto new_cutoff = (double *) force->pair->extract("cut_coul",itmp); current_cutoff = *new_cutoff; if (comm->me == 0) utils::logmesg(lmp,"Adjusted Coulomb cutoff for real space: {}\n", current_cutoff); diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index a6bfba3e6f..b518d8efe1 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -150,7 +150,7 @@ void MSM::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -1064,7 +1064,7 @@ void MSM::set_grid_global() cutoff = pow(k*k*sum/3.0,1.0/(2.0*p)); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); *p_cutoff = cutoff; if (me == 0) @@ -2506,7 +2506,7 @@ void MSM::grid_swap_reverse(int n, double*** &gridn) void MSM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2552,7 +2552,7 @@ void MSM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void MSM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2598,7 +2598,7 @@ void MSM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void MSM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2644,7 +2644,7 @@ void MSM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void MSM::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index d468af64d6..e94193759f 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -227,7 +227,7 @@ void PPPM::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -240,7 +240,7 @@ void PPPM::init() if (tip4pflag) { if (me == 0) utils::logmesg(lmp," extracting TIP4P info from pair style\n"); - double *p_qdist = (double *) force->pair->extract("qdist",itmp); + auto p_qdist = (double *) force->pair->extract("qdist",itmp); int *p_typeO = (int *) force->pair->extract("typeO",itmp); int *p_typeH = (int *) force->pair->extract("typeH",itmp); int *p_typeA = (int *) force->pair->extract("typeA",itmp); @@ -2608,7 +2608,7 @@ void PPPM::fieldforce_peratom() void PPPM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2668,7 +2668,7 @@ void PPPM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2728,7 +2728,7 @@ void PPPM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO) { FFT_SCALAR *src = &density_brick[nzlo_out][nylo_out][nxlo_out]; @@ -2743,7 +2743,7 @@ void PPPM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO) { FFT_SCALAR *dest = &density_brick[nzlo_out][nylo_out][nxlo_out]; diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 4f8221c6bf..aef14b0189 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -153,7 +153,7 @@ void PPPMDipole::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -2188,7 +2188,7 @@ void PPPMDipole::fieldforce_peratom_dipole() void PPPMDipole::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2261,7 +2261,7 @@ void PPPMDipole::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2334,7 +2334,7 @@ void PPPMDipole::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; if (flag == REVERSE_MU) { @@ -2355,7 +2355,7 @@ void PPPMDipole::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; if (flag == REVERSE_MU) { diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 177d49f06a..148da52770 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -138,7 +138,7 @@ void PPPMDipoleSpin::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); // check the correct extract here if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 2831af553a..3f3e4ded19 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -366,7 +366,7 @@ void PPPMDisp::init() if (tip4pflag) { int itmp; - double *p_qdist = (double *) force->pair->extract("qdist",itmp); + auto p_qdist = (double *) force->pair->extract("qdist",itmp); int *p_typeO = (int *) force->pair->extract("typeO",itmp); int *p_typeH = (int *) force->pair->extract("typeH",itmp); int *p_typeA = (int *) force->pair->extract("typeA",itmp); @@ -1297,7 +1297,7 @@ void PPPMDisp::init_coeffs() double **Q=nullptr; if (n > 1) { // get dispersion coefficients - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); memory->create(A,n,n,"pppm/disp:A"); memory->create(Q,n,n,"pppm/disp:Q"); // fill coefficients to matrix a @@ -1409,15 +1409,15 @@ void PPPMDisp::init_coeffs() } if (function[1]) { // geometric 1/r^6 - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); B = new double[n+1]; B[0] = 0.0; for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i])); } if (function[2]) { // arithmetic 1/r^6 - double **epsilon = (double **) force->pair->extract("epsilon",tmp); - double **sigma = (double **) force->pair->extract("sigma",tmp); + auto epsilon = (double **) force->pair->extract("epsilon",tmp); + auto sigma = (double **) force->pair->extract("sigma",tmp); if (!(epsilon&&sigma)) error->all(FLERR,"Epsilon or sigma reference not set by pair style for PPPMDisp"); double eps_i,sigma_i,sigma_n; @@ -6816,7 +6816,7 @@ void PPPMDisp::fieldforce_none_peratom() void PPPMDisp::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7329,7 +7329,7 @@ void PPPMDisp::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7842,7 +7842,7 @@ void PPPMDisp::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7897,7 +7897,7 @@ void PPPMDisp::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index 9ca040aa64..c3e8fafdac 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -125,10 +125,8 @@ void remap_3d(FFT_SCALAR *in, FFT_SCALAR *out, FFT_SCALAR *buf, for (int i=0;inrecv;i++) recvBufferSize += plan->recv_size[i]; - FFT_SCALAR *packedSendBuffer - = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * sendBufferSize); - FFT_SCALAR *packedRecvBuffer - = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * recvBufferSize); + auto packedSendBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * sendBufferSize); + auto packedRecvBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * recvBufferSize); int *sendcnts = (int *) malloc(sizeof(int) * plan->commringlen); int *rcvcnts = (int *) malloc(sizeof(int) * plan->commringlen); diff --git a/src/MACHDYN/compute_smd_hourglass_error.cpp b/src/MACHDYN/compute_smd_hourglass_error.cpp index b0d01d2b14..1e36c9d182 100644 --- a/src/MACHDYN/compute_smd_hourglass_error.cpp +++ b/src/MACHDYN/compute_smd_hourglass_error.cpp @@ -86,7 +86,7 @@ void ComputeSMDHourglassError::compute_peratom() { } int itmp = 0; - double *hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); + auto hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); if (hourglass_error == nullptr) { error->all(FLERR, "compute smd/hourglass_error failed to access hourglass_error array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_dt.cpp b/src/MACHDYN/compute_smd_tlsph_dt.cpp index ca1973309f..44311fc4ce 100644 --- a/src/MACHDYN/compute_smd_tlsph_dt.cpp +++ b/src/MACHDYN/compute_smd_tlsph_dt.cpp @@ -87,7 +87,7 @@ void ComputeSMDTlsphDt::compute_peratom() { } int itmp = 0; - double *particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", + auto particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", itmp); if (particle_dt == nullptr) { error->all(FLERR, diff --git a/src/MACHDYN/compute_smd_tlsph_shape.cpp b/src/MACHDYN/compute_smd_tlsph_shape.cpp index 1887de683c..5e69c6650b 100644 --- a/src/MACHDYN/compute_smd_tlsph_shape.cpp +++ b/src/MACHDYN/compute_smd_tlsph_shape.cpp @@ -89,12 +89,12 @@ void ComputeSmdTlsphShape::compute_peratom() { } int itmp = 0; - Matrix3d *R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); + auto R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); if (R == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access rotation array"); } - Matrix3d *F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); + auto F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); if (F == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access deformation gradient array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_strain.cpp b/src/MACHDYN/compute_smd_tlsph_strain.cpp index 30f158a3f1..bb71792442 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain.cpp +++ b/src/MACHDYN/compute_smd_tlsph_strain.cpp @@ -92,7 +92,7 @@ void ComputeSMDTLSPHstrain::compute_peratom() { // copy data to output array int itmp = 0; - Matrix3d *Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); + auto Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); if (Fincr == nullptr) { error->all(FLERR, "compute smd/tlsph_strain failed to access Fincr array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp b/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp index 1889cbcc0f..d6da2d2288 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp +++ b/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp @@ -89,7 +89,7 @@ void ComputeSMDTLSPHStrainRate::compute_peratom() { } int itmp = 0; - Matrix3d *D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); + auto D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); if (D == nullptr) { error->all(FLERR, "compute smd/tlsph_strain_rate could not access strain rate. Are the matching pair styles present?"); diff --git a/src/MACHDYN/compute_smd_tlsph_stress.cpp b/src/MACHDYN/compute_smd_tlsph_stress.cpp index 038e09a3c0..f8592fec8d 100644 --- a/src/MACHDYN/compute_smd_tlsph_stress.cpp +++ b/src/MACHDYN/compute_smd_tlsph_stress.cpp @@ -99,7 +99,7 @@ void ComputeSMDTLSPHStress::compute_peratom() { } int itmp = 0; - Matrix3d *T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); + auto T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); if (T == nullptr) { error->all(FLERR, "compute smd/tlsph_stress could not access stress tensors. Are the matching pair styles present?"); } diff --git a/src/MACHDYN/compute_smd_ulsph_effm.cpp b/src/MACHDYN/compute_smd_ulsph_effm.cpp index 24cae6b14e..35b0fe851d 100644 --- a/src/MACHDYN/compute_smd_ulsph_effm.cpp +++ b/src/MACHDYN/compute_smd_ulsph_effm.cpp @@ -23,16 +23,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "compute_smd_ulsph_effm.h" + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" #include "pair.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -87,12 +89,9 @@ void ComputeSMD_Ulsph_Effm::compute_peratom() { } int itmp = 0; - double *particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", - itmp); - if (particle_dt == nullptr) { - error->all(FLERR, - "compute smd/ulsph_effm failed to access particle_dt array"); - } + auto particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", itmp); + if (particle_dt == nullptr) + error->all(FLERR, "compute smd/ulsph_effm failed to access particle_dt array"); int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp b/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp index 9e2709eb0a..b690bfab88 100644 --- a/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp +++ b/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp @@ -87,7 +87,7 @@ void ComputeSMDULSPHStrainRate::compute_peratom() { } int itmp = 0; - Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); + auto L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); if (L == nullptr) { error->all(FLERR, "compute smd/ulsph_strain_rate could not access any velocity gradients. Are the matching pair styles present?"); diff --git a/src/MACHDYN/compute_smd_ulsph_stress.cpp b/src/MACHDYN/compute_smd_ulsph_stress.cpp index 9aa75b76e8..b7bf3fd546 100644 --- a/src/MACHDYN/compute_smd_ulsph_stress.cpp +++ b/src/MACHDYN/compute_smd_ulsph_stress.cpp @@ -99,7 +99,7 @@ void ComputeSMDULSPHStress::compute_peratom() { } int itmp = 0; - Matrix3d *T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); + auto T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); if (T == nullptr) { error->all(FLERR, "compute smd/ulsph_stress could not access stress tensors. Are the matching pair styles present?"); } diff --git a/src/MACHDYN/fix_smd_adjust_dt.cpp b/src/MACHDYN/fix_smd_adjust_dt.cpp index f45364713a..0890527640 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.cpp +++ b/src/MACHDYN/fix_smd_adjust_dt.cpp @@ -103,11 +103,11 @@ void FixSMDTlsphDtReset::end_of_step() { * extract minimum CFL timestep from TLSPH and ULSPH pair styles */ - double *dtCFL_TLSPH = (double *) force->pair->extract("smd/tlsph/dtCFL_ptr", itmp); - double *dtCFL_ULSPH = (double *) force->pair->extract("smd/ulsph/dtCFL_ptr", itmp); - double *dt_TRI = (double *) force->pair->extract("smd/tri_surface/stable_time_increment_ptr", itmp); - double *dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); - double *dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); + auto dtCFL_TLSPH = (double *) force->pair->extract("smd/tlsph/dtCFL_ptr", itmp); + auto dtCFL_ULSPH = (double *) force->pair->extract("smd/ulsph/dtCFL_ptr", itmp); + auto dt_TRI = (double *) force->pair->extract("smd/tri_surface/stable_time_increment_ptr", itmp); + auto dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); + auto dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); if ((dtCFL_TLSPH == nullptr) && (dtCFL_ULSPH == nullptr) && (dt_TRI == nullptr) && (dt_HERTZ == nullptr) && (dt_PERI_IPMB == nullptr)) { @@ -222,7 +222,7 @@ void FixSMDTlsphDtReset::write_restart(FILE *fp) { void FixSMDTlsphDtReset::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; t_elapsed = list[n++]; } diff --git a/src/MACHDYN/fix_smd_integrate_tlsph.cpp b/src/MACHDYN/fix_smd_integrate_tlsph.cpp index 8bde3b3d07..cb020d330d 100644 --- a/src/MACHDYN/fix_smd_integrate_tlsph.cpp +++ b/src/MACHDYN/fix_smd_integrate_tlsph.cpp @@ -137,7 +137,7 @@ void FixSMDIntegrateTlsph::initial_integrate(int /*vflag*/) { if (igroup == atom->firstgroup) nlocal = atom->nfirst; - Vector3d *smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); + auto smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); if (xsphFlag) { if (smoothVelDifference == nullptr) { diff --git a/src/MACHDYN/fix_smd_integrate_ulsph.cpp b/src/MACHDYN/fix_smd_integrate_ulsph.cpp index 967cf33095..2a082078a6 100644 --- a/src/MACHDYN/fix_smd_integrate_ulsph.cpp +++ b/src/MACHDYN/fix_smd_integrate_ulsph.cpp @@ -169,7 +169,7 @@ void FixSMDIntegrateUlsph::initial_integrate(int /*vflag*/) { * get smoothed velocities from ULSPH pair style */ - Vector3d *smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); + auto smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); if (xsphFlag) { if (smoothVel == nullptr) { @@ -264,7 +264,7 @@ void FixSMDIntegrateUlsph::final_integrate() { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss num_neighs array"); } - Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); + auto L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); if (L == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss velocityGradient array"); } diff --git a/src/MANIFOLD/manifold_thylakoid.cpp b/src/MANIFOLD/manifold_thylakoid.cpp index ca50bfc881..a6cded49aa 100644 --- a/src/MANIFOLD/manifold_thylakoid.cpp +++ b/src/MANIFOLD/manifold_thylakoid.cpp @@ -447,7 +447,7 @@ thyla_part *manifold_thylakoid::make_plane_part (double a, double b, double c, args[3] = pt[0]; args[4] = pt[1]; args[5] = pt[2]; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_PLANE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_PLANE,args,0,0,0,0,0,0); return p; } @@ -462,7 +462,7 @@ thyla_part *manifold_thylakoid::make_cyl_part (double a, double b, double c, args[4] = pt[1]; args[5] = pt[2]; args[6] = R; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_CYL,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_CYL,args,0,0,0,0,0,0); return p; } @@ -474,7 +474,7 @@ thyla_part *manifold_thylakoid::make_sphere_part(const std::vector &pt, args[1] = pt[0]; args[2] = pt[1]; args[3] = pt[2]; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_SPHERE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_SPHERE,args,0,0,0,0,0,0); return p; } @@ -490,6 +490,6 @@ thyla_part *manifold_thylakoid::make_cyl_to_plane_part(double X0, double R0, dou args[4] = pt[1]; args[5] = pt[2]; args[6] = s; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_CYL_TO_PLANE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_CYL_TO_PLANE,args,0,0,0,0,0,0); return p; } diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 67ecc581f9..e575a6643b 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -503,7 +503,7 @@ void PairEAMCD::read_h_coeff(char *filename) error->one(FLERR,"Failure to seek to end-of-file for reading h(x) coeffs: {}", utils::getsyserror()); - char *buf = new char[MAXLINE+1]; + auto buf = new char[MAXLINE+1]; auto rv = fread(buf,1,MAXLINE,fptr); if (rv == 0) error->one(FLERR,"Failure to read h(x) coeffs: {}", utils::getsyserror()); buf[rv] = '\0'; // must 0-terminate buffer for string processing diff --git a/src/MANYBODY/pair_meam_spline.cpp b/src/MANYBODY/pair_meam_spline.cpp index 033cce51b0..ab4f39bf15 100644 --- a/src/MANYBODY/pair_meam_spline.cpp +++ b/src/MANYBODY/pair_meam_spline.cpp @@ -665,7 +665,7 @@ void PairMEAMSpline::SplineFunction::prepareSpline() h = (xmax-xmin)/(N-1); hsq = h*h; - double* u = new double[N]; + auto u = new double[N]; Y2[0] = -0.5; u[0] = (3.0/(X[1]-X[0])) * ((Y[1]-Y[0])/(X[1]-X[0]) - deriv0); for (int i = 1; i <= N-2; i++) { diff --git a/src/MANYBODY/pair_meam_sw_spline.cpp b/src/MANYBODY/pair_meam_sw_spline.cpp index 164787a9a4..c744e8f002 100644 --- a/src/MANYBODY/pair_meam_sw_spline.cpp +++ b/src/MANYBODY/pair_meam_sw_spline.cpp @@ -546,7 +546,7 @@ void PairMEAMSWSpline::SplineFunction::prepareSpline() h = (xmax-xmin)/((double)(N-1)); hsq = h*h; - double* u = new double[N]; + auto u = new double[N]; Y2[0] = -0.5; u[0] = (3.0/(X[1]-X[0])) * ((Y[1]-Y[0])/(X[1]-X[0]) - deriv0); for (int i = 1; i <= N-2; i++) { diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 21aba6d6df..cb7b3fe361 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -635,7 +635,7 @@ void PairPolymorphic::read_file(char *file) MPI_Bcast(pairParameters, npair*sizeof(PairParameters), MPI_BYTE, 0, world); // start reading tabular functions - double * singletable = new double[nr]; + auto singletable = new double[nr]; for (int i = 0; i < npair; i++) { // U PairParameters &p = pairParameters[i]; if (comm->me == 0) reader->next_dvector(singletable, nr); diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index a39f2b90ec..8a46af69da 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -198,7 +198,7 @@ void PairVashishtaTable::twobody_table(const Param ¶m, double rsq, // use analytic form if rsq is inside inner cutoff if (rsq < tabinnersq) { - Param *pparam = const_cast (¶m); + auto pparam = const_cast (¶m); PairVashishta::twobody(pparam,rsq,fforce,eflag,eng); return; } diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 9900f1aa26..690e628fe3 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -205,7 +205,7 @@ int FixAtomSwap::setmask() void FixAtomSwap::init() { - char *id_pe = (char *) "thermo_pe"; + auto id_pe = (char *) "thermo_pe"; int ipe = modify->find_compute(id_pe); c_pe = modify->compute[ipe]; @@ -804,7 +804,7 @@ void FixAtomSwap::write_restart(FILE *fp) void FixAtomSwap::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 344e950847..a5a2eaff82 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -1232,7 +1232,7 @@ void FixChargeRegulation::write_restart(FILE *fp) void FixChargeRegulation::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 1d411c19a7..6937b90202 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -1324,7 +1324,7 @@ void FixGCMC::attempt_molecule_insertion() MathExtra::quat_to_mat(quat,rotmat); double insertion_energy = 0.0; - bool *procflag = new bool[natoms_per_molecule]; + auto procflag = new bool[natoms_per_molecule]; for (int i = 0; i < natoms_per_molecule; i++) { MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]); @@ -2416,9 +2416,9 @@ void FixGCMC::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - double *comx = new double[maxmol_all]; - double *comy = new double[maxmol_all]; - double *comz = new double[maxmol_all]; + auto comx = new double[maxmol_all]; + auto comy = new double[maxmol_all]; + auto comz = new double[maxmol_all]; for (int imolecule = 0; imolecule < maxmol_all; imolecule++) { for (int i = 0; i < nlocal; i++) { if (molecule[i] == imolecule) { @@ -2538,7 +2538,7 @@ void FixGCMC::write_restart(FILE *fp) void FixGCMC::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_mol_swap.cpp b/src/MC/fix_mol_swap.cpp index a8c7b4ddb2..c93f0093a8 100644 --- a/src/MC/fix_mol_swap.cpp +++ b/src/MC/fix_mol_swap.cpp @@ -138,7 +138,7 @@ void FixMolSwap::init() { // c_pe = compute used to calculate before/after potential energy - char *id_pe = (char *) "thermo_pe"; + auto id_pe = (char *) "thermo_pe"; int ipe = modify->find_compute(id_pe); c_pe = modify->compute[ipe]; @@ -487,7 +487,7 @@ void FixMolSwap::write_restart(FILE *fp) void FixMolSwap::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random->reset(seed); diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index e2989f8981..bb20313ea8 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -619,7 +619,7 @@ void FixWidom::attempt_molecule_insertion() MathExtra::quat_to_mat(quat,rotmat); double insertion_energy = 0.0; - bool *procflag = new bool[natoms_per_molecule]; + auto procflag = new bool[natoms_per_molecule]; for (int i = 0; i < natoms_per_molecule; i++) { MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]); @@ -1089,9 +1089,9 @@ void FixWidom::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - double *comx = new double[maxmol_all]; - double *comy = new double[maxmol_all]; - double *comz = new double[maxmol_all]; + auto comx = new double[maxmol_all]; + auto comy = new double[maxmol_all]; + auto comz = new double[maxmol_all]; for (int imolecule = 0; imolecule < maxmol_all; imolecule++) { for (int i = 0; i < nlocal; i++) { if (molecule[i] == imolecule) { @@ -1195,7 +1195,7 @@ void FixWidom::write_restart(FILE *fp) void FixWidom::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MDI/library_mdi.cpp b/src/MDI/library_mdi.cpp index 445e42b7e4..ad2e995b4c 100644 --- a/src/MDI/library_mdi.cpp +++ b/src/MDI/library_mdi.cpp @@ -129,6 +129,6 @@ The function executes a single command from an external MDI driver. int lammps_execute_mdi_command(const char *command, MDI_Comm comm, void *class_obj) { - MDIEngine *mdi_engine = (MDIEngine *) class_obj; + auto mdi_engine = (MDIEngine *) class_obj; return mdi_engine->execute_command(command, comm); } diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index b76e9d38b8..2e29ed2fd4 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -1349,7 +1349,7 @@ void MDIEngine::send_total_energy() void MDIEngine::send_labels() { - char *labels = new char[atom->natoms * MDI_LABEL_LENGTH]; + auto labels = new char[atom->natoms * MDI_LABEL_LENGTH]; memset(labels, ' ', atom->natoms * MDI_LABEL_LENGTH); memset(ibuf1, 0, atom->natoms * sizeof(int)); @@ -1579,7 +1579,7 @@ void MDIEngine::single_command() { if (nbytes < 0) error->all(FLERR, "MDI: COMMAND nbytes has not been set"); - char *cmd = new char[nbytes + 1]; + auto cmd = new char[nbytes + 1]; int ierr = MDI_Recv(cmd, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: COMMAND data"); MPI_Bcast(cmd, nbytes + 1, MPI_CHAR, 0, world); @@ -1600,7 +1600,7 @@ void MDIEngine::many_commands() { if (nbytes < 0) error->all(FLERR, "MDI: COMMANDS nbytes has not been set"); - char *cmds = new char[nbytes + 1]; + auto cmds = new char[nbytes + 1]; int ierr = MDI_Recv(cmds, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: COMMANDS data"); MPI_Bcast(cmds, nbytes + 1, MPI_CHAR, 0, world); @@ -1621,7 +1621,7 @@ void MDIEngine::infile() { if (nbytes < 0) error->all(FLERR, "MDI: INFILE nbytes has not been set"); - char *infile = new char[nbytes + 1]; + auto infile = new char[nbytes + 1]; int ierr = MDI_Recv(infile, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: INFILE data for {}", infile); MPI_Bcast(infile, nbytes + 1, MPI_CHAR, 0, world); diff --git a/src/MDI/mdi_plugin.cpp b/src/MDI/mdi_plugin.cpp index d1fcd2d941..5d8c3516d6 100644 --- a/src/MDI/mdi_plugin.cpp +++ b/src/MDI/mdi_plugin.cpp @@ -81,7 +81,7 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp) // build full plugin_args string for args to plugin library int n = strlen(mdi_arg) + strlen(infile_arg) + strlen(extra_arg) + 16; - char *plugin_args = new char[n]; + auto plugin_args = new char[n]; plugin_args[0] = 0; strcat(plugin_args, "-mdi \""); strcat(plugin_args, mdi_arg); @@ -114,7 +114,7 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp) int MDIPlugin::plugin_wrapper(void * /*pmpicomm*/, MDI_Comm mdicomm, void *vptr) { - MDIPlugin *ptr = (MDIPlugin *) vptr; + auto ptr = (MDIPlugin *) vptr; LAMMPS *lammps = ptr->lmp; char *lammps_command = ptr->lammps_command; diff --git a/src/MISC/fix_imd.cpp b/src/MISC/fix_imd.cpp index 1e2160ef07..18d338a69f 100644 --- a/src/MISC/fix_imd.cpp +++ b/src/MISC/fix_imd.cpp @@ -566,7 +566,7 @@ FixIMD::~FixIMD() } #endif - taginthash_t *hashtable = (taginthash_t *)idmap; + auto hashtable = (taginthash_t *)idmap; memory->destroy(comm_buf); memory->destroy(force_buf); taginthash_destroy(hashtable); @@ -699,17 +699,17 @@ void FixIMD::setup(int) error->all(FLERR,"LAMMPS terminated on error in setting up IMD connection."); /* initialize and build hashtable. */ - taginthash_t *hashtable=new taginthash_t; + auto hashtable=new taginthash_t; taginthash_init(hashtable, num_coords); idmap = (void *)hashtable; int tmp, ndata; - struct commdata *buf = static_cast(comm_buf); + auto buf = static_cast(comm_buf); if (me == 0) { MPI_Status status; MPI_Request request; - tagint *taglist = new tagint[num_coords]; + auto taglist = new tagint[num_coords]; int numtag=0; /* counter to map atom tags to a 0-based consecutive index list */ for (i=0; i < nlocal; ++i) { @@ -899,15 +899,15 @@ void FixIMD::post_force(int /*vflag*/) } case IMD_FCOORDS: { - float *dummy_coords = new float[3*length]; + auto dummy_coords = new float[3*length]; imd_recv_fcoords(clientsock, length, dummy_coords); delete[] dummy_coords; break; } case IMD_MDCOMM: { - int32 *imd_tags = new int32[length]; - float *imd_fdat = new float[3*length]; + auto imd_tags = new int32[length]; + auto imd_fdat = new float[3*length]; imd_recv_mdcomm(clientsock, length, imd_tags, imd_fdat); if (imd_forces < length) { /* grow holding space for forces, if needed. */ @@ -1014,7 +1014,7 @@ void FixIMD::post_force(int /*vflag*/) msgdata = new char[msglen]; imd_fill_header((IMDheader *)msgdata, IMD_FCOORDS, num_coords); /* array pointer, to the offset where we receive the coordinates. */ - float *recvcoord = (float *) (msgdata+IMDHEADERSIZE); + auto recvcoord = (float *) (msgdata+IMDHEADERSIZE); /* add local data */ if (unwrap_flag) { @@ -1207,7 +1207,7 @@ void * imdsock_create() { } int imdsock_bind(void * v, int port) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; memset(&(s->addr), 0, sizeof(s->addr)); s->addr.sin_family = PF_INET; s->addr.sin_port = htons(port); @@ -1216,7 +1216,7 @@ int imdsock_bind(void * v, int port) { } int imdsock_listen(void * v) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; return listen(s->sd, 5); } @@ -1250,7 +1250,7 @@ void *imdsock_accept(void * v) { } int imdsock_write(void * v, const void *buf, int len) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; #if defined(_MSC_VER) || defined(__MINGW32__) return send(s->sd, (const char*) buf, len, 0); /* windows lacks the write() call */ #else @@ -1259,7 +1259,7 @@ int imdsock_write(void * v, const void *buf, int len) { } int imdsock_read(void * v, void *buf, int len) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; #if defined(_MSC_VER) || defined(__MINGW32__) return recv(s->sd, (char*) buf, len, 0); /* windows lacks the read() call */ #else @@ -1269,7 +1269,7 @@ int imdsock_read(void * v, void *buf, int len) { } void imdsock_shutdown(void *v) { - imdsocket * s = (imdsocket *) v; + auto s = (imdsocket *) v; if (s == nullptr) return; @@ -1281,7 +1281,7 @@ void imdsock_shutdown(void *v) { } void imdsock_destroy(void * v) { - imdsocket * s = (imdsocket *) v; + auto s = (imdsocket *) v; if (s == nullptr) return; @@ -1294,7 +1294,7 @@ void imdsock_destroy(void * v) { } int imdsock_selread(void *v, int sec) { - imdsocket *s = (imdsocket *)v; + auto s = (imdsocket *)v; fd_set rfd; struct timeval tv; int rc; @@ -1313,7 +1313,7 @@ int imdsock_selread(void *v, int sec) { } int imdsock_selwrite(void *v, int sec) { - imdsocket *s = (imdsocket *)v; + auto s = (imdsocket *)v; fd_set wfd; struct timeval tv; int rc; diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index b82339713e..290ce38c02 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -416,7 +416,7 @@ void FixIPI::final_integrate() int nat=bsize/3; double **f= atom->f; - double *lbuf = new double[bsize]; + auto lbuf = new double[bsize]; // reassembles the force vector from the local arrays int nlocal = atom->nlocal; diff --git a/src/MISC/fix_srp.cpp b/src/MISC/fix_srp.cpp index 393be42bb2..1fb15aafd3 100644 --- a/src/MISC/fix_srp.cpp +++ b/src/MISC/fix_srp.cpp @@ -607,7 +607,7 @@ void FixSRP::write_restart(FILE *fp) void FixSRP::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; comm->cutghostuser = static_cast (list[n++]); btype = static_cast (list[n++]); diff --git a/src/MISC/pair_list.cpp b/src/MISC/pair_list.cpp index d7d59e90d3..f6ac2e3190 100644 --- a/src/MISC/pair_list.cpp +++ b/src/MISC/pair_list.cpp @@ -89,7 +89,7 @@ void PairList::compute(int eflag, int vflag) const int nlocal = atom->nlocal; const int newton_pair = force->newton_pair; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; // NOLINT double fpair,epair; int i,j; diff --git a/src/ML-HDNNP/pair_hdnnp.cpp b/src/ML-HDNNP/pair_hdnnp.cpp index 7522b301bf..f226bb601b 100644 --- a/src/ML-HDNNP/pair_hdnnp.cpp +++ b/src/ML-HDNNP/pair_hdnnp.cpp @@ -319,7 +319,7 @@ void PairHDNNP::handleExtrapolationWarnings() MPI_Status ms; // Get buffer size. MPI_Recv(&bs, 1, MPI_LONG, i, 0, world, &ms); - char *buf = new char[bs]; + auto buf = new char[bs]; // Receive buffer. MPI_Recv(buf, bs, MPI_BYTE, i, 0, world, &ms); interface->extractEWBuffer(buf, bs); @@ -331,7 +331,7 @@ void PairHDNNP::handleExtrapolationWarnings() // Get desired buffer length for all extrapolation warning entries. long bs = interface->getEWBufferSize(); // Allocate and fill buffer. - char *buf = new char[bs]; + auto buf = new char[bs]; interface->fillEWBuffer(buf, bs); // Send buffer size and buffer. MPI_Send(&bs, 1, MPI_LONG, 0, 0, world); diff --git a/src/ML-IAP/mliap_so3.cpp b/src/ML-IAP/mliap_so3.cpp index 0733ffa198..55418c9821 100644 --- a/src/ML-IAP/mliap_so3.cpp +++ b/src/ML-IAP/mliap_so3.cpp @@ -369,16 +369,16 @@ void MLIAP_SO3::compute_W(int nmax, double *arr) } int i, j, k, n = nmax; - double *outeig = new double[n]; - double *outeigvec = new double[n * n]; - double *arrinv = new double[n * n]; + auto outeig = new double[n]; + auto outeigvec = new double[n * n]; + auto arrinv = new double[n * n]; - double *sqrtD = new double[n * n]; - double *tempM = new double[n * n]; + auto sqrtD = new double[n * n]; + auto tempM = new double[n * n]; - double **temparr = new double *[n]; - double **tempvl = new double *[n]; - double *tempout = new double[n]; + auto temparr = new double *[n]; + auto tempvl = new double *[n]; + auto tempout = new double[n]; int info; diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 3ba430bb5c..eeb30c4d64 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -574,7 +574,7 @@ void AngleTable::spline(double *x, double *y, int n, double yp1, double ypn, dou { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e300) y2[0] = u[0] = 0.0; diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 72e21e5210..e1eac7c4c2 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -538,7 +538,7 @@ void BondTable::spline(double *x, double *y, int n, double yp1, double ypn, doub { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e300) y2[0] = u[0] = 0.0; diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 4b7f0b04f3..76ba8b8283 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -405,9 +405,9 @@ void DihedralCharmmfsw::init_style() int itmp; int *p_dihedflag = (int *) force->pair->extract("dihedflag", itmp); - double *p_cutljinner = (double *) force->pair->extract("cut_lj_inner", itmp); - double *p_cutlj = (double *) force->pair->extract("cut_lj", itmp); - double *p_cutcoul = (double *) force->pair->extract("cut_coul", itmp); + auto p_cutljinner = (double *) force->pair->extract("cut_lj_inner", itmp); + auto p_cutlj = (double *) force->pair->extract("cut_lj", itmp); + auto p_cutcoul = (double *) force->pair->extract("cut_coul", itmp); if (p_cutcoul == nullptr || p_cutljinner == nullptr || p_cutlj == nullptr || p_dihedflag == nullptr) diff --git a/src/MOLECULE/dihedral_table.cpp b/src/MOLECULE/dihedral_table.cpp index dbca4a85c1..ea0b30cbd5 100644 --- a/src/MOLECULE/dihedral_table.cpp +++ b/src/MOLECULE/dihedral_table.cpp @@ -80,11 +80,11 @@ static int solve_cyc_tridiag( const double diag[], size_t d_stride, size_t N, bool warn) { int status = GSL_SUCCESS; - double * delta = (double *) malloc (N * sizeof (double)); - double * gamma = (double *) malloc (N * sizeof (double)); - double * alpha = (double *) malloc (N * sizeof (double)); - double * c = (double *) malloc (N * sizeof (double)); - double * z = (double *) malloc (N * sizeof (double)); + auto delta = (double *) malloc (N * sizeof (double)); + auto gamma = (double *) malloc (N * sizeof (double)); + auto alpha = (double *) malloc (N * sizeof (double)); + auto c = (double *) malloc (N * sizeof (double)); + auto z = (double *) malloc (N * sizeof (double)); if (delta == nullptr || gamma == nullptr || alpha == nullptr || c == nullptr || z == nullptr) { if (warn) @@ -193,9 +193,9 @@ static int cyc_spline(double const *xa, double const *ya, int n, double period, double *y2a, bool warn) { - double *diag = new double[n]; - double *offdiag = new double[n]; - double *rhs = new double[n]; + auto diag = new double[n]; + auto offdiag = new double[n]; + auto rhs = new double[n]; double xa_im1, xa_ip1; // In the cyclic case, there are n equations with n unknows. @@ -812,9 +812,9 @@ void DihedralTable::coeff(int narg, char **arg) // We also want the angles to be sorted in increasing order. // This messy code fixes these problems with the user's data: { - double *phifile_tmp = new double[tb->ninput]; //temporary arrays - double *ffile_tmp = new double[tb->ninput]; //used for sorting - double *efile_tmp = new double[tb->ninput]; + auto phifile_tmp = new double[tb->ninput]; //temporary arrays + auto ffile_tmp = new double[tb->ninput]; //used for sorting + auto efile_tmp = new double[tb->ninput]; // After re-imaging, does the range of angles cross the 0 or 2*PI boundary? // If so, find the discontinuity: diff --git a/src/MOLFILE/dump_molfile.cpp b/src/MOLFILE/dump_molfile.cpp index bb45680395..8cc28ab88e 100644 --- a/src/MOLFILE/dump_molfile.cpp +++ b/src/MOLFILE/dump_molfile.cpp @@ -98,7 +98,7 @@ DumpMolfile::DumpMolfile(LAMMPS *lmp, int narg, char **arg) mf = new MolfileInterface(arg[5],MFI::M_WRITE); - const char *path = (const char *) "."; + const char *path = (const char *) "."; // NOLINT if (narg > 6) path=arg[6]; diff --git a/src/MOLFILE/molfile_interface.cpp b/src/MOLFILE/molfile_interface.cpp index 5fd398570e..a83d8ed46c 100644 --- a/src/MOLFILE/molfile_interface.cpp +++ b/src/MOLFILE/molfile_interface.cpp @@ -47,7 +47,7 @@ extern "C" { // callback function for plugin registration. static int plugin_register_cb(void *v, vmdplugin_t *p) { - plugin_reginfo_t *r = static_cast(v); + auto r = static_cast(v); // 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) @@ -214,7 +214,7 @@ MolfileInterface::~MolfileInterface() forget_plugin(); if (_info) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); delete[] a; _info = nullptr; } @@ -278,7 +278,7 @@ int MolfileInterface::load_plugin(const char *filename) ((regfunc)rfunc)(®info, plugin_register_cb); // make some checks to see if the plugin is suitable or not. - molfile_plugin_t *plugin = static_cast(reginfo.p); + auto plugin = static_cast(reginfo.p); // if the callback found a matching plugin and copied the struct, // its name element will point to a different location now. @@ -398,7 +398,7 @@ int MolfileInterface::open(const char *name, int *natoms) { if (!_plugin || !_dso || !natoms) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); if (_mode & M_WRITE) _ptr = p->open_file_write(name,_type,*natoms); @@ -412,7 +412,7 @@ int MolfileInterface::open(const char *name, int *natoms) // we need to deal with structure information, // so we allocate and initialize storage for it. if (_mode & (M_RSTRUCT|M_WSTRUCT)) { - molfile_atom_t *a = new molfile_atom_t[_natoms]; + auto a = new molfile_atom_t[_natoms]; _info = a; memset(_info,0,_natoms*sizeof(molfile_atom_t)); for (int i=0; i < _natoms; ++i) { @@ -431,7 +431,7 @@ int MolfileInterface::structure() { if (!_plugin || !_dso) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); int optflags = MOLFILE_NOOPTIONS; @@ -443,10 +443,10 @@ int MolfileInterface::structure() optflags |= (_props & P_RADS) ? MOLFILE_RADIUS : 0; optflags |= (_props & P_ATMN) ? MOLFILE_ATOMICNUMBER : 0; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); p->write_structure(_ptr,optflags,a); } else if (_mode & M_RSTRUCT) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); p->read_structure(_ptr,&optflags,a); // mandatory properties _props = P_NAME|P_TYPE|P_RESN|P_RESI|P_SEGN|P_CHAI; @@ -467,7 +467,7 @@ int MolfileInterface::close() if (!_plugin || !_dso || !_ptr) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); if (_mode & M_WRITE) { p->close_file_write(_ptr); @@ -476,7 +476,7 @@ int MolfileInterface::close() } if (_info) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); delete[] a; _info = nullptr; } @@ -494,8 +494,8 @@ int MolfileInterface::timestep(float *coords, float *vels, if (!_plugin || !_dso || !_ptr) return 1; - molfile_plugin_t *p = static_cast(_plugin); - molfile_timestep_t *t = new molfile_timestep_t; + auto p = static_cast(_plugin); + auto t = new molfile_timestep_t; int rv; if (_mode & M_WRITE) { @@ -710,7 +710,7 @@ int MolfileInterface::property(int propid, int idx, float *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) _props |= write_atom_property(a[idx], propid, *prop); @@ -727,7 +727,7 @@ int MolfileInterface::property(int propid, int *types, float *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -747,7 +747,7 @@ int MolfileInterface::property(int propid, float *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -768,7 +768,7 @@ int MolfileInterface::property(int propid, int idx, double *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) return write_atom_property(a[idx], propid, *prop); @@ -785,7 +785,7 @@ int MolfileInterface::property(int propid, int *types, double *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -805,7 +805,7 @@ int MolfileInterface::property(int propid, double *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -840,7 +840,7 @@ int MolfileInterface::property(int propid, int idx, int *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -865,7 +865,7 @@ int MolfileInterface::property(int propid, int *types, int *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -894,7 +894,7 @@ int MolfileInterface::property(int propid, int *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -925,7 +925,7 @@ int MolfileInterface::property(int propid, int idx, char *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { _props |= write_atom_property(a[idx], propid, prop); @@ -943,7 +943,7 @@ int MolfileInterface::property(int propid, int *types, char **prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) { @@ -964,7 +964,7 @@ int MolfileInterface::property(int propid, char **prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) { diff --git a/src/MOLFILE/reader_molfile.cpp b/src/MOLFILE/reader_molfile.cpp index 5f75ae50f5..7b12678329 100644 --- a/src/MOLFILE/reader_molfile.cpp +++ b/src/MOLFILE/reader_molfile.cpp @@ -78,7 +78,7 @@ void ReaderMolfile::settings(int narg, char **arg) if (me == 0) { mf = new MolfileInterface(arg[0],MFI::M_READ); - const char *path = (const char *) "."; + const char *path = (const char *) "."; // NOLINT if (narg > 1) path=arg[1]; @@ -220,12 +220,12 @@ bigint ReaderMolfile::read_header(double box[3][3], int &boxinfo, int &triclinic triclinic = 1; - const double la = static_cast(cell[0]); - const double lb = static_cast(cell[1]); - const double lc = static_cast(cell[2]); - const double alpha = static_cast(cell[3]); - const double beta = static_cast(cell[4]); - const double gamma = static_cast(cell[5]); + const auto la = static_cast(cell[0]); + const auto lb = static_cast(cell[1]); + const auto lc = static_cast(cell[2]); + const auto alpha = static_cast(cell[3]); + const auto beta = static_cast(cell[4]); + const auto gamma = static_cast(cell[5]); const double lx = la; const double xy = lb * cos(gamma/90.0*MY_PI2); diff --git a/src/OPENMP/angle_charmm_omp.cpp b/src/OPENMP/angle_charmm_omp.cpp index 1c84828c63..2994cfad13 100644 --- a/src/OPENMP/angle_charmm_omp.cpp +++ b/src/OPENMP/angle_charmm_omp.cpp @@ -88,8 +88,8 @@ void AngleCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double delxUB,delyUB,delzUB,rsqUB,rUB,dr,rk,forceUB; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_class2_omp.cpp b/src/OPENMP/angle_class2_omp.cpp index 54aa062d44..239b373004 100644 --- a/src/OPENMP/angle_class2_omp.cpp +++ b/src/OPENMP/angle_class2_omp.cpp @@ -89,8 +89,8 @@ void AngleClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22,b1,b2; double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_delta_omp.cpp b/src/OPENMP/angle_cosine_delta_omp.cpp index e60d0748df..48330a5087 100644 --- a/src/OPENMP/angle_cosine_delta_omp.cpp +++ b/src/OPENMP/angle_cosine_delta_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineDeltaOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,cot,a11,a12,a22,b11,b12,b22,c0,s0,s; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_omp.cpp b/src/OPENMP/angle_cosine_omp.cpp index d0c27dfab0..cd5a9fab58 100644 --- a/src/OPENMP/angle_cosine_omp.cpp +++ b/src/OPENMP/angle_cosine_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_periodic_omp.cpp b/src/OPENMP/angle_cosine_periodic_omp.cpp index 58db02d6f7..a97a9d7e89 100644 --- a/src/OPENMP/angle_cosine_periodic_omp.cpp +++ b/src/OPENMP/angle_cosine_periodic_omp.cpp @@ -89,8 +89,8 @@ void AngleCosinePeriodicOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; double tn,tn_1,tn_2,un,un_1,un_2; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_shift_exp_omp.cpp b/src/OPENMP/angle_cosine_shift_exp_omp.cpp index f2abf1f1b0..1f9b150a57 100644 --- a/src/OPENMP/angle_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_exp_omp.cpp @@ -87,8 +87,8 @@ void AngleCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a11,a12,a22; double exp2,aa,uumin,cccpsss,cssmscc; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_shift_omp.cpp b/src/OPENMP/angle_cosine_shift_omp.cpp index 4d6e1ab81a..08649f01e2 100644 --- a/src/OPENMP/angle_cosine_shift_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,s,cps,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; double eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_squared_omp.cpp b/src/OPENMP/angle_cosine_squared_omp.cpp index 65b73216c7..6755426b71 100644 --- a/src/OPENMP/angle_cosine_squared_omp.cpp +++ b/src/OPENMP/angle_cosine_squared_omp.cpp @@ -87,8 +87,8 @@ void AngleCosineSquaredOMP::eval(int nfrom, int nto, ThrData * const thr) double dcostheta,tk; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_fourier_omp.cpp b/src/OPENMP/angle_fourier_omp.cpp index d7a05f6850..b1e4cf1f0a 100644 --- a/src/OPENMP/angle_fourier_omp.cpp +++ b/src/OPENMP/angle_fourier_omp.cpp @@ -87,8 +87,8 @@ void AngleFourierOMP::eval(int nfrom, int nto, ThrData * const thr) double term; double rsq1,rsq2,r1,r2,c,c2,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_fourier_simple_omp.cpp b/src/OPENMP/angle_fourier_simple_omp.cpp index 670f8cfc83..b76e9c875e 100644 --- a/src/OPENMP/angle_fourier_simple_omp.cpp +++ b/src/OPENMP/angle_fourier_simple_omp.cpp @@ -93,8 +93,8 @@ void AngleFourierSimpleOMP::eval(int nfrom, int nto, ThrData *const thr) double term, sgn; double rsq1, rsq2, r1, r2, c, cn, th, nth, a, a11, a12, a22; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t *_noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_harmonic_omp.cpp b/src/OPENMP/angle_harmonic_omp.cpp index 2d1a34570d..a67f784624 100644 --- a/src/OPENMP/angle_harmonic_omp.cpp +++ b/src/OPENMP/angle_harmonic_omp.cpp @@ -87,8 +87,8 @@ void AngleHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_quartic_omp.cpp b/src/OPENMP/angle_quartic_omp.cpp index 3770319323..6592584c99 100644 --- a/src/OPENMP/angle_quartic_omp.cpp +++ b/src/OPENMP/angle_quartic_omp.cpp @@ -87,8 +87,8 @@ void AngleQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,dtheta2,dtheta3,dtheta4,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_sdk_omp.cpp b/src/OPENMP/angle_sdk_omp.cpp index 8fcfb3df08..e82121959b 100644 --- a/src/OPENMP/angle_sdk_omp.cpp +++ b/src/OPENMP/angle_sdk_omp.cpp @@ -89,8 +89,8 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,rsq3,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_table_omp.cpp b/src/OPENMP/angle_table_omp.cpp index cca34a67f7..d796ac23e3 100644 --- a/src/OPENMP/angle_table_omp.cpp +++ b/src/OPENMP/angle_table_omp.cpp @@ -88,8 +88,8 @@ void AngleTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double theta,u,mdu; //mdu: minus du, -du/dx=f - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/bond_class2_omp.cpp b/src/OPENMP/bond_class2_omp.cpp index 170e97d13d..9b7ed7169f 100644 --- a/src/OPENMP/bond_class2_omp.cpp +++ b/src/OPENMP/bond_class2_omp.cpp @@ -85,8 +85,8 @@ void BondClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,dr2,dr3,dr4,de_bond; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_fene_expand_omp.cpp b/src/OPENMP/bond_fene_expand_omp.cpp index 56ea5b52a0..30c6f154b7 100644 --- a/src/OPENMP/bond_fene_expand_omp.cpp +++ b/src/OPENMP/bond_fene_expand_omp.cpp @@ -89,8 +89,8 @@ void BondFENEExpandOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r0sq,rlogarg,sr2,sr6; double r,rshift,rshiftsq; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/bond_fene_omp.cpp b/src/OPENMP/bond_fene_omp.cpp index 57afe43a18..ef1343ec90 100644 --- a/src/OPENMP/bond_fene_omp.cpp +++ b/src/OPENMP/bond_fene_omp.cpp @@ -88,8 +88,8 @@ void BondFENEOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r0sq,rlogarg,sr2,sr6; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/bond_gromos_omp.cpp b/src/OPENMP/bond_gromos_omp.cpp index bba8f15230..6089290386 100644 --- a/src/OPENMP/bond_gromos_omp.cpp +++ b/src/OPENMP/bond_gromos_omp.cpp @@ -81,8 +81,8 @@ void BondGromosOMP::eval(int nfrom, int nto, ThrData * const thr) int i1,i2,n,type; double delx,dely,delz,ebond,fbond; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_omp.cpp b/src/OPENMP/bond_harmonic_omp.cpp index 5ad816bf1b..cc9bbea5da 100644 --- a/src/OPENMP/bond_harmonic_omp.cpp +++ b/src/OPENMP/bond_harmonic_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_shift_cut_omp.cpp b/src/OPENMP/bond_harmonic_shift_cut_omp.cpp index 3d462a8305..702eae64d0 100644 --- a/src/OPENMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/OPENMP/bond_harmonic_shift_cut_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicShiftCutOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_shift_omp.cpp b/src/OPENMP/bond_harmonic_shift_omp.cpp index 567287bcc7..375de2eff7 100644 --- a/src/OPENMP/bond_harmonic_shift_omp.cpp +++ b/src/OPENMP/bond_harmonic_shift_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_morse_omp.cpp b/src/OPENMP/bond_morse_omp.cpp index 3e9c5a9b5b..b1938b926f 100644 --- a/src/OPENMP/bond_morse_omp.cpp +++ b/src/OPENMP/bond_morse_omp.cpp @@ -84,8 +84,8 @@ void BondMorseOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,ralpha; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_nonlinear_omp.cpp b/src/OPENMP/bond_nonlinear_omp.cpp index 4a011a1f8a..209c7d4719 100644 --- a/src/OPENMP/bond_nonlinear_omp.cpp +++ b/src/OPENMP/bond_nonlinear_omp.cpp @@ -84,8 +84,8 @@ void BondNonlinearOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,drsq,lamdasq,denom,denomsq; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_table_omp.cpp b/src/OPENMP/bond_table_omp.cpp index dcc13c85c9..011ba5cc49 100644 --- a/src/OPENMP/bond_table_omp.cpp +++ b/src/OPENMP/bond_table_omp.cpp @@ -85,8 +85,8 @@ void BondTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r; double u,mdu; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/dihedral_charmm_omp.cpp b/src/OPENMP/dihedral_charmm_omp.cpp index 7efd6d367b..72d6a93a64 100644 --- a/src/OPENMP/dihedral_charmm_omp.cpp +++ b/src/OPENMP/dihedral_charmm_omp.cpp @@ -103,8 +103,8 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) ecoul = evdwl = edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * const atomtype = atom->type; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; diff --git a/src/OPENMP/dihedral_class2_omp.cpp b/src/OPENMP/dihedral_class2_omp.cpp index f843def3ec..e2bcfaa990 100644 --- a/src/OPENMP/dihedral_class2_omp.cpp +++ b/src/OPENMP/dihedral_class2_omp.cpp @@ -99,8 +99,8 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp index 9da2a5b8b5..45ca6ee84f 100644 --- a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp @@ -95,8 +95,8 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_fourier_omp.cpp b/src/OPENMP/dihedral_fourier_omp.cpp index a7c5264fa5..594cd3e922 100644 --- a/src/OPENMP/dihedral_fourier_omp.cpp +++ b/src/OPENMP/dihedral_fourier_omp.cpp @@ -92,8 +92,8 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_harmonic_omp.cpp b/src/OPENMP/dihedral_harmonic_omp.cpp index 6bbfd6ff12..dd93cfd126 100644 --- a/src/OPENMP/dihedral_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_harmonic_omp.cpp @@ -94,8 +94,8 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_helix_omp.cpp b/src/OPENMP/dihedral_helix_omp.cpp index c73622ed9d..d33f7fb4d0 100644 --- a/src/OPENMP/dihedral_helix_omp.cpp +++ b/src/OPENMP/dihedral_helix_omp.cpp @@ -97,8 +97,8 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_multi_harmonic_omp.cpp b/src/OPENMP/dihedral_multi_harmonic_omp.cpp index cf7e991c9d..d8de18e3c3 100644 --- a/src/OPENMP/dihedral_multi_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_multi_harmonic_omp.cpp @@ -95,8 +95,8 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_nharmonic_omp.cpp b/src/OPENMP/dihedral_nharmonic_omp.cpp index f2ec46190e..11c0839529 100644 --- a/src/OPENMP/dihedral_nharmonic_omp.cpp +++ b/src/OPENMP/dihedral_nharmonic_omp.cpp @@ -94,8 +94,8 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_opls_omp.cpp b/src/OPENMP/dihedral_opls_omp.cpp index 543485aa0f..b3b5ea9178 100644 --- a/src/OPENMP/dihedral_opls_omp.cpp +++ b/src/OPENMP/dihedral_opls_omp.cpp @@ -96,8 +96,8 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_quadratic_omp.cpp b/src/OPENMP/dihedral_quadratic_omp.cpp index f6582d3bc0..2c08dd4505 100644 --- a/src/OPENMP/dihedral_quadratic_omp.cpp +++ b/src/OPENMP/dihedral_quadratic_omp.cpp @@ -97,8 +97,8 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/domain_omp.cpp b/src/OPENMP/domain_omp.cpp index af4d41a585..48b1118333 100644 --- a/src/OPENMP/domain_omp.cpp +++ b/src/OPENMP/domain_omp.cpp @@ -47,7 +47,7 @@ void DomainOMP::pbc() // verify owned atoms have valid numerical coords // may not if computed pairwise force between 2 atoms at same location - const double *_noalias const coord = &atom->x[0][0]; + const double *_noalias const coord = atom->x[0]; // NOLINT const int n3 = 3 * nlocal; int flag = 0; #if defined(_OPENMP) // clang-format off @@ -57,8 +57,8 @@ void DomainOMP::pbc() if (!std::isfinite(coord[i])) flag = 1; if (flag) error->one(FLERR, "Non-numeric atom coords - simulation unstable"); - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; - dbl3_t *_noalias const v = (dbl3_t *) &atom->v[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const v = (dbl3_t *) atom->v[0]; const double *_noalias const lo = (triclinic == 0) ? boxlo : boxlo_lamda; const double *_noalias const hi = (triclinic == 0) ? boxhi : boxhi_lamda; const double *_noalias const period = (triclinic == 0) ? prd : prd_lamda; @@ -162,7 +162,7 @@ void DomainOMP::lamda2x(int n) { const int num = n; if (!n) return; - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) @@ -183,7 +183,7 @@ void DomainOMP::x2lamda(int n) { const int num = n; if (!n) return; - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) diff --git a/src/OPENMP/fix_nh_asphere_omp.cpp b/src/OPENMP/fix_nh_asphere_omp.cpp index 9325038790..2329ef584d 100644 --- a/src/OPENMP/fix_nh_asphere_omp.cpp +++ b/src/OPENMP/fix_nh_asphere_omp.cpp @@ -68,10 +68,10 @@ void FixNHAsphereOMP::init() void FixNHAsphereOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; - const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -101,9 +101,9 @@ void FixNHAsphereOMP::nve_v() void FixNHAsphereOMP::nve_x() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus; @@ -154,8 +154,8 @@ void FixNHAsphereOMP::nve_x() void FixNHAsphereOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nh_omp.cpp b/src/OPENMP/fix_nh_omp.cpp index c2601c1b22..29186af629 100644 --- a/src/OPENMP/fix_nh_omp.cpp +++ b/src/OPENMP/fix_nh_omp.cpp @@ -16,15 +16,17 @@ Contributing authors: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_nh_omp.h" -#include + #include "atom.h" #include "compute.h" #include "domain.h" #include "error.h" #include "modify.h" +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -231,7 +233,7 @@ void FixNHOMP::nh_v_press() const double factor0 = exp(-dt4*(omega_dot[0]+mtk_term2)); const double factor1 = exp(-dt4*(omega_dot[1]+mtk_term2)); const double factor2 = exp(-dt4*(omega_dot[2]+mtk_term2)); - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -283,8 +285,8 @@ void FixNHOMP::nh_v_press() void FixNHOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -324,8 +326,8 @@ void FixNHOMP::nve_v() void FixNHOMP::nve_x() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -348,7 +350,7 @@ void FixNHOMP::nve_x() void FixNHOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nh_sphere_omp.cpp b/src/OPENMP/fix_nh_sphere_omp.cpp index 2c00a8ffb7..788db2b6ee 100644 --- a/src/OPENMP/fix_nh_sphere_omp.cpp +++ b/src/OPENMP/fix_nh_sphere_omp.cpp @@ -16,12 +16,13 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_nh_sphere_omp.h" + #include "atom.h" #include "compute.h" #include "error.h" +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -65,10 +66,10 @@ void FixNHSphereOMP::init() void FixNHSphereOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; - const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const omega = (dbl3_t *) atom->omega[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const radius = atom->radius; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; @@ -110,8 +111,8 @@ void FixNHSphereOMP::nve_v() void FixNHSphereOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const omega = (dbl3_t *) atom->omega[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nve_omp.cpp b/src/OPENMP/fix_nve_omp.cpp index 1380d4ea18..6562e90270 100644 --- a/src/OPENMP/fix_nve_omp.cpp +++ b/src/OPENMP/fix_nve_omp.cpp @@ -34,9 +34,9 @@ void FixNVEOMP::initial_integrate(int /* vflag */) { // update v and x of atoms in group - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -81,8 +81,8 @@ void FixNVEOMP::final_integrate() { // update v of atoms in group - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nvt_sllod_omp.cpp b/src/OPENMP/fix_nvt_sllod_omp.cpp index 3a36b0eff5..dae2dfb5d3 100644 --- a/src/OPENMP/fix_nvt_sllod_omp.cpp +++ b/src/OPENMP/fix_nvt_sllod_omp.cpp @@ -100,7 +100,7 @@ void FixNVTSllodOMP::nh_v_temp() // calculate temperature since some computes require temp // computed on current nlocal atoms to remove bias - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_omp.cpp b/src/OPENMP/fix_omp.cpp index 6be7f7c1fc..849f1f42b9 100644 --- a/src/OPENMP/fix_omp.cpp +++ b/src/OPENMP/fix_omp.cpp @@ -130,7 +130,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) #endif { const int tid = get_tid(); - Timer *t = new Timer(lmp); + auto t = new Timer(lmp); thr[tid] = new ThrData(tid,t); } } @@ -182,7 +182,7 @@ void FixOMP::init() #endif { const int tid = get_tid(); - Timer *t = new Timer(lmp); + auto t = new Timer(lmp); thr[tid] = new ThrData(tid,t); } } diff --git a/src/OPENMP/fix_qeq_reaxff_omp.cpp b/src/OPENMP/fix_qeq_reaxff_omp.cpp index 63dd28aa77..27a4ed037b 100644 --- a/src/OPENMP/fix_qeq_reaxff_omp.cpp +++ b/src/OPENMP/fix_qeq_reaxff_omp.cpp @@ -118,7 +118,7 @@ void FixQEqReaxFFOMP::init() memory->create(aspc_b, aspc_order_max+2, "qeq/reaxff/aspc_b"); // Calculate damping factor - double o = double(aspc_order); + auto o = double(aspc_order); aspc_omega = (o+2.0) / (2*o+3.0); // Calculate B coefficients diff --git a/src/OPENMP/fix_rigid_nh_omp.cpp b/src/OPENMP/fix_rigid_nh_omp.cpp index 4e73eaa89b..ce13bf3c37 100644 --- a/src/OPENMP/fix_rigid_nh_omp.cpp +++ b/src/OPENMP/fix_rigid_nh_omp.cpp @@ -236,7 +236,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) void FixRigidNHOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; @@ -606,9 +606,9 @@ void FixRigidNHOMP::remap() template void FixRigidNHOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -633,9 +633,9 @@ void FixRigidNHOMP::set_xv_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &xcmi = * ((dbl3_t *) xcm[ibody]); - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &xcmi = * ((dbl3_t *) xcm[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); const int xbox = (xcmimage[i] & IMGMASK) - IMGMAX; const int ybox = (xcmimage[i] >> IMGBITS & IMGMASK) - IMGMAX; @@ -806,9 +806,9 @@ void FixRigidNHOMP::set_xv_thr() template void FixRigidNHOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -833,8 +833,8 @@ void FixRigidNHOMP::set_v_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); double delta[3],vx,vy,vz; MathExtra::matvec(ex_space[ibody],ey_space[ibody], diff --git a/src/OPENMP/fix_rigid_omp.cpp b/src/OPENMP/fix_rigid_omp.cpp index 97a2b50827..b5d73fe18a 100644 --- a/src/OPENMP/fix_rigid_omp.cpp +++ b/src/OPENMP/fix_rigid_omp.cpp @@ -109,7 +109,7 @@ void FixRigidOMP::initial_integrate(int vflag) void FixRigidOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; @@ -326,9 +326,9 @@ void FixRigidOMP::final_integrate() template void FixRigidOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -353,9 +353,9 @@ void FixRigidOMP::set_xv_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &xcmi = * ((dbl3_t *) xcm[ibody]); - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &xcmi = * ((dbl3_t *) xcm[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); const int xbox = (xcmimage[i] & IMGMASK) - IMGMAX; const int ybox = (xcmimage[i] >> IMGBITS & IMGMASK) - IMGMAX; @@ -526,9 +526,9 @@ void FixRigidOMP::set_xv_thr() template void FixRigidOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -553,8 +553,8 @@ void FixRigidOMP::set_v_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); double delta[3],vx,vy,vz; MathExtra::matvec(ex_space[ibody],ey_space[ibody], diff --git a/src/OPENMP/fix_rigid_small_omp.cpp b/src/OPENMP/fix_rigid_small_omp.cpp index 896bfdff38..62235b84a7 100644 --- a/src/OPENMP/fix_rigid_small_omp.cpp +++ b/src/OPENMP/fix_rigid_small_omp.cpp @@ -111,7 +111,7 @@ void FixRigidSmallOMP::initial_integrate(int vflag) void FixRigidSmallOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; const int nthreads=comm->nthreads; @@ -273,9 +273,9 @@ void FixRigidSmallOMP::final_integrate() template void FixRigidSmallOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -468,9 +468,9 @@ void FixRigidSmallOMP::set_xv_thr() template void FixRigidSmallOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; diff --git a/src/OPENMP/improper_class2_omp.cpp b/src/OPENMP/improper_class2_omp.cpp index ad53ecd735..9474b696f5 100644 --- a/src/OPENMP/improper_class2_omp.cpp +++ b/src/OPENMP/improper_class2_omp.cpp @@ -106,8 +106,8 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; @@ -506,8 +506,8 @@ void ImproperClass2OMP::angleangle_thr(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_cossq_omp.cpp b/src/OPENMP/improper_cossq_omp.cpp index 24d7919995..acb6cd0d46 100644 --- a/src/OPENMP/improper_cossq_omp.cpp +++ b/src/OPENMP/improper_cossq_omp.cpp @@ -91,8 +91,8 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_cvff_omp.cpp b/src/OPENMP/improper_cvff_omp.cpp index 3cceb856a9..47b9b930e1 100644 --- a/src/OPENMP/improper_cvff_omp.cpp +++ b/src/OPENMP/improper_cvff_omp.cpp @@ -93,8 +93,8 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_harmonic_omp.cpp b/src/OPENMP/improper_harmonic_omp.cpp index 97d8ad174d..9d341febff 100644 --- a/src/OPENMP/improper_harmonic_omp.cpp +++ b/src/OPENMP/improper_harmonic_omp.cpp @@ -92,8 +92,8 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_umbrella_omp.cpp b/src/OPENMP/improper_umbrella_omp.cpp index 91c9237826..a07ac6a73f 100644 --- a/src/OPENMP/improper_umbrella_omp.cpp +++ b/src/OPENMP/improper_umbrella_omp.cpp @@ -91,8 +91,8 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_adp_omp.cpp b/src/OPENMP/pair_adp_omp.cpp index cf9514e4d6..93a0fa1215 100644 --- a/src/OPENMP/pair_adp_omp.cpp +++ b/src/OPENMP/pair_adp_omp.cpp @@ -112,8 +112,8 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const * const mu_t = thr->get_mu(); double * const * const lambda_t = thr->get_lambda(); diff --git a/src/OPENMP/pair_agni_omp.cpp b/src/OPENMP/pair_agni_omp.cpp index 814845108f..4719d7e4a4 100644 --- a/src/OPENMP/pair_agni_omp.cpp +++ b/src/OPENMP/pair_agni_omp.cpp @@ -80,8 +80,8 @@ void PairAGNIOMP::eval(int iifrom, int iito, ThrData * const thr) double rsq; int *ilist,*jlist,*numneigh,**firstneigh; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; ilist = list->ilist; diff --git a/src/OPENMP/pair_beck_omp.cpp b/src/OPENMP/pair_beck_omp.cpp index 5f9a9efa8a..dae9decc0e 100644 --- a/src/OPENMP/pair_beck_omp.cpp +++ b/src/OPENMP/pair_beck_omp.cpp @@ -88,8 +88,8 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_born_coul_long_omp.cpp b/src/OPENMP/pair_born_coul_long_omp.cpp index 99851bb943..9d52b6cc8c 100644 --- a/src/OPENMP/pair_born_coul_long_omp.cpp +++ b/src/OPENMP/pair_born_coul_long_omp.cpp @@ -95,8 +95,8 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_coul_msm_omp.cpp b/src/OPENMP/pair_born_coul_msm_omp.cpp index 0fe1456ec7..ec6cb989c3 100644 --- a/src/OPENMP/pair_born_coul_msm_omp.cpp +++ b/src/OPENMP/pair_born_coul_msm_omp.cpp @@ -93,8 +93,8 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_coul_wolf_omp.cpp b/src/OPENMP/pair_born_coul_wolf_omp.cpp index 32d7830faf..af6771fd9c 100644 --- a/src/OPENMP/pair_born_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_born_coul_wolf_omp.cpp @@ -90,8 +90,8 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_omp.cpp b/src/OPENMP/pair_born_omp.cpp index ea6d64fc33..673136b00b 100644 --- a/src/OPENMP/pair_born_omp.cpp +++ b/src/OPENMP/pair_born_omp.cpp @@ -83,8 +83,8 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_buck_coul_cut_omp.cpp b/src/OPENMP/pair_buck_coul_cut_omp.cpp index 0df45126bf..4f086932db 100644 --- a/src/OPENMP/pair_buck_coul_cut_omp.cpp +++ b/src/OPENMP/pair_buck_coul_cut_omp.cpp @@ -85,8 +85,8 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_coul_long_omp.cpp b/src/OPENMP/pair_buck_coul_long_omp.cpp index 396b4edd3c..0b4f26bf52 100644 --- a/src/OPENMP/pair_buck_coul_long_omp.cpp +++ b/src/OPENMP/pair_buck_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_coul_msm_omp.cpp b/src/OPENMP/pair_buck_coul_msm_omp.cpp index 6442f45eac..e859a0e284 100644 --- a/src/OPENMP/pair_buck_coul_msm_omp.cpp +++ b/src/OPENMP/pair_buck_coul_msm_omp.cpp @@ -94,8 +94,8 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_omp.cpp b/src/OPENMP/pair_buck_omp.cpp index 88314f912a..285e2fadde 100644 --- a/src/OPENMP/pair_buck_omp.cpp +++ b/src/OPENMP/pair_buck_omp.cpp @@ -83,8 +83,8 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_colloid_omp.cpp b/src/OPENMP/pair_colloid_omp.cpp index ecd560bb8e..64a7d06322 100644 --- a/src/OPENMP/pair_colloid_omp.cpp +++ b/src/OPENMP/pair_colloid_omp.cpp @@ -88,8 +88,8 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_coul_cut_omp.cpp b/src/OPENMP/pair_coul_cut_omp.cpp index c1d672e637..884fe532be 100644 --- a/src/OPENMP/pair_coul_cut_omp.cpp +++ b/src/OPENMP/pair_coul_cut_omp.cpp @@ -85,8 +85,8 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_cut_soft_omp.cpp b/src/OPENMP/pair_coul_cut_soft_omp.cpp index d5669b200a..6b16d71442 100644 --- a/src/OPENMP/pair_coul_cut_soft_omp.cpp +++ b/src/OPENMP/pair_coul_cut_soft_omp.cpp @@ -86,8 +86,8 @@ void PairCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_debye_omp.cpp b/src/OPENMP/pair_coul_debye_omp.cpp index 757b7ec66e..622a84da95 100644 --- a/src/OPENMP/pair_coul_debye_omp.cpp +++ b/src/OPENMP/pair_coul_debye_omp.cpp @@ -85,8 +85,8 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_diel_omp.cpp b/src/OPENMP/pair_coul_diel_omp.cpp index be2f771e67..4de5b69f7e 100644 --- a/src/OPENMP/pair_coul_diel_omp.cpp +++ b/src/OPENMP/pair_coul_diel_omp.cpp @@ -86,8 +86,8 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_dsf_omp.cpp b/src/OPENMP/pair_coul_dsf_omp.cpp index 6df673ee80..e36c12172f 100644 --- a/src/OPENMP/pair_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_coul_dsf_omp.cpp @@ -95,8 +95,8 @@ void PairCoulDSFOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int nlocal = atom->nlocal; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_coul_long_omp.cpp b/src/OPENMP/pair_coul_long_omp.cpp index 9c15243f87..a54dc8c966 100644 --- a/src/OPENMP/pair_coul_long_omp.cpp +++ b/src/OPENMP/pair_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_long_soft_omp.cpp b/src/OPENMP/pair_coul_long_soft_omp.cpp index 0c31d8020e..b7d9cfc2fa 100644 --- a/src/OPENMP/pair_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_coul_long_soft_omp.cpp @@ -96,8 +96,8 @@ void PairCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_msm_omp.cpp b/src/OPENMP/pair_coul_msm_omp.cpp index 5165797fd6..bf18009117 100644 --- a/src/OPENMP/pair_coul_msm_omp.cpp +++ b/src/OPENMP/pair_coul_msm_omp.cpp @@ -95,8 +95,8 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_wolf_omp.cpp b/src/OPENMP/pair_coul_wolf_omp.cpp index 99d320353d..520fe790b7 100644 --- a/src/OPENMP/pair_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_coul_wolf_omp.cpp @@ -90,8 +90,8 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int nlocal = atom->nlocal; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_dpd_omp.cpp b/src/OPENMP/pair_dpd_omp.cpp index db03581762..8d47a6d8b6 100644 --- a/src/OPENMP/pair_dpd_omp.cpp +++ b/src/OPENMP/pair_dpd_omp.cpp @@ -127,9 +127,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_dpd_tstat_omp.cpp b/src/OPENMP/pair_dpd_tstat_omp.cpp index 8a329321a8..7909a1b8c1 100644 --- a/src/OPENMP/pair_dpd_tstat_omp.cpp +++ b/src/OPENMP/pair_dpd_tstat_omp.cpp @@ -125,9 +125,9 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) double rsq,r,rinv,dot,wd,randnum,factor_dpd; int *ilist,*jlist,*numneigh,**firstneigh; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_eam_omp.cpp b/src/OPENMP/pair_eam_omp.cpp index 2653cfba63..b3c963c3df 100644 --- a/src/OPENMP/pair_eam_omp.cpp +++ b/src/OPENMP/pair_eam_omp.cpp @@ -104,8 +104,8 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); const int tid = thr->get_tid(); const int nthreads = comm->nthreads; diff --git a/src/OPENMP/pair_edip_omp.cpp b/src/OPENMP/pair_edip_omp.cpp index da025d75d5..15619c277a 100644 --- a/src/OPENMP/pair_edip_omp.cpp +++ b/src/OPENMP/pair_edip_omp.cpp @@ -151,8 +151,8 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData *const thr) double *pre_thrPow2B_ij = prePow2B_ij + tid * leadDimInteractionList; double *pre_thrForceCoord = preForceCoord + tid * leadDimInteractionList; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int *_noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_eim_omp.cpp b/src/OPENMP/pair_eim_omp.cpp index 8c7b69c41b..aa6d2532f5 100644 --- a/src/OPENMP/pair_eim_omp.cpp +++ b/src/OPENMP/pair_eim_omp.cpp @@ -103,8 +103,8 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const fp_t = thr->get_fp(); const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_gauss_cut_omp.cpp b/src/OPENMP/pair_gauss_cut_omp.cpp index a36cb7c981..2460d66334 100644 --- a/src/OPENMP/pair_gauss_cut_omp.cpp +++ b/src/OPENMP/pair_gauss_cut_omp.cpp @@ -84,8 +84,8 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_gauss_omp.cpp b/src/OPENMP/pair_gauss_omp.cpp index eb8630d12c..3cdbb360e7 100644 --- a/src/OPENMP/pair_gauss_omp.cpp +++ b/src/OPENMP/pair_gauss_omp.cpp @@ -88,8 +88,8 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; double fxtmp,fytmp,fztmp; diff --git a/src/OPENMP/pair_gayberne_omp.cpp b/src/OPENMP/pair_gayberne_omp.cpp index 2476243305..e756e580a7 100644 --- a/src/OPENMP/pair_gayberne_omp.cpp +++ b/src/OPENMP/pair_gayberne_omp.cpp @@ -84,9 +84,9 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; double *iquat,*jquat; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; - dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_gran_hertz_history_omp.cpp b/src/OPENMP/pair_gran_hertz_history_omp.cpp index 2ee0921688..66be06020f 100644 --- a/src/OPENMP/pair_gran_hertz_history_omp.cpp +++ b/src/OPENMP/pair_gran_hertz_history_omp.cpp @@ -57,7 +57,7 @@ void PairGranHertzHistoryOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_gran_hooke_history_omp.cpp b/src/OPENMP/pair_gran_hooke_history_omp.cpp index 64482fd634..8dad7f463a 100644 --- a/src/OPENMP/pair_gran_hooke_history_omp.cpp +++ b/src/OPENMP/pair_gran_hooke_history_omp.cpp @@ -54,7 +54,7 @@ void PairGranHookeHistoryOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_gran_hooke_omp.cpp b/src/OPENMP/pair_gran_hooke_omp.cpp index 85277f0719..bfe91b63da 100644 --- a/src/OPENMP/pair_gran_hooke_omp.cpp +++ b/src/OPENMP/pair_gran_hooke_omp.cpp @@ -53,7 +53,7 @@ void PairGranHookeOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_harmonic_cut_omp.cpp b/src/OPENMP/pair_harmonic_cut_omp.cpp index 4412a72bc3..d7540d7c11 100644 --- a/src/OPENMP/pair_harmonic_cut_omp.cpp +++ b/src/OPENMP/pair_harmonic_cut_omp.cpp @@ -79,8 +79,8 @@ void PairHarmonicCutOMP::compute(int eflag, int vflag) template void PairHarmonicCutOMP::eval(int iifrom, int iito, ThrData *const thr) { - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int *_noalias const type = atom->type; const double *_noalias const special_lj = force->special_lj; const int *_noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp index 6d2fc10a3a..66f1a85c39 100644 --- a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp @@ -130,8 +130,8 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const molindex = atom->molindex; const int * _noalias const molatom = atom->molatom; diff --git a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp index badefcd985..f7cecda03a 100644 --- a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp @@ -129,8 +129,8 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int * _noalias const molindex = atom->molindex; diff --git a/src/OPENMP/pair_lj96_cut_omp.cpp b/src/OPENMP/pair_lj96_cut_omp.cpp index 177edcd00f..7ffa4f6a97 100644 --- a/src/OPENMP/pair_lj96_cut_omp.cpp +++ b/src/OPENMP/pair_lj96_cut_omp.cpp @@ -85,8 +85,8 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 8f7152b97d..5addcd167a 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -85,8 +85,8 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp index 0ccb471760..7a14e76ea2 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -87,8 +87,8 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp index 5fabdf7b1a..64cfb69882 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp @@ -81,8 +81,8 @@ template void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp index 7f65e405f2..9e127120a9 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -81,8 +81,8 @@ template void PairLJCharmmCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp index ee46f92e31..6bbb4040e3 100644 --- a/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp @@ -87,8 +87,8 @@ template void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp b/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp index 1fc2abf8ba..e9086f27e3 100644 --- a/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp @@ -87,8 +87,8 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_class2_coul_long_omp.cpp b/src/OPENMP/pair_lj_class2_coul_long_omp.cpp index 01115c6cb2..eaa6ac4366 100644 --- a/src/OPENMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_class2_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_class2_omp.cpp b/src/OPENMP/pair_lj_class2_omp.cpp index 758cd8fae0..4cc9801357 100644 --- a/src/OPENMP/pair_lj_class2_omp.cpp +++ b/src/OPENMP/pair_lj_class2_omp.cpp @@ -84,8 +84,8 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cubic_omp.cpp b/src/OPENMP/pair_lj_cubic_omp.cpp index e6e72096c9..d89e6cb711 100644 --- a/src/OPENMP/pair_lj_cubic_omp.cpp +++ b/src/OPENMP/pair_lj_cubic_omp.cpp @@ -88,8 +88,8 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp index 6d013c5f7c..04f2730f13 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp @@ -106,11 +106,11 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th evdwl = ecoul = 0.0; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const double *_noalias const q = atom->q; const double *_noalias const eps = atom->epsilon; - const dbl3_t *_noalias const norm = (dbl3_t *) atom->mu[0]; + const auto *_noalias const norm = (dbl3_t *) atom->mu[0]; const double *_noalias const curvature = atom->curvature; const double *_noalias const area = atom->area; const int *_noalias const type = atom->type; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp index e86bd88936..0df235b626 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp @@ -86,8 +86,8 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp index b44d56d6f3..b1afa96bf5 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -87,8 +87,8 @@ void PairLJCutCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp b/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp index 9996149e58..7797d938b7 100644 --- a/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp @@ -87,8 +87,8 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp index 59cd3e7467..e305c1caf9 100644 --- a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulDSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp index c076501d68..5c773891f8 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp @@ -112,11 +112,11 @@ void PairLJCutCoulLongDielectricOMP::eval(int iifrom, int iito, ThrData *const t evdwl = ecoul = 0.0; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const double *_noalias const q = atom->q; const double *_noalias const eps = atom->epsilon; - const dbl3_t *_noalias const norm = (dbl3_t *) atom->mu[0]; + const auto *_noalias const norm = (dbl3_t *) atom->mu[0]; const double *_noalias const curvature = atom->curvature; const double *_noalias const area = atom->area; const int *_noalias const type = atom->type; diff --git a/src/OPENMP/pair_lj_cut_coul_long_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_omp.cpp index c66ccb40cc..af551017b2 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp index 5911f38072..3ceb40b262 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp b/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp index ccc92489b4..d573a349c1 100644 --- a/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp @@ -95,8 +95,8 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp b/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp index 5c00a88702..55c2bc6c11 100644 --- a/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp @@ -89,8 +89,8 @@ void PairLJCutCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp b/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp index 3da8e9f59c..1cecb1c7c4 100644 --- a/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp @@ -88,8 +88,8 @@ void PairLJCutDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); const double * _noalias const q = atom->q; const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; diff --git a/src/OPENMP/pair_lj_cut_omp.cpp b/src/OPENMP/pair_lj_cut_omp.cpp index e62c422e15..96ecd959e2 100644 --- a/src/OPENMP/pair_lj_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_omp.cpp @@ -75,8 +75,8 @@ void PairLJCutOMP::compute(int eflag, int vflag) template void PairLJCutOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_lj_cut_soft_omp.cpp b/src/OPENMP/pair_lj_cut_soft_omp.cpp index ac39009ebe..c9b1a4bc42 100644 --- a/src/OPENMP/pair_lj_cut_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_soft_omp.cpp @@ -75,8 +75,8 @@ void PairLJCutSoftOMP::compute(int eflag, int vflag) template void PairLJCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp index e81dfbe242..1034e8e0e5 100644 --- a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp @@ -98,8 +98,8 @@ void PairLJCutTholeLongOMP::compute(int eflag, int vflag) template void PairLJCutTholeLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp index 3c02a5898f..be6f77f7f5 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -139,8 +139,8 @@ void PairLJCutTIP4PCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp index 06858a7b52..b6948f0c8b 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp @@ -153,8 +153,8 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp index 8ba108e3a4..49e76992f7 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -141,8 +141,8 @@ void PairLJCutTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_expand_omp.cpp b/src/OPENMP/pair_lj_expand_omp.cpp index e22c773f97..35d23aadc4 100644 --- a/src/OPENMP/pair_lj_expand_omp.cpp +++ b/src/OPENMP/pair_lj_expand_omp.cpp @@ -85,8 +85,8 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp index ad75760f2b..096f60b1ec 100644 --- a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -87,8 +87,8 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_gromacs_omp.cpp b/src/OPENMP/pair_lj_gromacs_omp.cpp index fd1001e30b..f450d83705 100644 --- a/src/OPENMP/pair_lj_gromacs_omp.cpp +++ b/src/OPENMP/pair_lj_gromacs_omp.cpp @@ -85,8 +85,8 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp b/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp index 606e57188a..b0fdf3a393 100644 --- a/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp @@ -718,8 +718,8 @@ template < const int EVFLAG, const int EFLAG, const int NEWTON_PAIR, const int CTABLE, const int LJTABLE, const int ORDER1, const int ORDER6 > void PairLJLongTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1095,8 +1095,8 @@ void PairLJLongTIP4PLongOMP::eval_inner(int iifrom, int iito, ThrData * const th { double rsq, r2inv, forcecoul = 0.0, forcelj, cforce; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1352,8 +1352,8 @@ void PairLJLongTIP4PLongOMP::eval_middle(int iifrom, int iito, ThrData * const t { double rsq, r2inv, forcecoul,forcelj, cforce; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1622,8 +1622,8 @@ void PairLJLongTIP4PLongOMP::eval_outer(int iifrom, int iito, ThrData * const th double v[6]; dbl3_t x1,x2,xH1,xH2; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; diff --git a/src/OPENMP/pair_lj_relres_omp.cpp b/src/OPENMP/pair_lj_relres_omp.cpp index 250710cfa1..159b22bbb1 100644 --- a/src/OPENMP/pair_lj_relres_omp.cpp +++ b/src/OPENMP/pair_lj_relres_omp.cpp @@ -85,8 +85,8 @@ void PairLJRelResOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp b/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp index 747aa88fa6..fff5d17b13 100644 --- a/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp @@ -81,8 +81,8 @@ template void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_sdk_omp.cpp b/src/OPENMP/pair_lj_sdk_omp.cpp index 05a7bac568..909bb73fc8 100644 --- a/src/OPENMP/pair_lj_sdk_omp.cpp +++ b/src/OPENMP/pair_lj_sdk_omp.cpp @@ -88,8 +88,8 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp b/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp index 70ce7e5a23..36ac61a14c 100644 --- a/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp @@ -92,8 +92,8 @@ void PairLJSFDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); const double * _noalias const q = atom->q; const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; diff --git a/src/OPENMP/pair_lj_smooth_linear_omp.cpp b/src/OPENMP/pair_lj_smooth_linear_omp.cpp index 21589a7480..49768a8641 100644 --- a/src/OPENMP/pair_lj_smooth_linear_omp.cpp +++ b/src/OPENMP/pair_lj_smooth_linear_omp.cpp @@ -85,8 +85,8 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_smooth_omp.cpp b/src/OPENMP/pair_lj_smooth_omp.cpp index 6831459c7c..f142fb7930 100644 --- a/src/OPENMP/pair_lj_smooth_omp.cpp +++ b/src/OPENMP/pair_lj_smooth_omp.cpp @@ -85,8 +85,8 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_meam_spline_omp.cpp b/src/OPENMP/pair_meam_spline_omp.cpp index 19da4c90ec..d704b9c19c 100644 --- a/src/OPENMP/pair_meam_spline_omp.cpp +++ b/src/OPENMP/pair_meam_spline_omp.cpp @@ -100,7 +100,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) } // Allocate array for temporary bond info. - MEAM2Body *myTwoBodyInfo = new MEAM2Body[myMaxNeighbors]; + auto myTwoBodyInfo = new MEAM2Body[myMaxNeighbors]; const double * const * const x = atom->x; double * const * const forces = thr->get_f(); diff --git a/src/OPENMP/pair_morse_omp.cpp b/src/OPENMP/pair_morse_omp.cpp index 7078ffee30..76026e7598 100644 --- a/src/OPENMP/pair_morse_omp.cpp +++ b/src/OPENMP/pair_morse_omp.cpp @@ -84,8 +84,8 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_morse_smooth_linear_omp.cpp b/src/OPENMP/pair_morse_smooth_linear_omp.cpp index 85088dc30f..448a094993 100644 --- a/src/OPENMP/pair_morse_smooth_linear_omp.cpp +++ b/src/OPENMP/pair_morse_smooth_linear_omp.cpp @@ -86,8 +86,8 @@ void PairMorseSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp b/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp index b888dbdb82..0dc2d7f094 100644 --- a/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp @@ -86,8 +86,8 @@ void PairNMCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_nm_cut_coul_long_omp.cpp b/src/OPENMP/pair_nm_cut_coul_long_omp.cpp index bacf06a06a..9f09258ce8 100644 --- a/src/OPENMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/OPENMP/pair_nm_cut_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairNMCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_nm_cut_omp.cpp b/src/OPENMP/pair_nm_cut_omp.cpp index 6c4765023a..6fe77934f1 100644 --- a/src/OPENMP/pair_nm_cut_omp.cpp +++ b/src/OPENMP/pair_nm_cut_omp.cpp @@ -76,8 +76,8 @@ void PairNMCutOMP::compute(int eflag, int vflag) template void PairNMCutOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_resquared_omp.cpp b/src/OPENMP/pair_resquared_omp.cpp index af75e8b161..a02427f09f 100644 --- a/src/OPENMP/pair_resquared_omp.cpp +++ b/src/OPENMP/pair_resquared_omp.cpp @@ -82,9 +82,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; RE2Vars wi,wj; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; - dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_soft_omp.cpp b/src/OPENMP/pair_soft_omp.cpp index b524d8a371..277810a60e 100644 --- a/src/OPENMP/pair_soft_omp.cpp +++ b/src/OPENMP/pair_soft_omp.cpp @@ -88,8 +88,8 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_sw_omp.cpp b/src/OPENMP/pair_sw_omp.cpp index 22cf2b4dba..f6d615b2a1 100644 --- a/src/OPENMP/pair_sw_omp.cpp +++ b/src/OPENMP/pair_sw_omp.cpp @@ -80,8 +80,8 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_table_omp.cpp b/src/OPENMP/pair_table_omp.cpp index 72d5ecd4de..d60dfb58f1 100644 --- a/src/OPENMP/pair_table_omp.cpp +++ b/src/OPENMP/pair_table_omp.cpp @@ -86,8 +86,8 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_tersoff_mod_c_omp.cpp b/src/OPENMP/pair_tersoff_mod_c_omp.cpp index cd59e06673..bfd55f3b0e 100644 --- a/src/OPENMP/pair_tersoff_mod_c_omp.cpp +++ b/src/OPENMP/pair_tersoff_mod_c_omp.cpp @@ -101,8 +101,8 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_mod_omp.cpp b/src/OPENMP/pair_tersoff_mod_omp.cpp index de19aa3872..d7c64002c5 100644 --- a/src/OPENMP/pair_tersoff_mod_omp.cpp +++ b/src/OPENMP/pair_tersoff_mod_omp.cpp @@ -101,8 +101,8 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_omp.cpp b/src/OPENMP/pair_tersoff_omp.cpp index 2a3cfb5d54..50c002a01b 100644 --- a/src/OPENMP/pair_tersoff_omp.cpp +++ b/src/OPENMP/pair_tersoff_omp.cpp @@ -104,8 +104,8 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_table_omp.cpp b/src/OPENMP/pair_tersoff_table_omp.cpp index 94f9e72c3d..010a3f5610 100644 --- a/src/OPENMP/pair_tersoff_table_omp.cpp +++ b/src/OPENMP/pair_tersoff_table_omp.cpp @@ -112,8 +112,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) double evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_tip4p_cut_omp.cpp b/src/OPENMP/pair_tip4p_cut_omp.cpp index fb3e907761..91d0063a01 100644 --- a/src/OPENMP/pair_tip4p_cut_omp.cpp +++ b/src/OPENMP/pair_tip4p_cut_omp.cpp @@ -138,8 +138,8 @@ void PairTIP4PCutOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_tip4p_long_omp.cpp b/src/OPENMP/pair_tip4p_long_omp.cpp index 2f08746db5..21d4484e99 100644 --- a/src/OPENMP/pair_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_tip4p_long_omp.cpp @@ -153,8 +153,8 @@ void PairTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_tip4p_long_soft_omp.cpp b/src/OPENMP/pair_tip4p_long_soft_omp.cpp index 3bbb0717ab..e2d8023d4b 100644 --- a/src/OPENMP/pair_tip4p_long_soft_omp.cpp +++ b/src/OPENMP/pair_tip4p_long_soft_omp.cpp @@ -140,8 +140,8 @@ void PairTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_ufm_omp.cpp b/src/OPENMP/pair_ufm_omp.cpp index 2140de5546..aa7a7ed3ea 100644 --- a/src/OPENMP/pair_ufm_omp.cpp +++ b/src/OPENMP/pair_ufm_omp.cpp @@ -86,8 +86,8 @@ void PairUFMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_vashishta_omp.cpp b/src/OPENMP/pair_vashishta_omp.cpp index 3e5a13ae06..e867e58a6d 100644 --- a/src/OPENMP/pair_vashishta_omp.cpp +++ b/src/OPENMP/pair_vashishta_omp.cpp @@ -80,8 +80,8 @@ void PairVashishtaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_vashishta_table_omp.cpp b/src/OPENMP/pair_vashishta_table_omp.cpp index c40259af88..eb9e80b7a3 100644 --- a/src/OPENMP/pair_vashishta_table_omp.cpp +++ b/src/OPENMP/pair_vashishta_table_omp.cpp @@ -80,8 +80,8 @@ void PairVashishtaTableOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_yukawa_colloid_omp.cpp b/src/OPENMP/pair_yukawa_colloid_omp.cpp index a6fea6f0d4..f879eeddf9 100644 --- a/src/OPENMP/pair_yukawa_colloid_omp.cpp +++ b/src/OPENMP/pair_yukawa_colloid_omp.cpp @@ -84,8 +84,8 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const radius = atom->radius; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_yukawa_omp.cpp b/src/OPENMP/pair_yukawa_omp.cpp index ac7b2302ad..efaa42fb50 100644 --- a/src/OPENMP/pair_yukawa_omp.cpp +++ b/src/OPENMP/pair_yukawa_omp.cpp @@ -84,8 +84,8 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_zbl_omp.cpp b/src/OPENMP/pair_zbl_omp.cpp index 1ce0200b99..a1083e0658 100644 --- a/src/OPENMP/pair_zbl_omp.cpp +++ b/src/OPENMP/pair_zbl_omp.cpp @@ -76,8 +76,8 @@ void PairZBLOMP::compute(int eflag, int vflag) template void PairZBLOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; diff --git a/src/OPENMP/pppm_cg_omp.cpp b/src/OPENMP/pppm_cg_omp.cpp index 1a245b1323..5dd78770f5 100644 --- a/src/OPENMP/pppm_cg_omp.cpp +++ b/src/OPENMP/pppm_cg_omp.cpp @@ -359,8 +359,8 @@ void PPPMCGOMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -441,7 +441,7 @@ void PPPMCGOMP::fieldforce_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const double qqrd2e = force->qqrd2e; const int nthreads = comm->nthreads; @@ -458,7 +458,7 @@ void PPPMCGOMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (int j = ifrom; j < ito; ++j) { @@ -522,7 +522,7 @@ void PPPMCGOMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const double qqrd2e = force->qqrd2e; const int nthreads = comm->nthreads; @@ -540,7 +540,7 @@ void PPPMCGOMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -616,7 +616,7 @@ void PPPMCGOMP::fieldforce_peratom() // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const int nthreads = comm->nthreads; diff --git a/src/OPENMP/pppm_disp_omp.cpp b/src/OPENMP/pppm_disp_omp.cpp index 3c9767e85d..e4937002a6 100644 --- a/src/OPENMP/pppm_disp_omp.cpp +++ b/src/OPENMP/pppm_disp_omp.cpp @@ -344,8 +344,8 @@ void PPPMDispOMP::particle_map(double dxinv, double dyinv, int nxhi_o, int nyhi_o, int nzhi_o) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -426,8 +426,8 @@ void PPPMDispOMP::make_rho_c() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -515,8 +515,8 @@ void PPPMDispOMP::make_rho_g() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -619,8 +619,8 @@ void PPPMDispOMP::make_rho_a() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; diff --git a/src/OPENMP/pppm_disp_tip4p_omp.cpp b/src/OPENMP/pppm_disp_tip4p_omp.cpp index 083577f16f..56f3f14c2c 100644 --- a/src/OPENMP/pppm_disp_tip4p_omp.cpp +++ b/src/OPENMP/pppm_disp_tip4p_omp.cpp @@ -338,8 +338,8 @@ void PPPMDispTIP4POMP::particle_map_c(double dxinv, double dyinv, if (atom->nlocal == 0) return; const int * _noalias const type = atom->type; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -417,8 +417,8 @@ void PPPMDispTIP4POMP::particle_map(double dxinv, double dyinv, // no local atoms => nothing to do if (atom->nlocal == 0) return; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -496,8 +496,8 @@ void PPPMDispTIP4POMP::make_rho_c() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; dbl3_t xM; @@ -590,8 +590,8 @@ void PPPMDispTIP4POMP::make_rho_g() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -692,8 +692,8 @@ void PPPMDispTIP4POMP::make_rho_a() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -789,9 +789,9 @@ void PPPMDispTIP4POMP::fieldforce_c_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -811,7 +811,7 @@ void PPPMDispTIP4POMP::fieldforce_c_ik() // get per thread data ThrData *thr = fix->get_thr(tid); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -897,9 +897,9 @@ void PPPMDispTIP4POMP::fieldforce_c_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -920,7 +920,7 @@ void PPPMDispTIP4POMP::fieldforce_c_ad() // get per thread data ThrData *thr = fix->get_thr(tid); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -1856,7 +1856,7 @@ void PPPMDispTIP4POMP::find_M_thr(int i, int &iH1, int &iH2, dbl3_t &xM) iH1 = domain->closest_image(i,iH1); iH2 = domain->closest_image(i,iH2); - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; double delx1 = x[iH1].x - x[i].x; double dely1 = x[iH1].y - x[i].y; diff --git a/src/OPENMP/pppm_omp.cpp b/src/OPENMP/pppm_omp.cpp index e82a6b0b13..221f0be836 100644 --- a/src/OPENMP/pppm_omp.cpp +++ b/src/OPENMP/pppm_omp.cpp @@ -358,8 +358,8 @@ void PPPMOMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -441,9 +441,9 @@ void PPPMOMP::fieldforce_ik() if (nlocal == 0) return; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; @@ -462,7 +462,7 @@ void PPPMOMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -527,9 +527,9 @@ void PPPMOMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -548,7 +548,7 @@ void PPPMOMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -625,7 +625,7 @@ void PPPMOMP::fieldforce_peratom() // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; #if defined(_OPENMP) diff --git a/src/OPENMP/pppm_tip4p_omp.cpp b/src/OPENMP/pppm_tip4p_omp.cpp index 9d8832681e..b9902df398 100644 --- a/src/OPENMP/pppm_tip4p_omp.cpp +++ b/src/OPENMP/pppm_tip4p_omp.cpp @@ -346,8 +346,8 @@ void PPPMTIP4POMP::particle_map() if (atom->nlocal == 0) return; const int * _noalias const type = atom->type; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -423,8 +423,8 @@ void PPPMTIP4POMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; dbl3_t xM; @@ -513,9 +513,9 @@ void PPPMTIP4POMP::fieldforce_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -536,7 +536,7 @@ void PPPMTIP4POMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -624,9 +624,9 @@ void PPPMTIP4POMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -648,7 +648,7 @@ void PPPMTIP4POMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -837,7 +837,7 @@ void PPPMTIP4POMP::find_M_thr(int i, int &iH1, int &iH2, dbl3_t &xM) iH1 = domain->closest_image(i,iH1); iH2 = domain->closest_image(i,iH2); - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; double delx1 = x[iH1].x - x[i].x; double dely1 = x[iH1].y - x[i].y; diff --git a/src/OPENMP/thr_omp.cpp b/src/OPENMP/thr_omp.cpp index 73a5f97ca2..01f12ed17d 100644 --- a/src/OPENMP/thr_omp.cpp +++ b/src/OPENMP/thr_omp.cpp @@ -210,7 +210,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, } if (evflag) { - Pair * const pair = (Pair *)style; + auto const pair = (Pair *)style; #if defined(_OPENMP) #pragma omp critical diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index 0fa145c6c5..24ebdd8b4c 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -96,8 +96,8 @@ void PairEAMOpt::eval() int* _noalias type = atom->type; int nlocal = atom->nlocal; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; double tmp_cutforcesq = cutforcesq; double tmp_rdr = rdr; @@ -112,10 +112,10 @@ void PairEAMOpt::eval() int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc((size_t)ntypes2*(nr+1)*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { - fast_alpha_t* _noalias tab = &fast_alpha[i*ntypes*nr+j*nr]; + auto * _noalias tab = &fast_alpha[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { for (int m = 1; m <= nr; m++) { tab[m].rhor0i = rhor_spline[type2rhor[i+1][j+1]][m][6]; @@ -133,12 +133,12 @@ void PairEAMOpt::eval() } } } - fast_alpha_t* _noalias tabeight = fast_alpha; + auto * _noalias tabeight = fast_alpha; - fast_gamma_t* _noalias fast_gamma = + auto * _noalias fast_gamma = (fast_gamma_t*) malloc((size_t)ntypes2*(nr+1)*sizeof(fast_gamma_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { - fast_gamma_t* _noalias tab = &fast_gamma[i*ntypes*nr+j*nr]; + auto * _noalias tab = &fast_gamma[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { for (int m = 1; m <= nr; m++) { tab[m].rhor4i = rhor_spline[type2rhor[i+1][j+1]][m][2]; @@ -166,7 +166,7 @@ void PairEAMOpt::eval() } } } - fast_gamma_t* _noalias tabss = fast_gamma; + auto * _noalias tabss = fast_gamma; // zero out density @@ -188,7 +188,7 @@ void PairEAMOpt::eval() jnum = numneigh[i]; double tmprho = rho[i]; - fast_alpha_t* _noalias tabeighti = &tabeight[itype*ntypes*nr]; + auto * _noalias tabeighti = &tabeight[itype*ntypes*nr]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -271,7 +271,7 @@ void PairEAMOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_gamma_t* _noalias tabssi = &tabss[itype1*ntypes*nr]; + auto * _noalias tabssi = &tabss[itype1*ntypes*nr]; double* _noalias scale_i = scale[itype1+1]+1; numforce[i] = 0; diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.cpp b/src/OPT/pair_lj_charmm_coul_long_opt.cpp index 186172035c..bfc904b853 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.cpp +++ b/src/OPT/pair_lj_charmm_coul_long_opt.cpp @@ -98,8 +98,8 @@ void PairLJCharmmCoulLongOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; @@ -107,7 +107,7 @@ void PairLJCharmmCoulLongOpt::eval() double tmp_coef1 = 1.0/denom_lj; double tmp_coef2 = cut_ljsq - 3.0*cut_lj_innersq; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*)malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -117,7 +117,7 @@ void PairLJCharmmCoulLongOpt::eval() a.lj3 = lj3[i+1][j+1]; a.lj4 = lj4[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -135,7 +135,7 @@ void PairLJCharmmCoulLongOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*) &tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*) &tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_lj_cut_opt.cpp b/src/OPT/pair_lj_cut_opt.cpp index f272e6fc78..9fbddd492a 100644 --- a/src/OPT/pair_lj_cut_opt.cpp +++ b/src/OPT/pair_lj_cut_opt.cpp @@ -78,13 +78,13 @@ void PairLJCutOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -95,7 +95,7 @@ void PairLJCutOpt::eval() a.lj4 = lj4[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -112,7 +112,7 @@ void PairLJCutOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_morse_opt.cpp b/src/OPT/pair_morse_opt.cpp index 04aace0d43..2c256073a2 100644 --- a/src/OPT/pair_morse_opt.cpp +++ b/src/OPT/pair_morse_opt.cpp @@ -79,13 +79,13 @@ void PairMorseOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -96,7 +96,7 @@ void PairMorseOpt::eval() a.d0 = d0[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -113,7 +113,7 @@ void PairMorseOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_ufm_opt.cpp b/src/OPT/pair_ufm_opt.cpp index 3502dfda6c..6809420f8a 100644 --- a/src/OPT/pair_ufm_opt.cpp +++ b/src/OPT/pair_ufm_opt.cpp @@ -78,13 +78,13 @@ void PairUFMOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -95,7 +95,7 @@ void PairUFMOpt::eval() a.scale = scale[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -112,7 +112,7 @@ void PairUFMOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/ORIENT/fix_orient_bcc.cpp b/src/ORIENT/fix_orient_bcc.cpp index 9449f5bcd8..3989863280 100644 --- a/src/ORIENT/fix_orient_bcc.cpp +++ b/src/ORIENT/fix_orient_bcc.cpp @@ -566,8 +566,8 @@ void FixOrientBCC::find_best_ref(double *displs, int which_crystal, int FixOrientBCC::compare(const void *pi, const void *pj) { - FixOrientBCC::Sort *ineigh = (FixOrientBCC::Sort *) pi; - FixOrientBCC::Sort *jneigh = (FixOrientBCC::Sort *) pj; + auto ineigh = (FixOrientBCC::Sort *) pi; + auto jneigh = (FixOrientBCC::Sort *) pj; if (ineigh->rsq < jneigh->rsq) return -1; else if (ineigh->rsq > jneigh->rsq) return 1; diff --git a/src/ORIENT/fix_orient_fcc.cpp b/src/ORIENT/fix_orient_fcc.cpp index d631ca9bd8..4dbe763cdf 100644 --- a/src/ORIENT/fix_orient_fcc.cpp +++ b/src/ORIENT/fix_orient_fcc.cpp @@ -564,8 +564,8 @@ void FixOrientFCC::find_best_ref(double *displs, int which_crystal, int FixOrientFCC::compare(const void *pi, const void *pj) { - FixOrientFCC::Sort *ineigh = (FixOrientFCC::Sort *) pi; - FixOrientFCC::Sort *jneigh = (FixOrientFCC::Sort *) pj; + auto ineigh = (FixOrientFCC::Sort *) pi; + auto jneigh = (FixOrientFCC::Sort *) pj; if (ineigh->rsq < jneigh->rsq) return -1; else if (ineigh->rsq > jneigh->rsq) return 1; diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 7bf2679443..9d44602756 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -83,7 +83,7 @@ void ComputeDilatationAtom::compute_peratom() int tmp; auto anypair = force->pair_match("^peri",0); - double *theta = (double *)anypair->extract("theta",tmp); + auto theta = (double *)anypair->extract("theta",tmp); int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 1d1c0d1c5e..51b8adf741 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -561,7 +561,7 @@ void FixPeriNeigh::write_restart(FILE *fp) void FixPeriNeigh::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; first = static_cast (list[n++]); maxpartner = static_cast (list[n++]); diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index 57b82fbe64..dc1e63e4ca 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -269,11 +269,11 @@ void DynamicalMatrix::calculateMatrix() double *m = atom->mass; double **f = atom->f; - double **dynmat = new double*[3]; + auto dynmat = new double*[3]; for (int i=0; i<3; i++) dynmat[i] = new double[dynlenb]; - double **fdynmat = new double*[3]; + auto fdynmat = new double*[3]; for (int i=0; i<3; i++) fdynmat[i] = new double[dynlenb]; @@ -575,7 +575,7 @@ void DynamicalMatrix::create_groupmap() bigint natoms = atom->natoms; int *recv = new int[comm->nprocs]; int *displs = new int[comm->nprocs]; - bigint *temp_groupmap = new bigint[natoms]; + auto temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) for (bigint i=1; i<=natoms; i++) { @@ -584,7 +584,7 @@ void DynamicalMatrix::create_groupmap() gid += 1; // gid at the end of loop is final_Gid } //create an array of length final_gid - bigint *sub_groupmap = new bigint[gid]; + auto sub_groupmap = new bigint[gid]; gid = 0; //create a map between global atom id and group atom id for each proc diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index b85337e5db..37361be26a 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -671,7 +671,7 @@ void FixPhonon::postprocess( ) // to get Phi = KT.G^-1; normalization of FFTW data is done here double boltz = force->boltz, TempAve = 0.; - double *kbtsqrt = new double[sysdim]; + auto kbtsqrt = new double[sysdim]; double TempFac = inv_neval * inv_nTemp; double NormFac = TempFac * double(ntotal); @@ -695,7 +695,7 @@ void FixPhonon::postprocess( ) MPI_Gatherv(Phi_q[0],mynq*fft_dim2*2,MPI_DOUBLE,Phi_all[0],recvcnts,displs,MPI_DOUBLE,0,world); // to collect all basis info and averaged it on root - double *basis_root = new double[fft_dim]; + auto basis_root = new double[fft_dim]; if (fft_dim > sysdim) MPI_Reduce(&basis[1][0], &basis_root[sysdim], fft_dim-sysdim, MPI_DOUBLE, MPI_SUM, 0, world); if (me == 0) { // output dynamic matrix by root diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 954089ca65..065575ae58 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -287,8 +287,8 @@ void ThirdOrder::calculateMatrix() bigint j; bigint *firstneigh; - double *dynmat = new double[dynlenb]; - double *fdynmat = new double[dynlenb]; + auto dynmat = new double[dynlenb]; + auto fdynmat = new double[dynlenb]; memset(&dynmat[0],0,dynlenb*sizeof(double)); memset(&fdynmat[0],0,dynlenb*sizeof(double)); @@ -620,7 +620,7 @@ void ThirdOrder::create_groupmap() bigint natoms = atom->natoms; int *recv = new int[comm->nprocs]; int *displs = new int[comm->nprocs]; - bigint *temp_groupmap = new bigint[natoms]; + auto temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) for (bigint i=1; i<=natoms; i++) { @@ -629,7 +629,7 @@ void ThirdOrder::create_groupmap() gid += 1; // gid at the end of loop is final_Gid } //create an array of length final_gid - bigint *sub_groupmap = new bigint[gid]; + auto sub_groupmap = new bigint[gid]; gid = 0; //create a map between global atom id and group atom id for each proc @@ -717,8 +717,8 @@ void ThirdOrder::getNeighbortags() { } bigint nbytes = ((bigint) sizeof(bigint)) * sum; - bigint *data = (bigint *) memory->smalloc(nbytes, "thirdorder:firsttags"); - bigint *datarecv = (bigint *) memory->smalloc(nbytes, "thirdorder:neighbortags"); + auto data = (bigint *) memory->smalloc(nbytes, "thirdorder:firsttags"); + auto datarecv = (bigint *) memory->smalloc(nbytes, "thirdorder:neighbortags"); nbytes = ((bigint) sizeof(bigint *)) * natoms; firsttags = (bigint **) memory->smalloc(nbytes, "thirdorder:firsttags"); neighbortags = (bigint **) memory->smalloc(nbytes, "thirdorder:neighbortags"); diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index d651a16760..f8dfb8af22 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -135,7 +135,7 @@ int plugin_load(const char *file, LAMMPS *lmp) void plugin_register(lammpsplugin_t *plugin, void *ptr) { #if defined(LMP_PLUGIN) - LAMMPS *lmp = (LAMMPS *) ptr; + auto lmp = (LAMMPS *) ptr; int me = lmp->comm->me; if (plugin == nullptr) return; diff --git a/src/PTM/compute_ptm_atom.cpp b/src/PTM/compute_ptm_atom.cpp index e024d45012..10341d3cd0 100644 --- a/src/PTM/compute_ptm_atom.cpp +++ b/src/PTM/compute_ptm_atom.cpp @@ -126,7 +126,7 @@ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) if (rmsd_threshold == 0) rmsd_threshold = INFINITY; - char* group_name = (char *)"all"; + auto group_name = (char *)"all"; if (narg > 5) { group_name = arg[5]; } @@ -192,7 +192,7 @@ static bool sorthelper_compare(ptmnbr_t const &a, ptmnbr_t const &b) { static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, int num, size_t* nbr_indices, int32_t* numbers, double (*nbr_pos)[3]) { - ptmnbrdata_t* data = (ptmnbrdata_t*)vdata; + auto data = (ptmnbrdata_t*)vdata; int *mask = data->mask; int group2bit = data->group2bit; diff --git a/src/PTM/ptm_neighbour_ordering.cpp b/src/PTM/ptm_neighbour_ordering.cpp index cae938a7bb..bc95c33cb0 100644 --- a/src/PTM/ptm_neighbour_ordering.cpp +++ b/src/PTM/ptm_neighbour_ordering.cpp @@ -179,7 +179,7 @@ static int _calculate_neighbour_ordering(void* _voronoi_handle, int num_points, { assert(num_points <= PTM_MAX_INPUT_POINTS); - ptm_voro::voronoicell_neighbor* voronoi_handle = (ptm_voro::voronoicell_neighbor*)_voronoi_handle; + auto voronoi_handle = (ptm_voro::voronoicell_neighbor*)_voronoi_handle; double max_norm = 0; double points[PTM_MAX_INPUT_POINTS][3]; @@ -277,13 +277,13 @@ static int find_diamond_neighbours(void* _voronoi_handle, int num_points, double void* voronoi_initialize_local() { - ptm_voro::voronoicell_neighbor* ptr = new ptm_voro::voronoicell_neighbor; + auto ptr = new ptm_voro::voronoicell_neighbor; return (void*)ptr; } void voronoi_uninitialize_local(void* _ptr) { - ptm_voro::voronoicell_neighbor* ptr = (ptm_voro::voronoicell_neighbor*)_ptr; + auto ptr = (ptm_voro::voronoicell_neighbor*)_ptr; delete ptr; } diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 43b6f9ea6c..9bf7066a0d 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -106,7 +106,7 @@ void PairPython::compute(int eflag, int vflag) // prepare access to compute_force and compute_energy functions PyUtils::GIL lock; - PyObject *py_pair_instance = (PyObject *) py_potential; + auto py_pair_instance = (PyObject *) py_potential; PyObject *py_compute_force = PyObject_GetAttrString(py_pair_instance,"compute_force"); if (!py_compute_force) { PyUtils::Print_Errors(); @@ -347,8 +347,8 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, // prepare access to compute_force and compute_energy functions PyUtils::GIL lock; - PyObject *py_compute_force = (PyObject *) get_member_function("compute_force"); - PyObject *py_compute_energy = (PyObject *) get_member_function("compute_energy"); + auto py_compute_force = (PyObject *) get_member_function("compute_force"); + auto py_compute_energy = (PyObject *) get_member_function("compute_energy"); PyObject *py_compute_args = Py_BuildValue("(dii)", rsq, itype, jtype); if (!py_compute_args) { @@ -383,7 +383,7 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, void * PairPython::get_member_function(const char * name) { PyUtils::GIL lock; - PyObject *py_pair_instance = (PyObject *) py_potential; + auto py_pair_instance = (PyObject *) py_potential; PyObject * py_mfunc = PyObject_GetAttrString(py_pair_instance, name); if (!py_mfunc) { PyUtils::Print_Errors(); diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index bc593d5b8a..5a7098814b 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -238,7 +238,7 @@ void PythonImpl::command(int narg, char **arg) // pFunc = function object for requested function - PyObject *pModule = (PyObject *) pyMain; + auto pModule = (PyObject *) pyMain; PyObject *pFunc = PyObject_GetAttrString(pModule, pfuncs[ifunc].name); if (!pFunc) { @@ -268,7 +268,7 @@ void PythonImpl::invoke_function(int ifunc, char *result) PyObject *pValue; char *str; - PyObject *pFunc = (PyObject *) pfuncs[ifunc].pFunc; + auto pFunc = (PyObject *) pfuncs[ifunc].pFunc; // create Python tuple of input arguments diff --git a/src/QTB/fix_qbmsst.cpp b/src/QTB/fix_qbmsst.cpp index 88588f6c01..8ce7b616b1 100644 --- a/src/QTB/fix_qbmsst.cpp +++ b/src/QTB/fix_qbmsst.cpp @@ -846,7 +846,7 @@ void FixQBMSST::write_restart(FILE *fp) void FixQBMSST::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; omega[direction] = list[n++]; e0 = list[n++]; v0 = list[n++]; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index dd56e96e81..d50c46a04c 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -3938,7 +3938,7 @@ void FixBondReact::ReadConstraints(char *line, int myrxn) double tmp[MAXCONARGS]; char **strargs,*ptr,*lptr; memory->create(strargs,MAXCONARGS,MAXLINE,"bond/react:strargs"); - char *constraint_type = new char[MAXLINE]; + auto constraint_type = new char[MAXLINE]; strcpy(constraintstr[myrxn],"("); // string for boolean constraint logic for (int i = 0; i < nconstraints[myrxn]; i++) { readline(line); diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index 26b1d00203..bd93dec0b7 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -134,7 +134,7 @@ void FixACKS2ReaxFF::pertype_parameters(char *arg) eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); bcut_acks2 = (double *) pair->extract("bcut_acks2",tmp); - double* bond_softness_ptr = (double *) pair->extract("bond_softness",tmp); + auto bond_softness_ptr = (double *) pair->extract("bond_softness",tmp); if (chi == nullptr || eta == nullptr || gamma == nullptr || bcut_acks2 == nullptr || bond_softness_ptr == nullptr) diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index b6c53aa977..83a5096412 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -1088,7 +1088,7 @@ void FixQEqReaxFF::get_chi_field() memset(&chi_field[0],0,atom->nmax*sizeof(double)); if (!efield) return; - const double * const *x = (const double * const *)atom->x; + const auto x = (const double * const *)atom->x; const int *mask = atom->mask; const imageint *image = atom->image; const int nlocal = atom->nlocal; diff --git a/src/REPLICA/fix_event_hyper.cpp b/src/REPLICA/fix_event_hyper.cpp index 5f68506db5..9cdb881d06 100644 --- a/src/REPLICA/fix_event_hyper.cpp +++ b/src/REPLICA/fix_event_hyper.cpp @@ -79,7 +79,7 @@ void FixEventHyper::write_restart(FILE *fp) void FixEventHyper::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = (int) ubuf(list[n++]).i; event_timestep = (bigint) ubuf(list[n++]).i; diff --git a/src/REPLICA/fix_event_prd.cpp b/src/REPLICA/fix_event_prd.cpp index 3256d01923..9e1aee90e6 100644 --- a/src/REPLICA/fix_event_prd.cpp +++ b/src/REPLICA/fix_event_prd.cpp @@ -82,7 +82,7 @@ void FixEventPRD::write_restart(FILE *fp) void FixEventPRD::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = static_cast (list[n++]); event_timestep = static_cast (list[n++]); diff --git a/src/REPLICA/fix_event_tad.cpp b/src/REPLICA/fix_event_tad.cpp index f51401fae1..1ab34d3eed 100644 --- a/src/REPLICA/fix_event_tad.cpp +++ b/src/REPLICA/fix_event_tad.cpp @@ -78,7 +78,7 @@ void FixEventTAD::write_restart(FILE *fp) void FixEventTAD::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = static_cast (list[n++]); event_timestep = static_cast (list[n++]); diff --git a/src/REPLICA/fix_grem.cpp b/src/REPLICA/fix_grem.cpp index 743d31fe96..1d0dceda96 100644 --- a/src/REPLICA/fix_grem.cpp +++ b/src/REPLICA/fix_grem.cpp @@ -166,8 +166,8 @@ void FixGrem::init() error->all(FLERR,"Fix id for nvt or npt fix does not exist"); Fix *nh = modify->fix[ifix]; - double *t_start = (double *)nh->extract("t_start",ifix); - double *t_stop = (double *)nh->extract("t_stop",ifix); + auto t_start = (double *)nh->extract("t_start",ifix); + auto t_stop = (double *)nh->extract("t_stop",ifix); if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) { tbath = *t_start; if (*t_start != *t_stop) @@ -178,8 +178,8 @@ void FixGrem::init() pressref = 0.0; if (pressflag) { int *p_flag = (int *)nh->extract("p_flag",ifix); - double *p_start = (double *) nh->extract("p_start",ifix); - double *p_stop = (double *) nh->extract("p_stop",ifix); + auto p_start = (double *) nh->extract("p_start",ifix); + auto p_stop = (double *) nh->extract("p_stop",ifix); if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr) && (ifix == 1)) { ifix = 0; diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index d391604530..d6787f0b98 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -60,10 +60,10 @@ void Hyper::command(int narg, char **arg) int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); t_event = utils::inumeric(FLERR,arg[1],false,lmp); - char *id_fix = new char[strlen(arg[2])+1]; + auto id_fix = new char[strlen(arg[2])+1]; strcpy(id_fix,arg[2]); - char *id_compute = new char[strlen(arg[3])+1]; + auto id_compute = new char[strlen(arg[3])+1]; strcpy(id_compute,arg[3]); options(narg-4,&arg[4]); diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index f7e6c68b31..88e1fddfa5 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -423,7 +423,7 @@ void NEB::readfile(char *file, int flag) error->all(FLERR,"Incorrectly formatted NEB file"); } - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; double fraction = ireplica/(nreplica-1.0); double **x = atom->x; int nlocal = atom->nlocal; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index f98c63d1ff..bf44c9fc50 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -872,7 +872,7 @@ void TAD::compute_tlo(int ievent) // update first event - char* statstr = (char *) "D "; + auto statstr = (char *) "D "; if (ievent == 0) { deltfirst = deltlo; diff --git a/src/REPLICA/temper_grem.cpp b/src/REPLICA/temper_grem.cpp index 43d8ebe1d9..09672980a2 100644 --- a/src/REPLICA/temper_grem.cpp +++ b/src/REPLICA/temper_grem.cpp @@ -103,7 +103,7 @@ void TemperGrem::command(int narg, char **arg) int pressflag = fix_grem->pressflag; // fix_grem does all the checking... if (pressflag) { - double *p_start = (double *) nh->extract("p_start",ifix); + auto p_start = (double *) nh->extract("p_start",ifix); pressref = p_start[0]; } diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 780dbd66f5..b1a8b15335 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -156,7 +156,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Variable {} for fix rigid/small custom does not exist", arg[4]+2); if (input->variable->atomstyle(ivariable) == 0) error->all(FLERR,"Fix rigid custom variable {} is not atom-style variable", arg[4]+2); - double *value = new double[nlocal]; + auto value = new double[nlocal]; input->variable->compute_atom(ivariable,0,value,1,0); int minval = INT_MAX; for (i = 0; i < nlocal; i++) @@ -2288,7 +2288,7 @@ void FixRigid::readfile(int which, double *vec, double **array1, double **array2 if (nlines == 0) return; else if (nlines < 0) error->all(FLERR,"Fix rigid infile has incorrect format"); - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; int nread = 0; while (nread < nlines) { nchunk = MIN(nlines-nread,CHUNK); diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 943d7225ba..17902a05aa 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -1162,7 +1162,7 @@ void FixRigidNH::write_restart(FILE *fp) void FixRigidNH::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 8b773a30ea..4111266773 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -1272,7 +1272,7 @@ void FixRigidNHSmall::write_restart(FILE *fp) void FixRigidNHSmall::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 45aadd845f..2fa704ffe0 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -139,7 +139,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (input->variable->atomstyle(ivariable) == 0) error->all(FLERR,"Fix rigid/small custom variable {} is not atom-style variable", arg[4]+2); - double *value = new double[nlocal]; + auto value = new double[nlocal]; input->variable->compute_atom(ivariable,0,value,1,0); int minval = INT_MAX; for (i = 0; i < nlocal; i++) @@ -1573,8 +1573,7 @@ void FixRigidSmall::create_bodies(tagint *bodyID) int *proclist; memory->create(proclist,ncount,"rigid/small:proclist"); - InRvous *inbuf = (InRvous *) - memory->smalloc(ncount*sizeof(InRvous),"rigid/small:inbuf"); + auto inbuf = (InRvous *) memory->smalloc(ncount*sizeof(InRvous),"rigid/small:inbuf"); // setup buf to pass to rendezvous comm // one BodyMsg datum for each constituent atom @@ -1607,7 +1606,7 @@ void FixRigidSmall::create_bodies(tagint *bodyID) 0,proclist, rendezvous_body,0,buf,sizeof(OutRvous), (void *) this); - OutRvous *outbuf = (OutRvous *) buf; + auto outbuf = (OutRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1649,7 +1648,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, double *x,*xown,*rsqclose; double **bbox,**ctr; - FixRigidSmall *frsptr = (FixRigidSmall *) ptr; + auto frsptr = (FixRigidSmall *) ptr; Memory *memory = frsptr->memory; Error *error = frsptr->error; MPI_Comm world = frsptr->world; @@ -1661,7 +1660,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, // key = body ID // value = index into Ncount-length data structure - InRvous *in = (InRvous *) inbuf; + auto in = (InRvous *) inbuf; std::map hash; tagint id; @@ -1756,8 +1755,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, int nout = n; memory->create(proclist,nout,"rigid/small:proclist"); - OutRvous *out = (OutRvous *) - memory->smalloc(nout*sizeof(OutRvous),"rigid/small:out"); + auto out = (OutRvous *) memory->smalloc(nout*sizeof(OutRvous),"rigid/small:out"); for (i = 0; i < nout; i++) { proclist[i] = in[i].me; @@ -2499,7 +2497,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (nlines == 0) return; else if (nlines < 0) error->all(FLERR,"Fix rigid infile has incorrect format"); - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; int nread = 0; while (nread < nlines) { nchunk = MIN(nlines-nread,CHUNK); diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index f012789414..b9fa66bec7 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -1035,8 +1035,7 @@ void FixShake::atom_owners() int *proclist; memory->create(proclist,nlocal,"shake:proclist"); - IDRvous *idbuf = (IDRvous *) - memory->smalloc((bigint) nlocal*sizeof(IDRvous),"shake:idbuf"); + auto idbuf = (IDRvous *) memory->smalloc((bigint) nlocal*sizeof(IDRvous),"shake:idbuf"); // setup input buf to rendezvous comm // input datums = pairs of bonded atoms @@ -1085,8 +1084,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - PartnerInfo *inbuf = (PartnerInfo *) - memory->smalloc((bigint) nsend*sizeof(PartnerInfo),"special:inbuf"); + auto inbuf = (PartnerInfo *) memory->smalloc((bigint) nsend*sizeof(PartnerInfo),"special:inbuf"); // set values in 4 partner arrays for all partner atoms I own // also setup input buf to rendezvous comm @@ -1164,7 +1162,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, rendezvous_partners_info, 0,buf,sizeof(PartnerInfo), (void *) this); - PartnerInfo *outbuf = (PartnerInfo *) buf; + auto outbuf = (PartnerInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1214,8 +1212,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - NShakeInfo *inbuf = (NShakeInfo *) - memory->smalloc((bigint) nsend*sizeof(NShakeInfo),"special:inbuf"); + auto inbuf = (NShakeInfo *) memory->smalloc((bigint) nsend*sizeof(NShakeInfo),"special:inbuf"); // set partner_nshake for all partner atoms I own // also setup input buf to rendezvous comm @@ -1252,7 +1249,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, 0,proclist, rendezvous_nshake,0,buf,sizeof(NShakeInfo), (void *) this); - NShakeInfo *outbuf = (NShakeInfo *) buf; + auto outbuf = (NShakeInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1293,8 +1290,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - ShakeInfo *inbuf = (ShakeInfo *) - memory->smalloc((bigint) nsend*sizeof(ShakeInfo),"special:inbuf"); + auto inbuf = (ShakeInfo *) memory->smalloc((bigint) nsend*sizeof(ShakeInfo),"special:inbuf"); // set 3 shake arrays for all partner atoms I own // also setup input buf to rendezvous comm @@ -1345,7 +1341,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, 0,proclist, rendezvous_shake,0,buf,sizeof(ShakeInfo), (void *) this); - ShakeInfo *outbuf = (ShakeInfo *) buf; + auto outbuf = (ShakeInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1377,7 +1373,7 @@ int FixShake::rendezvous_ids(int n, char *inbuf, int &flag, int *& /*proclist*/, char *& /*outbuf*/, void *ptr) { - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Memory *memory = fsptr->memory; tagint *atomIDs; @@ -1386,7 +1382,7 @@ int FixShake::rendezvous_ids(int n, char *inbuf, memory->create(atomIDs,n,"special:atomIDs"); memory->create(procowner,n,"special:procowner"); - IDRvous *in = (IDRvous *) inbuf; + auto in = (IDRvous *) inbuf; for (int i = 0; i < n; i++) { atomIDs[i] = in[i].atomID; @@ -1417,7 +1413,7 @@ int FixShake::rendezvous_partners_info(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1437,7 +1433,7 @@ int FixShake::rendezvous_partners_info(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID = 4 values - PartnerInfo *in = (PartnerInfo *) inbuf; + auto in = (PartnerInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -1472,7 +1468,7 @@ int FixShake::rendezvous_nshake(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1492,7 +1488,7 @@ int FixShake::rendezvous_nshake(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID - NShakeInfo *in = (NShakeInfo *) inbuf; + auto in = (NShakeInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -1526,7 +1522,7 @@ int FixShake::rendezvous_shake(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1546,7 +1542,7 @@ int FixShake::rendezvous_shake(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID - ShakeInfo *in = (ShakeInfo *) inbuf; + auto in = (ShakeInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -2564,8 +2560,7 @@ void FixShake::stats() if (me == 0) { const int width = log10((MAX(MAX(1,nb),na)))+2; - auto mesg = fmt::format("SHAKE stats (type/ave/delta/count) on step {}\n", - update->ntimestep); + auto mesg = fmt::format("SHAKE stats (type/ave/delta/count) on step {}\n", update->ntimestep); for (i = 1; i < nb; i++) { const auto bcnt = b_count_all[i]; if (bcnt) diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 38bba33adf..63a3d8c839 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -264,8 +264,8 @@ int FixAppendAtoms::get_spatial() else failed = 0; count++; } - double *pos = new double[count-2]; - double *val = new double[count-2]; + auto pos = new double[count-2]; + auto val = new double[count-2]; for (int loop=0; loop < count-2; loop++) { pos[loop] = fix->compute_vector(2*loop); val[loop] = fix->compute_vector(2*loop+1); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index ae1d0f4cd5..90a0c45d9a 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -815,7 +815,7 @@ void FixMSST::write_restart(FILE *fp) void FixMSST::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; omega[direction] = list[n++]; e0 = list[n++]; v0 = list[n++]; diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index ff1025c840..46a3ccf0ef 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -395,7 +395,7 @@ int FixNPHug::size_restart_global() void FixNPHug::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; e0 = list[n++]; v0 = list[n++]; p0 = list[n++]; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 1fee0ace0d..27097051e4 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -418,7 +418,7 @@ void NEBSpin::readfile(char *file, int flag) error->all(FLERR,"Incorrectly formatted NEB file"); } - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; double fraction = ireplica/(nreplica-1.0); double **x = atom->x; double **sp = atom->sp; diff --git a/src/arg_info.cpp b/src/arg_info.cpp index 4bdbfc8c92..86becc1da5 100644 --- a/src/arg_info.cpp +++ b/src/arg_info.cpp @@ -103,7 +103,7 @@ ArgInfo::ArgInfo(const std::string &arg, int allowed) : type(NONE), dim(0), inde char *ArgInfo::copy_name() { - char *dest = new char[name.size() + 1]; + auto dest = new char[name.size() + 1]; strcpy(dest, name.c_str()); // NOLINT return dest; } diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 87d42403e6..dd83619da8 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -213,7 +213,7 @@ void AtomVecHybrid::process_args(int narg, char **arg) char *ptr; for (int idup = 0; idup < ndupfield; idup++) { - char *dup = (char *) dupfield[idup]; + auto dup = (char *) dupfield[idup]; ptr = strstr(concat_grow,dup); if ((ptr && strstr(ptr+1,dup)) && (comm->me == 0)) error->warning(FLERR,fmt::format("Per-atom {} is used in multiple sub-" diff --git a/src/change_box.cpp b/src/change_box.cpp index bbac78ab3d..08af5f11c9 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -372,7 +372,7 @@ void ChangeBox::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/comm.cpp b/src/comm.cpp index 7e88144efe..3b0195f410 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -550,7 +550,7 @@ void Comm::set_proc_grid(int outflag) // create ProcMap class to create 3d grid and map procs to it - ProcMap *pmap = new ProcMap(lmp); + auto pmap = new ProcMap(lmp); // create 3d grid of processors // produces procgrid and coregrid (if relevant) @@ -1011,7 +1011,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, { // irregular comm of inbuf from caller decomp to rendezvous decomp - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrvous; if (inorder) nrvous = irregular->create_data_grouped(n,procs); @@ -1019,8 +1019,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, - "rendezvous:inbuf"); + auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); irregular->exchange_data(inbuf,insize,inbuf_rvous); bigint irregular1_bytes = irregular->memory_usage(); @@ -1033,14 +1032,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, int flag; int *procs_rvous; char *outbuf_rvous; - int nrvous_out = callback(nrvous,inbuf_rvous,flag, - procs_rvous,outbuf_rvous,ptr); + int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr); if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous if (flag == 0) { if (statflag) rendezvous_stats(n,0,nrvous,nrvous_out,insize,outsize, - (bigint) nrvous_out*sizeof(int) + - irregular1_bytes); + (bigint) nrvous_out*sizeof(int) + irregular1_bytes); return 0; // all nout_rvous are 0, no 2nd comm stage } @@ -1050,14 +1047,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, irregular = new Irregular(lmp); int nout; - if (outorder) - nout = irregular->create_data_grouped(nrvous_out,procs_rvous); + if (outorder) nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, - "rendezvous:outbuf"); + outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); irregular->exchange_data(outbuf_rvous,outsize,outbuf); bigint irregular2_bytes = irregular->memory_usage(); @@ -1164,8 +1159,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of inbuf from caller decomp to rendezvous decomp // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, - "rendezvous:inbuf"); + auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); memset(inbuf_rvous,0,(bigint) nrvous*insize*sizeof(char)); MPI_Alltoallv(inbuf_a2a,sendcount,sdispls,MPI_CHAR, @@ -1184,8 +1178,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, int *procs_rvous; char *outbuf_rvous; - int nrvous_out = callback(nrvous,inbuf_rvous,flag, - procs_rvous,outbuf_rvous,ptr); + int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr); if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous if (flag == 0) { @@ -1206,8 +1199,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, - "rendezvous:outbuf"); + outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); memory->create(offsets,nprocs,"rendezvous:offsets"); for (int i = 0; i < nprocs; i++) procs_a2a[i] = 0; @@ -1225,8 +1217,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, offset += outsize; } - all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) + - (bigint)nrvous_out*outsize; + all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) + (bigint)nrvous_out*outsize; } else { procs_a2a = procs_rvous; diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 535720c575..446e306675 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -151,7 +151,7 @@ void ComputeCentroAtom::compute_peratom() int nhalf = nnn / 2; int npairs = nnn * (nnn - 1) / 2; - double *pairs = new double[npairs]; + auto pairs = new double[npairs]; // compute centro-symmetry parameter for each atom in group // use full neighbor list diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index daa8fc64e7..235263684d 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -1084,8 +1084,8 @@ void ComputeChunkAtom::compress_chunk_ids() void ComputeChunkAtom::idring(int n, char *cbuf, void *ptr) { - ComputeChunkAtom *cptr = (ComputeChunkAtom *)ptr; - tagint *list = (tagint *) cbuf; + auto cptr = (ComputeChunkAtom *)ptr; + auto list = (tagint *) cbuf; std::map *hash = cptr->hash; for (int i = 0; i < n; i++) (*hash)[list[i]] = 0; } diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index f21d1fc23d..c19d9f3368 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -553,7 +553,7 @@ void CreateAtoms::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -654,7 +654,7 @@ void CreateAtoms::add_random() // warm up the generator 30x to avoid correlations in first-particle // positions if runs are repeated with consecutive seeds - RanPark *random = new RanPark(lmp,seed); + auto random = new RanPark(lmp,seed); for (int ii=0; ii < 30; ii++) random->uniform(); // bounding box for atom creation diff --git a/src/create_box.cpp b/src/create_box.cpp index 34d840dfd3..73b60eb799 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -72,7 +72,7 @@ void CreateBox::command(int narg, char **arg) } else { domain->triclinic = 1; - RegPrism *region = (RegPrism *) domain->regions[iregion]; + auto region = dynamic_cast( domain->regions[iregion]); domain->boxlo[0] = region->xlo; domain->boxhi[0] = region->xhi; domain->boxlo[1] = region->ylo; diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 11d3523cd0..405e0a7390 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -428,7 +428,7 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) int seed = utils::inumeric(FLERR,arg[4],false,lmp); options(narg-5,&arg[5]); - RanMars *random = new RanMars(lmp,seed + comm->me); + auto random = new RanMars(lmp,seed + comm->me); // allocate and initialize deletion list @@ -594,8 +594,8 @@ void DeleteAtoms::recount_topology() void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) { - DeleteAtoms *daptr = (DeleteAtoms *) ptr; - tagint *list = (tagint *) cbuf; + auto daptr = (DeleteAtoms *) ptr; + auto list = (tagint *) cbuf; std::map *hash = daptr->hash; int *num_bond = daptr->atom->num_bond; @@ -711,8 +711,8 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) void DeleteAtoms::molring(int n, char *cbuf, void *ptr) { - DeleteAtoms *daptr = (DeleteAtoms *)ptr; - tagint *list = (tagint *) cbuf; + auto daptr = (DeleteAtoms *)ptr; + auto list = (tagint *) cbuf; int *dlist = daptr->dlist; std::map *hash = daptr->hash; int nlocal = daptr->atom->nlocal; diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index c63f3c6592..0406a9a635 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -177,7 +177,7 @@ void DisplaceAtoms::command(int narg, char **arg) // makes atom result independent of what proc owns it via random->reset() if (style == RANDOM) { - RanPark *random = new RanPark(lmp,1); + auto random = new RanPark(lmp,1); double dx = xscale*utils::numeric(FLERR,arg[2],false,lmp); double dy = yscale*utils::numeric(FLERR,arg[3],false,lmp); @@ -345,7 +345,7 @@ void DisplaceAtoms::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/domain.cpp b/src/domain.cpp index 29244dff6a..9ec0bebbdd 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -100,7 +100,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; lattice = nullptr; - char **args = new char*[2]; + auto args = new char*[2]; args[0] = (char *) "none"; args[1] = (char *) "1.0"; set_lattice(2,args); diff --git a/src/dump.cpp b/src/dump.cpp index 480bbe666c..19682883ff 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -270,12 +270,12 @@ void Dump::init() reorderflag = 1; double range = maxall-minall + EPSILON; idlo = static_cast (range*me/nprocs + minall); - tagint idhi = static_cast (range*(me+1)/nprocs + minall); + auto idhi = static_cast (range*(me+1)/nprocs + minall); - tagint lom1 = static_cast ((idlo-1-minall)/range * nprocs); - tagint lo = static_cast ((idlo-minall)/range * nprocs); - tagint him1 = static_cast ((idhi-1-minall)/range * nprocs); - tagint hi = static_cast ((idhi-minall)/range * nprocs); + auto lom1 = static_cast ((idlo-1-minall)/range * nprocs); + auto lo = static_cast ((idlo-minall)/range * nprocs); + auto him1 = static_cast ((idhi-1-minall)/range * nprocs); + auto hi = static_cast ((idhi-minall)/range * nprocs); if (me && me == lom1) idlo--; else if (me && me != lo) idlo++; if (me+1 == him1) idhi--; @@ -841,7 +841,7 @@ int Dump::idcompare(const int i, const int j, void *ptr) int Dump::bufcompare(const int i, const int j, void *ptr) { - Dump *dptr = (Dump *) ptr; + auto dptr = (Dump *) ptr; double *bufsort = dptr->bufsort; const int size_one = dptr->size_one; const int sortcolm1 = dptr->sortcolm1; @@ -862,7 +862,7 @@ int Dump::bufcompare(const int i, const int j, void *ptr) int Dump::bufcompare_reverse(const int i, const int j, void *ptr) { - Dump *dptr = (Dump *) ptr; + auto dptr = (Dump *) ptr; double *bufsort = dptr->bufsort; const int size_one = dptr->size_one; const int sortcolm1 = dptr->sortcolm1; @@ -938,7 +938,7 @@ void Dump::balance() // post recvs first int nswap = 0; - MPI_Request *request = new MPI_Request[nprocs]; + auto request = new MPI_Request[nprocs]; // find which proc starting atom belongs to diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 766dc9cd74..0cf8f2af75 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -700,7 +700,7 @@ void FixAdapt::write_restart(FILE *fp) void FixAdapt::restart(char *buf) { - double *dbuf = (double *) buf; + auto dbuf = (double *) buf; previous_diam_scale = dbuf[0]; previous_chg_scale = dbuf[1]; diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 034cecd55a..fd6eb3e36a 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -844,7 +844,7 @@ void FixDeposit::write_restart(FILE *fp) void FixDeposit::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast(list[n++]); ninserted = static_cast(list[n++]); diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 756292d06b..c079c07b1c 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -1218,7 +1218,7 @@ void FixMove::write_restart(FILE *fp) void FixMove::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; time_origin = static_cast(list[n++]); } diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 28c0cafc60..032d959a03 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -1352,7 +1352,7 @@ int FixNH::pack_restart_data(double *list) void FixNH::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index 90db93b9ad..fb32947fe8 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -262,7 +262,7 @@ void FixSpringChunk::write_restart(FILE *fp) void FixSpringChunk::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; int n = list[0]; memory->destroy(com0); diff --git a/src/fix_store.cpp b/src/fix_store.cpp index eb23fbad97..759e71a955 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -187,7 +187,7 @@ void FixStore::restart(char *buf) { // first 2 values in buf are vec/array sizes - double *dbuf = (double *) buf; + auto dbuf = (double *) buf; int nrow_restart = dbuf[0]; int ncol_restart = dbuf[1]; diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 19ec4b52bd..26c14e842d 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -258,7 +258,7 @@ void FixTempBerendsen::write_restart(FILE *fp) void FixTempBerendsen::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; } diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 2b3db70d4b..41fb49e3f4 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -256,7 +256,7 @@ void FixTempRescale::write_restart(FILE *fp) void FixTempRescale::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; energy = list[n++]; } diff --git a/src/gridcomm.cpp b/src/gridcomm.cpp index dcf5fc6fe2..57cbb130f5 100644 --- a/src/gridcomm.cpp +++ b/src/gridcomm.cpp @@ -609,10 +609,9 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) } } - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrecv_request = irregular->create_data(nsend_request,proclist,1); - Request *rrequest = - (Request *) memory->smalloc(nrecv_request*sizeof(Request),"GridComm:rrequest"); + auto rrequest = (Request *) memory->smalloc(nrecv_request*sizeof(Request),"GridComm:rrequest"); irregular->exchange_data((char *) srequest,sizeof(Request),(char *) rrequest); irregular->destroy_data(); @@ -620,8 +619,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) // overlap box used to setup my Send data struct and respond to requests send = (Send *) memory->smalloc(nrecv_request*sizeof(Send),"GridComm:send"); - sresponse = (Response *) - memory->smalloc(nrecv_request*sizeof(Response),"GridComm:sresponse"); + sresponse = (Response *) memory->smalloc(nrecv_request*sizeof(Response),"GridComm:sresponse"); memory->destroy(proclist); memory->create(proclist,nrecv_request,"GridComm:proclist"); @@ -652,8 +650,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) int nsend_response = nrecv_request; int nrecv_response = irregular->create_data(nsend_response,proclist,1); - Response *rresponse = - (Response *) memory->smalloc(nrecv_response*sizeof(Response),"GridComm:rresponse"); + auto rresponse = (Response *) memory->smalloc(nrecv_response*sizeof(Response),"GridComm:rresponse"); irregular->exchange_data((char *) sresponse,sizeof(Response),(char *) rresponse); irregular->destroy_data(); delete irregular; @@ -992,7 +989,7 @@ forward_comm_tiled(T *ptr, int nper, int nbyte, int which, { int i,m,offset; - char *buf2 = (char *) vbuf2; + auto buf2 = (char *) vbuf2; // post all receives @@ -1091,7 +1088,7 @@ reverse_comm_tiled(T *ptr, int nper, int nbyte, int which, { int i,m,offset; - char *buf2 = (char *) vbuf2; + auto buf2 = (char *) vbuf2; // post all receives diff --git a/src/group.cpp b/src/group.cpp index 0dc0a560dd..9aec2c8382 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -675,8 +675,8 @@ void Group::add_molecules(int /*igroup*/, int bit) void Group::molring(int n, char *cbuf, void *ptr) { - Group *gptr = (Group *) ptr; - tagint *list = (tagint *) cbuf; + auto gptr = (Group *) ptr; + auto list = (tagint *) cbuf; std::map *hash = gptr->hash; int nlocal = gptr->atom->nlocal; tagint *molecule = gptr->atom->molecule; diff --git a/src/hashlittle.cpp b/src/hashlittle.cpp index 3aeb0825de..37f8cf03b1 100644 --- a/src/hashlittle.cpp +++ b/src/hashlittle.cpp @@ -153,7 +153,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) u.ptr = key; if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint32_t *k = (const uint32_t *)key; /* NOLINT read 32-bit chunks */ /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ while (length > 12) @@ -197,7 +197,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) #else /* make valgrind happy */ - const uint8_t *k8 = (const uint8_t *)k; + const uint8_t *k8 = (const uint8_t *)k; /* NOLINT */ switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; @@ -218,7 +218,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) #endif /* !valgrind */ } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ + const uint16_t *k = (const uint16_t *)key; /* NOLINT read 16-bit chunks */ const uint8_t *k8; /*--------------- all but last block: aligned reads and different mixing */ @@ -233,7 +233,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) } /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; + k8 = (const uint8_t *)k; /* NOLINT */ switch(length) { case 12: c+=k[4]+(((uint32_t)k[5])<<16); @@ -265,7 +265,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) } } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; + const uint8_t *k = (const uint8_t *)key; /* NOLINT */ /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) diff --git a/src/image.cpp b/src/image.cpp index ee686bd653..b542290e0d 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1105,7 +1105,7 @@ void Image::write_PNG(FILE *fp) png_set_text(png_ptr,info_ptr,text_ptr,1); png_write_info(png_ptr,info_ptr); - png_bytep *row_pointers = new png_bytep[height]; + auto row_pointers = new png_bytep[height]; for (int i=0; i < height; ++i) row_pointers[i] = (png_bytep) &writeBuffer[(height-i-1)*3*width]; diff --git a/src/info.cpp b/src/info.cpp index 1beadff753..fad9814a5f 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -1053,7 +1053,7 @@ static void print_columns(FILE *fp, std::map *styles) // std::map keys are already sorted int pos = 80; - for (typename std::map::iterator it = styles->begin(); it != styles->end(); ++it) { + for (auto it = styles->begin(); it != styles->end(); ++it) { const std::string &style_name = it->first; // skip "internal" styles diff --git a/src/input.cpp b/src/input.cpp index 689c016b68..32f525be29 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -891,7 +891,7 @@ void Input::ifthenelse() int ncommands = last-first + 1; if (ncommands <= 0) error->all(FLERR,"Illegal if command"); - char **commands = new char*[ncommands]; + auto commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { n = strlen(arg[i]) + 1; @@ -944,7 +944,7 @@ void Input::ifthenelse() int ncommands = last-first + 1; if (ncommands <= 0) error->all(FLERR,"Illegal if command"); - char **commands = new char*[ncommands]; + auto commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { n = strlen(arg[i]) + 1; diff --git a/src/library.cpp b/src/library.cpp index c2ae52a809..8ab97321ba 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -290,7 +290,7 @@ multiple LAMMPS instances concurrently or sequentially. See void lammps_close(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; delete lmp; } @@ -440,7 +440,7 @@ and :cpp:func:`Input::file()`. void lammps_file(void *handle, const char *filename) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -477,7 +477,7 @@ passing a string without a command. char *lammps_command(void *handle, const char *cmd) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; char *result = nullptr; BEGIN_CAPTURE @@ -548,7 +548,7 @@ executing. void lammps_commands_string(void *handle, const char *str) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; // copy str and convert from CR-LF (DOS-style) to LF (Unix style) line int n = strlen(str); @@ -624,9 +624,9 @@ the size of a ``bigint`` integer. double lammps_get_natoms(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; - double natoms = static_cast(lmp->atom->natoms); + auto natoms = static_cast(lmp->atom->natoms); if (natoms > 9.0e15) return 0; // TODO:XXX why not -1? return natoms; } @@ -650,7 +650,7 @@ a ``double``, so it can also return information that is computed on-the-fly. double lammps_get_thermo(void *handle, const char *keyword) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; double dval = 0.0; BEGIN_CAPTURE @@ -690,7 +690,7 @@ void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Domain *domain = lmp->domain; BEGIN_CAPTURE @@ -752,7 +752,7 @@ are created. void lammps_reset_box(void *handle, double *boxlo, double *boxhi, double xy, double yz, double xz) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Domain *domain = lmp->domain; BEGIN_CAPTURE @@ -813,7 +813,7 @@ system it will be set to zero. void lammps_memory_usage(void *handle, double *meminfo) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); info.get_memory_info(meminfo); } @@ -993,7 +993,7 @@ not recognized, the function returns -1. int lammps_extract_setting(void *handle, const char *keyword) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; // This can be customized by adding keywords and documenting them in the section above. if (strcmp(keyword,"bigint") == 0) return sizeof(bigint); @@ -1438,7 +1438,7 @@ report the "native" data type. The following tables are provided: void *lammps_extract_global(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; @@ -1450,7 +1450,7 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"atimestep") == 0) return (void *) &lmp->update->atimestep; if (utils::strmatch(lmp->update->integrate_style,"^respa")) { - Respa *respa = (Respa *)lmp->update->integrate; + auto respa = dynamic_cast(lmp->update->integrate); if (strcmp(name,"respa_levels") == 0) return (void *) &respa->nlevels; if (strcmp(name,"respa_dt") == 0) return (void *) respa->step; } @@ -1537,7 +1537,7 @@ to then decide how to cast the (void*) pointer and access the data. int lammps_extract_atom_datatype(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->atom->extract_datatype(name); } @@ -1571,7 +1571,7 @@ of the :cpp:func:`Atom::extract() ` function. void *lammps_extract_atom(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->atom->extract(name); } @@ -1685,7 +1685,7 @@ lists the available options. void *lammps_extract_compute(void *handle, const char *id, int style, int type) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1871,7 +1871,7 @@ The following table lists the available options. void *lammps_extract_fix(void *handle, const char *id, int style, int type, int nrow, int ncol) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1881,19 +1881,19 @@ void *lammps_extract_fix(void *handle, const char *id, int style, int type, if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { if (!fix->scalar_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } if (type == LMP_TYPE_VECTOR) { if (!fix->vector_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_vector(nrow); return (void *) dptr; } if (type == LMP_TYPE_ARRAY) { if (!fix->array_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } @@ -1995,7 +1995,7 @@ a char pointer. void *lammps_extract_variable(void *handle, const char *name, const char *group) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2003,7 +2003,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) if (ivar < 0) return nullptr; if (lmp->input->variable->equalstyle(ivar)) { - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = lmp->input->variable->compute_equal(ivar); return (void *) dptr; } else if (lmp->input->variable->atomstyle(ivar)) { @@ -2011,7 +2011,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) int igroup = lmp->group->find(group); if (igroup < 0) return nullptr; int nlocal = lmp->atom->nlocal; - double *vector = (double *) malloc(nlocal*sizeof(double)); + auto vector = (double *) malloc(nlocal*sizeof(double)); lmp->input->variable->compute_atom(ivar,igroup,vector,1,0); return (void *) vector; } else { @@ -2039,7 +2039,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) */ int lammps_set_variable(void *handle, char *name, char *str) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; int err = -1; BEGIN_CAPTURE @@ -2078,7 +2078,7 @@ int lammps_set_variable(void *handle, char *name, char *str) void lammps_gather_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2213,7 +2213,7 @@ void lammps_gather_atoms(void *handle, char *name, int type, int count, void *da void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2362,7 +2362,7 @@ void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, v void lammps_gather_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2500,7 +2500,7 @@ void lammps_gather_atoms_subset(void *handle, char *name, int type, int count, void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2576,7 +2576,7 @@ void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *d double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < natoms; i++) @@ -2619,7 +2619,7 @@ void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *d void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2699,7 +2699,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < ndata; i++) { @@ -2800,7 +2800,7 @@ Below is a brief C code demonstrating accessing this collected bond information. void lammps_gather_bonds(void *handle, void *data) { - LAMMPS *lmp = (LAMMPS *)handle; + auto lmp = (LAMMPS *)handle; BEGIN_CAPTURE { void *val = lammps_extract_global(handle,"nbonds"); bigint nbonds = *(bigint *)val; @@ -2861,7 +2861,7 @@ void lammps_gather_bonds(void *handle, void *data) void lammps_gather(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3096,7 +3096,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) void lammps_gather_concat(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3350,7 +3350,7 @@ void lammps_gather_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3596,7 +3596,7 @@ void lammps_gather_subset(void *handle, char *name, void lammps_scatter(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3767,7 +3767,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < natoms; i++) @@ -3814,7 +3814,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) void lammps_scatter_subset(void *handle, char *name,int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3991,7 +3991,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count, double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < ndata; i++) { @@ -4074,7 +4074,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, const double *x, const double *v, const imageint *image, int bexpand) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; bigint natoms_prev = lmp->atom->natoms; BEGIN_CAPTURE @@ -4196,7 +4196,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, * \return return neighbor list index if found, otherwise -1 */ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int nsub, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Pair *pair = lmp->force->pair_match(style, exact, nsub); if (pair != nullptr) { @@ -4226,7 +4226,7 @@ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int n * \return return neighbor list index if found, otherwise -1 */ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; auto fix = lmp->modify->get_fix_by_id(id); if (!fix) return -1; @@ -4255,7 +4255,7 @@ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { * \return return neighbor list index if found, otherwise -1 */ int lammps_find_compute_neighlist(void* handle, const char *id, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; auto compute = lmp->modify->get_compute_by_id(id); if (!compute) return -1; @@ -4279,7 +4279,7 @@ int lammps_find_compute_neighlist(void* handle, const char *id, int reqid) { * not a valid index */ int lammps_neighlist_num_elements(void *handle, int idx) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; if (idx < 0 || idx >= neighbor->nlist) { @@ -4304,7 +4304,7 @@ int lammps_neighlist_num_elements(void *handle, int idx) { * \param[out] neighbors pointer to array of neighbor atom local indices or NULL */ void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *iatom, int *numneigh, int **neighbors) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; @@ -4348,7 +4348,7 @@ growing with every new LAMMPS release. int lammps_version(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->num_ver; } @@ -4662,7 +4662,7 @@ Valid categories are: *atom*\ , *integrate*\ , *minimize*\ , * \return 1 if included, 0 if not. */ int lammps_has_style(void *handle, const char *category, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); return info.has_style(category, name) ? 1 : 0; } @@ -4683,7 +4683,7 @@ categories. * \return number of styles in category */ int lammps_style_count(void *handle, const char *category) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); return info.get_available_styles(category).size(); } @@ -4709,7 +4709,7 @@ int lammps_style_count(void *handle, const char *category) { */ int lammps_style_name(void *handle, const char *category, int idx, char *buffer, int buf_size) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); auto styles = info.get_available_styles(category); @@ -4741,7 +4741,7 @@ the given *name* exists. Valid categories are: *compute*\ , *dump*\ , * \return 1 if included, 0 if not. */ int lammps_has_id(void *handle, const char *category, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { int ncompute = lmp->modify->ncompute; @@ -4806,7 +4806,7 @@ categories. * \return number of IDs in category */ int lammps_id_count(void *handle, const char *category) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { return lmp->modify->ncompute; } else if (strcmp(category,"dump") == 0) { @@ -4850,7 +4850,7 @@ set to an empty string, otherwise 1. */ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, int buf_size) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { if ((idx >=0) && (idx < lmp->modify->ncompute)) { @@ -5065,8 +5065,8 @@ external code. void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr) { - LAMMPS *lmp = (LAMMPS *) handle; - FixExternal::FnPtr callback = (FixExternal::FnPtr) funcptr; + auto lmp = (LAMMPS *) handle; + auto callback = (FixExternal::FnPtr) funcptr; BEGIN_CAPTURE { @@ -5076,7 +5076,7 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style 'external'", id); - FixExternal *fext = (FixExternal *) fix; + auto fext = dynamic_cast( fix); fext->set_callback(callback, ptr); } END_CAPTURE @@ -5126,7 +5126,7 @@ external code. double **lammps_fix_external_get_force(void *handle, const char *id) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; double **fexternal = nullptr; BEGIN_CAPTURE @@ -5174,7 +5174,7 @@ external code. void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5184,7 +5184,7 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_energy_global(eng); } END_CAPTURE @@ -5222,7 +5222,7 @@ external code. void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5232,7 +5232,7 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_virial_global(virial); } END_CAPTURE @@ -5270,7 +5270,7 @@ external code. void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5280,7 +5280,7 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_energy_peratom(eng); } END_CAPTURE @@ -5321,7 +5321,7 @@ external code. void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5331,7 +5331,7 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_virial_peratom(virial); } END_CAPTURE @@ -5365,7 +5365,7 @@ external code. void lammps_fix_external_set_vector_length(void *handle, const char *id, int len) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5375,7 +5375,7 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_vector_length(len); } END_CAPTURE @@ -5419,7 +5419,7 @@ external code. void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5429,7 +5429,7 @@ void lammps_fix_external_set_vector(void *handle, const char *id, int idx, doubl if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_vector(idx, val); } END_CAPTURE @@ -5482,7 +5482,7 @@ void lammps_free(void *ptr) int lammps_is_running(void *handle) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->update->whichflag; } @@ -5495,7 +5495,7 @@ int lammps_is_running(void *handle) void lammps_force_timeout(void *handle) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->timer->force_timeout(); } diff --git a/src/main.cpp b/src/main.cpp index 095e1752da..19ccbb465a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,7 +72,7 @@ int main(int argc, char **argv) #ifdef LAMMPS_EXCEPTIONS try { - LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm); + auto lammps = new LAMMPS(argc, argv, lammps_comm); lammps->input->file(); delete lammps; } catch (LAMMPSAbortException &ae) { @@ -94,7 +94,7 @@ int main(int argc, char **argv) } #else try { - LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm); + auto lammps = new LAMMPS(argc, argv, lammps_comm); lammps->input->file(); delete lammps; } catch (fmt::format_error &fe) { diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 98c773915b..eab6278b3a 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -880,13 +880,13 @@ int Neighbor::init_pair() } if (requests[i]->pair && i < nrequest_original) { - Pair *pair = (Pair *) requests[i]->requestor; + auto pair = (Pair *) requests[i]->requestor; pair->init_list(requests[i]->id,lists[i]); } else if (requests[i]->fix && i < nrequest_original) { Fix *fix = (Fix *) requests[i]->requestor; fix->init_list(requests[i]->id,lists[i]); } else if (requests[i]->compute && i < nrequest_original) { - Compute *compute = (Compute *) requests[i]->requestor; + auto compute = (Compute *) requests[i]->requestor; compute->init_list(requests[i]->id,lists[i]); } } @@ -2677,7 +2677,7 @@ void Neighbor::modify_params(int narg, char **arg) void Neighbor::modify_params(const std::string &modcmd) { auto args = utils::split_words(modcmd); - char **newarg = new char*[args.size()]; + auto newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { newarg[i++] = (char *)arg.c_str(); diff --git a/src/output.cpp b/src/output.cpp index c9da837f63..9444164b63 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -66,7 +66,7 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) // create default Thermo class - char **newarg = new char*[1]; + auto newarg = new char*[1]; newarg[0] = (char *) "one"; thermo = new Thermo(lmp,1,newarg); delete[] newarg; @@ -275,7 +275,7 @@ void Output::setup(int memflag) (ntimestep/restart_every_single)*restart_every_single + restart_every_single; else { - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -288,7 +288,7 @@ void Output::setup(int memflag) (ntimestep/restart_every_double)*restart_every_double + restart_every_double; else { - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -401,7 +401,7 @@ void Output::setup(int memflag) if (restart_every_single) next_restart_single += restart_every_single; else { modify->clearstep_compute(); - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -422,7 +422,7 @@ void Output::setup(int memflag) if (restart_every_double) next_restart_double += restart_every_double; else { modify->clearstep_compute(); - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -648,7 +648,7 @@ int Output::check_time_dumps(bigint ntimestep) } else { modify->clearstep_compute(); update->ntimestep--; - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart < ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -667,7 +667,7 @@ int Output::check_time_dumps(bigint ntimestep) } else { modify->clearstep_compute(); update->ntimestep--; - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart < ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 5deb35b634..6349fb78f7 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -1013,7 +1013,7 @@ void PairHybrid::set_special(int m) double * PairHybrid::save_special() { - double *saved = new double[8]; + auto saved = new double[8]; for (int i = 0; i < 4; ++i) { saved[i] = force->special_lj[i]; @@ -1054,7 +1054,7 @@ void *PairHybrid::extract(const char *str, int &dim) if (couldim != -1 && dim != couldim) error->all(FLERR, "Coulomb styles of pair hybrid sub-styles do not match"); - double *p_newvalue = (double *) ptr; + auto p_newvalue = (double *) ptr; double newvalue = *p_newvalue; if (cutptr && (newvalue != cutvalue)) error->all(FLERR, diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 24158f46a0..6bdaeb4530 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -67,7 +67,7 @@ void PairHybridScaled::compute(int eflag, int vflag) const int nvars = scalevars.size(); if (nvars > 0) { - double *vals = new double[nvars]; + auto vals = new double[nvars]; for (int k = 0; k < nvars; ++k) { int m = input->variable->find(scalevars[k].c_str()); if (m < 0) @@ -385,7 +385,7 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, const int nvars = scalevars.size(); if (nvars > 0) { - double *vals = new double[nvars]; + auto vals = new double[nvars]; for (int k = 0; k < nvars; ++k) { int m = input->variable->find(scalevars[k].c_str()); if (m < 0) diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 7b77a847f1..aefe9c4c4f 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -873,7 +873,7 @@ void PairTable::spline(double *x, double *y, int n, double yp1, double ypn, doub { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; diff --git a/src/platform.cpp b/src/platform.cpp index b2bca69934..8645bca6e1 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -678,7 +678,7 @@ std::string platform::current_directory() if (_getcwd(buf, MAX_PATH)) { cwd = buf; } delete[] buf; #else - char *buf = new char[PATH_MAX]; + auto buf = new char[PATH_MAX]; if (::getcwd(buf, PATH_MAX)) { cwd = buf; } delete[] buf; #endif diff --git a/src/procmap.cpp b/src/procmap.cpp index 3fc8a2263e..801a18c7a5 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -163,7 +163,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, char node_name[MPI_MAX_PROCESSOR_NAME]; MPI_Get_processor_name(node_name,&name_length); node_name[name_length] = '\0'; - char *node_names = new char[MPI_MAX_PROCESSOR_NAME*nprocs]; + auto node_names = new char[MPI_MAX_PROCESSOR_NAME*nprocs]; MPI_Allgather(node_name,MPI_MAX_PROCESSOR_NAME,MPI_CHAR,node_names, MPI_MAX_PROCESSOR_NAME,MPI_CHAR,world); std::string node_string = std::string(node_name); diff --git a/src/random_park.cpp b/src/random_park.cpp index 34a5378a35..34f8396e44 100644 --- a/src/random_park.cpp +++ b/src/random_park.cpp @@ -94,7 +94,7 @@ void RanPark::reset(int ibase, double *coord) { int i; - char *str = (char *) &ibase; + auto str = (char *) &ibase; int n = sizeof(int); unsigned int hash = 0; diff --git a/src/rcb.cpp b/src/rcb.cpp index 92eafebc28..ef326793cc 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -1130,8 +1130,8 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, void box_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) { - RCB::BBox *box1 = (RCB::BBox *) in; - RCB::BBox *box2 = (RCB::BBox *) inout; + auto box1 = (RCB::BBox *) in; + auto box2 = (RCB::BBox *) inout; for (int i = 0; i < 3; i++) { if (box1->lo[i] < box2->lo[i]) box2->lo[i] = box1->lo[i]; @@ -1160,8 +1160,8 @@ void box_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) void median_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) { - RCB::Median *med1 = (RCB::Median *) in; - RCB::Median *med2 = (RCB::Median *) inout; + auto med1 = (RCB::Median *) in; + auto med2 = (RCB::Median *) inout; med2->totallo += med1->totallo; if (med1->valuelo > med2->valuelo) { @@ -1209,8 +1209,7 @@ void RCB::invert(int sortflag) int *proclist; memory->create(proclist,nsend,"RCB:proclist"); - Invert *sinvert = - (Invert *) memory->smalloc(nsend*sizeof(Invert),"RCB:sinvert"); + auto sinvert = (Invert *) memory->smalloc(nsend*sizeof(Invert),"RCB:sinvert"); int m = 0; for (int i = nkeep; i < nfinal; i++) { @@ -1225,8 +1224,7 @@ void RCB::invert(int sortflag) // nrecv = # of my dots to send to other procs int nrecv = irregular->create_data(nsend,proclist,sortflag); - Invert *rinvert = - (Invert *) memory->smalloc(nrecv*sizeof(Invert),"RCB:rinvert"); + auto rinvert = (Invert *) memory->smalloc(nrecv*sizeof(Invert),"RCB:rinvert"); irregular->exchange_data((char *) sinvert,sizeof(Invert),(char *) rinvert); irregular->destroy_data(); diff --git a/src/read_data.cpp b/src/read_data.cpp index 8144414af9..2ea37b58f8 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -871,7 +871,7 @@ void ReadData::command(int narg, char **arg) if (addflag != NONE) { if (domain->triclinic) domain->x2lamda(atom->nlocal); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -887,7 +887,7 @@ void ReadData::command(int narg, char **arg) if (domain->nonperiodic == 2) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -1738,7 +1738,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) void ReadData::mass() { char *next; - char *buf = new char[ntypes*MAXLINE]; + auto buf = new char[ntypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ntypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1758,7 +1758,7 @@ void ReadData::mass() void ReadData::paircoeffs() { char *next; - char *buf = new char[ntypes*MAXLINE]; + auto buf = new char[ntypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ntypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1784,7 +1784,7 @@ void ReadData::pairIJcoeffs() char *next; int nsq = ntypes * (ntypes+1) / 2; - char *buf = new char[nsq * MAXLINE]; + auto buf = new char[nsq * MAXLINE]; int eof = utils::read_lines_from_file(fp,nsq,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1810,7 +1810,7 @@ void ReadData::bondcoeffs() if (!nbondtypes) return; char *next; - char *buf = new char[nbondtypes*MAXLINE]; + auto buf = new char[nbondtypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nbondtypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1835,7 +1835,7 @@ void ReadData::anglecoeffs(int which) if (!nangletypes) return; char *next; - char *buf = new char[nangletypes*MAXLINE]; + auto buf = new char[nangletypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nangletypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1861,7 +1861,7 @@ void ReadData::dihedralcoeffs(int which) if (!ndihedraltypes) return; char *next; - char *buf = new char[ndihedraltypes*MAXLINE]; + auto buf = new char[ndihedraltypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ndihedraltypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1891,7 +1891,7 @@ void ReadData::impropercoeffs(int which) if (!nimpropertypes) return; char *next; - char *buf = new char[nimpropertypes*MAXLINE]; + auto buf = new char[nimpropertypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nimpropertypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); diff --git a/src/read_dump.cpp b/src/read_dump.cpp index f3ca55f94f..81d1d7e9c2 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -1078,7 +1078,7 @@ void ReadDump::migrate_old_atoms() for (int i = 0; i < nlocal; i++) procassign[i] = tag[i] % nprocs; - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1,1,procassign); delete irregular; @@ -1101,7 +1101,7 @@ void ReadDump::migrate_new_atoms() procassign[i] = mtag % nprocs; } - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); newmaxnew = MAX(newmaxnew,1); // avoid null pointer @@ -1138,7 +1138,7 @@ void ReadDump::migrate_atoms_by_coords() if (triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index f8ac14534b..3f6f2f481b 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -434,7 +434,7 @@ void ReadRestart::command(int narg, char **arg) atom->map_set(); } if (domain->triclinic) domain->x2lamda(atom->nlocal); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -759,7 +759,7 @@ void ReadRestart::header() } else if (flag == ATOM_STYLE) { char *style = read_string(); int nargcopy = read_int(); - char **argcopy = new char*[nargcopy]; + auto argcopy = new char*[nargcopy]; for (int i = 0; i < nargcopy; i++) argcopy[i] = read_string(); atom->create_avec(style,nargcopy,argcopy,1); @@ -879,7 +879,7 @@ void ReadRestart::type_arrays() if (flag == MASS) { read_int(); - double *mass = new double[atom->ntypes+1]; + auto mass = new double[atom->ntypes+1]; read_double_vec(atom->ntypes,&mass[1]); atom->set_mass(mass); delete[] mass; @@ -1100,7 +1100,7 @@ void ReadRestart::file_layout() void ReadRestart::magic_string() { int n = strlen(MAGIC_STRING) + 1; - char *str = new char[n]; + auto str = new char[n]; int count; if (me == 0) count = fread(str,sizeof(char),n,fp); @@ -1142,7 +1142,7 @@ void ReadRestart::check_eof_magic() if (revision < 1) return; int n = strlen(MAGIC_STRING) + 1; - char *str = new char[n]; + auto str = new char[n]; // read magic string at end of file and restore file pointer @@ -1210,7 +1210,7 @@ char *ReadRestart::read_string() { int n = read_int(); if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart"); - char *value = new char[n]; + auto value = new char[n]; if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error); MPI_Bcast(value,n,MPI_CHAR,0,world); return value; diff --git a/src/rerun.cpp b/src/rerun.cpp index 83971f6adc..b788cfcaec 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -122,7 +122,7 @@ void Rerun::command(int narg, char **arg) // pass list of filenames to ReadDump // along with post-"dump" args and post-"format" args - ReadDump *rd = new ReadDump(lmp); + auto rd = new ReadDump(lmp); rd->store_files(nfile,arg); if (nremain) diff --git a/src/reset_atom_ids.cpp b/src/reset_atom_ids.cpp index 822490ffc8..5a6e5170bd 100644 --- a/src/reset_atom_ids.cpp +++ b/src/reset_atom_ids.cpp @@ -386,8 +386,7 @@ void ResetIDs::sort() int *proclist; memory->create(proclist,nlocal,"special:proclist"); - AtomRvous *atombuf = (AtomRvous *) - memory->smalloc((bigint) nlocal*sizeof(AtomRvous),"resetIDs:idbuf"); + auto atombuf = (AtomRvous *) memory->smalloc((bigint) nlocal*sizeof(AtomRvous),"resetIDs:idbuf"); int ibinx,ibiny,ibinz,iproc; bigint ibin; @@ -413,10 +412,9 @@ void ResetIDs::sort() // perform rendezvous operation, send atombuf to other procs char *buf; - int nreturn = comm->rendezvous(1,nlocal,(char *) atombuf,sizeof(AtomRvous), - 0,proclist, + int nreturn = comm->rendezvous(1,nlocal,(char *) atombuf,sizeof(AtomRvous),0,proclist, sort_bins,0,buf,sizeof(IDRvous),(void *) this); - IDRvous *outbuf = (IDRvous *) buf; + auto outbuf = (IDRvous *) buf; memory->destroy(proclist); memory->sfree(atombuf); @@ -439,13 +437,11 @@ void ResetIDs::sort() outbuf = list of N IDRvous datums, sent back to sending proc ------------------------------------------------------------------------- */ -int ResetIDs::sort_bins(int n, char *inbuf, - int &flag, int *&proclist, char *&outbuf, - void *ptr) +int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) { int i,ibin,index; - ResetIDs *rptr = (ResetIDs *) ptr; + auto rptr = (ResetIDs *) ptr; Memory *memory = rptr->memory; Error *error = rptr->error; MPI_Comm world = rptr->world; @@ -470,7 +466,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, count[ibin] = 0; } - AtomRvous *in = (AtomRvous *) inbuf; + auto in = (AtomRvous *) inbuf; for (i = 0; i < n; i++) { if (in[i].ibin < binlo || in[i].ibin >= binhi) { @@ -530,8 +526,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, int nout = n; memory->create(proclist,nout,"resetIDs:proclist"); - IDRvous *out = (IDRvous *) - memory->smalloc(nout*sizeof(IDRvous),"resetIDs:out"); + auto out = (IDRvous *) memory->smalloc(nout*sizeof(IDRvous),"resetIDs:out"); tagint one = nprev + 1; for (ibin = 0; ibin < nbins; ibin++) { @@ -593,7 +588,7 @@ int compare_coords(const void *iptr, const void *jptr) int compare_coords(const int i, const int j, void *ptr) { - ResetIDs::AtomRvous *rvous = (ResetIDs::AtomRvous *) ptr; + auto rvous = (ResetIDs::AtomRvous *) ptr; double *xi = rvous[i].x; double *xj = rvous[j].x; if (xi[0] < xj[0]) return -1; diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index a29ea98e18..79f44bdc3c 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -231,7 +231,7 @@ void ResetMolIDs::reset() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - tagint newid = static_cast(chunkIDs[i]); + auto newid = static_cast(chunkIDs[i]); if (singleexist) { if (newid == 1) newid = 0; else newid += offset - 1; diff --git a/src/set.cpp b/src/set.cpp index d0de0b4e62..2e3cff9526 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -1064,8 +1064,8 @@ void Set::setrandom(int keyword) double **x = atom->x; int seed = ivalue; - RanPark *ranpark = new RanPark(lmp,1); - RanMars *ranmars = new RanMars(lmp,seed + comm->me); + auto ranpark = new RanPark(lmp,1); + auto ranmars = new RanMars(lmp,seed + comm->me); // set approx fraction of atom types to newtype diff --git a/src/special.cpp b/src/special.cpp index ceba160be2..7f43199e18 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -165,8 +165,7 @@ void Special::atom_owners() int *proclist; memory->create(proclist,nlocal,"special:proclist"); - IDRvous *idbuf = (IDRvous *) - memory->smalloc((bigint) nlocal*sizeof(IDRvous),"special:idbuf"); + auto idbuf = (IDRvous *) memory->smalloc((bigint) nlocal*sizeof(IDRvous),"special:idbuf"); // setup input buf for rendezvous comm // one datum for each owned atom: datum = owning proc, atomID @@ -215,8 +214,7 @@ void Special::onetwo_build_newton() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // one datum for each unowned bond partner: bond partner ID, atomID @@ -239,7 +237,7 @@ void Special::onetwo_build_newton() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -341,8 +339,7 @@ void Special::onethree_build() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onetwo partners where either is unknown @@ -371,7 +368,7 @@ void Special::onethree_build() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -444,8 +441,7 @@ void Special::onefour_build() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onethree and onetwo partners where onethree is unknown @@ -473,7 +469,7 @@ void Special::onefour_build() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -825,8 +821,7 @@ void Special::angle_trim() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onetwo partners where either is unknown @@ -894,7 +889,7 @@ void Special::angle_trim() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1067,8 +1062,7 @@ void Special::dihedral_trim() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onefour atom IDs in a dihedral defined for my atoms @@ -1105,7 +1099,7 @@ void Special::dihedral_trim() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1197,11 +1191,9 @@ void Special::dihedral_trim() no outbuf ------------------------------------------------------------------------- */ -int Special::rendezvous_ids(int n, char *inbuf, - int &flag, int *& /*proclist*/, char *& /*outbuf*/, - void *ptr) +int Special::rendezvous_ids(int n, char *inbuf, int &flag, int *& /*proclist*/, char *& /*outbuf*/, void *ptr) { - Special *sptr = (Special *) ptr; + auto sptr = (Special *) ptr; Memory *memory = sptr->memory; int *procowner; @@ -1210,7 +1202,7 @@ int Special::rendezvous_ids(int n, char *inbuf, memory->create(procowner,n,"special:procowner"); memory->create(atomIDs,n,"special:atomIDs"); - IDRvous *in = (IDRvous *) inbuf; + auto in = (IDRvous *) inbuf; for (int i = 0; i < n; i++) { procowner[i] = in[i].me; @@ -1239,7 +1231,7 @@ int Special::rendezvous_ids(int n, char *inbuf, int Special::rendezvous_pairs(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) { - Special *sptr = (Special *) ptr; + auto sptr = (Special *) ptr; Atom *atom = sptr->atom; Memory *memory = sptr->memory; @@ -1258,7 +1250,7 @@ int Special::rendezvous_pairs(int n, char *inbuf, int &flag, int *&proclist, // proclist = owner of atomID in caller decomposition - PairRvous *in = (PairRvous *) inbuf; + auto in = (PairRvous *) inbuf; int *procowner = sptr->procowner; memory->create(proclist,n,"special:proclist"); diff --git a/src/utils.cpp b/src/utils.cpp index 871baf0645..a8e1b14104 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -744,7 +744,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod char *utils::strdup(const std::string &text) { - char *tmp = new char[text.size() + 1]; + auto tmp = new char[text.size() + 1]; strcpy(tmp, text.c_str()); // NOLINT return tmp; } @@ -814,7 +814,7 @@ std::string utils::star_subst(const std::string &name, bigint step, int pad) std::string utils::utf8_subst(const std::string &line) { - const unsigned char *const in = (const unsigned char *) line.c_str(); + const auto *const in = (const unsigned char *) line.c_str(); const int len = line.size(); std::string out; diff --git a/src/variable.cpp b/src/variable.cpp index dd18854ef5..5249ed3035 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -296,8 +296,8 @@ void Variable::set(int narg, char **arg) int maxcopy = strlen(arg[2]) + 1; int maxwork = maxcopy; - char *scopy = (char *) memory->smalloc(maxcopy,"var:string/copy"); - char *work = (char *) memory->smalloc(maxwork,"var:string/work"); + auto scopy = (char *) memory->smalloc(maxcopy,"var:string/copy"); + auto work = (char *) memory->smalloc(maxwork,"var:string/work"); strcpy(scopy,arg[2]); input->substitute(scopy,work,maxcopy,maxwork,1); memory->sfree(work); @@ -544,7 +544,7 @@ void Variable::set(int narg, char **arg) void Variable::set(const std::string &setcmd) { std::vector args = utils::split_words(setcmd); - char **newarg = new char*[args.size()]; + auto newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { newarg[i++] = (char *)arg.c_str(); @@ -560,7 +560,7 @@ void Variable::set(const std::string &setcmd) void Variable::set(char *name, int narg, char **arg) { - char **newarg = new char*[2+narg]; + auto newarg = new char*[2+narg]; newarg[0] = name; newarg[1] = (char *) "index"; for (int i = 0; i < narg; i++) newarg[2+i] = arg[i]; @@ -1276,12 +1276,12 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int istop = i - 1; int n = istop - istart + 1; - char *number = new char[n+1]; + auto number = new char[n+1]; strncpy(number,&str[istart],n); number[n] = '\0'; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(number); treestack[ntreestack++] = newtree; @@ -1307,7 +1307,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int istop = i-1; int n = istop - istart + 1; - char *word = new char[n+1]; + auto word = new char[n+1]; strncpy(word,&str[istart],n); word[n] = '\0'; @@ -1365,7 +1365,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = compute->scalar; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1390,7 +1390,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) index1 > compute->size_vector) value1 = 0.0; else value1 = compute->vector[index1-1]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1417,7 +1417,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) index1 > compute->size_array_rows) value1 = 0.0; else value1 = compute->array[index1-1][index2-1]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1441,7 +1441,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_VECTOR; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = compute->vector; newtree->nvector = compute->size_vector; @@ -1466,7 +1466,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_ARRAY; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = &compute->array[0][index1-1]; newtree->nvector = compute->size_array_rows; @@ -1528,7 +1528,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_PERATOM; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = compute->vector_atom; newtree->nstride = 1; @@ -1553,7 +1553,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_PERATOM; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; if (compute->array_atom) newtree->array = &compute->array_atom[0][index1-1]; @@ -1613,7 +1613,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_scalar(); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1631,7 +1631,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_vector(index1-1); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1651,7 +1651,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_array(index1-1,index2-1); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1676,7 +1676,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) for (int m = 0; m < nvec; m++) vec[m] = fix->compute_vector(m); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1703,7 +1703,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) for (int m = 0; m < nvec; m++) vec[m] = fix->compute_array(m,index1-1); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1752,7 +1752,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) update->ntimestep % fix->peratom_freq) print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = fix->vector_atom; newtree->nstride = 1; @@ -1771,7 +1771,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) update->ntimestep % fix->peratom_freq) print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; if (fix->array_atom) newtree->array = &fix->array_atom[0][index1-1]; @@ -1815,7 +1815,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = dvalue[ivar]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1831,7 +1831,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (var == nullptr) print_var_error(FLERR,"Invalid variable evaluation in variable formula",ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(var); treestack[ntreestack++] = newtree; @@ -1860,7 +1860,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (treetype == VECTOR) print_var_error(FLERR,"Atomfile-style variable in vector-style variable formula",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = reader[ivar]->fixstore->vstore; newtree->nstride = 1; @@ -1879,7 +1879,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) double *vec; int nvec = compute_vector(ivar,&vec); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1917,7 +1917,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int m = index; // convert from tagint to int if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = vec[m-1]; treestack[ntreestack++] = newtree; @@ -1979,7 +1979,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (constants.find(word) != constants.end()) { value1 = constants[word]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1998,7 +1998,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,fmt::format("Invalid thermo keyword '{}' in variable formula", word),ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -2075,7 +2075,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) opprevious = opstack[--nopstack]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = opprevious; if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; @@ -2537,8 +2537,8 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STAGGER) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); if (tree->first->type != VALUE || tree->second->type != VALUE) return 0.0; tree->type = VALUE; if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) @@ -2551,9 +2551,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2571,9 +2571,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ2) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2595,9 +2595,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ3) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2624,9 +2624,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STRIDE) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2642,12 +2642,12 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STRIDE2) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); - bigint ivalue4 = static_cast (collapse_tree(tree->extra[1])); - bigint ivalue5 = static_cast (collapse_tree(tree->extra[2])); - bigint ivalue6 = static_cast (collapse_tree(tree->extra[3])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue4 = static_cast (collapse_tree(tree->extra[1])); + auto ivalue5 = static_cast (collapse_tree(tree->extra[2])); + auto ivalue6 = static_cast (collapse_tree(tree->extra[3])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE || tree->extra[1]->type != VALUE || tree->extra[2]->type != VALUE || tree->extra[3]->type != VALUE) @@ -2911,8 +2911,8 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STAGGER) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) error->one(FLERR,"Invalid math function in variable formula"); bigint lower = update->ntimestep/ivalue1 * ivalue1; @@ -2923,9 +2923,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == LOGFREQ) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 || ivalue2 >= ivalue3) error->one(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2940,9 +2940,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == LOGFREQ2) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2961,9 +2961,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STRIDE) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2976,12 +2976,12 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STRIDE2) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); - bigint ivalue4 = static_cast (eval_tree(tree->extra[1],i)); - bigint ivalue5 = static_cast (eval_tree(tree->extra[2],i)); - bigint ivalue6 = static_cast (eval_tree(tree->extra[3],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue4 = static_cast (eval_tree(tree->extra[1],i)); + auto ivalue5 = static_cast (eval_tree(tree->extra[2],i)); + auto ivalue6 = static_cast (eval_tree(tree->extra[3],i)); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (ivalue4 < 0 || ivalue5 < 0 || ivalue6 <= 0 || ivalue4 > ivalue5) @@ -3429,8 +3429,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STAGGER; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) print_var_error(FLERR,"Invalid math function in variable formula",ivar); bigint lower = update->ntimestep/ivalue1 * ivalue1; @@ -3446,9 +3446,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 || ivalue2 >= ivalue3) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; @@ -3468,9 +3468,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ2; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; @@ -3493,9 +3493,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ3; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 1 || ivalue3 <= 0 || ivalue3-ivalue1+1 < ivalue2 ) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -3524,9 +3524,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STRIDE; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); double value; @@ -3544,12 +3544,12 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STRIDE2; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); - bigint ivalue4 = static_cast (values[1]); - bigint ivalue5 = static_cast (values[2]); - bigint ivalue6 = static_cast (values[3]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); + auto ivalue4 = static_cast (values[1]); + auto ivalue5 = static_cast (values[2]); + auto ivalue6 = static_cast (values[3]); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (ivalue4 < 0 || ivalue5 < 0 || ivalue6 <= 0 || ivalue4 > ivalue5) @@ -3853,7 +3853,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4129,7 +4129,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4147,7 +4147,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (igroup == -1) print_var_error(FLERR,"Group ID in variable formula does not exist",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = GMASK; newtree->ivalue1 = group->bitmask[igroup]; treestack[ntreestack++] = newtree; @@ -4161,7 +4161,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t int iregion = region_function(args[0],ivar); domain->regions[iregion]->prematch(); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = RMASK; newtree->ivalue1 = iregion; treestack[ntreestack++] = newtree; @@ -4178,7 +4178,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t int iregion = region_function(args[1],ivar); domain->regions[iregion]->prematch(); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = GRMASK; newtree->ivalue1 = group->bitmask[igroup]; newtree->ivalue2 = iregion; @@ -4207,7 +4207,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (done) remove(ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4228,7 +4228,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t int done = reader[ivar]->read_peratom(); if (done) remove(ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = result; newtree->nstride = 1; @@ -4247,7 +4247,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4263,7 +4263,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4279,7 +4279,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4296,7 +4296,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4310,7 +4310,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4390,7 +4390,7 @@ void Variable::peratom2global(int flag, char *word, double *vector, int nstride, MPI_Allreduce(&mine,&value,1,MPI_DOUBLE,MPI_SUM,world); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4436,7 +4436,7 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree if (tree == nullptr) error->all(FLERR,"Atom vector in equal-style variable formula"); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->nstride = 3; treestack[ntreestack++] = newtree; diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 0aca596ae6..8dc2a4b04f 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -100,7 +100,7 @@ void WriteCoeff::command(int narg, char **arg) coeff_mode = CLASS2_MODE; } - const char *section = (const char *) ""; + const char * section = (const char *) ""; // NOLINT fputs(str, two); // style utils::sfgets(FLERR, str, 256, one, file, error); // coeff int n = strlen(str); diff --git a/src/write_dump.cpp b/src/write_dump.cpp index eba081582e..8e6a5147e7 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -47,7 +47,7 @@ void WriteDump::command(int narg, char **arg) Dump *dump = nullptr; - char **dumpargs = new char*[modindex+2]; + auto dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id dumpargs[1] = arg[0]; // group dumpargs[2] = arg[1]; // dump style diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index d3c5dba1b5..94f1e2c864 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -83,7 +83,7 @@ int main(int narg, char **arg) } n = strlen(arg[iarg]) + 1 + 4; - char *filetxt = new char[n]; + auto filetxt = new char[n]; strcpy(filetxt, arg[iarg]); strcat(filetxt, ".txt"); FILE *fptxt = fopen(filetxt, "w");