diff --git a/src/DIFFRACTION/compute_saed.cpp b/src/DIFFRACTION/compute_saed.cpp index e2a7bb33d9..db5c4f6ed8 100644 --- a/src/DIFFRACTION/compute_saed.cpp +++ b/src/DIFFRACTION/compute_saed.cpp @@ -206,7 +206,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : // Find reciprocal spacing and integer dimensions for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; - Knmax[i] = ceil(Kmax / dK[i]); + Knmax[i] = (int) ceil(Kmax / dK[i]); } // Finding the intersection of the reciprocal space and Ewald sphere @@ -348,7 +348,7 @@ void ComputeSAED::compute_vector() utils::logmesg(lmp,"-----\nComputing SAED intensities"); double t0 = platform::walltime(); - auto 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,8 +364,8 @@ void ComputeSAED::compute_vector() } } - auto xlocal = new double [3*nlocalgroup]; - int *typelocal = new int [nlocalgroup]; + auto *xlocal = new double[3*nlocalgroup]; + auto *typelocal = new int[nlocalgroup]; nlocalgroup = 0; for (int ii = 0; ii < nlocal; ii++) { @@ -378,20 +378,6 @@ void ComputeSAED::compute_vector() } } -/* - double *x = new double [3*nlocal]; - int nlocalgroup = 0; - for (int ii = 0; ii < nlocal; ii++) { - if (mask[ii] & groupbit) { - x[3*ii+0] = atom->x[ii][0]; - x[3*ii+1] = atom->x[ii][1]; - x[3*ii+2] = atom->x[ii][2]; - nlocalgroup++; - } - } -*/ - - // determining parameter set to use based on maximum S = sin(theta)/lambda double Smax = Kmax / 2; @@ -413,7 +399,7 @@ void ComputeSAED::compute_vector() #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(offset,ASFSAED,typelocal,xlocal,Fvec,m,frac) #endif { - auto 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 +467,7 @@ void ComputeSAED::compute_vector() delete[] f; } - auto 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_saed_consts.h b/src/DIFFRACTION/compute_saed_consts.h index c590e44ad6..6dbd323ae3 100644 --- a/src/DIFFRACTION/compute_saed_consts.h +++ b/src/DIFFRACTION/compute_saed_consts.h @@ -27,10 +27,11 @@ elastic and absorptive electron atomic scattering factors Acta Crystallogr.A 52 25776 */ -#define SAEDmaxType 98 +namespace { +constexpr int SAEDmaxType = 98; // list of element types associated with atomic scattering factor constants -static const char *SAEDtypeList[SAEDmaxType] = { +const char *const SAEDtypeList[SAEDmaxType] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", @@ -40,7 +41,7 @@ static const char *SAEDtypeList[SAEDmaxType] = { "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf"}; // list of atomic scattering factor constants for electron diffraction -static const double ASFSAED[SAEDmaxType][20] = { +const double ASFSAED[SAEDmaxType][20] = { /* Each set of four rows in this file represents a single row in the matrix First two rows are constants for 0 < sin(theta)/lambda < 2 Z-number A1 A2 A3 A4 A5 @@ -245,5 +246,5 @@ static const double ASFSAED[SAEDmaxType][20] = { /* 98*/ {1.2089, 2.7391, 4.3482, 4.0047, 4.6497, 0.2421, 1.7487, 6.7262, 23.2153, 80.3108, 0.8100, 3.0001, 5.4635, 4.1756, 3.5066, 0.1310, 1.4038, 7.6057, 34.0186, 90.5226}, }; - +} // namespace #endif diff --git a/src/DIFFRACTION/compute_xrd_consts.h b/src/DIFFRACTION/compute_xrd_consts.h index 264b6e7ff2..64faea0226 100644 --- a/src/DIFFRACTION/compute_xrd_consts.h +++ b/src/DIFFRACTION/compute_xrd_consts.h @@ -28,8 +28,8 @@ x-ray and electron atomic scattering factors at high angles Acta Crystallogr. A 45 78693 */ -static constexpr int XRDmaxType = 210; namespace { +constexpr int XRDmaxType = 210; const char *const XRDtypeList[XRDmaxType] = { "H", "He1-", "He", "Li", "Li1+", "Be", "Be2+", "B", "C", "Cval", "N", "O", "O1-", "F", "F1-", "Ne", "Na", "Na1+", "Mg", "Mg2+", "Al", "Al3+", "Si", "Sival", diff --git a/src/DIFFRACTION/fix_saed_vtk.cpp b/src/DIFFRACTION/fix_saed_vtk.cpp index 693bb925b6..4c8c65df84 100644 --- a/src/DIFFRACTION/fix_saed_vtk.cpp +++ b/src/DIFFRACTION/fix_saed_vtk.cpp @@ -172,7 +172,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) { for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; - Knmax[i] = ceil(Kmax / dK[i]); + Knmax[i] = (int) ceil(Kmax / dK[i]); Knmin[i] = -Knmax[i]; } } else { @@ -187,7 +187,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : int Ksearch[3]; for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; - Ksearch[i] = ceil(Kmax / dK[i]); + Ksearch[i] = (int) ceil(Kmax / dK[i]); } for (int k = -Ksearch[2]; k <= Ksearch[2]; k++) {