diff --git a/examples/msst/log.27Nov18.msst.g++.1 b/examples/msst/log.30Jun20.msst.g++.1 similarity index 75% rename from examples/msst/log.27Nov18.msst.g++.1 rename to examples/msst/log.30Jun20.msst.g++.1 index 4b18e67702..1e0e083620 100644 --- a/examples/msst/log.27Nov18.msst.g++.1 +++ b/examples/msst/log.30Jun20.msst.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (30 Jun 2020) using 1 OpenMP thread(s) per MPI task # LJ test of msst shock dynamics @@ -21,7 +21,7 @@ Created orthogonal box = (0 0 0) to (96.4602 96.4602 96.4602) 1 by 1 by 1 MPI processor grid create_atoms 1 region box1 Created 23328 atoms - Time spent = 0.00902033 secs + create_atoms CPU = 0.007 seconds mass 1 40.00 @@ -50,7 +50,7 @@ Neighbor list info ... pair build: half/bin/atomonly/newton stencil: half/bin/3d/newton bin: standard -Per MPI rank memory allocation (min/avg/max) = 17.86 | 17.86 | 17.86 Mbytes +Per MPI rank memory allocation (min/avg/max) = 17.85 | 17.85 | 17.85 Mbytes Step Temp E_pair E_mol TotEng Press 0 600 -1943.9014 0 -134.75058 992.06384 10 586.44651 -1917.3971 0 -149.11346 1306.17 @@ -63,30 +63,30 @@ Step Temp E_pair E_mol TotEng Press 80 300.28534 -1056.589 0 -151.15321 8324.8812 90 305.83368 -1073.3097 0 -151.14426 8175.2478 100 304.06857 -1067.9843 0 -151.14112 8191.234 -Loop time of 3.49498 on 1 procs for 100 steps with 23328 atoms +Loop time of 3.62419 on 1 procs for 100 steps with 23328 atoms -Performance: 4.944 ns/day, 4.854 hours/ns, 28.612 timesteps/s +Performance: 4.768 ns/day, 5.034 hours/ns, 27.592 timesteps/s 99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 3.354 | 3.354 | 3.354 | 0.0 | 95.97 -Neigh | 0.074059 | 0.074059 | 0.074059 | 0.0 | 2.12 -Comm | 0.020118 | 0.020118 | 0.020118 | 0.0 | 0.58 -Output | 0.0010924 | 0.0010924 | 0.0010924 | 0.0 | 0.03 -Modify | 0.034063 | 0.034063 | 0.034063 | 0.0 | 0.97 -Other | | 0.01168 | | | 0.33 +Pair | 3.4606 | 3.4606 | 3.4606 | 0.0 | 95.49 +Neigh | 0.065469 | 0.065469 | 0.065469 | 0.0 | 1.81 +Comm | 0.030757 | 0.030757 | 0.030757 | 0.0 | 0.85 +Output | 0.0024359 | 0.0024359 | 0.0024359 | 0.0 | 0.07 +Modify | 0.049582 | 0.049582 | 0.049582 | 0.0 | 1.37 +Other | | 0.01537 | | | 0.42 -Nlocal: 23328 ave 23328 max 23328 min +Nlocal: 23328.0 ave 23328.0 max 23328.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 22235 ave 22235 max 22235 min +Nghost: 22235.0 ave 22235.0 max 22235.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 2.18372e+06 ave 2.18372e+06 max 2.18372e+06 min +Neighs: 2183715.0 ave 2183715.0 max 2183715.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 2183715 -Ave neighs/atom = 93.6092 +Ave neighs/atom = 93.60918209876543 Neighbor list builds = 1 Dangerous builds = 0 unfix 2 @@ -95,9 +95,9 @@ unfix 2 fix msst all msst z 28.0 q 200 mu 3e2 tscale 0.01 MSST parameters: Shock in z direction - Cell mass-like parameter qmass (units of mass^2/length^4) = 2.00000e+02 - Shock velocity = 2.80000e+01 - Artificial viscosity (units of mass/length/time) = 3.00000e+02 + Cell mass-like parameter qmass (units of mass^2/length^4) = 200 + Shock velocity = 28 + Artificial viscosity (units of mass/length/time) = 300 Initial pressure calculated on first step Initial volume calculated on first step Initial energy calculated on first step @@ -121,11 +121,11 @@ thermo_style custom step temp ke pe lx ly lz pxx pyy pzz etotal v_dhug v_d #dump_modify 3 pad 3 run 100 -Fix MSST v0 = 8.97521e+05 -Fix MSST p0 = 8.10679e+03 -Fix MSST e0 = to be -1.51141e+02 -Fix MSST initial strain rate of -3.20112e-02 established by reducing temperature by factor of 1.00000e-02 -Per MPI rank memory allocation (min/avg/max) = 18.99 | 18.99 | 18.99 Mbytes +Fix MSST v0 = 897520.7 +Fix MSST p0 = 8106.7886 +Fix MSST e0 = -151.14112 +Fix MSST initial strain rate of -0.032011238 established by reducing temperature by factor of 0.01 +Per MPI rank memory allocation (min/avg/max) = 18.98 | 18.98 | 18.98 Mbytes Step Temp KinEng PotEng Lx Ly Lz Pxx Pyy Pzz TotEng v_dhug v_dray v_lgr_vel v_lgr_pos f_msst 100 301.02788 907.67474 -1058.8159 96.4602 96.4602 96.4602 8242.1214 8202.9779 8095.8693 -151.14112 1.5203428 -10.919311 0 0 9.1684318 110 297.71411 897.68288 -1048.8859 96.4602 96.4602 96.399397 8347.6253 8303.7121 8220.7572 -151.20299 1.439058 28.652258 0.017649501 -0.55980494 5.7336721 @@ -138,30 +138,30 @@ Step Temp KinEng PotEng Lx Ly Lz Pxx Pyy Pzz TotEng v_dhug v_dray v_lgr_vel v_lg 180 304.99 919.62151 -1071.3588 96.4602 96.4602 96.022824 8461.5542 8343.1436 8484.9824 -151.73733 0.99203387 -235.51793 0.12695926 -4.4693063 -15.685622 190 305.1148 919.99782 -1071.7807 96.4602 96.4602 95.9748 8498.7562 8371.4217 8514.4473 -151.78288 0.93937416 -273.43964 0.1408996 -5.0266132 -18.403999 200 306.45829 924.0488 -1075.8787 96.4602 96.4602 95.927931 8488.9509 8385.2408 8529.6443 -151.82991 0.88654815 -324.00777 0.15450451 -5.583645 -21.055149 -Loop time of 5.50267 on 1 procs for 100 steps with 23328 atoms +Loop time of 7.9807 on 1 procs for 100 steps with 23328 atoms -Performance: 3.140 ns/day, 7.643 hours/ns, 18.173 timesteps/s +Performance: 2.165 ns/day, 11.084 hours/ns, 12.530 timesteps/s 99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 4.7512 | 4.7512 | 4.7512 | 0.0 | 86.34 -Neigh | 0.14916 | 0.14916 | 0.14916 | 0.0 | 2.71 -Comm | 0.020737 | 0.020737 | 0.020737 | 0.0 | 0.38 -Output | 0.010999 | 0.010999 | 0.010999 | 0.0 | 0.20 -Modify | 0.55965 | 0.55965 | 0.55965 | 0.0 | 10.17 -Other | | 0.01089 | | | 0.20 +Pair | 6.8295 | 6.8295 | 6.8295 | 0.0 | 85.58 +Neigh | 0.13211 | 0.13211 | 0.13211 | 0.0 | 1.66 +Comm | 0.032946 | 0.032946 | 0.032946 | 0.0 | 0.41 +Output | 0.02301 | 0.02301 | 0.02301 | 0.0 | 0.29 +Modify | 0.94857 | 0.94857 | 0.94857 | 0.0 | 11.89 +Other | | 0.01452 | | | 0.18 -Nlocal: 23328 ave 23328 max 23328 min +Nlocal: 23328.0 ave 23328.0 max 23328.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 22205 ave 22205 max 22205 min +Nghost: 22205.0 ave 22205.0 max 22205.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 2.18349e+06 ave 2.18349e+06 max 2.18349e+06 min +Neighs: 2183494.0 ave 2183494.0 max 2183494.0 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 2183494 -Ave neighs/atom = 93.5997 +Ave neighs/atom = 93.5997085048011 Neighbor list builds = 2 Dangerous builds = 0 -Total wall time: 0:00:09 +Total wall time: 0:00:11 diff --git a/examples/msst/log.27Nov18.msst.g++.4 b/examples/msst/log.30Jun20.msst.g++.4 similarity index 74% rename from examples/msst/log.27Nov18.msst.g++.4 rename to examples/msst/log.30Jun20.msst.g++.4 index c2ed0fcb5e..a98b957b50 100644 --- a/examples/msst/log.27Nov18.msst.g++.4 +++ b/examples/msst/log.30Jun20.msst.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (30 Jun 2020) using 1 OpenMP thread(s) per MPI task # LJ test of msst shock dynamics @@ -21,7 +21,7 @@ Created orthogonal box = (0 0 0) to (96.4602 96.4602 96.4602) 1 by 2 by 2 MPI processor grid create_atoms 1 region box1 Created 23328 atoms - Time spent = 0.00104165 secs + create_atoms CPU = 0.003 seconds mass 1 40.00 @@ -50,7 +50,7 @@ Neighbor list info ... pair build: half/bin/atomonly/newton stencil: half/bin/3d/newton bin: standard -Per MPI rank memory allocation (min/avg/max) = 7.784 | 7.784 | 7.784 Mbytes +Per MPI rank memory allocation (min/avg/max) = 7.785 | 7.785 | 7.785 Mbytes Step Temp E_pair E_mol TotEng Press 0 600 -1943.9014 0 -134.75058 992.06384 10 586.47212 -1917.4465 0 -149.08565 1305.7368 @@ -63,30 +63,30 @@ Step Temp E_pair E_mol TotEng Press 80 299.37658 -1053.8476 0 -151.1519 8352.9467 90 304.24026 -1068.4941 0 -151.13319 8218.1594 100 301.9683 -1061.6332 0 -151.12284 8244.1277 -Loop time of 0.978562 on 4 procs for 100 steps with 23328 atoms +Loop time of 0.995305 on 4 procs for 100 steps with 23328 atoms -Performance: 17.659 ns/day, 1.359 hours/ns, 102.191 timesteps/s -97.8% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17.362 ns/day, 1.382 hours/ns, 100.472 timesteps/s +98.2% 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.86406 | 0.88129 | 0.89922 | 1.4 | 90.06 -Neigh | 0.019231 | 0.019453 | 0.019816 | 0.2 | 1.99 -Comm | 0.043947 | 0.06197 | 0.079005 | 5.1 | 6.33 -Output | 0.00057197 | 0.00082499 | 0.0015628 | 0.0 | 0.08 -Modify | 0.0091414 | 0.0092927 | 0.0094769 | 0.1 | 0.95 -Other | | 0.005727 | | | 0.59 +Pair | 0.88957 | 0.90144 | 0.91686 | 1.1 | 90.57 +Neigh | 0.016824 | 0.016945 | 0.017106 | 0.1 | 1.70 +Comm | 0.039949 | 0.054853 | 0.068734 | 4.8 | 5.51 +Output | 0.00076342 | 0.0010425 | 0.0018687 | 1.5 | 0.10 +Modify | 0.012839 | 0.012946 | 0.013153 | 0.1 | 1.30 +Other | | 0.008074 | | | 0.81 -Nlocal: 5832 ave 5850 max 5813 min +Nlocal: 5832.0 ave 5850.0 max 5813.0 min Histogram: 1 0 0 0 1 1 0 0 0 1 -Nghost: 10571 ave 10590 max 10553 min +Nghost: 10571.0 ave 10590.0 max 10553.0 min Histogram: 1 0 0 0 1 1 0 0 0 1 -Neighs: 545762 ave 548069 max 543643 min +Neighs: 545761.75 ave 548069.0 max 543643.0 min Histogram: 1 0 0 1 0 1 0 0 0 1 Total # of neighbors = 2183047 -Ave neighs/atom = 93.5805 +Ave neighs/atom = 93.58054698216735 Neighbor list builds = 1 Dangerous builds = 0 unfix 2 @@ -95,9 +95,9 @@ unfix 2 fix msst all msst z 28.0 q 200 mu 3e2 tscale 0.01 MSST parameters: Shock in z direction - Cell mass-like parameter qmass (units of mass^2/length^4) = 2.00000e+02 - Shock velocity = 2.80000e+01 - Artificial viscosity (units of mass/length/time) = 3.00000e+02 + Cell mass-like parameter qmass (units of mass^2/length^4) = 200 + Shock velocity = 28 + Artificial viscosity (units of mass/length/time) = 300 Initial pressure calculated on first step Initial volume calculated on first step Initial energy calculated on first step @@ -121,11 +121,11 @@ thermo_style custom step temp ke pe lx ly lz pxx pyy pzz etotal v_dhug v_d #dump_modify 3 pad 3 run 100 -Fix MSST v0 = 8.97521e+05 -Fix MSST p0 = 8.18624e+03 -Fix MSST e0 = to be -1.51123e+02 -Fix MSST initial strain rate of -3.19005e-02 established by reducing temperature by factor of 1.00000e-02 -Per MPI rank memory allocation (min/avg/max) = 8.534 | 8.534 | 8.534 Mbytes +Fix MSST v0 = 897520.7 +Fix MSST p0 = 8186.2393 +Fix MSST e0 = -151.12284 +Fix MSST initial strain rate of -0.031900492 established by reducing temperature by factor of 0.01 +Per MPI rank memory allocation (min/avg/max) = 8.535 | 8.535 | 8.535 Mbytes Step Temp KinEng PotEng Lx Ly Lz Pxx Pyy Pzz TotEng v_dhug v_dray v_lgr_vel v_lgr_pos f_msst 100 298.94862 901.40524 -1052.5281 96.4602 96.4602 96.4602 8270.9151 8253.4662 8175.4946 -151.12284 1.5098415 -10.744684 0 0 9.1051034 110 296.49826 894.01679 -1045.224 96.4602 96.4602 96.399609 8338.4937 8340.5504 8294.9909 -151.20723 1.4327442 23.73173 0.017588167 -0.55980562 5.6560557 @@ -138,30 +138,30 @@ Step Temp KinEng PotEng Lx Ly Lz Pxx Pyy Pzz TotEng v_dhug v_dray v_lgr_vel v_lg 180 305.86343 922.25514 -1073.9633 96.4602 96.4602 96.023049 8345.1853 8432.5201 8461.3276 -151.70813 0.97863988 -338.30793 0.12689398 -4.4693274 -15.815462 190 307.44054 927.01052 -1078.7892 96.4602 96.4602 95.9747 8368.4081 8427.5109 8450.584 -151.77867 0.92329631 -416.89333 0.1409285 -5.0266346 -18.541801 200 308.43619 930.01265 -1081.8521 96.4602 96.4602 95.927349 8393.2058 8443.1265 8454.6733 -151.83947 0.8723277 -479.24592 0.1546734 -5.5836644 -21.20378 -Loop time of 1.57102 on 4 procs for 100 steps with 23328 atoms +Loop time of 2.16596 on 4 procs for 100 steps with 23328 atoms -Performance: 10.999 ns/day, 2.182 hours/ns, 63.653 timesteps/s -97.5% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 7.978 ns/day, 3.008 hours/ns, 46.169 timesteps/s +98.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 | 1.2237 | 1.2543 | 1.3264 | 3.7 | 79.84 -Neigh | 0.038648 | 0.039684 | 0.041811 | 0.6 | 2.53 -Comm | 0.026617 | 0.10771 | 0.14194 | 14.3 | 6.86 -Output | 0.0035126 | 0.0045422 | 0.0076261 | 2.6 | 0.29 -Modify | 0.15787 | 0.15969 | 0.16403 | 0.6 | 10.16 -Other | | 0.005042 | | | 0.32 +Pair | 1.7569 | 1.7822 | 1.8059 | 1.6 | 82.28 +Neigh | 0.034235 | 0.03546 | 0.037677 | 0.7 | 1.64 +Comm | 0.065427 | 0.091172 | 0.11833 | 7.4 | 4.21 +Output | 0.0062776 | 0.0065615 | 0.0074117 | 0.6 | 0.30 +Modify | 0.24069 | 0.2423 | 0.24655 | 0.5 | 11.19 +Other | | 0.008271 | | | 0.38 -Nlocal: 5832 ave 5874 max 5803 min +Nlocal: 5832.0 ave 5874.0 max 5803.0 min Histogram: 2 0 0 0 0 1 0 0 0 1 -Nghost: 10563.8 ave 10588 max 10526 min +Nghost: 10563.75 ave 10588.0 max 10526.0 min Histogram: 1 0 0 0 1 0 0 0 0 2 -Neighs: 545708 ave 550787 max 542668 min +Neighs: 545708.5 ave 550787.0 max 542668.0 min Histogram: 2 0 0 0 1 0 0 0 0 1 Total # of neighbors = 2182834 -Ave neighs/atom = 93.5714 +Ave neighs/atom = 93.57141632373114 Neighbor list builds = 2 Dangerous builds = 0 -Total wall time: 0:00:02 +Total wall time: 0:00:03 diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 67b2a7fb0f..c9591e92ac 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -32,6 +32,8 @@ #include "domain.h" #include "memory.h" #include "error.h" +#include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -142,52 +144,28 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : // output MSST info if (comm->me == 0) { - if (screen) { - fprintf(screen,"MSST parameters:\n"); - if (direction == 0) fprintf(screen," Shock in x direction\n"); - else if (direction == 1) fprintf(screen," Shock in y direction\n"); - else if (direction == 2) fprintf(screen," Shock in z direction\n"); - fprintf(screen," Cell mass-like parameter qmass " - "(units of mass^2/length^4) = %12.5e\n", qmass); - fprintf(screen," Shock velocity = %12.5e\n", velocity); - fprintf(screen," Artificial viscosity " - "(units of mass/length/time) = %12.5e\n", mu); + std::string mesg = "MSST parameters:\n"; + if (direction == 0) mesg += " Shock in x direction\n"; + else if (direction == 1) mesg += " Shock in y direction\n"; + else if (direction == 2) mesg += " Shock in z direction\n"; + mesg += fmt::format(" Cell mass-like parameter qmass " + "(units of mass^2/length^4) = {:.8g}\n", qmass); + mesg += fmt::format(" Shock velocity = {:.8g}\n", velocity); + mesg += fmt::format(" Artificial viscosity " + "(units of mass/length/time) = {:.8g}\n", mu); - if (p0_set) - fprintf(screen," Initial pressure specified to be %12.5e\n", p0); - else fprintf(screen," Initial pressure calculated on first step\n"); + if (p0_set) + mesg += fmt::format(" Initial pressure specified to be {:.8g}\n", p0); + else mesg += " Initial pressure calculated on first step\n"; - if (v0_set) - fprintf(screen," Initial volume specified to be %12.5e\n", v0); - else fprintf(screen," Initial volume calculated on first step\n"); + if (v0_set) + mesg += fmt::format(" Initial volume specified to be {:.8g}\n", v0); + else mesg += " Initial volume calculated on first step\n"; - if (e0_set) - fprintf(screen," Initial energy specified to be %12.5e\n", e0); - else fprintf(screen," Initial energy calculated on first step\n"); - } - if (logfile) { - fprintf(logfile,"MSST parameters:\n"); - if (direction == 0) fprintf(logfile," Shock in x direction\n"); - else if (direction == 1) fprintf(logfile," Shock in y direction\n"); - else if (direction == 2) fprintf(logfile," Shock in z direction\n"); - fprintf(logfile," Cell mass-like parameter qmass " - "(units of mass^2/length^4) = %12.5e\n", qmass); - fprintf(logfile," Shock velocity = %12.5e\n", velocity); - fprintf(logfile," Artificial viscosity " - "(units of mass/length/time) = %12.5e\n", mu); - - if (p0_set) - fprintf(logfile," Initial pressure specified to be %12.5e\n", p0); - else fprintf(logfile," Initial pressure calculated on first step\n"); - - if (v0_set) - fprintf(logfile," Initial volume specified to be %12.5e\n", v0); - else fprintf(logfile," Initial volume calculated on first step\n"); - - if (e0_set) - fprintf(logfile," Initial energy specified to be %12.5e\n", e0); - else fprintf(logfile," Initial energy calculated on first step\n"); - } + if (e0_set) + mesg += fmt::format(" Initial energy specified to be {:.8g}\n", e0); + else mesg += " Initial energy calculated on first step\n"; + utils::logmesg(lmp,mesg); } // check for periodicity in controlled dimensions @@ -199,51 +177,29 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 10; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"MSST_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + std::string fixcmd = std::string(id) + "MSST_temp"; + id_temp = new char[fixcmd.size()+1]; + strcpy(id_temp,fixcmd.c_str()); + modify->add_compute(fixcmd + " all temp"); tflag = 1; // create a new pressure compute // id = fix-ID + "MSST_press", compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 11; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"MSST_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + fixcmd = std::string(id) + "MSST_press"; + id_press = new char[fixcmd.size()+1]; + strcpy(id_press,fixcmd.c_str()); + modify->add_compute(fixcmd + " all pressure " + std::string(id_temp)); pflag = 1; // create a new potential energy compute // id = fix-ID + "MSST_pe", compute group = all - n = strlen(id) + 8; - id_pe = new char[n]; - strcpy(id_pe,id); - strcat(id_pe,"MSST_pe"); - - newarg = new char*[3]; - newarg[0] = id_pe; - newarg[1] = (char*) "all"; - newarg[2] = (char*) "pe"; - modify->add_compute(3,newarg); - delete [] newarg; + fixcmd = std::string(id) + "MSST_pe"; + id_pe = new char[fixcmd.size()+1]; + strcpy(id_pe,fixcmd.c_str()); + modify->add_compute(fixcmd + " all pe"); peflag = 1; // initialize the time derivative of the volume @@ -334,21 +290,21 @@ void FixMSST::init() rfix = NULL; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) nrigid++; + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + utils::strmatch(modify->fix[i]->style,"^poems$")) nrigid++; if (nrigid) { rfix = new int[nrigid]; nrigid = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) rfix[nrigid++] = i; + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + utils::strmatch(modify->fix[i]->style,"^poems$")) rfix[nrigid++] = i; } // find fix external being used to drive LAMMPS from DFTB+ if (dftb) { for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"external") == 0) + if (utils::strmatch(modify->fix[i]->style,"^external$")) fix_external = (FixExternal *) modify->fix[i]; if (fix_external == NULL) error->all(FLERR,"Fix msst dftb cannot be used w/out fix external"); @@ -371,31 +327,24 @@ void FixMSST::setup(int /*vflag*/) if ( v0_set == 0 ) { v0 = compute_vol(); v0_set = 1; - if (comm->me == 0) { - if ( screen ) fprintf(screen,"Fix MSST v0 = %12.5e\n", v0); - if ( logfile ) fprintf(logfile,"Fix MSST v0 = %12.5e\n", v0); - } + if (comm->me == 0) + utils::logmesg(lmp,fmt::format("Fix MSST v0 = {:.8g}\n", v0)); } if ( p0_set == 0 ) { p0 = p_current[direction]; p0_set = 1; - if ( comm->me == 0 ) { - if ( screen ) fprintf(screen,"Fix MSST p0 = %12.5e\n", p0); - if ( logfile ) fprintf(logfile,"Fix MSST p0 = %12.5e\n", p0); - } + if ( comm->me == 0 ) + utils::logmesg(lmp,fmt::format("Fix MSST p0 = {:.8g}\n", p0)); } if ( e0_set == 0 ) { e0 = compute_etotal(); e0_set = 1; - if ( comm->me == 0 ) { - if ( screen ) fprintf(screen,"Fix MSST e0 = to be %12.5e\n",e0); - if ( logfile ) fprintf(logfile,"Fix MSST e0 = to be %12.5e\n",e0); - } - + if ( comm->me == 0 ) + utils::logmesg(lmp,fmt::format("Fix MSST e0 = {:.8g}\n", e0)); } temperature->compute_vector(); @@ -415,16 +364,11 @@ void FixMSST::setup(int /*vflag*/) omega[direction]=-1*sqrt(fac1); double fac2 = omega[direction]/v0; - if ( comm->me == 0 && tscale != 1.0) { - if ( screen ) - fprintf(screen,"Fix MSST initial strain rate of %12.5e established " - "by reducing temperature by factor of %12.5e\n", - fac2,tscale); - if ( logfile ) - fprintf(logfile,"Fix MSST initial strain rate of %12.5e established " - "by reducing temperature by factor of %12.5e\n", - fac2,tscale); - } + if ( comm->me == 0 && tscale != 1.0) + utils::logmesg(lmp,fmt::format("Fix MSST initial strain rate of " + "{:.8g} established by reducing " + "temperature by factor of {:.8g}\n", + fac2,tscale)); for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { for (int k = 0; k < 3; k++ ) {