diff --git a/examples/PACKAGES/uf3/in.uf3.2b.W b/examples/PACKAGES/uf3/in.uf3.2b.W index 29510ea5b1..bff3529e9c 100644 --- a/examples/PACKAGES/uf3/in.uf3.2b.W +++ b/examples/PACKAGES/uf3/in.uf3.2b.W @@ -24,7 +24,7 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 diff --git a/examples/PACKAGES/uf3/in.uf3.3b.W b/examples/PACKAGES/uf3/in.uf3.3b.W index e66b38aa83..9ca29293b5 100644 --- a/examples/PACKAGES/uf3/in.uf3.3b.W +++ b/examples/PACKAGES/uf3/in.uf3.3b.W @@ -24,7 +24,7 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 pair_coeff 3b 1 1 1 W_W_W.uf3 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 index bd4eb61bcd..4dee5c5942 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,10 +39,8 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform @@ -91,20 +89,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0344773 on 1 procs for 100 steps with 128 atoms +Loop time of 0.0345905 on 1 procs for 100 steps with 128 atoms -Performance: 125.300 ns/day, 0.192 hours/ns, 2900.463 timesteps/s, 371.259 katom-step/s -98.6% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 124.890 ns/day, 0.192 hours/ns, 2890.965 timesteps/s, 370.044 katom-step/s +99.2% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.033145 | 0.033145 | 0.033145 | 0.0 | 96.14 +Pair | 0.03333 | 0.03333 | 0.03333 | 0.0 | 96.36 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00071163 | 0.00071163 | 0.00071163 | 0.0 | 2.06 -Output | 0.0002018 | 0.0002018 | 0.0002018 | 0.0 | 0.59 -Modify | 0.00017741 | 0.00017741 | 0.00017741 | 0.0 | 0.51 -Other | | 0.0002413 | | | 0.70 +Comm | 0.00068797 | 0.00068797 | 0.00068797 | 0.0 | 1.99 +Output | 0.00015217 | 0.00015217 | 0.00015217 | 0.0 | 0.44 +Modify | 0.00019786 | 0.00019786 | 0.00019786 | 0.0 | 0.57 +Other | | 0.0002224 | | | 0.64 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 index 4d42ef0016..10936a977c 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,10 +39,8 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform @@ -91,20 +89,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0111207 on 4 procs for 100 steps with 128 atoms +Loop time of 0.0104225 on 4 procs for 100 steps with 128 atoms -Performance: 388.463 ns/day, 0.062 hours/ns, 8992.202 timesteps/s, 1.151 Matom-step/s -98.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 414.488 ns/day, 0.058 hours/ns, 9594.626 timesteps/s, 1.228 Matom-step/s +99.4% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0087312 | 0.008777 | 0.0088396 | 0.0 | 78.92 +Pair | 0.0076422 | 0.0077975 | 0.0081692 | 0.2 | 74.81 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0019835 | 0.0020323 | 0.0020742 | 0.1 | 18.27 -Output | 7.6664e-05 | 8.1924e-05 | 9.4556e-05 | 0.0 | 0.74 -Modify | 5.4618e-05 | 5.8768e-05 | 6.2489e-05 | 0.0 | 0.53 -Other | | 0.0001708 | | | 1.54 +Comm | 0.001954 | 0.0022765 | 0.0024447 | 0.4 | 21.84 +Output | 7.7086e-05 | 8.2565e-05 | 9.3188e-05 | 0.0 | 0.79 +Modify | 4.8524e-05 | 5.011e-05 | 5.1759e-05 | 0.0 | 0.48 +Other | | 0.0002159 | | | 2.07 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 index ad6c138b96..3e95eb6055 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,17 +39,13 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing pair_coeff 3b 1 1 1 W_W_W.uf3 - -UF3: Opening W_W_W.uf3 file UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform @@ -101,20 +97,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.486699 on 1 procs for 100 steps with 128 atoms +Loop time of 0.478107 on 1 procs for 100 steps with 128 atoms -Performance: 8.876 ns/day, 2.704 hours/ns, 205.466 timesteps/s, 26.300 katom-step/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 9.036 ns/day, 2.656 hours/ns, 209.158 timesteps/s, 26.772 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.48518 | 0.48518 | 0.48518 | 0.0 | 99.69 +Pair | 0.47649 | 0.47649 | 0.47649 | 0.0 | 99.66 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00082659 | 0.00082659 | 0.00082659 | 0.0 | 0.17 -Output | 0.00014676 | 0.00014676 | 0.00014676 | 0.0 | 0.03 -Modify | 0.00025566 | 0.00025566 | 0.00025566 | 0.0 | 0.05 -Other | | 0.0002862 | | | 0.06 +Comm | 0.00082433 | 0.00082433 | 0.00082433 | 0.0 | 0.17 +Output | 0.00020504 | 0.00020504 | 0.00020504 | 0.0 | 0.04 +Modify | 0.00022769 | 0.00022769 | 0.00022769 | 0.0 | 0.05 +Other | | 0.0003635 | | | 0.08 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 index 56ab30c270..330a69ea40 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,17 +39,13 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing pair_coeff 3b 1 1 1 W_W_W.uf3 - -UF3: Opening W_W_W.uf3 file UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform @@ -101,20 +97,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.133856 on 4 procs for 100 steps with 128 atoms +Loop time of 0.135192 on 4 procs for 100 steps with 128 atoms -Performance: 32.273 ns/day, 0.744 hours/ns, 747.069 timesteps/s, 95.625 katom-step/s -98.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 31.955 ns/day, 0.751 hours/ns, 739.688 timesteps/s, 94.680 katom-step/s +99.5% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.1196 | 0.1221 | 0.12575 | 0.7 | 91.22 +Pair | 0.11876 | 0.12259 | 0.13092 | 1.4 | 90.68 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0074076 | 0.011068 | 0.01359 | 2.4 | 8.27 -Output | 0.00013888 | 0.00015365 | 0.00018854 | 0.0 | 0.11 -Modify | 0.00010546 | 0.00011783 | 0.00013025 | 0.0 | 0.09 -Other | | 0.0004172 | | | 0.31 +Comm | 0.0035898 | 0.011903 | 0.015736 | 4.5 | 8.80 +Output | 0.00016067 | 0.00018114 | 0.00023041 | 0.0 | 0.13 +Modify | 9.9574e-05 | 0.00011041 | 0.00012152 | 0.0 | 0.08 +Other | | 0.0004092 | | | 0.30 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 6b518c7ef1..4fa87ba335 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -19,6 +19,7 @@ ---------------------------------------------------------------------- */ #include "pair_uf3.h" + #include "uf3_pair_bspline.h" #include "uf3_triplet_bspline.h" @@ -35,7 +36,9 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::THIRD; + +/* ---------------------------------------------------------------------- */ PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) { @@ -45,11 +48,11 @@ PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) neighshort = nullptr; centroidstressflag = CENTROID_AVAIL; manybody_flag = 1; - one_coeff = 0; //if 1 then allow only one coeff call of form 'pair_coeff * *' - //by setting it to 0 we will allow multiple 'pair_coeff' calls bsplines_created = 0; } +/* ---------------------------------------------------------------------- */ + PairUF3::~PairUF3() { if (copymode) return; @@ -75,18 +78,11 @@ PairUF3::~PairUF3() void PairUF3::settings(int narg, char **arg) { - if (narg != 2) - error->all(FLERR, "UF3: Invalid number of argument in pair settings\n\ - Are you running 2-body or 2 & 3-body UF potential\n\ - Also how many elements?"); + if (narg != 1) + error->all(FLERR, "Invalid number of arguments for pair_style uf3" + " Are you using a 2-body or 2 & 3-body UF potential?"); nbody_flag = utils::numeric(FLERR, arg[0], true, lmp); - num_of_elements = utils::numeric(FLERR, arg[1], true, lmp); // atom->ntypes; - if (num_of_elements != atom->ntypes) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Number of elements provided in the input file and \ -number of elements detected by lammps in the structure are not same\n\ - proceed with caution\n"); - } + num_of_elements = atom->ntypes; if (nbody_flag == 2) { pot_3b = false; n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; @@ -97,7 +93,7 @@ number of elements detected by lammps in the structure are not same\n\ n3body_pot_files = num_of_elements * (num_of_elements * (num_of_elements + 1) / 2); tot_pot_files = n2body_pot_files + n3body_pot_files; } else - error->all(FLERR, "UF3: UF3 not yet implemented for {}-body", nbody_flag); + error->all(FLERR, "Pair style uf3 not (yet) implemented for {}-body terms", nbody_flag); } /* ---------------------------------------------------------------------- @@ -107,131 +103,33 @@ void PairUF3::coeff(int narg, char **arg) { if (!allocated) allocate(); - if (narg != 3 && narg != 5){ - /*error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ - older style of specifying UF3 POT files. This style of listing \n\ - all the potential files on a single line will be depcrecated in \n\ - the next version of ML-UF3");*/ - if (narg == tot_pot_files + 2) - error->all(FLERR, "UF3 The old style of listing all the potential files\n\ - on a single line is depcrecated"); - else - error->all(FLERR, "UF3: Invalid number of argument in pair coeff;\n\ - Provide the species number followed by the LAMMPS POT file\n\ - Eg. 'pair_coeff 1 1 POT_FILE' for 2-body and \n\ - 'pair_coeff 3b 1 2 2 POT_FILE' for 3-body."); - } - if (narg == 3 || narg == 5){ - int ilo, ihi, jlo, jhi, klo, khi; - if (narg == 3){ - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - } + if (narg != 3 && narg != 5) + error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); - if (narg == 5){ - utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); - utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); - } - - if (narg == 3){ - if (utils::strmatch(arg[0],".*\\*.*") || utils::strmatch(arg[1],".*\\*.*")){ - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo, i); j <= jhi; j++) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); - uf3_read_pot_file(i,j,arg[2]); - } - } - } - - else{ - int i = utils::inumeric(FLERR, arg[0], true, lmp); - int j = utils::inumeric(FLERR, arg[1], true, lmp); - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); + int ilo, ihi, jlo, jhi, klo, khi; + if (narg == 3) { + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { uf3_read_pot_file(i,j,arg[2]); } } + } else if (narg == 5) { + utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); + utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); + if (!utils::strmatch(arg[0],"^3b$")) + error->all(FLERR, "Pair style uf3 3-body terms require the first argument to be 3b"); - if (narg == 5){ - if (!utils::strmatch(arg[0],"3b")) - error->all(FLERR, "UF3: Invalid argument. For 3-body the first argument\n\ - argument to pair_coeff needs to be 3b.\n\ - Example pair_coeff 3b 1 2 2 A_B_B."); - if (utils::strmatch(arg[1],".*\\*.*") || utils::strmatch(arg[2],".*\\*.*") || utils::strmatch(arg[3],".*\\*.*")){ - for (int i = ilo; i <= ihi; i++) { - for (int j = jlo; j <= jhi; j++) { - for (int k = MAX(klo, jlo); k <= khi; k++) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); - uf3_read_pot_file(i,j,k,arg[4]); - } - } - } - } - else{ - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); - int i = utils::inumeric(FLERR, arg[1], true, lmp); - int j = utils::inumeric(FLERR, arg[2], true, lmp); - int k = utils::inumeric(FLERR, arg[3], true, lmp); - uf3_read_pot_file(i,j,k,arg[4]); - } - } - } - - /*else{ - if (narg != tot_pot_files + 2) - error->all(FLERR,"UF3: Invalid number of argument in pair coeff; \n\ - Number of potential files provided is not correct"); - - error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ - older style of specifying UF3 POT files. This style of listing \n\ - all the potential files on a single line will be depcrecated in \n\ - the next version of ML-UF3"); - - // open UF3 potential file on all proc - for (int i = 2; i < narg; i++) { uf3_read_pot_file(arg[i]); } - if (!bsplines_created) create_bsplines(); - - // setflag check needed here - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = 1; j < num_of_elements + 1; j++) { - if (setflag[i][j] != 1) - error->all(FLERR,"UF3: Not all 2-body UF potentials are set, \n\ - missing potential file for {}-{} interaction",i, j); - } - } - - if (pot_3b) { - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = 1; k < num_of_elements + 1; k++) { - if (setflag_3b[i][j][k] != 1) - error->all(FLERR,"UF3: Not all 3-body UF potentials are set, \n\ - missing potential file for {}-{}-{} interaction", i, j, k); - } - } - } - } - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++) { - UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j]); - UFBS2b[j][i] = UFBS2b[i][j]; - } - if (pot_3b) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = j; k < num_of_elements + 1; k++) { - std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = - uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key]); - UFBS3b[i][k][j] = UFBS3b[i][j][k]; + for (int i = ilo; i <= ihi; i++) { + for (int j = jlo; j <= jhi; j++) { + for (int k = MAX(klo, jlo); k <= khi; k++) { + uf3_read_pot_file(i,j,k,arg[4]); } } } } - }*/ } void PairUF3::allocate() @@ -356,13 +254,13 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")){ + if (utils::strmatch(knot_type,"uk")) { utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform\n\ knot spacing\n",potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; } - else if (utils::strmatch(knot_type,"nk")){ + else if (utils::strmatch(knot_type,"nk")) { utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform\n\ knot spacing\n",potf_name); knot_spacing_type_2b[itype][jtype] = 1; @@ -479,13 +377,13 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")){ + if (utils::strmatch(knot_type,"uk")) { utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform\n\ knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; } - else if (utils::strmatch(knot_type,"nk")){ + else if (utils::strmatch(knot_type,"nk")) { utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform\n\ knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; @@ -1122,7 +1020,7 @@ void PairUF3::compute(int eflag, int vflag) rjk = sqrt( ((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); - if (rjk >= min_cut_3b[itype][jtype][ktype][0]){ + if (rjk >= min_cut_3b[itype][jtype][ktype][0]) { double *triangle_eval = UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); @@ -1169,7 +1067,8 @@ void PairUF3::compute(int eflag, int vflag) if (eflag) evdwl = *triangle_eval; - if (evflag) { ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); + if (evflag) { + ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); // Centroid stress 3-body term if (vflag_either && cvflag_atom) { double ric[3]; @@ -1267,12 +1166,12 @@ double PairUF3::memory_usage() bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ (num_of_elements+1)*3*sizeof(double); //min_cut_3b - for (int i=1; i < num_of_elements+1; i++){ - for (int j=i; j < num_of_elements+1; j++){ + for (int i=1; i < num_of_elements+1; i++) { + for (int j=i; j < num_of_elements+1; j++) { bytes += (double)2*n2b_knot[i][j].size()*sizeof(double); //n2b_knot bytes += (double)2*n2b_coeff[i][j].size()*sizeof(double); //n2b_coeff } - if (pot_3b){ + if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { bytes += (double)2*n3b_knot_matrix[i][j][k][0].size()*sizeof(double); @@ -1281,8 +1180,8 @@ double PairUF3::memory_usage() std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - for (int l=0; l < n3b_coeff_matrix[key].size(); l++){ - for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++){ + for (int l=0; l < n3b_coeff_matrix[key].size(); l++) { + for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++) { bytes += (double)2*n3b_coeff_matrix[key][l][m].size()*sizeof(double); //key = ijk //key = ikj @@ -1294,7 +1193,7 @@ double PairUF3::memory_usage() } for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++){ + for (int j = i; j < num_of_elements + 1; j++) { bytes += (double)2*UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] } if (pot_3b) {