diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index ea23478805..cdfb379087 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -99,20 +99,20 @@ void PairBrownian::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -494,7 +494,7 @@ void PairBrownian::init_style() // are re-calculated at every step. flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != nullptr) { @@ -514,14 +514,14 @@ void PairBrownian::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); // Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index e25ef37f04..15afd56886 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -82,20 +82,20 @@ void PairBrownianPoly::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (j = 0; j < 3; j++){ + for (j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -355,7 +355,7 @@ void PairBrownianPoly::init_style() // are re-calculated at every step. flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != nullptr) { @@ -375,14 +375,14 @@ void PairBrownianPoly::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); // Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index d813b794f1..64b7aa2e30 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -155,20 +155,20 @@ void PairLubricate::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -559,7 +559,7 @@ void PairLubricate::init_style() // are re-calculated at every step. shearing = flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) { shearing = flagdeform = 1; if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) @@ -584,15 +584,15 @@ void PairLubricate::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); //Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 3974b12b56..c047ce6a07 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -158,8 +158,8 @@ void PairLubricateU::compute(int eflag, int vflag) // store back the saved forces and torques in original arrays - for(i=0;iprd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -813,20 +813,20 @@ void PairLubricateU::compute_RU() double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -1013,7 +1013,7 @@ void PairLubricateU::compute_RU() torque[i][1] -= vxmu2f*ty; torque[i][2] -= vxmu2f*tz; - if(newton_pair || j < nlocal) { + if (newton_pair || j < nlocal) { torque[j][0] -= vxmu2f*tx; torque[j][1] -= vxmu2f*ty; torque[j][2] -= vxmu2f*tz; @@ -1084,20 +1084,20 @@ void PairLubricateU::compute_RU(double **x) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -1284,7 +1284,7 @@ void PairLubricateU::compute_RU(double **x) torque[i][1] -= vxmu2f*ty; torque[i][2] -= vxmu2f*tz; - if(newton_pair || j < nlocal) { + if (newton_pair || j < nlocal) { torque[j][0] -= vxmu2f*tx; torque[j][1] -= vxmu2f*ty; torque[j][2] -= vxmu2f*tz; @@ -1791,7 +1791,7 @@ void PairLubricateU::init_style() // are re-calculated at every step. flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != nullptr) { @@ -1811,14 +1811,14 @@ void PairLubricateU::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); //Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 6b44c4e077..49c77e9b60 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -126,8 +126,8 @@ void PairLubricateUPoly::compute(int eflag, int vflag) // Store back the saved forces and torques in original arrays - for(i=0;iprd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -626,20 +626,20 @@ void PairLubricateUPoly::compute_RU(double **x) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (j = 0; j < 3; j++){ + for (j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -1155,10 +1155,10 @@ void PairLubricateUPoly::init_style() // are re-calculated at every step. flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != nullptr){ + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -1176,14 +1176,14 @@ void PairLubricateUPoly::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); //Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); @@ -1214,7 +1214,7 @@ void PairLubricateUPoly::init_style() if (!flagVF) vol_f = 0; if (!comm->me) { - if(logfile) + if (logfile) fprintf(logfile, "lubricateU: vol_f = %g, vol_p = %g, vol_T = %g\n", vol_f,vol_P,vol_T); if (screen) diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index b35411ab4b..a395f8c67e 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -137,20 +137,20 @@ void PairLubricatePoly::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; @@ -461,7 +461,7 @@ void PairLubricatePoly::init_style() // are re-calculated at every step. shearing = flagdeform = flagwall = 0; - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) { shearing = flagdeform = 1; if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) @@ -478,7 +478,7 @@ void PairLubricatePoly::init_style() if (wallfix->xflag) flagwall = 2; // Moving walls exist } - if (strstr(modify->fix[i]->style,"wall") != nullptr){ + if (strstr(modify->fix[i]->style,"wall") != nullptr) { flagwall = 1; // Walls exist if (((FixWall *) modify->fix[i])->xflag ) { flagwall = 2; // Moving walls exist @@ -492,14 +492,14 @@ void PairLubricatePoly::init_style() if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd; else { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]); //Since fix->wall->init happens after pair->init_style wallcoord = input->variable->compute_equal(wallfix->xindex[m]); diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 946ea57bfd..7c30d7c101 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -168,7 +168,7 @@ void DumpAtomGZ::write() int DumpAtomGZ::modify_param(int narg, char **arg) { int consumed = DumpAtom::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { if (strcmp(arg[0],"compression_level") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); int min_level = Z_DEFAULT_COMPRESSION; diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index 3313b8d78d..f51a8b393b 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -171,7 +171,7 @@ void DumpAtomZstd::write() int DumpAtomZstd::modify_param(int narg, char **arg) { int consumed = DumpAtom::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { try { if (strcmp(arg[0],"checksum") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index e50e13ff4e..9beb606b24 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -176,7 +176,7 @@ void DumpCFGGZ::write() int DumpCFGGZ::modify_param(int narg, char **arg) { int consumed = DumpCFG::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { if (strcmp(arg[0],"compression_level") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); int min_level = Z_DEFAULT_COMPRESSION; diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index ff8b7c395a..13890334ba 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -173,7 +173,7 @@ void DumpCFGZstd::write() int DumpCFGZstd::modify_param(int narg, char **arg) { int consumed = DumpCFG::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { try { if (strcmp(arg[0],"checksum") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index e36dea7d21..f345f4b111 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -168,7 +168,7 @@ void DumpCustomGZ::write() int DumpCustomGZ::modify_param(int narg, char **arg) { int consumed = DumpCustom::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { if (strcmp(arg[0],"compression_level") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); int min_level = Z_DEFAULT_COMPRESSION; diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index 8937ce04c9..81ace6172f 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -171,7 +171,7 @@ void DumpCustomZstd::write() int DumpCustomZstd::modify_param(int narg, char **arg) { int consumed = DumpCustom::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { try { if (strcmp(arg[0],"checksum") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 17eecc95fd..e0d2f0d2dd 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -183,7 +183,7 @@ void DumpLocalGZ::write() int DumpLocalGZ::modify_param(int narg, char **arg) { int consumed = DumpLocal::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { if (strcmp(arg[0],"compression_level") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); int min_level = Z_DEFAULT_COMPRESSION; diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index 8a7a8cf19b..c03670ffba 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -171,7 +171,7 @@ void DumpLocalZstd::write() int DumpLocalZstd::modify_param(int narg, char **arg) { int consumed = DumpLocal::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { try { if (strcmp(arg[0],"checksum") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index c84c83b9cb..21a55f6b07 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -147,7 +147,7 @@ void DumpXYZGZ::write() int DumpXYZGZ::modify_param(int narg, char **arg) { int consumed = DumpXYZ::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { if (strcmp(arg[0],"compression_level") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); int min_level = Z_DEFAULT_COMPRESSION; diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index 0cc65a03b8..9c220bdca7 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -145,7 +145,7 @@ void DumpXYZZstd::write() int DumpXYZZstd::modify_param(int narg, char **arg) { int consumed = DumpXYZ::modify_param(narg, arg); - if(consumed == 0) { + if (consumed == 0) { try { if (strcmp(arg[0],"checksum") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/COMPRESS/zstd_file_writer.cpp b/src/COMPRESS/zstd_file_writer.cpp index 2631faa4ad..9f69f95395 100644 --- a/src/COMPRESS/zstd_file_writer.cpp +++ b/src/COMPRESS/zstd_file_writer.cpp @@ -48,7 +48,7 @@ ZstdFileWriter::~ZstdFileWriter() void ZstdFileWriter::open(const std::string &path) { - if(isopen()) return; + if (isopen()) return; fp = fopen(path.c_str(), "wb"); @@ -72,7 +72,7 @@ void ZstdFileWriter::open(const std::string &path) size_t ZstdFileWriter::write(const void * buffer, size_t length) { - if(!isopen()) return 0; + if (!isopen()) return 0; ZSTD_inBuffer input = { buffer, length, 0 }; ZSTD_EndDirective mode = ZSTD_e_continue; @@ -90,7 +90,7 @@ size_t ZstdFileWriter::write(const void * buffer, size_t length) void ZstdFileWriter::flush() { - if(!isopen()) return; + if (!isopen()) return; size_t remaining; ZSTD_inBuffer input = { nullptr, 0, 0 }; @@ -109,7 +109,7 @@ void ZstdFileWriter::flush() void ZstdFileWriter::close() { - if(!isopen()) return; + if (!isopen()) return; size_t remaining; ZSTD_inBuffer input = { nullptr, 0, 0 }; @@ -144,7 +144,7 @@ void ZstdFileWriter::setCompressionLevel(int level) const int min_level = ZSTD_minCLevel(); const int max_level = ZSTD_maxCLevel(); - if(level < min_level || level > max_level) + if (level < min_level || level > max_level) throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level)); compression_level = level; diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 92a9fd04e7..4bf74a3b7e 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -232,7 +232,7 @@ double ComputeTempCS::compute_scalar() double t = 0.0; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { vthermal[0] = v[i][0] - vint[i][0]; vthermal[1] = v[i][1] - vint[i][1]; @@ -271,7 +271,7 @@ void ComputeTempCS::compute_vector() double t[6]; for (int i = 0; i < 6; i++) t[i] = 0.0; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (rmass) massone = rmass[i]; else massone = mass[type[i]]; diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 7da95cdc11..c1370af307 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -370,7 +370,7 @@ void PairEAMAlloyGPU::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(PairEAM::lmp, filename, "eam/alloy", unit_convert_flag); diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index d613069a9a..ce3ea8bb0b 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -370,7 +370,7 @@ void PairEAMFSGPU::read_file(char *filename) Fs *file = fs; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(PairEAM::lmp, filename, "eam/fs", unit_convert_flag); diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index 6a7ea52a54..df17b2091a 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -141,7 +141,7 @@ void PairVashishtaGPU::compute(int eflag, int vflag) void PairVashishtaGPU::allocate() { - if(!allocated) { + if (!allocated) { PairVashishta::allocate(); } int n = atom->ntypes; @@ -260,7 +260,7 @@ void PairVashishtaGPU::init_style() double PairVashishtaGPU::init_one(int i, int j) { - if(!gpu_allocated) { + if (!gpu_allocated) { allocate(); } if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 7218149d08..f52b976b63 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -1303,7 +1303,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, relrot2 = omega[1]; relrot3 = omega[2]; } - if (roll_model != ROLL_NONE){ + if (roll_model != ROLL_NONE) { // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // This is different from the Marshall papers, diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index fe88d0755f..215926e23e 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -536,7 +536,7 @@ void PairGranular::compute(int eflag, int vflag) } if (roll_model[itype][jtype] != ROLL_NONE || - twist_model[itype][jtype] != TWIST_NONE){ + twist_model[itype][jtype] != TWIST_NONE) { relrot1 = omega[i][0] - omega[j][0]; relrot2 = omega[i][1] - omega[j][1]; relrot3 = omega[i][2] - omega[j][2]; diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 564f063668..faf1d26909 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -252,7 +252,7 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, } } else { query += fmt::format("&{}=[", key); - while (n != std::string::npos){ + while (n != std::string::npos) { std::string sval = val.substr(0, n); if (utils::is_integer(sval) || utils::is_double(sval) || diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index 0b50f2d3d8..c41a42c99a 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -230,9 +230,9 @@ void AtomKokkos::sort() reallocate memory to the pointer selected by the mask ------------------------------------------------------------------------- */ -void AtomKokkos::grow(unsigned int mask){ +void AtomKokkos::grow(unsigned int mask) { - if (mask & SPECIAL_MASK){ + if (mask & SPECIAL_MASK) { memoryKK->destroy_kokkos(k_special, special); sync(Device, mask); modified(Device, mask); diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index b15fc2965b..39897018ec 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -281,10 +281,10 @@ int AtomVecAngleKokkos::pack_comm_kokkos(const int &n, // Check whether to always run forward communication on the host // Choose correct forward PackComm kernel - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -296,7 +296,7 @@ int AtomVecAngleKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -310,8 +310,8 @@ int AtomVecAngleKokkos::pack_comm_kokkos(const int &n, } } else { atomKK->sync(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -323,7 +323,7 @@ int AtomVecAngleKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -396,11 +396,11 @@ int AtomVecAngleKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &li const int & iswap, const int nfirst, const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, @@ -414,7 +414,7 @@ int AtomVecAngleKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &li Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, @@ -431,8 +431,8 @@ int AtomVecAngleKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &li } else { atomKK->sync(Device,X_MASK); atomKK->modified(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, @@ -446,7 +446,7 @@ int AtomVecAngleKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &li Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecAngleKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, @@ -492,7 +492,7 @@ struct AtomVecAngleKokkos_UnpackComm { void AtomVecAngleKokkos::unpack_comm_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); struct AtomVecAngleKokkos_UnpackComm f(atomKK->k_x,buf,first); @@ -641,7 +641,7 @@ void AtomVecAngleKokkos::unpack_comm_vel(int n, int first, double *buf) int AtomVecAngleKokkos::pack_reverse(int n, int first, double *buf) { - if(n > 0) + if (n > 0) atomKK->sync(Host,F_MASK); int m = 0; @@ -658,7 +658,7 @@ int AtomVecAngleKokkos::pack_reverse(int n, int first, double *buf) void AtomVecAngleKokkos::unpack_reverse(int n, int *list, double *buf) { - if(n > 0) + if (n > 0) atomKK->modified(Host,F_MASK); int m = 0; @@ -742,7 +742,7 @@ int AtomVecAngleKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecAngleKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -756,7 +756,7 @@ int AtomVecAngleKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecAngleKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -939,7 +939,7 @@ struct AtomVecAngleKokkos_UnpackBorder { typename AT::t_tagint_1d &molecule, const int& first): _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_molecule(molecule), - _first(first){ + _first(first) { }; KOKKOS_INLINE_FUNCTION @@ -963,7 +963,7 @@ void AtomVecAngleKokkos::unpack_border_kokkos(const int &n, const int &first, atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); while (first+n >= nmax) grow(0); atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecAngleKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,h_molecule,first); Kokkos::parallel_for(n,f); @@ -1129,7 +1129,7 @@ struct AtomVecAngleKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { // 3 comp of x, 3 comp of v, 1 tag, 1 type, 1 mask, 1 image, 1 molecule, 3 nspecial, // maxspecial special, 1 num_bond, bond_per_atom bond_type, bond_per_atom bond_atom, // 1 num_angle, angle_per_atom angle_type, angle_per_atom angle_atom1, angle_atom2, @@ -1178,7 +1178,7 @@ struct AtomVecAngleKokkos_PackExchangeFunctor { const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -1220,12 +1220,12 @@ int AtomVecAngleKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_ X_FLOAT hi ) { const int elements = 17+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom; - if(nsend > (int) (k_buf.view().extent(0)* + if (nsend > (int) (k_buf.view().extent(0)* k_buf.view().extent(1))/elements) { int newsize = nsend*elements/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecAngleKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); @@ -1333,7 +1333,7 @@ struct AtomVecAngleKokkos_UnpackExchangeFunctor { _angle_atom2(atom->k_angle_atom2.view()), _angle_atom3(atom->k_angle_atom3.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { elements =17+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom; const int maxsendlist = (buf.template view().extent(0)* buf.template view().extent(1))/elements; @@ -1386,7 +1386,7 @@ int AtomVecAngleKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int n int nlocal,int dim,X_FLOAT lo,X_FLOAT hi, ExecutionSpace space) { const size_t elements = 17+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom; - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecAngleKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.cpp b/src/KOKKOS/atom_vec_atomic_kokkos.cpp index 013b55c959..c1ae398e22 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.cpp +++ b/src/KOKKOS/atom_vec_atomic_kokkos.cpp @@ -200,7 +200,7 @@ int AtomVecAtomicKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecAtomicKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,dx,dy,dz); @@ -214,7 +214,7 @@ int AtomVecAtomicKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecAtomicKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,dx,dy,dz); @@ -374,7 +374,7 @@ struct AtomVecAtomicKokkos_UnpackBorder { typename ArrayTypes::t_int_1d &type, typename ArrayTypes::t_int_1d &mask, const int& first): - _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_first(first){ + _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_first(first) { }; KOKKOS_INLINE_FUNCTION @@ -396,7 +396,7 @@ void AtomVecAtomicKokkos::unpack_border_kokkos(const int &n, const int &first, atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK); while (first+n >= nmax) grow(0); atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecAtomicKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,first); Kokkos::parallel_for(n,f); } else { @@ -504,7 +504,7 @@ struct AtomVecAtomicKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 11; const int maxsendlist = (buf.template view().extent(0)*buf.template view().extent(1))/elements; @@ -527,7 +527,7 @@ struct AtomVecAtomicKokkos_PackExchangeFunctor { _buf(mysend,10) = d_ubuf(_image[i]).d; const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -546,11 +546,11 @@ struct AtomVecAtomicKokkos_PackExchangeFunctor { int AtomVecAtomicKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &k_buf, DAT::tdual_int_1d k_sendlist,DAT::tdual_int_1d k_copylist,ExecutionSpace space,int dim,X_FLOAT lo,X_FLOAT hi ) { - if(nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/11) { + if (nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/11) { int newsize = nsend*11/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecAtomicKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); return nsend*11; @@ -615,7 +615,7 @@ struct AtomVecAtomicKokkos_UnpackExchangeFunctor { _mask(atom->k_mask.view()), _image(atom->k_image.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 11; const int maxsendlist = (buf.template view().extent(0)*buf.template view().extent(1))/elements; @@ -644,7 +644,7 @@ struct AtomVecAtomicKokkos_UnpackExchangeFunctor { /* ---------------------------------------------------------------------- */ int AtomVecAtomicKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nrecv,int nlocal,int dim,X_FLOAT lo,X_FLOAT hi,ExecutionSpace space) { - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecAtomicKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); Kokkos::parallel_for(nrecv/11,f); diff --git a/src/KOKKOS/atom_vec_bond_kokkos.cpp b/src/KOKKOS/atom_vec_bond_kokkos.cpp index 91d7dbef63..dd973a9369 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.cpp +++ b/src/KOKKOS/atom_vec_bond_kokkos.cpp @@ -250,7 +250,7 @@ int AtomVecBondKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecBondKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -264,7 +264,7 @@ int AtomVecBondKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecBondKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -447,7 +447,7 @@ struct AtomVecBondKokkos_UnpackBorder { typename AT::t_tagint_1d &molecule, const int& first): _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_molecule(molecule), - _first(first){ + _first(first) { }; KOKKOS_INLINE_FUNCTION @@ -471,7 +471,7 @@ void AtomVecBondKokkos::unpack_border_kokkos(const int &n, const int &first, atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); while (first+n >= nmax) grow(0); atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecBondKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,h_molecule,first); Kokkos::parallel_for(n,f); @@ -621,7 +621,7 @@ struct AtomVecBondKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { // 3 comp of x, 3 comp of v, 1 tag, 1 type, 1 mask, 1 image, 1 molecule, 3 nspecial, // maxspecial special, 1 num_bond, bond_per_atom bond_type, bond_per_atom bond_atom, // 1 to store buffer length @@ -661,7 +661,7 @@ struct AtomVecBondKokkos_PackExchangeFunctor { const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -696,12 +696,12 @@ int AtomVecBondKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2 X_FLOAT hi ) { const int elements = 16+atomKK->maxspecial+atomKK->bond_per_atom+atomKK->bond_per_atom; - if(nsend > (int) (k_buf.view().extent(0)* + if (nsend > (int) (k_buf.view().extent(0)* k_buf.view().extent(1))/elements) { int newsize = nsend*elements/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecBondKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); @@ -794,7 +794,7 @@ struct AtomVecBondKokkos_UnpackExchangeFunctor { _bond_type(atom->k_bond_type.view()), _bond_atom(atom->k_bond_atom.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { elements = 16+atom->maxspecial+atom->bond_per_atom+atom->bond_per_atom; const int maxsendlist = (buf.template view().extent(0)* buf.template view().extent(1))/elements; @@ -840,7 +840,7 @@ int AtomVecBondKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nr int nlocal,int dim,X_FLOAT lo,X_FLOAT hi, ExecutionSpace space) { const size_t elements = 16+atomKK->maxspecial+atomKK->bond_per_atom+atomKK->bond_per_atom; - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecBondKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); diff --git a/src/KOKKOS/atom_vec_charge_kokkos.cpp b/src/KOKKOS/atom_vec_charge_kokkos.cpp index 698703371f..4416ab34b8 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.cpp +++ b/src/KOKKOS/atom_vec_charge_kokkos.cpp @@ -267,7 +267,7 @@ int AtomVecChargeKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecChargeKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_q,dx,dy,dz); @@ -281,7 +281,7 @@ int AtomVecChargeKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecChargeKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_q,dx,dy,dz); @@ -463,7 +463,7 @@ struct AtomVecChargeKokkos_UnpackBorder { typename ArrayTypes::t_int_1d &mask, typename ArrayTypes::t_float_1d &q, const int& first): - _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_q(q),_first(first){ + _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_q(q),_first(first) { }; KOKKOS_INLINE_FUNCTION @@ -485,7 +485,7 @@ void AtomVecChargeKokkos::unpack_border_kokkos(const int &n, const int &first, if (first+n >= nmax) { grow(first+n+100); } - if(space==Host) { + if (space==Host) { struct AtomVecChargeKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,h_q,first); Kokkos::parallel_for(n,f); @@ -618,7 +618,7 @@ struct AtomVecChargeKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 12; const int maxsendlist = (buf.template view().extent(0)* buf.template view().extent(1))/elements; @@ -643,7 +643,7 @@ struct AtomVecChargeKokkos_PackExchangeFunctor { _buf(mysend,11) = _q[i]; const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -667,11 +667,11 @@ int AtomVecChargeKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat ExecutionSpace space,int dim, X_FLOAT lo,X_FLOAT hi ) { - if(nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/12) { + if (nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/12) { int newsize = nsend*12/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecChargeKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); @@ -740,7 +740,7 @@ struct AtomVecChargeKokkos_UnpackExchangeFunctor { _image(atom->k_image.view()), _q(atom->k_q.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 12; const int maxsendlist = (buf.template view().extent(0)*buf.template view().extent(1))/elements; @@ -772,7 +772,7 @@ struct AtomVecChargeKokkos_UnpackExchangeFunctor { int AtomVecChargeKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nrecv, int nlocal,int dim,X_FLOAT lo,X_FLOAT hi, ExecutionSpace space) { - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecChargeKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); Kokkos::parallel_for(nrecv/12,f); diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index 8a733f66e4..26fcda983b 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -267,10 +267,10 @@ int AtomVecDPDKokkos::pack_comm_kokkos(const int &n, // Check whether to always run forward communication on the host // Choose correct forward PackComm kernel - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackComm f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, buf,list,iswap, @@ -286,7 +286,7 @@ int AtomVecDPDKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackComm f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, buf,list,iswap, @@ -304,8 +304,8 @@ int AtomVecDPDKokkos::pack_comm_kokkos(const int &n, } } else { atomKK->sync(Device,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackComm f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, buf,list,iswap, @@ -321,7 +321,7 @@ int AtomVecDPDKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackComm f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, buf,list,iswap, @@ -409,11 +409,11 @@ struct AtomVecDPDKokkos_PackCommSelf { int AtomVecDPDKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); atomKK->modified(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackCommSelf f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, nfirst,list,iswap, @@ -429,7 +429,7 @@ int AtomVecDPDKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackCommSelf f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, nfirst,list,iswap, @@ -448,8 +448,8 @@ int AtomVecDPDKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list } else { atomKK->sync(Device,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); atomKK->modified(Device,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackCommSelf f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, nfirst,list,iswap, @@ -465,7 +465,7 @@ int AtomVecDPDKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecDPDKokkos_PackCommSelf f(atomKK->k_x, atomKK->k_dpdTheta,atomKK->k_uCond,atomKK->k_uMech,atomKK->k_uChem, nfirst,list,iswap, @@ -527,7 +527,7 @@ struct AtomVecDPDKokkos_UnpackComm { void AtomVecDPDKokkos::unpack_comm_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); atomKK->modified(Host,X_MASK|DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK); struct AtomVecDPDKokkos_UnpackComm f(atomKK->k_x, @@ -716,7 +716,7 @@ void AtomVecDPDKokkos::unpack_comm_vel(int n, int first, double *buf) int AtomVecDPDKokkos::pack_reverse(int n, int first, double *buf) { - if(n > 0) + if (n > 0) atomKK->sync(Host,F_MASK); int m = 0; @@ -733,7 +733,7 @@ int AtomVecDPDKokkos::pack_reverse(int n, int first, double *buf) void AtomVecDPDKokkos::unpack_reverse(int n, int *list, double *buf) { - if(n > 0) { + if (n > 0) { atomKK->sync(Host,F_MASK); atomKK->modified(Host,F_MASK); } @@ -831,7 +831,7 @@ int AtomVecDPDKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DA dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecDPDKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -849,7 +849,7 @@ int AtomVecDPDKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DA } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecDPDKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1134,7 +1134,7 @@ void AtomVecDPDKokkos::unpack_border_kokkos(const int &n, const int &first, atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK| DPDTHETA_MASK|UCOND_MASK|UMECH_MASK|UCHEM_MASK| UCG_MASK|UCGNEW_MASK|DVECTOR_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecDPDKokkos_UnpackBorder f(buf.view(), h_x,h_tag,h_type,h_mask, h_dpdTheta,h_uCond,h_uMech,h_uChem,h_uCG,h_uCGnew, @@ -1326,7 +1326,7 @@ struct AtomVecDPDKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 17; const int maxsendlist = (buf.template view().extent(0)*buf.template view().extent(1))/elements; @@ -1355,7 +1355,7 @@ struct AtomVecDPDKokkos_PackExchangeFunctor { _buf(mysend,16) = _uCGnew[i]; const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -1380,7 +1380,7 @@ struct AtomVecDPDKokkos_PackExchangeFunctor { int AtomVecDPDKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &k_buf, DAT::tdual_int_1d k_sendlist,DAT::tdual_int_1d k_copylist,ExecutionSpace space,int dim,X_FLOAT lo,X_FLOAT hi ) { - if(nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/17) { + if (nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/17) { int newsize = nsend*17/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } @@ -1388,7 +1388,7 @@ int AtomVecDPDKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d MASK_MASK | IMAGE_MASK| DPDTHETA_MASK | UCOND_MASK | UMECH_MASK | UCHEM_MASK | UCG_MASK | UCGNEW_MASK | DVECTOR_MASK); - if(space == Host) { + if (space == Host) { AtomVecDPDKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); } else { @@ -1469,7 +1469,7 @@ struct AtomVecDPDKokkos_UnpackExchangeFunctor { _mask(atom->k_mask.view()), _image(atom->k_image.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { const size_t elements = 17; const int maxsendlist = (buf.template view().extent(0)*buf.template view().extent(1))/elements; @@ -1504,7 +1504,7 @@ struct AtomVecDPDKokkos_UnpackExchangeFunctor { /* ---------------------------------------------------------------------- */ int AtomVecDPDKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nrecv,int nlocal,int dim,X_FLOAT lo,X_FLOAT hi,ExecutionSpace space) { - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecDPDKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); Kokkos::parallel_for(nrecv/17,f); diff --git a/src/KOKKOS/atom_vec_full_kokkos.cpp b/src/KOKKOS/atom_vec_full_kokkos.cpp index 2c85e4129b..6f8673bbc8 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.cpp +++ b/src/KOKKOS/atom_vec_full_kokkos.cpp @@ -381,7 +381,7 @@ int AtomVecFullKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecFullKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_q,h_molecule,dx,dy,dz); @@ -395,7 +395,7 @@ int AtomVecFullKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecFullKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_q,h_molecule,dx,dy,dz); @@ -586,7 +586,7 @@ struct AtomVecFullKokkos_UnpackBorder { typename AT::t_tagint_1d &molecule, const int& first): _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_q(q),_molecule(molecule), - _first(first){ + _first(first) { }; KOKKOS_INLINE_FUNCTION @@ -611,7 +611,7 @@ void AtomVecFullKokkos::unpack_border_kokkos(const int &n, const int &first, atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|Q_MASK|MOLECULE_MASK); while (first+n >= nmax) grow(0); atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|Q_MASK|MOLECULE_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecFullKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,h_q,h_molecule,first); Kokkos::parallel_for(n,f); @@ -824,7 +824,7 @@ struct AtomVecFullKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { // 3 comp of x, 3 comp of v, 1 tag, 1 type, 1 mask, 1 image, 1 molecule, 3 nspecial, // maxspecial special, 1 num_bond, bond_per_atom bond_type, bond_per_atom bond_atom, // 1 num_angle, angle_per_atom angle_type, angle_per_atom angle_atom1, angle_atom2, @@ -895,7 +895,7 @@ struct AtomVecFullKokkos_PackExchangeFunctor { const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -955,12 +955,12 @@ int AtomVecFullKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2 { const int elements = 20+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; - if(nsend > (int) (k_buf.view().extent(0)* + if (nsend > (int) (k_buf.view().extent(0)* k_buf.view().extent(1))/elements) { int newsize = nsend*elements/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecFullKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); @@ -1106,7 +1106,7 @@ struct AtomVecFullKokkos_UnpackExchangeFunctor { _improper_atom3(atom->k_improper_atom3.view()), _improper_atom4(atom->k_improper_atom4.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { elements = 20+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; @@ -1178,7 +1178,7 @@ int AtomVecFullKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nr ExecutionSpace space) { const size_t elements = 20+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecFullKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index 35ed9160d2..86c79141c0 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -112,10 +112,10 @@ int AtomVecKokkos::pack_comm_kokkos(const int &n, // Check whether to always run forward communication on the host // Choose correct forward PackComm kernel - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -127,7 +127,7 @@ int AtomVecKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -141,8 +141,8 @@ int AtomVecKokkos::pack_comm_kokkos(const int &n, } } else { sync(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -154,7 +154,7 @@ int AtomVecKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackComm f(atomKK->k_x,buf,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -225,11 +225,11 @@ struct AtomVecKokkos_PackCommSelf { int AtomVecKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst, const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK); modified(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -241,7 +241,7 @@ int AtomVecKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list, c Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -256,8 +256,8 @@ int AtomVecKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list, c } else { sync(Device,X_MASK); modified(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -269,7 +269,7 @@ int AtomVecKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d &list, c Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -361,10 +361,10 @@ struct AtomVecKokkos_PackCommSelfFused { int AtomVecKokkos::pack_comm_self_fused(const int &n, const DAT::tdual_int_2d &list, const DAT::tdual_int_1d &sendnum_scan, const DAT::tdual_int_1d &firstrecv, const DAT::tdual_int_1d &pbc_flag, const DAT::tdual_int_2d &pbc, const DAT::tdual_int_1d &g2l) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK); modified(Host,X_MASK); - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelfFused f(atomKK->k_x,list,pbc,pbc_flag,firstrecv,sendnum_scan,g2l, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz); @@ -378,7 +378,7 @@ int AtomVecKokkos::pack_comm_self_fused(const int &n, const DAT::tdual_int_2d &l } else { sync(Device,X_MASK); modified(Device,X_MASK); - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommSelfFused f(atomKK->k_x,list,pbc,pbc_flag,firstrecv,sendnum_scan,g2l, domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz); @@ -421,7 +421,7 @@ struct AtomVecKokkos_UnpackComm { void AtomVecKokkos::unpack_comm_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK); modified(Host,X_MASK); struct AtomVecKokkos_UnpackComm f(atomKK->k_x,buf,first); @@ -530,7 +530,7 @@ int AtomVecKokkos::pack_comm_vel_kokkos( const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK|V_MASK); if (pbc_flag) { if (deform_vremap) { @@ -552,7 +552,7 @@ int AtomVecKokkos::pack_comm_vel_kokkos( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, atomKK->k_v, @@ -571,7 +571,7 @@ int AtomVecKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, atomKK->k_v, @@ -591,9 +591,9 @@ int AtomVecKokkos::pack_comm_vel_kokkos( } } else { sync(Device,X_MASK|V_MASK); - if(pbc_flag) { - if(deform_vremap) { - if(domain->triclinic) { + if (pbc_flag) { + if (deform_vremap) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, atomKK->k_v, @@ -611,7 +611,7 @@ int AtomVecKokkos::pack_comm_vel_kokkos( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, atomKK->k_v, @@ -630,7 +630,7 @@ int AtomVecKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, atomKK->k_v, @@ -692,7 +692,7 @@ struct AtomVecKokkos_UnpackCommVel { void AtomVecKokkos::unpack_comm_vel_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { sync(Host,X_MASK|V_MASK); modified(Host,X_MASK|V_MASK); struct AtomVecKokkos_UnpackCommVel f(atomKK->k_x,atomKK->k_v,buf,first); @@ -865,7 +865,7 @@ struct AtomVecKokkos_PackReverse { int AtomVecKokkos::pack_reverse_kokkos(const int &n, const int &first, const DAT::tdual_ffloat_2d &buf ) { - if(commKK->reverse_comm_on_host) { + if (commKK->reverse_comm_on_host) { sync(Host,F_MASK); struct AtomVecKokkos_PackReverse f(atomKK->k_f,buf,first); Kokkos::parallel_for(n,f); @@ -911,7 +911,7 @@ struct AtomVecKokkos_UnPackReverseSelf { int AtomVecKokkos::unpack_reverse_self(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const int nfirst) { - if(commKK->reverse_comm_on_host) { + if (commKK->reverse_comm_on_host) { sync(Host,F_MASK); struct AtomVecKokkos_UnPackReverseSelf f(atomKK->k_f,nfirst,list,iswap); Kokkos::parallel_for(n,f); @@ -966,7 +966,7 @@ void AtomVecKokkos::unpack_reverse_kokkos(const int &n, // Check whether to always run reverse communication on the host // Choose correct reverse UnPackReverse kernel - if(commKK->reverse_comm_on_host) { + if (commKK->reverse_comm_on_host) { struct AtomVecKokkos_UnPackReverse f(atomKK->k_f,buf,list,iswap); Kokkos::parallel_for(n,f); modified(Host,F_MASK); @@ -981,7 +981,7 @@ void AtomVecKokkos::unpack_reverse_kokkos(const int &n, int AtomVecKokkos::pack_reverse(int n, int first, double *buf) { - if(n > 0) + if (n > 0) sync(Host,F_MASK); int m = 0; @@ -1007,7 +1007,7 @@ void AtomVecKokkos::unpack_reverse(int n, int *list, double *buf) h_f(j,2) += buf[m++]; } - if(n > 0) + if (n > 0) modified(Host,F_MASK); } diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.cpp b/src/KOKKOS/atom_vec_molecular_kokkos.cpp index 20a748191c..2fb33e02b7 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.cpp +++ b/src/KOKKOS/atom_vec_molecular_kokkos.cpp @@ -360,10 +360,10 @@ int AtomVecMolecularKokkos::pack_comm_kokkos(const int &n, // Check whether to always run forward communication on the host // Choose correct forward PackComm kernel - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackComm f(atomKK->k_x,buf,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -375,7 +375,7 @@ int AtomVecMolecularKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackComm f(atomKK->k_x,buf,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -389,8 +389,8 @@ int AtomVecMolecularKokkos::pack_comm_kokkos(const int &n, } } else { atomKK->sync(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackComm f(atomKK->k_x,buf,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -402,7 +402,7 @@ int AtomVecMolecularKokkos::pack_comm_kokkos(const int &n, Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackComm f(atomKK->k_x,buf,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -476,11 +476,11 @@ int AtomVecMolecularKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d const int & iswap, const int nfirst, const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -492,7 +492,7 @@ int AtomVecMolecularKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -507,8 +507,8 @@ int AtomVecMolecularKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d } else { atomKK->sync(Device,X_MASK); atomKK->modified(Device,X_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -520,7 +520,7 @@ int AtomVecMolecularKokkos::pack_comm_self(const int &n, const DAT::tdual_int_2d Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecMolecularKokkos_PackCommSelf f(atomKK->k_x,nfirst,list,iswap,domain->xprd,domain->yprd,domain->zprd, domain->xy,domain->xz,domain->yz,pbc); @@ -564,7 +564,7 @@ struct AtomVecMolecularKokkos_UnpackComm { void AtomVecMolecularKokkos::unpack_comm_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK); atomKK->modified(Host,X_MASK); struct AtomVecMolecularKokkos_UnpackComm f(atomKK->k_x,buf,first); @@ -713,7 +713,7 @@ void AtomVecMolecularKokkos::unpack_comm_vel(int n, int first, double *buf) int AtomVecMolecularKokkos::pack_reverse(int n, int first, double *buf) { - if(n > 0) + if (n > 0) atomKK->sync(Host,F_MASK); int m = 0; @@ -730,7 +730,7 @@ int AtomVecMolecularKokkos::pack_reverse(int n, int first, double *buf) void AtomVecMolecularKokkos::unpack_reverse(int n, int *list, double *buf) { - if(n > 0) + if (n > 0) atomKK->modified(Host,F_MASK); int m = 0; @@ -814,7 +814,7 @@ int AtomVecMolecularKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendli dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecMolecularKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -828,7 +828,7 @@ int AtomVecMolecularKokkos::pack_border_kokkos(int n, DAT::tdual_int_2d k_sendli } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecMolecularKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask,h_molecule,dx,dy,dz); @@ -1011,7 +1011,7 @@ struct AtomVecMolecularKokkos_UnpackBorder { typename AT::t_tagint_1d &molecule, const int& first): _buf(buf),_x(x),_tag(tag),_type(type),_mask(mask),_molecule(molecule), - _first(first){ + _first(first) { }; KOKKOS_INLINE_FUNCTION @@ -1035,7 +1035,7 @@ void AtomVecMolecularKokkos::unpack_border_kokkos(const int &n, const int &first atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); while (first+n >= nmax) grow(0); atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK); - if(space==Host) { + if (space==Host) { struct AtomVecMolecularKokkos_UnpackBorder f(buf.view(),h_x,h_tag,h_type,h_mask,h_molecule,first); Kokkos::parallel_for(n,f); @@ -1240,7 +1240,7 @@ struct AtomVecMolecularKokkos_PackExchangeFunctor { _sendlist(sendlist.template view()), _copylist(copylist.template view()), _nlocal(nlocal),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { // 3 comp of x, 3 comp of v, 1 tag, 1 type, 1 mask, 1 image, 1 molecule, 3 nspecial, // maxspecial special, 1 num_bond, bond_per_atom bond_type, bond_per_atom bond_atom, // 1 num_angle, angle_per_atom angle_type, angle_per_atom angle_atom1, angle_atom2, @@ -1309,7 +1309,7 @@ struct AtomVecMolecularKokkos_PackExchangeFunctor { const int j = _copylist(mysend); - if(j>-1) { + if (j>-1) { _xw(i,0) = _x(j,0); _xw(i,1) = _x(j,1); _xw(i,2) = _x(j,2); @@ -1368,12 +1368,12 @@ int AtomVecMolecularKokkos::pack_exchange_kokkos(const int &nsend,DAT::tdual_xfl { const int elements = 19+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; - if(nsend > (int) (k_buf.view().extent(0)* + if (nsend > (int) (k_buf.view().extent(0)* k_buf.view().extent(1))/elements) { int newsize = nsend*elements/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } - if(space == Host) { + if (space == Host) { AtomVecMolecularKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); @@ -1517,7 +1517,7 @@ struct AtomVecMolecularKokkos_UnpackExchangeFunctor { _improper_atom3(atom->k_improper_atom3.view()), _improper_atom4(atom->k_improper_atom4.view()), _nlocal(nlocal.template view()),_dim(dim), - _lo(lo),_hi(hi){ + _lo(lo),_hi(hi) { elements = 19+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; @@ -1589,7 +1589,7 @@ int AtomVecMolecularKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,i ExecutionSpace space) { const size_t elements = 19+atom->maxspecial+2*atom->bond_per_atom+4*atom->angle_per_atom+ 5*atom->dihedral_per_atom + 5*atom->improper_per_atom; - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecMolecularKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index 22d10e4632..451e9d737e 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -274,10 +274,10 @@ int AtomVecSphereKokkos::pack_comm_kokkos( return AtomVecKokkos::pack_comm_kokkos(n,list,iswap,buf,pbc_flag,pbc); // Check whether to always run forward communication on the host // Choose correct forward PackComm kernel - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|RADIUS_MASK|RMASS_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackComm f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -295,7 +295,7 @@ int AtomVecSphereKokkos::pack_comm_kokkos( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackComm f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -315,8 +315,8 @@ int AtomVecSphereKokkos::pack_comm_kokkos( } } else { atomKK->sync(Device,X_MASK|RADIUS_MASK|RMASS_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackComm f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -334,7 +334,7 @@ int AtomVecSphereKokkos::pack_comm_kokkos( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackComm f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -461,11 +461,11 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( const int &pbc_flag, const int* const pbc) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK); - if(pbc_flag) { - if(deform_vremap) { - if(domain->triclinic) { + if (pbc_flag) { + if (deform_vremap) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -507,7 +507,7 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -550,7 +550,7 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -594,9 +594,9 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( } } else { atomKK->sync(Device,X_MASK|RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK); - if(pbc_flag) { - if(deform_vremap) { - if(domain->triclinic) { + if (pbc_flag) { + if (deform_vremap) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -638,7 +638,7 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -681,7 +681,7 @@ int AtomVecSphereKokkos::pack_comm_vel_kokkos( } } } else { - if(domain->triclinic) { + if (domain->triclinic) { if (radvary == 0) { struct AtomVecSphereKokkos_PackCommVel f( atomKK->k_x,atomKK->k_mask, @@ -792,11 +792,11 @@ int AtomVecSphereKokkos::pack_comm_self( // Fallback to AtomVecKokkos if radvary == 0 if (radvary == 0) return AtomVecKokkos::pack_comm_self(n,list,iswap,nfirst,pbc_flag,pbc); - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->sync(Host,X_MASK|RADIUS_MASK|RMASS_MASK); atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackCommSelf f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -814,7 +814,7 @@ int AtomVecSphereKokkos::pack_comm_self( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackCommSelf f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -835,8 +835,8 @@ int AtomVecSphereKokkos::pack_comm_self( } else { atomKK->sync(Device,X_MASK|RADIUS_MASK|RMASS_MASK); atomKK->modified(Device,X_MASK|RADIUS_MASK|RMASS_MASK); - if(pbc_flag) { - if(domain->triclinic) { + if (pbc_flag) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackCommSelf f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -854,7 +854,7 @@ int AtomVecSphereKokkos::pack_comm_self( Kokkos::parallel_for(n,f); } } else { - if(domain->triclinic) { + if (domain->triclinic) { struct AtomVecSphereKokkos_PackCommSelf f( atomKK->k_x, atomKK->k_radius,atomKK->k_rmass, @@ -923,7 +923,7 @@ void AtomVecSphereKokkos::unpack_comm_kokkos( AtomVecKokkos::unpack_comm_kokkos(n,first,buf); return; } - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK); struct AtomVecSphereKokkos_UnpackComm f( atomKK->k_x, @@ -995,7 +995,7 @@ struct AtomVecSphereKokkos_UnpackCommVel { void AtomVecSphereKokkos::unpack_comm_vel_kokkos( const int &n, const int &first, const DAT::tdual_xfloat_2d &buf ) { - if(commKK->forward_comm_on_host) { + if (commKK->forward_comm_on_host) { atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK); if (radvary == 0) { struct AtomVecSphereKokkos_UnpackCommVel f( @@ -1352,7 +1352,7 @@ int AtomVecSphereKokkos::unpack_comm_hybrid(int n, int first, double *buf) int AtomVecSphereKokkos::pack_reverse(int n, int first, double *buf) { - if(n > 0) + if (n > 0) atomKK->sync(Host,F_MASK|TORQUE_MASK); int m = 0; @@ -1372,7 +1372,7 @@ int AtomVecSphereKokkos::pack_reverse(int n, int first, double *buf) int AtomVecSphereKokkos::pack_reverse_hybrid(int n, int first, double *buf) { - if(n > 0) + if (n > 0) atomKK->sync(Host,TORQUE_MASK); int m = 0; @@ -1389,7 +1389,7 @@ int AtomVecSphereKokkos::pack_reverse_hybrid(int n, int first, double *buf) void AtomVecSphereKokkos::unpack_reverse(int n, int *list, double *buf) { - if(n > 0) { + if (n > 0) { atomKK->modified(Host,F_MASK|TORQUE_MASK); } @@ -1409,7 +1409,7 @@ void AtomVecSphereKokkos::unpack_reverse(int n, int *list, double *buf) int AtomVecSphereKokkos::unpack_reverse_hybrid(int n, int *list, double *buf) { - if(n > 0) { + if (n > 0) { atomKK->modified(Host,TORQUE_MASK); } @@ -1502,7 +1502,7 @@ int AtomVecSphereKokkos::pack_border_kokkos( dy = pbc[1]; dz = pbc[2]; } - if(space==Host) { + if (space==Host) { AtomVecSphereKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1519,7 +1519,7 @@ int AtomVecSphereKokkos::pack_border_kokkos( } } else { dx = dy = dz = 0; - if(space==Host) { + if (space==Host) { AtomVecSphereKokkos_PackBorder f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1697,7 +1697,7 @@ int AtomVecSphereKokkos::pack_border_vel_kokkos( dz = pbc[2]; } if (!deform_vremap) { - if(space==Host) { + if (space==Host) { AtomVecSphereKokkos_PackBorderVel f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1721,7 +1721,7 @@ int AtomVecSphereKokkos::pack_border_vel_kokkos( dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; dvz = pbc[2]*h_rate[2]; - if(space==Host) { + if (space==Host) { AtomVecSphereKokkos_PackBorderVel f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1742,7 +1742,7 @@ int AtomVecSphereKokkos::pack_border_vel_kokkos( } } } else { - if(space==Host) { + if (space==Host) { AtomVecSphereKokkos_PackBorderVel f( buf.view(), k_sendlist.view(), iswap,h_x,h_tag,h_type,h_mask, @@ -1926,7 +1926,7 @@ struct AtomVecSphereKokkos_UnpackBorder { void AtomVecSphereKokkos::unpack_border_kokkos(const int &n, const int &first, const DAT::tdual_xfloat_2d &buf,ExecutionSpace space) { while (first+n >= nmax) grow(0); - if(space==Host) { + if (space==Host) { struct AtomVecSphereKokkos_UnpackBorder f(buf.view(), h_x,h_tag,h_type,h_mask, h_radius,h_rmass, @@ -2034,7 +2034,7 @@ void AtomVecSphereKokkos::unpack_border_vel_kokkos( const int &n, const int &first, const DAT::tdual_xfloat_2d &buf,ExecutionSpace space) { while (first+n >= nmax) grow(0); - if(space==Host) { + if (space==Host) { struct AtomVecSphereKokkos_UnpackBorderVel f(buf.view(), h_x,h_tag,h_type,h_mask, h_radius,h_rmass, @@ -2212,7 +2212,7 @@ int AtomVecSphereKokkos::pack_exchange_kokkos( DAT::tdual_int_1d k_copylist, ExecutionSpace space,int dim,X_FLOAT lo,X_FLOAT hi) { - if(nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/16) { + if (nsend > (int) (k_buf.view().extent(0)*k_buf.view().extent(1))/16) { int newsize = nsend*17/k_buf.view().extent(1)+1; k_buf.resize(newsize,k_buf.view().extent(1)); } @@ -2220,7 +2220,7 @@ int AtomVecSphereKokkos::pack_exchange_kokkos( MASK_MASK | IMAGE_MASK| RADIUS_MASK | RMASS_MASK | OMEGA_MASK); - if(space == Host) { + if (space == Host) { AtomVecSphereKokkos_PackExchangeFunctor f(atomKK,k_buf,k_sendlist,k_copylist,atom->nlocal,dim,lo,hi); Kokkos::parallel_for(nsend,f); } else { @@ -2338,7 +2338,7 @@ struct AtomVecSphereKokkos_UnpackExchangeFunctor { /* ---------------------------------------------------------------------- */ int AtomVecSphereKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf,int nrecv,int nlocal,int dim,X_FLOAT lo,X_FLOAT hi,ExecutionSpace space) { - if(space == Host) { + if (space == Host) { k_count.h_view(0) = nlocal; AtomVecSphereKokkos_UnpackExchangeFunctor f(atomKK,k_buf,k_count,dim,lo,hi); Kokkos::parallel_for(nrecv/16,f); diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 2ef4b14d4f..ddfa5530b8 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -571,10 +571,10 @@ void CommKokkos::reverse_comm_dump(Dump *dump) void CommKokkos::exchange() { - if(atom->nextra_grow + atom->nextra_border) { - if(!exchange_comm_classic) { + if (atom->nextra_grow + atom->nextra_border) { + if (!exchange_comm_classic) { static int print = 1; - if(print && comm->me==0) { + if (print && comm->me==0) { error->warning(FLERR,"Fixes cannot yet send exchange data in Kokkos communication, " "switching to classic exchange/border communication"); } @@ -625,7 +625,7 @@ struct BuildExchangeListFunctor { void operator() (int i) const { if (_x(i,_dim) < _lo || _x(i,_dim) >= _hi) { const int mysend=Kokkos::atomic_fetch_add(&_nsend(),1); - if(mysend < (int)_sendlist.extent(0)) { + if (mysend < (int)_sendlist.extent(0)) { _sendlist(mysend) = i; _sendflag(i) = 1; } @@ -713,7 +713,7 @@ void CommKokkos::exchange_device() int sendpos = nlocal-1; nlocal -= k_count.h_view(); - for(int i = 0; i < k_count.h_view(); i++) { + for (int i = 0; i < k_count.h_view(); i++) { if (k_exchange_sendlist.h_view(i)= lo && x(i,dim) <= hi) { sendlist(iswap,mysend++) = i; } @@ -979,7 +979,7 @@ void CommKokkos::borders_device() { k_sendlist.modify(); - if(k_total_send.h_view() >= maxsendlist[iswap]) { + if (k_total_send.h_view() >= maxsendlist[iswap]) { grow_list(iswap,k_total_send.h_view()); k_total_send.h_view() = 0; @@ -1227,7 +1227,7 @@ void CommKokkos::grow_send_kokkos(int n, int flag, ExecutionSpace space) maxsend = static_cast (BUFFACTOR * n); int maxsend_border = (maxsend+BUFEXTRA+5)/atom->avec->size_border + 2; if (flag) { - if(space == Device) + if (space == Device) k_buf_send.modify(); else k_buf_send.modify(); @@ -1280,7 +1280,7 @@ void CommKokkos::grow_list(int /*iswap*/, int n) memoryKK->grow_kokkos(k_sendlist,sendlist,maxswap,size,"comm:sendlist"); - for(int i=0;i()(i,0); } } diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp index 3703769e90..8cac92240f 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp @@ -241,7 +241,7 @@ void ComputeOrientOrderAtomKokkos::operator() (TagComputeOrientOrder int ncount = 0; Kokkos::parallel_reduce(Kokkos::TeamThreadRange(team,jnum), [&] (const int jj, int& count) { - Kokkos::single(Kokkos::PerThread(team), [&] (){ + Kokkos::single(Kokkos::PerThread(team), [&] () { int j = d_neighbors(i,jj); j &= NEIGHMASK; const F_FLOAT delx = x(j,0) - xtmp; @@ -439,14 +439,14 @@ void ComputeOrientOrderAtomKokkos::calc_boop1(int /*ncount*/, int ii const double r1 = d_rlist(ii,ineigh,1); const double r2 = d_rlist(ii,ineigh,2); const double rmag = sqrt(r0*r0 + r1*r1 + r2*r2); - if(rmag <= MY_EPSILON) { + if (rmag <= MY_EPSILON) { return; } const double costheta = r2 / rmag; SNAcomplex expphi = {r0,r1}; const double rxymag = sqrt(expphi.re*expphi.re+expphi.im*expphi.im); - if(rxymag <= MY_EPSILON) { + if (rxymag <= MY_EPSILON) { expphi.re = 1.0; expphi.im = 0.0; } else { @@ -466,14 +466,14 @@ void ComputeOrientOrderAtomKokkos::calc_boop1(int /*ncount*/, int ii const double polar_pf = polar_prefactor(l, 0, costheta); Kokkos::atomic_add(&(d_qnm(ii,il,l).re), polar_pf); SNAcomplex expphim = {expphi.re,expphi.im}; - for(int m = 1; m <= +l; m++) { + for (int m = 1; m <= +l; m++) { const double prefactor = polar_prefactor(l, m, costheta); SNAcomplex ylm = {prefactor * expphim.re, prefactor * expphim.im}; //d_qnm(ii,il,m+l).re += ylm.re; //d_qnm(ii,il,m+l).im += ylm.im; Kokkos::atomic_add(&(d_qnm(ii,il,m+l).re), ylm.re); Kokkos::atomic_add(&(d_qnm(ii,il,m+l).im), ylm.im); - if(m & 1) { + if (m & 1) { //d_qnm(ii,il,-m+l).re -= ylm.re; //d_qnm(ii,il,-m+l).im += ylm.im; Kokkos::atomic_add(&(d_qnm(ii,il,-m+l).re), -ylm.re); @@ -508,7 +508,7 @@ void ComputeOrientOrderAtomKokkos::calc_boop2(int ncount, int ii) co double facn = 1.0 / ncount; for (int il = 0; il < nqlist; il++) { int l = d_qlist[il]; - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { d_qnm(ii,il,m).re *= facn; d_qnm(ii,il,m).im *= facn; } @@ -522,7 +522,7 @@ void ComputeOrientOrderAtomKokkos::calc_boop2(int ncount, int ii) co int l = d_qlist[il]; double qnormfac = sqrt(MY_4PI/(2*l+1)); double qm_sum = 0.0; - for(int m = 0; m < 2*l+1; m++) + for (int m = 0; m < 2*l+1; m++) qm_sum += d_qnm(ii,il,m).re*d_qnm(ii,il,m).re + d_qnm(ii,il,m).im*d_qnm(ii,il,m).im; d_qnarray(i,jj++) = qnormfac * sqrt(qm_sum); } @@ -534,8 +534,8 @@ void ComputeOrientOrderAtomKokkos::calc_boop2(int ncount, int ii) co for (int il = 0; il < nqlist; il++) { int l = d_qlist[il]; double wlsum = 0.0; - for(int m1 = 0; m1 < 2*l+1; m1++) { - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { int m = m1 + m2 - l; SNAcomplex qm1qm2; qm1qm2.re = d_qnm(ii,il,m1).re*d_qnm(ii,il,m2).re - d_qnm(ii,il,m1).im*d_qnm(ii,il,m2).im; @@ -555,8 +555,8 @@ void ComputeOrientOrderAtomKokkos::calc_boop2(int ncount, int ii) co for (int il = 0; il < nqlist; il++) { int l = d_qlist[il]; double wlsum = 0.0; - for(int m1 = 0; m1 < 2*l+1; m1++) { - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { const int m = m1 + m2 - l; SNAcomplex qm1qm2; qm1qm2.re = d_qnm(ii,il,m1).re*d_qnm(ii,il,m2).re - d_qnm(ii,il,m1).im*d_qnm(ii,il,m2).im; @@ -581,14 +581,14 @@ void ComputeOrientOrderAtomKokkos::calc_boop2(int ncount, int ii) co const int il = iqlcomp; const int l = qlcomp; if (d_qnarray(i,il) < QEPSILON) - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { d_qnarray(i,jj++) = 0.0; d_qnarray(i,jj++) = 0.0; } else { const double qnormfac = sqrt(MY_4PI/(2*l+1)); const double qnfac = qnormfac/d_qnarray(i,il); - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { d_qnarray(i,jj++) = d_qnm(ii,il,m).re * qnfac; d_qnarray(i,jj++) = d_qnm(ii,il,m).im * qnfac; } @@ -665,8 +665,8 @@ void ComputeOrientOrderAtomKokkos::init_clebsch_gordan() idxcg_count = 0; for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m1 = 0; m1 < 2*l+1; m1++) - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) + for (int m1 = 0; m1 < 2*l+1; m1++) + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) idxcg_count++; } idxcg_max = idxcg_count; @@ -676,9 +676,9 @@ void ComputeOrientOrderAtomKokkos::init_clebsch_gordan() idxcg_count = 0; for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m1 = 0; m1 < 2*l+1; m1++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { aa2 = m1 - l; - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { bb2 = m2 - l; m = aa2 + bb2 + l; @@ -727,7 +727,7 @@ void ComputeOrientOrderAtomKokkos::check_team_size_for(int inum, int team_size_max = Kokkos::TeamPolicy(inum,Kokkos::AUTO).team_size_max(*this,Kokkos::ParallelForTag()); - if(team_size*vector_length > team_size_max) + if (team_size*vector_length > team_size_max) team_size = team_size_max/vector_length; } diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index e124d98f7e..0d03f6c910 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -235,7 +235,7 @@ struct DomainPBCFunctor { x(_x.view()), v(_v.view()), mask(_mask.view()), image(_image.view()), deform_groupbit(_deform_groupbit), - xperiodic(_xperiodic), yperiodic(_yperiodic), zperiodic(_zperiodic){ + xperiodic(_xperiodic), yperiodic(_yperiodic), zperiodic(_zperiodic) { lo[0]=_lo[0]; lo[1]=_lo[1]; lo[2]=_lo[2]; hi[0]=_hi[0]; hi[1]=_hi[1]; hi[2]=_hi[2]; period[0]=_period[0]; period[1]=_period[1]; period[2]=_period[2]; diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index 2294c24b11..8608b90543 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -77,7 +77,7 @@ void FixEnforce2DKokkos::post_force(int /*vflag*/) if (atomKK->torque_flag) flag_mask |= 4; copymode = 1; - switch( flag_mask ){ + switch( flag_mask ) { case 0:{ FixEnforce2DKokkosPostForceFunctor functor(this); Kokkos::parallel_for(nlocal,functor); @@ -139,21 +139,21 @@ template KOKKOS_INLINE_FUNCTION void FixEnforce2DKokkos::post_force_item( int i ) const { - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { v(i,2) = 0.0; f(i,2) = 0.0; - if(omega_flag){ + if (omega_flag) { omega(i,0) = 0.0; omega(i,1) = 0.0; } - if(angmom_flag){ + if (angmom_flag) { angmom(i,0) = 0.0; angmom(i,1) = 0.0; } - if(torque_flag){ + if (torque_flag) { torque(i,0) = 0.0; torque(i,1) = 0.0; } diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp index 2bf2812e0b..a14e301bfa 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp @@ -193,7 +193,7 @@ KOKKOS_INLINE_FUNCTION void FixEOStableRXKokkos::operator()(TagFixEOStableRXInit, const int &i) const { double tmp; if (mask[i] & groupbit) { - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) k_error_flag.template view()() = 1; energy_lookup(i,dpdTheta[i],tmp); uCond[i] = 0.0; @@ -233,7 +233,7 @@ void FixEOStableRXKokkos::post_integrate() template KOKKOS_INLINE_FUNCTION void FixEOStableRXKokkos::operator()(TagFixEOStableRXTemperatureLookup2, const int &i) const { - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { temperature_lookup(i,uCond[i]+uMech[i]+uChem[i],dpdTheta[i]); if (dpdTheta[i] <= 0.0) k_error_flag.template view()() = 1; @@ -314,7 +314,7 @@ void FixEOStableRXKokkos::energy_lookup(int id, double thetai, doubl nTotal = 1.0; } - for(int ispecies=0;ispecieslo); thetai = MAX(thetai,d_table_const.lo(ispecies)); @@ -364,7 +364,7 @@ void FixEOStableRXKokkos::temperature_lookup(int id, double ui, doub // Store the current thetai in t1 t1 = MAX(thetai,lo); t1 = MIN(t1,hi); - if(t1==hi) delta = -delta; + if (t1==hi) delta = -delta; // Compute u1 at thetai energy_lookup(id,t1,u1); @@ -382,9 +382,9 @@ void FixEOStableRXKokkos::temperature_lookup(int id, double ui, doub f2 = u2 - ui; // Apply the Secant Method - for(it=0; it()() = 2; + for (it=0; it()() = 2; temp = t1; temp = MAX(temp,lo); temp = MIN(temp,hi); @@ -392,15 +392,15 @@ void FixEOStableRXKokkos::temperature_lookup(int id, double ui, doub break; } temp = t2 - f2*(t2-t1)/(f2-f1); - if(fabs(temp-t2) < tolerance) break; + if (fabs(temp-t2) < tolerance) break; f1 = f2; t1 = t2; t2 = temp; energy_lookup(id,t2,u2); f2 = u2 - ui; } - if(it==maxit){ - if(std::isnan(f1) || std::isnan(f2) || std::isnan(ui) || std::isnan(thetai) || std::isnan(t1) || std::isnan(t2)) + if (it==maxit) { + if (std::isnan(f1) || std::isnan(f2) || std::isnan(ui) || std::isnan(thetai) || std::isnan(t1) || std::isnan(t2)) k_error_flag.template view()() = 2; else k_error_flag.template view()() = 3; @@ -440,7 +440,7 @@ void FixEOStableRXKokkos::unpack_forward_comm(int n, int first, doub m = 0; last = first + n ; - for (ii = first; ii < last; ii++){ + for (ii = first; ii < last; ii++) { h_uChem[ii] = buf[m++]; h_uCG[ii] = buf[m++]; h_uCGnew[ii] = buf[m++]; @@ -518,24 +518,24 @@ void FixEOStableRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->hi,h_table->hi,ntables,"Table::hi"); memoryKK->create_kokkos(d_table->invdelta,h_table->invdelta,ntables,"Table::invdelta"); - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { memoryKK->create_kokkos(d_table->r,h_table->r,ntables,tablength,"Table::r"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->de,h_table->de,ntables,tlm1,"Table::de"); } - for(int i=0; i < ntables; i++) { + for (int i=0; i < ntables; i++) { Table* tb = &tables[i]; h_table->lo[i] = tb->lo; h_table->hi[i] = tb->hi; h_table->invdelta[i] = tb->invdelta; - for(int j = 0; jr.extent(1); j++) + for (int j = 0; jr.extent(1); j++) h_table->r(i,j) = tb->r[j]; - for(int j = 0; je.extent(1); j++) + for (int j = 0; je.extent(1); j++) h_table->e(i,j) = tb->e[j]; - for(int j = 0; jde.extent(1); j++) + for (int j = 0; jde.extent(1); j++) h_table->de(i,j) = tb->de[j]; } diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index b5973e25a0..0dcaabb39c 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -61,7 +61,7 @@ FixLangevinKokkos::FixLangevinKokkos(LAMMPS *lmp, int narg, char **a for (int i = 1; i <= ntypes; i++) ratio[i] = 1.0; k_ratio.template modify(); - if(gjfflag){ + if (gjfflag) { grow_arrays(atomKK->nmax); atom->add_callback(Atom::GROW); // initialize franprev to zero @@ -76,7 +76,7 @@ FixLangevinKokkos::FixLangevinKokkos(LAMMPS *lmp, int narg, char **a k_franprev.template modify(); k_lv.template modify(); } - if(zeroflag){ + if (zeroflag) { k_fsumall = tdual_double_1d_3n("langevin:fsumall"); h_fsumall = k_fsumall.template view(); d_fsumall = k_fsumall.template view(); @@ -97,8 +97,8 @@ FixLangevinKokkos::~FixLangevinKokkos() memoryKK->destroy_kokkos(k_gfactor2,gfactor2); memoryKK->destroy_kokkos(k_ratio,ratio); memoryKK->destroy_kokkos(k_flangevin,flangevin); - if(gjfflag) memoryKK->destroy_kokkos(k_franprev,franprev); - if(gjfflag) memoryKK->destroy_kokkos(k_lv,lv); + if (gjfflag) memoryKK->destroy_kokkos(k_franprev,franprev); + if (gjfflag) memoryKK->destroy_kokkos(k_lv,lv); memoryKK->destroy_kokkos(k_tforce,tforce); } @@ -108,13 +108,13 @@ template void FixLangevinKokkos::init() { FixLangevin::init(); - if(oflag) + if (oflag) error->all(FLERR,"Fix langevin omega is not yet implemented with kokkos"); - if(ascale) + if (ascale) error->all(FLERR,"Fix langevin angmom is not yet implemented with kokkos"); - if(gjfflag && tbiasflag) + if (gjfflag && tbiasflag) error->all(FLERR,"Fix langevin gjf + tbias is not yet implemented with kokkos"); - if(gjfflag && tbiasflag) + if (gjfflag && tbiasflag) error->warning(FLERR,"Fix langevin gjf + kokkos is not implemented with random gaussians"); // prefactors are modified in the init @@ -182,8 +182,8 @@ void FixLangevinKokkos::post_force(int /*vflag*/) k_gfactor1.template sync(); k_gfactor2.template sync(); k_ratio.template sync(); - if(gjfflag) k_franprev.template sync(); - if(gjfflag) k_lv.template sync(); + if (gjfflag) k_franprev.template sync(); + if (gjfflag) k_lv.template sync(); boltz = force->boltz; dt = update->dt; @@ -217,7 +217,7 @@ void FixLangevinKokkos::post_force(int /*vflag*/) } // account for bias velocity - if(tbiasflag == BIAS){ + if (tbiasflag == BIAS) { atomKK->sync(temperature->execution_space,temperature->datamask_read); temperature->compute_scalar(); temperature->remove_bias_all(); // modifies velocities @@ -516,7 +516,7 @@ void FixLangevinKokkos::post_force(int /*vflag*/) } - if(tbiasflag == BIAS){ + if (tbiasflag == BIAS) { atomKK->sync(temperature->execution_space,temperature->datamask_read); temperature->restore_bias_all(); // modifies velocities atomKK->modified(temperature->execution_space,temperature->datamask_modify); @@ -566,8 +566,8 @@ FSUM FixLangevinKokkos::post_force_item(int i) const if (mask[i] & groupbit) { rand_type rand_gen = rand_pool.get_state(); - if(Tp_TSTYLEATOM) tsqrt_t = sqrt(d_tforce[i]); - if(Tp_RMASS){ + if (Tp_TSTYLEATOM) tsqrt_t = sqrt(d_tforce[i]); + if (Tp_RMASS) { gamma1 = -rmass[i] / t_period / ftm2v; gamma2 = sqrt(rmass[i]) * fran_prop_const / ftm2v; gamma1 *= 1.0/d_ratio[type[i]]; @@ -581,7 +581,7 @@ FSUM FixLangevinKokkos::post_force_item(int i) const fran[1] = gamma2 * (rand_gen.drand() - 0.5); //(random->uniform()-0.5); fran[2] = gamma2 * (rand_gen.drand() - 0.5); //(random->uniform()-0.5); - if(Tp_BIAS){ + if (Tp_BIAS) { fdrag[0] = gamma1*v(i,0); fdrag[1] = gamma1*v(i,1); fdrag[2] = gamma1*v(i,2); @@ -625,7 +625,7 @@ FSUM FixLangevinKokkos::post_force_item(int i) const f(i,2) += fdrag[2] + fran[2]; if (Tp_TALLY) { - if (Tp_GJF){ + if (Tp_GJF) { fdrag[0] = gamma1*d_lv(i,0)/gjfsib/gjfsib; fdrag[1] = gamma1*d_lv(i,1)/gjfsib/gjfsib; fdrag[2] = gamma1*d_lv(i,2)/gjfsib/gjfsib; @@ -794,7 +794,7 @@ void FixLangevinKokkos::end_of_step() FixLangevinKokkosTallyEnergyFunctor tally_functor(this); Kokkos::parallel_reduce(nlocal,tally_functor,energy_onestep); - if (gjfflag){ + if (gjfflag) { if (rmass.data()) { FixLangevinKokkosEndOfStepFunctor functor(this); Kokkos::parallel_for(nlocal,functor); @@ -817,7 +817,7 @@ void FixLangevinKokkos::end_of_step_item(int i) const { tmp[0] = v(i,0); tmp[1] = v(i,1); tmp[2] = v(i,2); - if (!osflag){ + if (!osflag) { v(i,0) = d_lv(i,0); v(i,1) = d_lv(i,1); v(i,2) = d_lv(i,2); @@ -848,7 +848,7 @@ void FixLangevinKokkos::end_of_step_rmass_item(int i) const tmp[0] = v(i,0); tmp[1] = v(i,1); tmp[2] = v(i,2); - if (!osflag){ + if (!osflag) { v(i,0) = d_lv(i,0); v(i,1) = d_lv(i,1); v(i,2) = d_lv(i,2); diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index c96f5ded68..e81579061b 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -139,8 +139,8 @@ void FixQEqReaxKokkos::init_shielding_k() k_shield = DAT::tdual_ffloat_2d("qeq/kk:shield",ntypes+1,ntypes+1); d_shield = k_shield.template view(); - for( i = 1; i <= ntypes; ++i ) - for( j = 1; j <= ntypes; ++j ) + for ( i = 1; i <= ntypes; ++i ) + for ( j = 1; j <= ntypes; ++j ) k_shield.h_view(i,j) = pow( gamma[i] * gamma[j], -1.5 ); k_shield.template modify(); @@ -1053,7 +1053,7 @@ void FixQEqReaxKokkos::sparse13_item(int ii) const const int i = d_ilist[ii]; if (mask[i] & groupbit) { F_FLOAT tmp = 0.0; - for(int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { + for (int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { const int j = d_jlist(jj); tmp += d_val(jj) * d_s[j]; a_o[j] += d_val(jj) * d_s[i]; @@ -1106,7 +1106,7 @@ void FixQEqReaxKokkos::sparse23_item(int ii) const const int i = d_ilist[ii]; if (mask[i] & groupbit) { F_FLOAT tmp = 0.0; - for(int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { + for (int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { const int j = d_jlist(jj); tmp += d_val(jj) * d_d[j]; a_o[j] += d_val(jj) * d_d[i]; @@ -1166,7 +1166,7 @@ void FixQEqReaxKokkos::sparse33_item(int ii) const const int i = d_ilist[ii]; if (mask[i] & groupbit) { F_FLOAT tmp = 0.0; - for(int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { + for (int jj = d_firstnbr[i]; jj < d_firstnbr[i] + d_numnbrs[i]; jj++) { const int j = d_jlist(jj); tmp += d_val(jj) * d_t[j]; a_o[j] += d_val(jj) * d_t[i]; @@ -1371,11 +1371,11 @@ void FixQEqReaxKokkos::operator()(TagFixQEqReaxPackForwardComm, cons if (pack_flag == 1) d_buf[i] = d_d[j]; - else if( pack_flag == 2 ) + else if ( pack_flag == 2 ) d_buf[i] = d_s[j]; - else if( pack_flag == 3 ) + else if ( pack_flag == 3 ) d_buf[i] = d_t[j]; - else if( pack_flag == 4 ) + else if ( pack_flag == 4 ) d_buf[i] = q[j]; } @@ -1394,11 +1394,11 @@ KOKKOS_INLINE_FUNCTION void FixQEqReaxKokkos::operator()(TagFixQEqReaxUnpackForwardComm, const int &i) const { if (pack_flag == 1) d_d[i + first] = d_buf[i]; - else if( pack_flag == 2) + else if ( pack_flag == 2) d_s[i + first] = d_buf[i]; - else if( pack_flag == 3) + else if ( pack_flag == 3) d_t[i + first] = d_buf[i]; - else if( pack_flag == 4) + else if ( pack_flag == 4) q[i + first] = d_buf[i]; } @@ -1412,13 +1412,13 @@ int FixQEqReaxKokkos::pack_forward_comm(int n, int *list, double *bu int m; if (pack_flag == 1) - for(m = 0; m < n; m++) buf[m] = h_d[list[m]]; - else if( pack_flag == 2 ) - for(m = 0; m < n; m++) buf[m] = h_s[list[m]]; - else if( pack_flag == 3 ) - for(m = 0; m < n; m++) buf[m] = h_t[list[m]]; - else if( pack_flag == 4 ) - for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; + for (m = 0; m < n; m++) buf[m] = h_d[list[m]]; + else if ( pack_flag == 2 ) + for (m = 0; m < n; m++) buf[m] = h_s[list[m]]; + else if ( pack_flag == 3 ) + for (m = 0; m < n; m++) buf[m] = h_t[list[m]]; + else if ( pack_flag == 4 ) + for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; return n; } @@ -1431,13 +1431,13 @@ void FixQEqReaxKokkos::unpack_forward_comm(int n, int first, double int i, m; if (pack_flag == 1) - for(m = 0, i = first; m < n; m++, i++) h_d[i] = buf[m]; - else if( pack_flag == 2) - for(m = 0, i = first; m < n; m++, i++) h_s[i] = buf[m]; - else if( pack_flag == 3) - for(m = 0, i = first; m < n; m++, i++) h_t[i] = buf[m]; - else if( pack_flag == 4) - for(m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) h_d[i] = buf[m]; + else if ( pack_flag == 2) + for (m = 0, i = first; m < n; m++, i++) h_s[i] = buf[m]; + else if ( pack_flag == 3) + for (m = 0, i = first; m < n; m++, i++) h_t[i] = buf[m]; + else if ( pack_flag == 4) + for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; } /* ---------------------------------------------------------------------- */ @@ -1446,7 +1446,7 @@ template int FixQEqReaxKokkos::pack_reverse_comm(int n, int first, double *buf) { int i, m; - for(m = 0, i = first; m < n; m++, i++) { + for (m = 0, i = first; m < n; m++, i++) { buf[m] = h_o[i]; } return n; @@ -1457,7 +1457,7 @@ int FixQEqReaxKokkos::pack_reverse_comm(int n, int first, double *bu template void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double *buf) { - for(int m = 0; m < n; m++) { + for (int m = 0; m < n; m++) { h_o[list[m]] += buf[m]; } } diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 81ac590471..7a8bfbf9dd 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -130,7 +130,7 @@ void FixRxKokkos::init() bool eos_flag = false; for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^eos/table/rx")) eos_flag = true; - if(!eos_flag) error->all(FLERR,"fix rx requires fix eos/table/rx to be specified"); + if (!eos_flag) error->all(FLERR,"fix rx requires fix eos/table/rx to be specified"); if (update_kinetics_data) create_kinetics_data(); @@ -322,7 +322,7 @@ void FixRxKokkos::k_rkf45_step (const int neq, const double h, Vecto // 1) k_rhs (0.0, y, f1, userData); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f1[k] *= h; ytmp[k] = y[k] + c21 * f1[k]; } @@ -330,7 +330,7 @@ void FixRxKokkos::k_rkf45_step (const int neq, const double h, Vecto // 2) k_rhs(0.0, ytmp, f2, userData); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f2[k] *= h; ytmp[k] = y[k] + c31 * f1[k] + c32 * f2[k]; } @@ -429,7 +429,7 @@ int FixRxKokkos::k_rkf45_h0 (const int neq, const double t, const do // Compute WRMS norm of y'' double yddnrm = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { double ydd = (ydot1[k] - ydot[k]) / hg; double wterr = ydd / (relTol * fabs( y[k] ) + absTol); yddnrm += wterr * wterr; @@ -441,7 +441,7 @@ int FixRxKokkos::k_rkf45_h0 (const int neq, const double t, const do //std::cout << "ydot " << ydot[neq-1] << std::endl; // should we accept this? - if (hnew_is_ok || iter == max_iters){ + if (hnew_is_ok || iter == max_iters) { hnew = hg; //if (iter == max_iters) // fprintf(stderr, "ERROR_HIN_MAX_ITERS\n"); @@ -510,7 +510,7 @@ void FixRxKokkos::k_rkf45(const int neq, const double t_stop, Vector double t = 0.0; - if (h < h_min){ + if (h < h_min) { //fprintf(stderr,"hin not implemented yet\n"); //exit(-1); nfe = k_rkf45_h0 (neq, t, t_stop, h_min, h_max, h, y, rwork, userData); @@ -530,7 +530,7 @@ void FixRxKokkos::k_rkf45(const int neq, const double t_stop, Vector // Estimate the solution error. // ... weighted 2-norm of the error. double err2 = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { const double wterr = eout[k] / (relTol * fabs( y[k] ) + absTol); err2 += wterr * wterr; } @@ -538,7 +538,7 @@ void FixRxKokkos::k_rkf45(const int neq, const double t_stop, Vector double err = fmax( uround, sqrt( err2 / double(nspecies) )); // Accept the solution? - if (err <= 1.0 || h <= h_min){ + if (err <= 1.0 || h <= h_min) { t += h; nst++; @@ -571,7 +571,7 @@ void FixRxKokkos::k_rkf45(const int neq, const double t_stop, Vector nit++; nfe += 6; - if (maxIters && nit > maxIters){ + if (maxIters && nit > maxIters) { //fprintf(stderr,"atom[%d] took too many iterations in rkf45 %d %e %e\n", id, nit, t, t_stop); counter.nFails ++; break; @@ -643,7 +643,7 @@ void FixRxKokkos::rkf45_step (const int neq, const double h, double // 1) rhs (0.0, y, f1, v_param); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f1[k] *= h; ytmp[k] = y[k] + c21 * f1[k]; } @@ -651,7 +651,7 @@ void FixRxKokkos::rkf45_step (const int neq, const double h, double // 2) rhs(0.0, ytmp, f2, v_param); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f2[k] *= h; ytmp[k] = y[k] + c31 * f1[k] + c32 * f2[k]; } @@ -748,7 +748,7 @@ int FixRxKokkos::rkf45_h0(const int neq, const double t, const doubl // Compute WRMS norm of y'' double yddnrm = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { double ydd = (ydot1[k] - ydot[k]) / hg; double wterr = ydd / (relTol * fabs( y[k] ) + absTol); yddnrm += wterr * wterr; @@ -760,7 +760,7 @@ int FixRxKokkos::rkf45_h0(const int neq, const double t, const doubl //std::cout << "ydot " << ydot[neq-1] << std::endl; // should we accept this? - if (hnew_is_ok || iter == max_iters){ + if (hnew_is_ok || iter == max_iters) { hnew = hg; if (iter == max_iters) fprintf(stderr, "ERROR_HIN_MAX_ITERS\n"); @@ -827,7 +827,7 @@ void FixRxKokkos::rkf45(const int neq, const double t_stop, double * double t = 0.0; - if (h < h_min){ + if (h < h_min) { //fprintf(stderr,"hin not implemented yet\n"); //exit(-1); nfe = rkf45_h0 (neq, t, t_stop, h_min, h_max, h, y, rwork, v_param); @@ -836,7 +836,7 @@ void FixRxKokkos::rkf45(const int neq, const double t_stop, double * //printf("t= %e t_stop= %e h= %e\n", t, t_stop, h); // Integrate until we reach the end time. - while (fabs(t - t_stop) > tround){ + while (fabs(t - t_stop) > tround) { double *yout = rwork; double *eout = yout + neq; @@ -846,7 +846,7 @@ void FixRxKokkos::rkf45(const int neq, const double t_stop, double * // Estimate the solution error. // ... weighted 2-norm of the error. double err2 = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { const double wterr = eout[k] / (relTol * fabs( y[k] ) + absTol); err2 += wterr * wterr; } @@ -854,7 +854,7 @@ void FixRxKokkos::rkf45(const int neq, const double t_stop, double * double err = fmax( uround, sqrt( err2 / double(nspecies) )); // Accept the solution? - if (err <= 1.0 || h <= h_min){ + if (err <= 1.0 || h <= h_min) { t += h; nst++; @@ -887,7 +887,7 @@ void FixRxKokkos::rkf45(const int neq, const double t_stop, double * nit++; nfe += 6; - if (maxIters && nit > maxIters){ + if (maxIters && nit > maxIters) { //fprintf(stderr,"atom[%d] took too many iterations in rkf45 %d %e %e\n", id, nit, t, t_stop); counter.nFails ++; break; @@ -928,14 +928,14 @@ int FixRxKokkos::rhs_dense(double /*t*/, const double *y, double *dy //const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; //const int nspecies = atom->nspecies_dpd; - for(int ispecies=0; ispecies::rhs_dense(double /*t*/, const double *y, double *dy } // Construct the reaction rates for each species - for(int ispecies=0; ispecies::rhs_sparse(double /*t*/, const double *y, double *d for (int i = 0; i < nreactions; ++i) { double rxnRateLawForward; - if (isIntegral(i)){ + if (isIntegral(i)) { rxnRateLawForward = kFor[i] * powint( conc[ nuk(i,0) ], inu(i,0) ); - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -992,7 +992,7 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d } } else { rxnRateLawForward = kFor[i] * pow( conc[ nuk(i,0) ], nu(i,0) ); - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1008,10 +1008,10 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d for (int k = 0; k < nspecies; ++k) dydt[k] = 0.0; - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { // Reactants ... dydt[ nuk(i,0) ] -= nu(i,0) * rxnRateLaw[i]; - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1020,7 +1020,7 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d // Products ... dydt[ nuk(i,maxReactants) ] += nu(i,maxReactants) * rxnRateLaw[i]; - for (int kk = maxReactants+1; kk < maxSpecies; ++kk){ + for (int kk = maxReactants+1; kk < maxSpecies; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1074,14 +1074,14 @@ int FixRxKokkos::k_rhs_dense(double /*t*/, const VectorType& y, Vect //const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; //const int nspecies = atom->nspecies_dpd; - for(int ispecies=0; ispecies::k_rhs_dense(double /*t*/, const VectorType& y, Vect } // Construct the reaction rates for each species - for(int ispecies=0; ispecies::k_rhs_sparse(double /*t*/, const VectorType& y, Vec for (int i = 0; i < nreactions; ++i) { double rxnRateLawForward; - if (isIntegral(i)){ + if (isIntegral(i)) { rxnRateLawForward = kFor[i] * powint( conc[ nuk(i,0) ], inu(i,0) ); - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1139,7 +1139,7 @@ int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, Vec } } else { rxnRateLawForward = kFor[i] * pow( conc[ nuk(i,0) ], nu(i,0) ); - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1155,10 +1155,10 @@ int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, Vec for (int k = 0; k < nspecies; ++k) dydt[k] = 0.0; - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { // Reactants ... dydt[ nuk(i,0) ] -= nu(i,0) * rxnRateLaw[i]; - for (int kk = 1; kk < maxReactants; ++kk){ + for (int kk = 1; kk < maxReactants; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1167,7 +1167,7 @@ int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, Vec // Products ... dydt[ nuk(i,maxReactants) ] += nu(i,maxReactants) * rxnRateLaw[i]; - for (int kk = maxReactants+1; kk < maxSpecies; ++kk){ + for (int kk = maxReactants+1; kk < maxSpecies; ++kk) { const int k = nuk(i,kk); if (k == SparseKinetics_invalidIndex) break; //if (k != SparseKinetics_invalidIndex) @@ -1686,7 +1686,7 @@ void FixRxKokkos::solve_reactions(const int /*vflag*/, const bool is // getElapsedTime(timer_ODE, timer_stop), nlocal, TotalCounters.nFuncs, TotalCounters.nSteps); // Warn the user if a failure was detected in the ODE solver. - if (TotalCounters.nFails > 0){ + if (TotalCounters.nFails > 0) { char sbuf[128]; sprintf(sbuf,"in FixRX::pre_force, ODE solver failed for %d atoms.", TotalCounters.nFails); error->warning(FLERR, sbuf); @@ -1752,7 +1752,7 @@ void FixRxKokkos::odeDiagnostics(void) double min_per_proc[numCounters]; // Compute counters per dpd time-step. - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { my_vals[i] = this->diagnosticCounter[i] / nTimes; //printf("my sum[%d] = %f %d\n", i, my_vals[i], comm->me); } @@ -1767,7 +1767,7 @@ void FixRxKokkos::odeDiagnostics(void) double avg_per_atom[numCounters], avg_per_proc[numCounters]; // Averages per-ODE and per-proc per time-step. - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { avg_per_atom[i] = sums[i] / nODEs; avg_per_proc[i] = sums[i] / comm->nprocs; } @@ -1775,7 +1775,7 @@ void FixRxKokkos::odeDiagnostics(void) // Sum up the differences from each task. double sum_sq[2*numCounters]; double my_sum_sq[2*numCounters]; - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { double diff_i = my_vals[i] - avg_per_proc[i]; my_sum_sq[i] = diff_i * diff_i; } @@ -1835,7 +1835,7 @@ void FixRxKokkos::odeDiagnostics(void) TimerType timer_stop = getTimeStamp(); double time_local = getElapsedTime( timer_start, timer_stop ); - if (comm->me == 0){ + if (comm->me == 0) { char smesg[128]; #define print_mesg(smesg) {\ @@ -1849,7 +1849,7 @@ void FixRxKokkos::odeDiagnostics(void) print_mesg(smesg); // only valid for single time-step! - if (diagnosticFrequency == 1){ + if (diagnosticFrequency == 1) { double rms_per_ODE[numCounters]; for (int i = 0; i < numCounters; ++i) rms_per_ODE[i] = sqrt( sum_sq[i+numCounters] / nODEs ); @@ -1867,7 +1867,7 @@ void FixRxKokkos::odeDiagnostics(void) sprintf(smesg, " AVG per Proc : %-12.5g | %-12.5g | %-12.5g | %-12.5g", avg_per_proc[StepSum], avg_per_proc[FuncSum], avg_per_proc[TimeSum], avg_per_proc[AtomSum]); print_mesg(smesg); - if (comm->nprocs > 1){ + if (comm->nprocs > 1) { double rms_per_proc[numCounters]; for (int i = 0; i < numCounters; ++i) rms_per_proc[i] = sqrt( sum_sq[i] / comm->nprocs ); @@ -2206,7 +2206,7 @@ int FixRxKokkos::pack_forward_comm(int n, int *list, double *buf, in int m = 0; for (int ii = 0; ii < n; ii++) { const int jj = list[ii]; - for(int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { buf[m++] = h_dvector(ispecies,jj); buf[m++] = h_dvector(ispecies+nspecies,jj); } @@ -2228,8 +2228,8 @@ void FixRxKokkos::unpack_forward_comm(int n, int first, double *buf) const int last = first + n ; int m = 0; - for (int ii = first; ii < last; ii++){ - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ii = first; ii < last; ii++) { + for (int ispecies = 0; ispecies < nspecies; ispecies++) { h_dvector(ispecies,ii) = buf[m++]; h_dvector(ispecies+nspecies,ii) = buf[m++]; } diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 564c405894..d8c4931e0e 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -79,7 +79,7 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a // k_pairDPD = (PairDPDfdtKokkos *) force->pair_match("dpd/fdt",1); k_pairDPDE = dynamic_cast *>(force->pair_match("dpd/fdt/energy",0)); -// if(k_pairDPDE){ +// if (k_pairDPDE) { comm_forward = 3; comm_reverse = 5; // } else { @@ -88,7 +88,7 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a // } - if(/* k_pairDPD == nullptr &&*/ k_pairDPDE == nullptr) + if (/* k_pairDPD == nullptr &&*/ k_pairDPDE == nullptr) error->all(FLERR,"Must use pair_style "/*"dpd/fdt/kk or "*/"dpd/fdt/energy/kk with fix shardlow/kk"); #ifdef DEBUG_SSA_PAIR_CT @@ -160,7 +160,7 @@ void FixShardlowKokkos::init() k_params.h_view(j,i) = k_params.h_view(i,j); - if(ik_cutsq.h_view(i,j); } @@ -196,7 +196,7 @@ void FixShardlowKokkos::pre_neighbor() if (domain->triclinic) error->all(FLERR,"Fix shardlow does not yet support triclinic geometries"); - if(rcut >= bbx || rcut >= bby || rcut>= bbz ) + if (rcut >= bbx || rcut >= bby || rcut>= bbz ) { char fmt[] = {"Shardlow algorithm requires sub-domain length > 2*(rcut+skin). Either reduce the number of processors requested, or change the cutoff/skin: rcut= %e bbx= %e bby= %e bbz= %e\n"}; char *msg = (char *) malloc(sizeof(fmt) + 4*15); @@ -231,7 +231,7 @@ void FixShardlowKokkos::pre_neighbor() massPerI = false; masses = atomKK->k_mass.view(); } -// if(k_pairDPDE){ +// if (k_pairDPDE) { dpdTheta = atomKK->k_dpdTheta.view(); //} else { @@ -632,7 +632,7 @@ void FixShardlowKokkos::initial_integrate(int /*vflag*/) for (workPhase = 0; workPhase < ssa_phaseCt; ++workPhase) { int workItemCt = h_ssa_phaseLen[workPhase]; - if(atom->ntypes > MAX_TYPES_STACKPARAMS) + if (atom->ntypes > MAX_TYPES_STACKPARAMS) Kokkos::parallel_for(Kokkos::RangePolicy >(0,workItemCt),*this); else Kokkos::parallel_for(Kokkos::RangePolicy >(0,workItemCt),*this); @@ -649,7 +649,7 @@ void FixShardlowKokkos::initial_integrate(int /*vflag*/) comm->forward_comm_fix(this); atomKK->modified(Host,V_MASK); - if(k_pairDPDE){ + if (k_pairDPDE) { // Zero out the ghosts' uCond & uMech to be used as delta accumulators // memset(&(atom->uCond[nlocal]), 0, sizeof(double)*nghost); // memset(&(atom->uMech[nlocal]), 0, sizeof(double)*nghost); @@ -667,7 +667,7 @@ void FixShardlowKokkos::initial_integrate(int /*vflag*/) // process neighbors in this AIR atomKK->sync(execution_space,X_MASK | V_MASK | TYPE_MASK | RMASS_MASK | UCOND_MASK | UMECH_MASK | DPDTHETA_MASK); - if(atom->ntypes > MAX_TYPES_STACKPARAMS) + if (atom->ntypes > MAX_TYPES_STACKPARAMS) Kokkos::parallel_for(Kokkos::RangePolicy >(0,workItemCt),*this); else Kokkos::parallel_for(Kokkos::RangePolicy >(0,workItemCt),*this); @@ -759,7 +759,7 @@ int FixShardlowKokkos::pack_reverse_comm(int n, int first, double *b buf[m++] = h_v(i, 0) - h_v_t0(i - nlocal, 0); buf[m++] = h_v(i, 1) - h_v_t0(i - nlocal, 1); buf[m++] = h_v(i, 2) - h_v_t0(i - nlocal, 2); - if(k_pairDPDE){ + if (k_pairDPDE) { buf[m++] = h_uCond(i); // for ghosts, this is an accumulated delta buf[m++] = h_uMech(i); // for ghosts, this is an accumulated delta } @@ -781,7 +781,7 @@ void FixShardlowKokkos::unpack_reverse_comm(int n, int *list, double h_v(j, 0) += buf[m++]; h_v(j, 1) += buf[m++]; h_v(j, 2) += buf[m++]; - if(k_pairDPDE){ + if (k_pairDPDE) { h_uCond(j) += buf[m++]; // add in the accumulated delta h_uMech(j) += buf[m++]; // add in the accumulated delta } diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index ff1b736bf0..6a1059490f 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -237,7 +237,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) gpu_aware_flag = 0; char* str; if ((str = getenv("OMPI_MCA_pml_pami_enable_cuda"))) - if((strcmp(str,"1") == 0)) { + if ((strcmp(str,"1") == 0)) { have_gpu_aware = 1; gpu_aware_flag = 1; } diff --git a/src/KOKKOS/nbin_kokkos.cpp b/src/KOKKOS/nbin_kokkos.cpp index 712ea345cf..8234ceea6f 100644 --- a/src/KOKKOS/nbin_kokkos.cpp +++ b/src/KOKKOS/nbin_kokkos.cpp @@ -111,7 +111,7 @@ void NBinKokkos::bin_atoms() Kokkos::parallel_for(atom->nlocal+atom->nghost, f); deep_copy(h_resize, d_resize); - if(h_resize()) { + if (h_resize()) { atoms_per_bin += 16; k_bins = DAT::tdual_int_2d("bins", mbins, atoms_per_bin); @@ -135,7 +135,7 @@ void NBinKokkos::binatomsItem(const int &i) const atom2bin(i) = ibin; const int ac = Kokkos::atomic_fetch_add(&bincount[ibin], (int)1); - if(ac < (int)bins.extent(1)) { + if (ac < (int)bins.extent(1)) { bins(ibin, ac) = i; } else { d_resize() = 1; diff --git a/src/KOKKOS/nbin_ssa_kokkos.cpp b/src/KOKKOS/nbin_ssa_kokkos.cpp index 8c9ccb5f59..276c3bee36 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.cpp +++ b/src/KOKKOS/nbin_ssa_kokkos.cpp @@ -156,7 +156,7 @@ void NBinSSAKokkos::bin_atoms() // actually bin the ghost atoms { - if(ghosts_per_gbin > (int) gbins.extent(1)) { + if (ghosts_per_gbin > (int) gbins.extent(1)) { k_gbins = DAT::tdual_int_2d("gbins", 8, ghosts_per_gbin); gbins = k_gbins.view(); } diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index 5417386a17..5394929e73 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -329,7 +329,7 @@ void NeighborKokkos::operator()(TagNeighborXhold, const int &i) cons /* ---------------------------------------------------------------------- */ -void NeighborKokkos::modify_ex_type_grow_kokkos(){ +void NeighborKokkos::modify_ex_type_grow_kokkos() { memoryKK->grow_kokkos(k_ex1_type,ex1_type,maxex_type,"neigh:ex1_type"); k_ex1_type.modify(); memoryKK->grow_kokkos(k_ex2_type,ex2_type,maxex_type,"neigh:ex2_type"); @@ -337,7 +337,7 @@ void NeighborKokkos::modify_ex_type_grow_kokkos(){ } /* ---------------------------------------------------------------------- */ -void NeighborKokkos::modify_ex_group_grow_kokkos(){ +void NeighborKokkos::modify_ex_group_grow_kokkos() { memoryKK->grow_kokkos(k_ex1_group,ex1_group,maxex_group,"neigh:ex1_group"); k_ex1_group.modify(); memoryKK->grow_kokkos(k_ex2_group,ex2_group,maxex_group,"neigh:ex2_group"); @@ -345,13 +345,13 @@ void NeighborKokkos::modify_ex_group_grow_kokkos(){ } /* ---------------------------------------------------------------------- */ -void NeighborKokkos::modify_mol_group_grow_kokkos(){ +void NeighborKokkos::modify_mol_group_grow_kokkos() { memoryKK->grow_kokkos(k_ex_mol_group,ex_mol_group,maxex_mol,"neigh:ex_mol_group"); k_ex_mol_group.modify(); } /* ---------------------------------------------------------------------- */ -void NeighborKokkos::modify_mol_intra_grow_kokkos(){ +void NeighborKokkos::modify_mol_intra_grow_kokkos() { memoryKK->grow_kokkos(k_ex_mol_intra,ex_mol_intra,maxex_mol,"neigh:ex_mol_intra"); k_ex_mol_intra.modify(); } diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index f7e8c0e82d..564e1b0b98 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -303,7 +303,7 @@ void NPairKokkos::build(NeighList *list_) } Kokkos::deep_copy(h_scalars, d_scalars); - if(data.h_resize()) { + if (data.h_resize()) { list->maxneighs = data.h_new_maxneighs() * 1.2; list->d_neighbors = typename AT::t_neighbors_2d(Kokkos::NoInit("neighbors"), list->d_neighbors.extent(0), list->maxneighs); data.neigh_list.d_neighbors = list->d_neighbors; @@ -410,24 +410,24 @@ void NeighborKokkosExecute:: = d_stencil; // loop over all bins in neighborhood (includes ibin) - if(HalfNeigh) - for(int m = 0; m < c_bincount(ibin); m++) { + if (HalfNeigh) + for (int m = 0; m < c_bincount(ibin); m++) { const int j = c_bins(ibin,m); const int jtype = type(j); //for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using HalfNeighborlists - if((j == i) || (HalfNeigh && !Newton && (j < i)) || + if ((j == i) || (HalfNeigh && !Newton && (j < i)) || (HalfNeigh && Newton && ((j < i) || ((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) || (x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp))))) ) continue; - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); const X_FLOAT delz = ztmp - x(j, 2); const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(i,j); @@ -436,38 +436,38 @@ void NeighborKokkosExecute:: /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n::t_int_1d_const_um =Kokkos::subview(bins,jbin,ALL); - for(int m = 0; m < c_bincount(jbin); m++) { + for (int m = 0; m < c_bincount(jbin); m++) { const int j = c_bins(jbin,m); const int jtype = type(j); - if(HalfNeigh && !Newton && (j < i)) continue; - if(!HalfNeigh && j==i) continue; - if(Tri) { + if (HalfNeigh && !Newton && (j < i)) continue; + if (!HalfNeigh && j==i) continue; + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -477,14 +477,14 @@ void NeighborKokkosExecute:: } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); const X_FLOAT delz = ztmp - x(j, 2); const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { if (!moltemplate) which = NeighborKokkosExecute::find_special(i,j); @@ -493,19 +493,19 @@ void NeighborKokkosExecute:: /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n:: neigh_list.d_numneigh(i) = n; - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop + if (n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop } neigh_list.d_ilist(i) = i; @@ -562,7 +562,7 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli const int ibin = dev.league_rank()*BINS_PER_TEAM+MY_BIN; - if(ibin >= mbins) return; + if (ibin >= mbins) return; X_FLOAT* other_x = sharedmem; other_x = other_x + 5*atoms_per_bin*MY_BIN; @@ -570,7 +570,7 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli int bincount_current = c_bincount[ibin]; - for(int kk = 0; kk < TEAMS_PER_BIN; kk++) { + for (int kk = 0; kk < TEAMS_PER_BIN; kk++) { const int MY_II = dev.team_rank()%atoms_per_bin+kk*dev.team_size(); const int i = MY_II < bincount_current ? c_bins(ibin, MY_II) : -1; /* if necessary, goto next page and add pages */ @@ -583,7 +583,7 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli int itype; const AtomNeighbors neighbors_i = neigh_list.get_neighbors((i>=0&&i= 0) { + if (i >= 0) { xtmp = x(i, 0); ytmp = x(i, 1); ztmp = x(i, 2); @@ -596,23 +596,23 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli other_id[MY_II] = i; int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); - if(test) return; + if (test) return; - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { #pragma unroll 4 - for(int m = 0; m < bincount_current; m++) { + for (int m = 0; m < bincount_current; m++) { int j = other_id[m]; const int jtype = other_x[m + 3 * atoms_per_bin]; //for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using halfneighborlists - if((j == i) || + if ((j == i) || (HalfNeigh && !Newton && (j < i)) || (HalfNeigh && Newton && ((j < i) || ((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) || (x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp))))) ) continue; - if(Tri) { + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -622,13 +622,13 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin]; const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { int which = 0; if (!moltemplate) @@ -638,19 +638,19 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n::build_ItemCuda(typename Kokkos::TeamPoli const typename ArrayTypes::t_int_1d_const_um stencil = d_stencil; - for(int k = 0; k < nstencil; k++) { + for (int k = 0; k < nstencil; k++) { const int jbin = ibin + stencil[k]; - if(ibin == jbin) continue; + if (ibin == jbin) continue; bincount_current = c_bincount[jbin]; int j = MY_II < bincount_current ? c_bins(jbin, MY_II) : -1; - if(j >= 0) { + if (j >= 0) { other_x[MY_II] = x(j, 0); other_x[MY_II + atoms_per_bin] = x(j, 1); other_x[MY_II + 2 * atoms_per_bin] = x(j, 2); @@ -680,16 +680,16 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli __syncthreads(); - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { #pragma unroll 8 - for(int m = 0; m < bincount_current; m++) { + for (int m = 0; m < bincount_current; m++) { const int j = other_id[m]; const int jtype = other_x[m + 3 * atoms_per_bin]; //if(HalfNeigh && (j < i)) continue; - if(HalfNeigh && !Newton && (j < i)) continue; - if(!HalfNeigh && j==i) continue; - if(Tri) { + if (HalfNeigh && !Newton && (j < i)) continue; + if (!HalfNeigh && j==i) continue; + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -699,14 +699,14 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin]; const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { int which = 0; if (!moltemplate) @@ -716,19 +716,19 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n::build_ItemCuda(typename Kokkos::TeamPoli __syncthreads(); } - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { neigh_list.d_numneigh(i) = n; neigh_list.d_ilist(i) = i; } - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop + if (n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop } } } @@ -787,14 +787,14 @@ void NeighborKokkosExecute:: const int ibin = c_atom2bin(i); for (int k = 0; k < nstencil; k++) { const int jbin = ibin + stencil[k]; - for(int m = 0; m < c_bincount(jbin); m++) { + for (int m = 0; m < c_bincount(jbin); m++) { const int j = c_bins(jbin,m); if (HalfNeigh && j <= i) continue; else if (j == i) continue; const int jtype = type[j]; - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); @@ -810,19 +810,19 @@ void NeighborKokkosExecute:: /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n:: ybin2 < 0 || ybin2 >= mbiny || zbin2 < 0 || zbin2 >= mbinz) continue; const int jbin = ibin + stencil[k]; - for(int m = 0; m < c_bincount(jbin); m++) { + for (int m = 0; m < c_bincount(jbin); m++) { const int j = c_bins(jbin,m); if (HalfNeigh && j <= i) continue; else if (j == i) continue; const int jtype = type[j]; - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); @@ -858,7 +858,7 @@ void NeighborKokkosExecute:: const X_FLOAT rsq = delx*delx + dely*dely + delz*delz; if (rsq <= cutneighsq(itype,jtype)) { - if(n:: neigh_list.d_numneigh(i) = n; - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop + if (n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop } neigh_list.d_ilist(i) = i; } @@ -902,18 +902,18 @@ void NeighborKokkosExecute:: const int mask_history = 3 << SBBITS; // loop over all bins in neighborhood (includes ibin) - if(HalfNeigh) - for(int m = 0; m < c_bincount(ibin); m++) { + if (HalfNeigh) + for (int m = 0; m < c_bincount(ibin); m++) { const int j = c_bins(ibin,m); const int jtype = type(j); //for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using HalfNeighborlists - if((j == i) || (HalfNeigh && !Newton && (j < i)) || + if ((j == i) || (HalfNeigh && !Newton && (j < i)) || (HalfNeigh && Newton && ((j < i) || ((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) || (x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp))))) ) continue; - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); @@ -922,29 +922,29 @@ void NeighborKokkosExecute:: const X_FLOAT radsum = radi + radius(j); const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); - if(rsq <= cutsq) { - if(n::t_int_1d_const_um =Kokkos::subview(bins,jbin,ALL); - for(int m = 0; m < c_bincount(jbin); m++) { + for (int m = 0; m < c_bincount(jbin); m++) { const int j = c_bins(jbin,m); const int jtype = type(j); - if(HalfNeigh && !Newton && (j < i)) continue; - if(!HalfNeigh && j==i) continue; - if(Tri) { + if (HalfNeigh && !Newton && (j < i)) continue; + if (!HalfNeigh && j==i) continue; + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -954,7 +954,7 @@ void NeighborKokkosExecute:: } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); @@ -963,9 +963,9 @@ void NeighborKokkosExecute:: const X_FLOAT radsum = radi + radius(j); const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); - if(rsq <= cutsq) { - if(n:: neigh_list.d_numneigh(i) = n; - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop + if (n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop } neigh_list.d_ilist(i) = i; @@ -1005,7 +1005,7 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team const int ibin = dev.league_rank()*BINS_PER_TEAM+MY_BIN; - if(ibin >= mbins) return; + if (ibin >= mbins) return; X_FLOAT* other_x = sharedmem; other_x = other_x + 6*atoms_per_bin*MY_BIN; @@ -1013,7 +1013,7 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team int bincount_current = c_bincount[ibin]; - for(int kk = 0; kk < TEAMS_PER_BIN; kk++) { + for (int kk = 0; kk < TEAMS_PER_BIN; kk++) { const int MY_II = dev.team_rank()%atoms_per_bin+kk*dev.team_size(); const int i = MY_II < bincount_current ? c_bins(ibin, MY_II) : -1; /* if necessary, goto next page and add pages */ @@ -1028,7 +1028,7 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team const AtomNeighbors neighbors_i = neigh_list.get_neighbors((i>=0&&i= 0) { + if (i >= 0) { xtmp = x(i, 0); ytmp = x(i, 1); ztmp = x(i, 2); @@ -1043,23 +1043,23 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team other_id[MY_II] = i; int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); - if(test) return; + if (test) return; - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { #pragma unroll 4 - for(int m = 0; m < bincount_current; m++) { + for (int m = 0; m < bincount_current; m++) { int j = other_id[m]; const int jtype = other_x[m + 3 * atoms_per_bin]; //for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using halfneighborlists - if((j == i) || + if ((j == i) || (HalfNeigh && !Newton && (j < i)) || (HalfNeigh && Newton && ((j < i) || ((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) || (x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp))))) ) continue; - if(Tri) { + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -1069,7 +1069,7 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin]; @@ -1077,8 +1077,8 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin]; const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); - if(rsq <= cutsq) { - if(n::build_ItemSizeCuda(typename Kokkos::Team const typename ArrayTypes::t_int_1d_const_um stencil = d_stencil; - for(int k = 0; k < nstencil; k++) { + for (int k = 0; k < nstencil; k++) { const int jbin = ibin + stencil[k]; - if(ibin == jbin) continue; + if (ibin == jbin) continue; bincount_current = c_bincount[jbin]; int j = MY_II < bincount_current ? c_bins(jbin, MY_II) : -1; - if(j >= 0) { + if (j >= 0) { other_x[MY_II] = x(j, 0); other_x[MY_II + atoms_per_bin] = x(j, 1); other_x[MY_II + 2 * atoms_per_bin] = x(j, 2); @@ -1110,16 +1110,16 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team __syncthreads(); - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { #pragma unroll 8 - for(int m = 0; m < bincount_current; m++) { + for (int m = 0; m < bincount_current; m++) { const int j = other_id[m]; const int jtype = other_x[m + 3 * atoms_per_bin]; - if(HalfNeigh && (j < i)) continue; - if(HalfNeigh && !Newton && (j < i)) continue; - if(!HalfNeigh && j==i) continue; - if(Tri) { + if (HalfNeigh && (j < i)) continue; + if (HalfNeigh && !Newton && (j < i)) continue; + if (!HalfNeigh && j==i) continue; + if (Tri) { if (x(j,2) < ztmp) continue; if (x(j,2) == ztmp) { if (x(j,1) < ytmp) continue; @@ -1129,7 +1129,7 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team } } } - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; @@ -1138,8 +1138,8 @@ void NeighborKokkosExecute::build_ItemSizeCuda(typename Kokkos::Team const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin]; const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); - if(rsq <= cutsq) { - if(n::build_ItemSizeCuda(typename Kokkos::Team __syncthreads(); } - if(i >= 0 && i < nlocal) { + if (i >= 0 && i < nlocal) { neigh_list.d_numneigh(i) = n; neigh_list.d_ilist(i) = i; } - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop + if (n > new_maxneighs()) new_maxneighs() = n; // avoid atomics, safe because in while loop } } } diff --git a/src/KOKKOS/npair_ssa_kokkos.cpp b/src/KOKKOS/npair_ssa_kokkos.cpp index 742cfe515d..a3608fd35a 100644 --- a/src/KOKKOS/npair_ssa_kokkos.cpp +++ b/src/KOKKOS/npair_ssa_kokkos.cpp @@ -489,7 +489,7 @@ fprintf(stdout, "tota%03d total %3d could use %6d inums, expected %6d inums. inu deep_copy(data.h_resize, data.resize); - if(data.h_resize()) { + if (data.h_resize()) { deep_copy(data.h_new_maxneighs, data.new_maxneighs); list->maxneighs = data.h_new_maxneighs() * 1.2; list->d_neighbors = typename ArrayTypes::t_neighbors_2d("neighbors", list->d_neighbors.extent(0), list->maxneighs); @@ -571,13 +571,13 @@ void NPairSSAKokkosExecute::build_locals_onePhase(const bool firstTr for (; jl < c_bincount(jbin); ++jl) { const int j = c_bins(jbin, jl); const int jtype = type(j); - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); const X_FLOAT delz = ztmp - x(j, 2); const X_FLOAT rsq = delx*delx + dely*dely + delz*delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(i,j); @@ -586,19 +586,19 @@ void NPairSSAKokkosExecute::build_locals_onePhase(const bool firstTr /* onemols[imol]->nspecial[iatom], */ /* tag[j]-tagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n::build_locals_onePhase(const bool firstTr if (n > 0) { neigh_list.d_numneigh(inum) = n; neigh_list.d_ilist(inum++) = i; - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); + if (n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); } } } @@ -699,13 +699,13 @@ void NPairSSAKokkosExecute::build_ghosts_onePhase(int workPhase) con for (int jl = 0; jl < c_bincount(jbin); ++jl) { const int j = c_bins(jbin, jl); const int jtype = type(j); - if(exclude && exclusion(i,j,itype,jtype)) continue; + if (exclude && exclusion(i,j,itype,jtype)) continue; const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); const X_FLOAT delz = ztmp - x(j, 2); const X_FLOAT rsq = delx*delx + dely*dely + delz*delz; - if(rsq <= cutneighsq(itype,jtype)) { + if (rsq <= cutneighsq(itype,jtype)) { if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(j,i); @@ -714,19 +714,19 @@ void NPairSSAKokkosExecute::build_ghosts_onePhase(int workPhase) con /* onemols[jmol]->nspecial[jatom], */ /* tag[i]-jtagprev); */ /* else which = 0; */ - if (which == 0){ - if(n 0) { - if(n::build_ghosts_onePhase(int workPhase) con if (n > 0) { neigh_list.d_numneigh(gNdx) = n; neigh_list.d_ilist(gNdx++) = i; - if(n > neigh_list.maxneighs) { + if (n > neigh_list.maxneighs) { resize() = 1; - if(n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); + if (n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); } } } diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index d3b00329d8..eb7b9ffd6e 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -335,7 +335,7 @@ double PairBuckCoulCutKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_in) copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -228,7 +228,7 @@ F_FLOAT PairBuckCoulLongKokkos:: compute_fcoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -267,7 +267,7 @@ F_FLOAT PairBuckCoulLongKokkos:: compute_ecoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -335,7 +335,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -345,7 +345,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -357,7 +357,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -368,7 +368,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -380,7 +380,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -391,7 +391,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -403,7 +403,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -414,7 +414,7 @@ void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cu host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -497,7 +497,7 @@ double PairBuckCoulLongKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).offset = offset[i][j]; k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_in) copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -190,7 +190,7 @@ F_FLOAT PairCoulLongKokkos:: compute_fcoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -229,7 +229,7 @@ F_FLOAT PairCoulLongKokkos:: compute_ecoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -293,7 +293,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -303,7 +303,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -315,7 +315,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -326,7 +326,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -338,7 +338,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -349,7 +349,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -361,7 +361,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -372,7 +372,7 @@ void PairCoulLongKokkos::init_tables(double cut_coul, double *cut_re host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -447,7 +447,7 @@ double PairCoulLongKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_in) if (splitFDT_flag) { if (!a0_is_zero) { - if(atom->ntypes > MAX_TYPES_STACKPARAMS) { + if (atom->ntypes > MAX_TYPES_STACKPARAMS) { if (neighflag == HALF) { if (newton_pair) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); @@ -287,7 +287,7 @@ void PairDPDfdtEnergyKokkos::compute(int eflag_in, int vflag_in) // loop over neighbors of my atoms - if(atom->ntypes > MAX_TYPES_STACKPARAMS) { + if (atom->ntypes > MAX_TYPES_STACKPARAMS) { if (neighflag == HALF) { if (newton_pair) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); @@ -671,7 +671,7 @@ double PairDPDfdtEnergyKokkos::init_one(int i, int j) k_params.h_view(i,j).kappa = kappa[i][j]; k_params.h_view(i,j).alpha = alpha[i][j]; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::operator()(TagPairEAMAlloyKernelC (p); @@ -985,7 +985,7 @@ void PairEAMAlloyKokkos::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/alloy", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 54397cea51..56a351a1ad 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -725,7 +725,7 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC (p); @@ -985,7 +985,7 @@ void PairEAMFSKokkos::read_file(char *filename) Fs *file = fs; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/fs", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index bcbddea28d..e5c9eada71 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -721,7 +721,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC (p); diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index bc60bab85c..855d2b259a 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -582,8 +582,8 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxCompute()() = 1; // A3. Compute some convenient quantities for evaluating the force @@ -599,7 +599,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxCompute::operator()(TagPairExp6rxCompute::operator()(TagPairExp6rxCompute()() = 1; // A3. Compute some convenient quantities for evaluating the force @@ -694,7 +694,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxCompute::operator()(TagPairExp6rxCompute::operator()(TagPairExp6rxComputeNoAtomics()() = 1; // A3. Compute some convenient quantities for evaluating the force @@ -973,7 +973,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxComputeNoAtomics::operator()(TagPairExp6rxComputeNoAtomics::operator()(TagPairExp6rxComputeNoAtomics()() = 1; // A3. Compute some convenient quantities for evaluating the force @@ -1068,7 +1068,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxComputeNoAtomics::operator()(TagPairExp6rxComputeNoAtomics::vectorized_operator(const int &ii, EV_FLOAT& double fpairOldEXP6_12 = 0.0; double fpairOldEXP6_21 = 0.0; - if(rmOld12_ij!=0.0 && rmOld21_ij!=0.0) + if (rmOld12_ij!=0.0 && rmOld21_ij!=0.0) { hasError |= (alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0); @@ -1387,7 +1387,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& double durc = -buck1*buck2*(rCutExp* rminv - rCutInv*rm6ij*rCut6inv); double rin1 = shift*rmOld12_ij*func_rin(alphaOld12_ij); - if(r < rin1){ + if (r < rin1) { const double rin6 = rin1*rin1*rin1*rin1*rin1*rin1; const double rin6inv = 1.0/rin6; @@ -1427,7 +1427,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& durc = -buck1*buck2*(rCutExp* rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rmOld21_ij*func_rin(alphaOld21_ij); - if(r < rin1){ + if (r < rin1) { const double rin6 = rin1*rin1*rin1*rin1*rin1*rin1; const double rin6inv = 1.0/rin6; @@ -1465,7 +1465,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& evdwlOld_j[jlane] = evdwlOld; } - if(rm12_ij!=0.0 && rm21_ij!=0.0) + if (rm12_ij!=0.0 && rm21_ij!=0.0) { hasError |= (alpha21_ij == 6.0 || alpha12_ij == 6.0); @@ -1483,7 +1483,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& double durc = -buck1*buck2*(rCutExp*rminv - rCutInv*rm6ij*rCut6inv); double rin1 = shift*rm12_ij*func_rin(alpha12_ij); - if(r < rin1){ + if (r < rin1) { const double rin6 = rin1*rin1*rin1*rin1*rin1*rin1; const double rin6inv = 1.0/rin6; @@ -1515,7 +1515,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& durc = -buck1*buck2*(rCutExp*rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rm21_ij*func_rin(alpha21_ij); - if(r < rin1){ + if (r < rin1) { const double rin6 = rin1*rin1*rin1*rin1*rin1*rin1; const double rin6inv = 1.0/rin6; @@ -1807,7 +1807,7 @@ void PairExp6rxKokkos::read_file(char *file) n = strlen(words[1]) + 1; params[nparams].potential = new char[n]; strcpy(params[nparams].potential,words[1]); - if (strcmp(params[nparams].potential,"exp6") == 0){ + if (strcmp(params[nparams].potential,"exp6") == 0) { params[nparams].alpha = atof(words[2]); params[nparams].epsilon = atof(words[3]); params[nparams].rm = atof(words[4]); @@ -1890,7 +1890,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub nTotalold = 0.0; // Compute the total number of molecules in the old and new CG particle as well as the total number of molecules in the fluid portion of the old and new CG particle - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { nTotal += dvector(ispecies,id); nTotalold += dvector(ispecies+nspecies,id); @@ -1903,7 +1903,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub nMoleculesOFA += dvector(ispecies,id); } } - if(nTotal < MY_EPSILON || nTotalold < MY_EPSILON) + if (nTotal < MY_EPSILON || nTotalold < MY_EPSILON) k_error_flag.template view()() = 1; // Compute the mole fraction of molecules within the fluid portion of the particle (One Fluid Approximation) @@ -1915,7 +1915,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub if (iparam < 0 || d_params[iparam].potentialType != exp6PotentialType ) continue; // If Site1 matches a pure species, then grab the parameters - if (isite1 == d_params[iparam].ispecies){ + if (isite1 == d_params[iparam].ispecies) { rm1_old = d_params[iparam].rm; rm1 = d_params[iparam].rm; epsilon1_old = d_params[iparam].epsilon; @@ -1931,7 +1931,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub } // If Site2 matches a pure species, then grab the parameters - if (isite2 == d_params[iparam].ispecies){ + if (isite2 == d_params[iparam].ispecies) { rm2_old = d_params[iparam].rm; rm2 = d_params[iparam].rm; epsilon2_old = d_params[iparam].epsilon; @@ -1952,9 +1952,9 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub rmi = d_params[iparam].rm; epsiloni = d_params[iparam].epsilon; alphai = d_params[iparam].alpha; - if(nMoleculesOFA::getMixingWeights(int id,double &epsilon1,doub rmj = d_params[jparam].rm; epsilonj = d_params[jparam].epsilon; alphaj = d_params[jparam].alpha; - if(nMoleculesOFA::getMixingWeights(int id,double &epsilon1,doub epsilonij = sqrt(epsiloni*epsilonj); alphaij = sqrt(alphai*alphaj); - if(fractionOFAold > 0.0){ + if (fractionOFAold > 0.0) { rm3_old += xMolei_old*xMolej_old*rm3ij; epsilon_old += xMolei_old*xMolej_old*rm3ij*epsilonij; alpha_old += xMolei_old*xMolej_old*rm3ij*epsilonij*alphaij; } - if(fractionOFA > 0.0){ + if (fractionOFA > 0.0) { rm3 += xMolei*xMolej*rm3ij; epsilon += xMolei*xMolej*rm3ij*epsilonij; alpha += xMolei*xMolej*rm3ij*epsilonij*alphaij; @@ -1988,9 +1988,9 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub } } - if (isOneFluidApprox(isite1)){ + if (isOneFluidApprox(isite1)) { rm1 = cbrt(rm3); - if(rm1 < MY_EPSILON) { + if (rm1 < MY_EPSILON) { rm1 = 0.0; epsilon1 = 0.0; alpha1 = 0.0; @@ -2002,7 +2002,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub fraction1 = fractionOFA; rm1_old = cbrt(rm3_old); - if(rm1_old < MY_EPSILON) { + if (rm1_old < MY_EPSILON) { rm1_old = 0.0; epsilon1_old = 0.0; alpha1_old = 0.0; @@ -2013,18 +2013,18 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub nMoleculesOld1 = 1.0-(nTotalold-nMoleculesOFAold); fractionOld1 = fractionOFAold; - if(scalingFlag == EXPONENT){ + if (scalingFlag == EXPONENT) { exponentScaling(nMoleculesOFA,epsilon1,rm1); exponentScaling(nMoleculesOFAold,epsilon1_old,rm1_old); - } else if(scalingFlag == POLYNOMIAL){ + } else if (scalingFlag == POLYNOMIAL) { polynomialScaling(nMoleculesOFA,alpha1,epsilon1,rm1); polynomialScaling(nMoleculesOFAold,alpha1_old,epsilon1_old,rm1_old); } } - if (isOneFluidApprox(isite2)){ + if (isOneFluidApprox(isite2)) { rm2 = cbrt(rm3); - if(rm2 < MY_EPSILON) { + if (rm2 < MY_EPSILON) { rm2 = 0.0; epsilon2 = 0.0; alpha2 = 0.0; @@ -2036,7 +2036,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub fraction2 = fractionOFA; rm2_old = cbrt(rm3_old); - if(rm2_old < MY_EPSILON) { + if (rm2_old < MY_EPSILON) { rm2_old = 0.0; epsilon2_old = 0.0; alpha2_old = 0.0; @@ -2047,46 +2047,46 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub nMoleculesOld2 = 1.0-(nTotalold-nMoleculesOFAold); fractionOld2 = fractionOFAold; - if(scalingFlag == EXPONENT){ + if (scalingFlag == EXPONENT) { exponentScaling(nMoleculesOFA,epsilon2,rm2); exponentScaling(nMoleculesOFAold,epsilon2_old,rm2_old); - } else if(scalingFlag == POLYNOMIAL){ + } else if (scalingFlag == POLYNOMIAL) { polynomialScaling(nMoleculesOFA,alpha2,epsilon2,rm2); polynomialScaling(nMoleculesOFAold,alpha2_old,epsilon2_old,rm2_old); } } // Check that no fractions are less than zero - if(fraction1 < 0.0 || nMolecules1 < 0.0){ - if(fraction1 < -MY_EPSILON || nMolecules1 < -MY_EPSILON){ + if (fraction1 < 0.0 || nMolecules1 < 0.0) { + if (fraction1 < -MY_EPSILON || nMolecules1 < -MY_EPSILON) { k_error_flag.template view()() = 2; } nMolecules1 = 0.0; fraction1 = 0.0; } - if(fraction2 < 0.0 || nMolecules2 < 0.0){ - if(fraction2 < -MY_EPSILON || nMolecules2 < -MY_EPSILON){ + if (fraction2 < 0.0 || nMolecules2 < 0.0) { + if (fraction2 < -MY_EPSILON || nMolecules2 < -MY_EPSILON) { k_error_flag.template view()() = 2; } nMolecules2 = 0.0; fraction2 = 0.0; } - if(fractionOld1 < 0.0 || nMoleculesOld1 < 0.0){ - if(fractionOld1 < -MY_EPSILON || nMoleculesOld1 < -MY_EPSILON){ + if (fractionOld1 < 0.0 || nMoleculesOld1 < 0.0) { + if (fractionOld1 < -MY_EPSILON || nMoleculesOld1 < -MY_EPSILON) { k_error_flag.template view()() = 2; } nMoleculesOld1 = 0.0; fractionOld1 = 0.0; } - if(fractionOld2 < 0.0 || nMoleculesOld2 < 0.0){ - if(fractionOld2 < -MY_EPSILON || nMoleculesOld2 < -MY_EPSILON){ + if (fractionOld2 < 0.0 || nMoleculesOld2 < 0.0) { + if (fractionOld2 < -MY_EPSILON || nMoleculesOld2 < -MY_EPSILON) { k_error_flag.template view()() = 2; } nMoleculesOld2 = 0.0; fractionOld2 = 0.0; } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; @@ -2298,9 +2298,9 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int #endif for (int id = idx_begin; id < idx_end; ++id) { - if(nMoleculesOFA[id]::getMixingWeightsVect(const int np_total, int for (int id = idx_begin; id < idx_end; ++id) { double xMolej, xMolej_old; - if(nMoleculesOFA[id] 0.0){ + if (fractionOFAold[id] > 0.0) { rm3_old[id] += xMolei_old[id]*xMolej_old*rm3ij; epsilon_old[id] += xMolei_old[id]*xMolej_old*rm3ij*epsilonij; alpha_old[id] += xMolei_old[id]*xMolej_old*rm3ij*epsilonij*alphaij; } - if(fractionOFA[id] > 0.0){ + if (fractionOFA[id] > 0.0) { rm3[id] += xMolei[id]*xMolej*rm3ij; epsilon[id] += xMolei[id]*xMolej*rm3ij*epsilonij; alpha[id] += xMolei[id]*xMolej*rm3ij*epsilonij*alphaij; @@ -2352,7 +2352,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int for (int id = idx_begin; id < idx_end; ++id) { rm1[id] = cbrt(rm3[id]); - if(rm1[id] < MY_EPSILON) { + if (rm1[id] < MY_EPSILON) { rm1[id] = 0.0; epsilon1[id] = 0.0; alpha1[id] = 0.0; @@ -2364,7 +2364,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int fraction1[id] = fractionOFA[id]; rm1_old[id] = cbrt(rm3_old[id]); - if(rm1_old[id] < MY_EPSILON) { + if (rm1_old[id] < MY_EPSILON) { rm1_old[id] = 0.0; epsilon1_old[id] = 0.0; alpha1_old[id] = 0.0; @@ -2376,7 +2376,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int fractionOld1[id] = fractionOFAold[id]; } - if(scalingFlag == EXPONENT) { + if (scalingFlag == EXPONENT) { #ifdef KOKKOS_ENABLE_PRAGMA_IVDEP #pragma ivdep #endif @@ -2386,7 +2386,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int exponentScaling(nMoleculesOFAold[id],epsilon1_old[id],rm1_old[id]); } } - else if(scalingFlag == POLYNOMIAL){ + else if (scalingFlag == POLYNOMIAL) { #ifdef KOKKOS_ENABLE_PRAGMA_IVDEP #pragma ivdep #endif @@ -2406,7 +2406,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int for (int id = idx_begin; id < idx_end; ++id) { rm2[id] = cbrt(rm3[id]); - if(rm2[id] < MY_EPSILON) { + if (rm2[id] < MY_EPSILON) { rm2[id] = 0.0; epsilon2[id] = 0.0; alpha2[id] = 0.0; @@ -2418,7 +2418,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int fraction2[id] = fractionOFA[id]; rm2_old[id] = cbrt(rm3_old[id]); - if(rm2_old[id] < MY_EPSILON) { + if (rm2_old[id] < MY_EPSILON) { rm2_old[id] = 0.0; epsilon2_old[id] = 0.0; alpha2_old[id] = 0.0; @@ -2430,7 +2430,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int fractionOld2[id] = fractionOFAold[id]; } - if(scalingFlag == EXPONENT){ + if (scalingFlag == EXPONENT) { #ifdef KOKKOS_ENABLE_PRAGMA_IVDEP #pragma ivdep #endif @@ -2440,7 +2440,7 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int exponentScaling(nMoleculesOFAold[id],epsilon2_old[id],rm2_old[id]); } } - else if(scalingFlag == POLYNOMIAL){ + else if (scalingFlag == POLYNOMIAL) { #ifdef KOKKOS_ENABLE_PRAGMA_IVDEP #pragma ivdep #endif @@ -2458,36 +2458,36 @@ void PairExp6rxKokkos::getMixingWeightsVect(const int np_total, int #endif for (int id = idx_begin; id < idx_end; ++id) { - if(fraction1[id] < 0.0 || nMolecules1[id] < 0.0){ - if(fraction1[id] < -MY_EPSILON || nMolecules1[id] < -MY_EPSILON){ + if (fraction1[id] < 0.0 || nMolecules1[id] < 0.0) { + if (fraction1[id] < -MY_EPSILON || nMolecules1[id] < -MY_EPSILON) { errorFlag2 = 2; } nMolecules1[id] = 0.0; fraction1[id] = 0.0; } - if(fraction2[id] < 0.0 || nMolecules2[id] < 0.0){ - if(fraction2[id] < -MY_EPSILON || nMolecules2[id] < -MY_EPSILON){ + if (fraction2[id] < 0.0 || nMolecules2[id] < 0.0) { + if (fraction2[id] < -MY_EPSILON || nMolecules2[id] < -MY_EPSILON) { errorFlag2 = 2; } nMolecules2[id] = 0.0; fraction2[id] = 0.0; } - if(fractionOld1[id] < 0.0 || nMoleculesOld1[id] < 0.0){ - if(fractionOld1[id] < -MY_EPSILON || nMoleculesOld1[id] < -MY_EPSILON){ + if (fractionOld1[id] < 0.0 || nMoleculesOld1[id] < 0.0) { + if (fractionOld1[id] < -MY_EPSILON || nMoleculesOld1[id] < -MY_EPSILON) { errorFlag2 = 2; } nMoleculesOld1[id] = 0.0; fractionOld1[id] = 0.0; } - if(fractionOld2[id] < 0.0 || nMoleculesOld2[id] < 0.0){ - if(fractionOld2[id] < -MY_EPSILON || nMoleculesOld2[id] < -MY_EPSILON){ + if (fractionOld2[id] < 0.0 || nMoleculesOld2[id] < 0.0) { + if (fractionOld2[id] < -MY_EPSILON || nMoleculesOld2[id] < -MY_EPSILON) { errorFlag2 = 2; } nMoleculesOld2[id] = 0.0; fractionOld2[id] = 0.0; } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old[id] = fractionOld1[id]; mixWtSite1[id] = fraction1[id]; mixWtSite2old[id] = fractionOld2[id]; @@ -2518,17 +2518,17 @@ void PairExp6rxKokkos::exponentScaling(double phi, double &epsilon, { double powfuch; - if(exponentEpsilon < 0.0){ + if (exponentEpsilon < 0.0) { powfuch = pow(phi,-exponentEpsilon); - if(powfuch::expValue(double value) const { double returnValue; - if(value < DBL_MIN_EXP) returnValue = 0.0; + if (value < DBL_MIN_EXP) returnValue = 0.0; else returnValue = exp(value); return returnValue; diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index 208fb8165b..577fac7437 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -151,7 +151,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::compute(int eflag_in, int copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -338,7 +338,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -348,7 +348,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -360,7 +360,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -371,7 +371,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -383,7 +383,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -394,7 +394,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -406,7 +406,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -417,7 +417,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_tables(double cut_co host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -499,7 +499,7 @@ double PairLJCharmmCoulCharmmImplicitKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_i copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -339,7 +339,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -349,7 +349,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -361,7 +361,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -372,7 +372,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -384,7 +384,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -395,7 +395,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -407,7 +407,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -418,7 +418,7 @@ void PairLJCharmmCoulCharmmKokkos::init_tables(double cut_coul, doub host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -500,7 +500,7 @@ double PairLJCharmmCoulCharmmKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_in) copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -255,7 +255,7 @@ F_FLOAT PairLJCharmmCoulLongKokkos:: compute_fcoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -292,7 +292,7 @@ KOKKOS_INLINE_FUNCTION F_FLOAT PairLJCharmmCoulLongKokkos:: compute_ecoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -360,7 +360,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -370,7 +370,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -382,7 +382,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -393,7 +393,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -405,7 +405,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -416,7 +416,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -428,7 +428,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -439,7 +439,7 @@ void PairLJCharmmCoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -508,7 +508,7 @@ double PairLJCharmmCoulLongKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::PairLJClass2CoulLongKokkos(LAMMPS *lmp): template PairLJClass2CoulLongKokkos::~PairLJClass2CoulLongKokkos() { - if (!copymode){ + if (!copymode) { memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); } @@ -137,7 +137,7 @@ void PairLJClass2CoulLongKokkos::compute(int eflag_in, int vflag_in) copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -206,7 +206,7 @@ F_FLOAT PairLJClass2CoulLongKokkos:: compute_fcoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -265,7 +265,7 @@ F_FLOAT PairLJClass2CoulLongKokkos:: compute_ecoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -330,7 +330,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -340,7 +340,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -352,7 +352,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -363,7 +363,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -375,7 +375,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -386,7 +386,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -398,7 +398,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -409,7 +409,7 @@ void PairLJClass2CoulLongKokkos::init_tables(double cut_coul, double host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -491,7 +491,7 @@ double PairLJClass2CoulLongKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).offset = offset[i][j]; k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::PairLJCutCoulCutKokkos(LAMMPS *lmp):PairLJCu template PairLJCutCoulCutKokkos::~PairLJCutCoulCutKokkos() { - if (allocated){ + if (allocated) { memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); memoryKK->destroy_kokkos(k_cut_coulsq, cut_coulsq); @@ -327,7 +327,7 @@ double PairLJCutCoulCutKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::~PairLJCutCoulLongKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); eatom = nullptr; vatom = nullptr; - if (allocated){ + if (allocated) { memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); } @@ -142,7 +142,7 @@ void PairLJCutCoulLongKokkos::compute(int eflag_in, int vflag_in) // loop over neighbors of my atoms EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -206,7 +206,7 @@ KOKKOS_INLINE_FUNCTION F_FLOAT PairLJCutCoulLongKokkos:: compute_fcoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -263,7 +263,7 @@ F_FLOAT PairLJCutCoulLongKokkos:: compute_ecoul(const F_FLOAT& rsq, const int& /*i*/, const int&j, const int& /*itype*/, const int& /*jtype*/, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { - if(Specialisation::DoTable && rsq > tabinnersq) { + if (Specialisation::DoTable && rsq > tabinnersq) { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits; @@ -328,7 +328,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -338,7 +338,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -350,7 +350,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -361,7 +361,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -373,7 +373,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -384,7 +384,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -396,7 +396,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -407,7 +407,7 @@ void PairLJCutCoulLongKokkos::init_tables(double cut_coul, double *c host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -489,7 +489,7 @@ double PairLJCutCoulLongKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).offset = offset[i][j]; k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).shift = shift[i][j]; k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag copymode = 1; EV_FLOAT ev; - if(ncoultablebits) + if (ncoultablebits) ev = pair_compute,CoulLongTable<1> > (this,(NeighListKokkos*)list); else @@ -324,7 +324,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = rtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -334,7 +334,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do { host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = drtable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -346,7 +346,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do table_type d_table("DeviceTable",ntable); // Copy ftable and dftable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -357,7 +357,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dftable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -369,7 +369,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do table_type d_table("DeviceTable",ntable); // Copy ctable and dctable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = ctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -380,7 +380,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = dctable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -392,7 +392,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do table_type d_table("DeviceTable",ntable); // Copy etable and detable - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = etable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -403,7 +403,7 @@ void PairLJGromacsCoulGromacsKokkos::init_tables(double cut_coul, do host_table_type h_table("HostTable",ntable); table_type d_table("DeviceTable",ntable); - for(int i = 0; i < ntable; i++) { + for (int i = 0; i < ntable; i++) { h_table(i) = detable[i]; } Kokkos::deep_copy(d_table,h_table); @@ -489,7 +489,7 @@ double PairLJGromacsCoulGromacsKokkos::init_one(int i, int j) k_params.h_view(i,j).cut_coulsq = cut_coulsqm; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cut_inner = cut_inner[i][j]; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(i,j).lj_type = lj_type[i][j]; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::compute(int eflag_in, int vflag_in) if (tabstyle == LOOKUP) compute_style(eflag_in,vflag_in); - else if(tabstyle == LINEAR) + else if (tabstyle == LINEAR) compute_style(eflag_in,vflag_in); copymode = 0; @@ -321,8 +321,8 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXComputeinnersq || rho[j]*rho[j] < tb->innersq){ - if (rho[i]*rho[i] < d_table_const.innersq(tidx) || rho[j]*rho[j] < d_table_const.innersq(tidx)){ + //if (rho[i]*rho[i] < tb->innersq || rho[j]*rho[j] < tb->innersq) { + if (rho[i]*rho[i] < d_table_const.innersq(tidx) || rho[j]*rho[j] < d_table_const.innersq(tidx)) { k_error_flag.template view()() = 1; } @@ -331,7 +331,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute (((rho[i]*rho[i]) - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx)); //jtable = static_cast (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); jtable = static_cast (((rho[j]*rho[j]) - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx)); - if (itable >= tlm1 || jtable >= tlm1){ + if (itable >= tlm1 || jtable >= tlm1) { k_error_flag.template view()() = 2; } //A_i = tb->f[itable]; @@ -349,22 +349,22 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute ((rho[i]*rho[i] - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx)); //jtable = static_cast (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); jtable = static_cast ((rho[j]*rho[j] - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx)); - if (itable >= tlm1 || jtable >= tlm1){ + if (itable >= tlm1 || jtable >= tlm1) { k_error_flag.template view()() = 2; } - if(itable<0) itable=0; - if(itable>=tlm1) itable=tlm1; - if(jtable<0) jtable=0; - if(jtable>=tlm1)jtable=tlm1; + if (itable<0) itable=0; + if (itable>=tlm1) itable=tlm1; + if (jtable<0) jtable=0; + if (jtable>=tlm1)jtable=tlm1; //fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta); fraction_i = (((rho[i]*rho[i]) - d_table_const.rsq(tidx,itable)) * d_table_const.invdelta(tidx)); //fraction_j = (((rho[j]*rho[j]) - tb->rsq[jtable]) * tb->invdelta); fraction_j = (((rho[j]*rho[j]) - d_table_const.rsq(tidx,jtable)) * d_table_const.invdelta(tidx)); - if(itable==0) fraction_i=0.0; - if(itable==tlm1) fraction_i=0.0; - if(jtable==0) fraction_j=0.0; - if(jtable==tlm1) fraction_j=0.0; + if (itable==0) fraction_i=0.0; + if (itable==tlm1) fraction_i=0.0; + if (jtable==0) fraction_j=0.0; + if (jtable==tlm1) fraction_j=0.0; //A_i = tb->f[itable] + fraction_i*tb->df[itable]; A_i = d_table_const.f(tidx,itable) + fraction_i*d_table_const.df(tidx,itable); @@ -405,10 +405,10 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute= tlm1){ + if (itable >= tlm1) { k_error_flag.template view()() = 2; } - if(itable==0) fraction_i=0.0; + if (itable==0) fraction_i=0.0; //else fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta); else fraction_i = (((rho[i]*rho[i]) - d_table_const.rsq(tidx,itable)) * d_table_const.invdelta(tidx)); //evdwl = tb->e[itable] + fraction_i*tb->de[itable]; @@ -547,7 +547,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXComputeLoca const double pi = MathConst::MY_PI; - for (int jj = 0; jj < jnum; jj++){ + for (int jj = 0; jj < jnum; jj++) { const int j = (d_neighbors(i,jj) & NEIGHMASK); const int jtype = type[j]; @@ -598,44 +598,44 @@ void PairMultiLucyRXKokkos::getMixingWeights(int id, double &mixWtSi nTotal = 0.0; nTotalOld = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { nTotal += dvector(ispecies,id); nTotalOld += dvector(ispecies+nspecies,id); } - if (isOneFluid(isite1) == false){ + if (isOneFluid(isite1) == false) { nMoleculesOld1 = dvector(isite1+nspecies,id); nMolecules1 = dvector(isite1,id); fractionOld1 = nMoleculesOld1/nTotalOld; fraction1 = nMolecules1/nTotal; } - if (isOneFluid(isite2) == false){ + if (isOneFluid(isite2) == false) { nMoleculesOld2 = dvector(isite2+nspecies,id); nMolecules2 = dvector(isite2,id); fractionOld2 = nMoleculesOld2/nTotalOld; fraction2 = nMolecules2/nTotal; } - if (isOneFluid(isite1) || isOneFluid(isite2)){ + if (isOneFluid(isite1) || isOneFluid(isite2)) { nMoleculesOFAold = 0.0; nMoleculesOFA = 0.0; fractionOFAold = 0.0; fractionOFA = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { if (isite1 == ispecies || isite2 == ispecies) continue; nMoleculesOFAold += dvector(ispecies+nspecies,id); nMoleculesOFA += dvector(ispecies,id); fractionOFAold += dvector(ispecies+nspecies,id) / nTotalOld; fractionOFA += dvector(ispecies,id) / nTotal; } - if (isOneFluid(isite1)){ + if (isOneFluid(isite1)) { nMoleculesOld1 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules1 = 1.0-(nTotal-nMoleculesOFA); fractionOld1 = fractionOFAold; fraction1 = fractionOFA; } - if (isOneFluid(isite2)){ + if (isOneFluid(isite2)) { nMoleculesOld2 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules2 = 1.0-(nTotal-nMoleculesOFA); fractionOld2 = fractionOFAold; @@ -643,7 +643,7 @@ void PairMultiLucyRXKokkos::getMixingWeights(int id, double &mixWtSi } } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; @@ -862,12 +862,12 @@ void PairMultiLucyRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->innersq,h_table->innersq,ntables,"Table::innersq"); memoryKK->create_kokkos(d_table->invdelta,h_table->invdelta,ntables,"Table::invdelta"); - if(tabstyle == LOOKUP) { + if (tabstyle == LOOKUP) { memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tlm1,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tlm1,"Table::f"); } - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,tablength,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tablength,"Table::f"); @@ -875,21 +875,21 @@ void PairMultiLucyRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->df,h_table->df,ntables,tlm1,"Table::df"); } - for(int i=0; i < ntables; i++) { + for (int i=0; i < ntables; i++) { Table* tb = &tables[i]; h_table->innersq[i] = tb->innersq; h_table->invdelta[i] = tb->invdelta; - for(int j = 0; j < (int)h_table->rsq.extent(1); j++) + for (int j = 0; j < (int)h_table->rsq.extent(1); j++) h_table->rsq(i,j) = tb->rsq[j]; - for(int j = 0; j < (int)h_table->e.extent(1); j++) + for (int j = 0; j < (int)h_table->e.extent(1); j++) h_table->e(i,j) = tb->e[j]; - for(int j = 0; j < (int)h_table->de.extent(1); j++) + for (int j = 0; j < (int)h_table->de.extent(1); j++) h_table->de(i,j) = tb->de[j]; - for(int j = 0; j < (int)h_table->f.extent(1); j++) + for (int j = 0; j < (int)h_table->f.extent(1); j++) h_table->f(i,j) = tb->f[j]; - for(int j = 0; j < (int)h_table->df.extent(1); j++) + for (int j = 0; j < (int)h_table->df.extent(1); j++) h_table->df(i,j) = tb->df[j]; } diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index eea397dc69..5d48b429cc 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -462,12 +462,12 @@ int PairReaxCKokkos::Init_Lookup_Tables() LR = (LR_lookup_table**) scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR"); - for( i = 0; i < num_atom_types+1; ++i ) + for ( i = 0; i < num_atom_types+1; ++i ) LR[i] = (LR_lookup_table*) scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]"); - for( i = 1; i <= num_atom_types; ++i ) { - for( j = i; j <= num_atom_types; ++j ) { + for ( i = 1; i <= num_atom_types; ++i ) { + for ( j = i; j <= num_atom_types; ++j ) { LR[i][j].xmin = 0; LR[i][j].xmax = control->nonb_cut; LR[i][j].n = control->tabulate + 2; @@ -487,7 +487,7 @@ int PairReaxCKokkos::Init_Lookup_Tables() smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb"); - for( r = 1; r <= control->tabulate; ++r ) { + for ( r = 1; r <= control->tabulate; ++r ) { LR_vdW_Coulomb(i, j, r * dr, &(LR[i][j].y[r]) ); h[r] = LR[i][j].dx; fh[r] = LR[i][j].y[r].H; @@ -546,9 +546,9 @@ void PairReaxCKokkos::Deallocate_Lookup_Tables() ntypes = atom->ntypes; - for( i = 0; i <= ntypes; ++i ) { + for ( i = 0; i <= ntypes; ++i ) { if (map[i] == -1) continue; - for( j = i; j <= ntypes; ++j ) { + for ( j = i; j <= ntypes; ++j ) { if (map[i] == -1) continue; if (LR[i][j].n) { sfree( control->error_ptr, LR[i][j].y, "LR[i,j].y" ); @@ -601,7 +601,7 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ dTap += k_tap.h_view[1]/r_ij; /*vdWaals Calculations*/ - if(system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) { // shielding powr_vdW1 = pow(r_ij, p_vdW1); powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); @@ -626,7 +626,7 @@ void PairReaxCKokkos::LR_vdW_Coulomb( int i, int j, double r_ij, LR_ Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - if(system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) { // inner wall e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); lr->e_vdW += Tap * e_core; @@ -1475,7 +1475,7 @@ void PairReaxCKokkos::operator()(PairReaxBuildListsFull, const int & const F_FLOAT rsq = delij[0]*delij[0] + delij[1]*delij[1] + delij[2]*delij[2]; double cutoffsq; - if(i < nlocal) cutoffsq = MAX(cut_bosq,cut_hbsq); + if (i < nlocal) cutoffsq = MAX(cut_bosq,cut_hbsq); else cutoffsq = cut_bosq; if (rsq > cutoffsq) continue; @@ -1643,7 +1643,7 @@ void PairReaxCKokkos::operator()(PairReaxBuildListsHalf, const F_FLOAT rsq = delij[0]*delij[0] + delij[1]*delij[1] + delij[2]*delij[2]; double cutoffsq; - if(i < nlocal) cutoffsq = MAX(cut_bosq,cut_hbsq); + if (i < nlocal) cutoffsq = MAX(cut_bosq,cut_hbsq); else cutoffsq = cut_bosq; if (rsq > cutoffsq) continue; @@ -1928,10 +1928,10 @@ void PairReaxCKokkos::operator()(PairReaxBondOrder2, const int &ii) d_C4dbopi2(i,j_index) = d_BO_pi2(i,j_index) * A3_ji; } - if(d_BO(i,j_index) < 1e-10) d_BO(i,j_index) = 0.0; - if(d_BO_s(i,j_index) < 1e-10) d_BO_s(i,j_index) = 0.0; - if(d_BO_pi(i,j_index) < 1e-10) d_BO_pi(i,j_index) = 0.0; - if(d_BO_pi2(i,j_index) < 1e-10) d_BO_pi2(i,j_index) = 0.0; + if (d_BO(i,j_index) < 1e-10) d_BO(i,j_index) = 0.0; + if (d_BO_s(i,j_index) < 1e-10) d_BO_s(i,j_index) = 0.0; + if (d_BO_pi(i,j_index) < 1e-10) d_BO_pi(i,j_index) = 0.0; + if (d_BO_pi2(i,j_index) < 1e-10) d_BO_pi2(i,j_index) = 0.0; total_bo += d_BO(i,j_index); @@ -2330,7 +2330,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeAngular::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion= 0 && sin_ijk <= 1e-10) tan_ijk_i = cos_ijk / 1e-10; - else if( sin_ijk <= 0 && sin_ijk >= -1e-10 ) + else if ( sin_ijk <= 0 && sin_ijk >= -1e-10 ) tan_ijk_i = -cos_ijk / 1e-10; else tan_ijk_i = cos_ijk / sin_ijk; exp_tor2_ik = exp( -p_tor2 * BOA_ik ); exp_cot2_ik = exp( -p_cot2 * SQR(BOA_ik -1.5) ); - for(int l = 0; l < 3; l++) fktmp[l] = 0.0; + for (int l = 0; l < 3; l++) fktmp[l] = 0.0; for (int ll = l_start; ll < l_end; ll++) { int l = d_bo_list[ll]; @@ -2643,7 +2643,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion::operator()(PairReaxComputeTorsion= 0 && sin_jil <= 1e-10) tan_jil_i = cos_jil / 1e-10; - else if( sin_jil <= 0 && sin_jil >= -1e-10 ) + else if ( sin_jil <= 0 && sin_jil >= -1e-10 ) tan_jil_i = -cos_jil / 1e-10; else tan_jil_i = cos_jil / sin_jil; @@ -2703,9 +2703,9 @@ void PairReaxCKokkos::operator()(PairReaxComputeTorsion= 0 && sin_ijk <= 1e-10) sin_ijk_rnd = 1e-10; - else if( sin_ijk <= 0 && sin_ijk >= -1e-10 ) sin_ijk_rnd = -1e-10; + else if ( sin_ijk <= 0 && sin_ijk >= -1e-10 ) sin_ijk_rnd = -1e-10; if (sin_jil >= 0 && sin_jil <= 1e-10) sin_jil_rnd = 1e-10; - else if( sin_jil <= 0 && sin_jil >= -1e-10 ) sin_jil_rnd = -1e-10; + else if ( sin_jil <= 0 && sin_jil >= -1e-10 ) sin_jil_rnd = -1e-10; // dcos_omega_di for (int d = 0; d < 3; d++) dcos_omega_dk[d] = ((htra-arg*hnra)/rik) * delik[d] - dellk[d]; @@ -2944,7 +2944,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeHydrogen::~PairTableKokkos() template void PairTableKokkos::compute(int eflag_in, int vflag_in) { - if(update_table) + if (update_table) create_kokkos_tables(); - if(tabstyle == LOOKUP) + if (tabstyle == LOOKUP) compute_style(eflag_in,vflag_in); - if(tabstyle == LINEAR) + if (tabstyle == LINEAR) compute_style(eflag_in,vflag_in); - if(tabstyle == SPLINE) + if (tabstyle == SPLINE) compute_style(eflag_in,vflag_in); - if(tabstyle == BITMAP) + if (tabstyle == BITMAP) compute_style(eflag_in,vflag_in); } @@ -117,7 +117,7 @@ void PairTableKokkos::compute_style(int eflag_in, int vflag_in) // loop over neighbors of my atoms EV_FLOAT ev; - if(atom->ntypes > MAX_TYPES_STACKPARAMS) { + if (atom->ntypes > MAX_TYPES_STACKPARAMS) { if (neighflag == FULL) { PairComputeFunctor,FULL,false,S_TableCompute > ff(this,(NeighListKokkos*) list); @@ -262,12 +262,12 @@ void PairTableKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->invdelta,h_table->invdelta,ntables,"Table::invdelta"); memoryKK->create_kokkos(d_table->deltasq6,h_table->deltasq6,ntables,"Table::deltasq6"); - if(tabstyle == LOOKUP) { + if (tabstyle == LOOKUP) { memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tlm1,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tlm1,"Table::f"); } - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,tablength,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tablength,"Table::f"); @@ -275,7 +275,7 @@ void PairTableKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->df,h_table->df,ntables,tlm1,"Table::df"); } - if(tabstyle == SPLINE) { + if (tabstyle == SPLINE) { memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,tablength,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tablength,"Table::f"); @@ -283,7 +283,7 @@ void PairTableKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->f2,h_table->f2,ntables,tablength,"Table::f2"); } - if(tabstyle == BITMAP) { + if (tabstyle == BITMAP) { int ntable = 1 << tablength; memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,ntable,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,ntable,"Table::e"); @@ -295,7 +295,7 @@ void PairTableKokkos::create_kokkos_tables() - for(int i=0; i < ntables; i++) { + for (int i=0; i < ntables; i++) { Table* tb = &tables[i]; h_table->nshiftbits[i] = tb->nshiftbits; @@ -304,21 +304,21 @@ void PairTableKokkos::create_kokkos_tables() h_table->invdelta[i] = tb->invdelta; h_table->deltasq6[i] = tb->deltasq6; - for(int j = 0; j < (int) h_table->rsq.extent(1); j++) + for (int j = 0; j < (int) h_table->rsq.extent(1); j++) h_table->rsq(i,j) = tb->rsq[j]; - for(int j = 0; j < (int) h_table->drsq.extent(1); j++) + for (int j = 0; j < (int) h_table->drsq.extent(1); j++) h_table->drsq(i,j) = tb->drsq[j]; - for(int j = 0; j < (int) h_table->e.extent(1); j++) + for (int j = 0; j < (int) h_table->e.extent(1); j++) h_table->e(i,j) = tb->e[j]; - for(int j = 0; j < (int) h_table->de.extent(1); j++) + for (int j = 0; j < (int) h_table->de.extent(1); j++) h_table->de(i,j) = tb->de[j]; - for(int j = 0; j < (int) h_table->f.extent(1); j++) + for (int j = 0; j < (int) h_table->f.extent(1); j++) h_table->f(i,j) = tb->f[j]; - for(int j = 0; j < (int) h_table->df.extent(1); j++) + for (int j = 0; j < (int) h_table->df.extent(1); j++) h_table->df(i,j) = tb->df[j]; - for(int j = 0; j < (int) h_table->e2.extent(1); j++) + for (int j = 0; j < (int) h_table->e2.extent(1); j++) h_table->e2(i,j) = tb->e2[j]; - for(int j = 0; j < (int) h_table->f2.extent(1); j++) + for (int j = 0; j < (int) h_table->f2.extent(1); j++) h_table->f2(i,j) = tb->f2[j]; } @@ -334,14 +334,14 @@ void PairTableKokkos::create_kokkos_tables() Kokkos::deep_copy(d_table->deltasq6,h_table->deltasq6); d_table_const.deltasq6 = d_table->deltasq6; - if(tabstyle == LOOKUP) { + if (tabstyle == LOOKUP) { Kokkos::deep_copy(d_table->e,h_table->e); d_table_const.e = d_table->e; Kokkos::deep_copy(d_table->f,h_table->f); d_table_const.f = d_table->f; } - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -354,7 +354,7 @@ void PairTableKokkos::create_kokkos_tables() d_table_const.df = d_table->df; } - if(tabstyle == SPLINE) { + if (tabstyle == SPLINE) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -367,7 +367,7 @@ void PairTableKokkos::create_kokkos_tables() d_table_const.f2 = d_table->f2; } - if(tabstyle == BITMAP) { + if (tabstyle == BITMAP) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -476,7 +476,7 @@ double PairTableKokkos::init_one(int i, int j) tabindex[j][i] = tabindex[i][j]; - if(i= 0); assert(id < (int)dvector.extent(1)); - for (int ispecies = 0; ispecies < nspecies; ++ispecies){ + for (int ispecies = 0; ispecies < nspecies; ++ispecies) { assert(ispecies < (int)dvector.extent(0)); nTotal += dvector(ispecies,id); assert(ispecies+nspecies < (int)dvector.extent(0)); @@ -82,39 +82,39 @@ void getMixingWeights( assert(isite1 < nspecies); assert(isite2 >= 0); assert(isite2 < nspecies); - if (isOneFluid(isite1) == false){ + if (isOneFluid(isite1) == false) { nMoleculesOld1 = dvector(isite1+nspecies,id); nMolecules1 = dvector(isite1,id); fractionOld1 = nMoleculesOld1/nTotalOld; fraction1 = nMolecules1/nTotal; } - if (isOneFluid(isite2) == false){ + if (isOneFluid(isite2) == false) { nMoleculesOld2 = dvector(isite2+nspecies,id); nMolecules2 = dvector(isite2,id); fractionOld2 = nMoleculesOld2/nTotalOld; fraction2 = nMolecules2/nTotal; } - if (isOneFluid(isite1) || isOneFluid(isite2)){ + if (isOneFluid(isite1) || isOneFluid(isite2)) { nMoleculesOFAold = 0.0; nMoleculesOFA = 0.0; fractionOFAold = 0.0; fractionOFA = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { if (isite1 == ispecies || isite2 == ispecies) continue; nMoleculesOFAold += dvector(ispecies+nspecies,id); nMoleculesOFA += dvector(ispecies,id); fractionOFAold += dvector(ispecies+nspecies,id)/nTotalOld; fractionOFA += dvector(ispecies,id)/nTotal; } - if(isOneFluid(isite1)){ + if (isOneFluid(isite1)) { nMoleculesOld1 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules1 = 1.0-(nTotal-nMoleculesOFA); fractionOld1 = fractionOFAold; fraction1 = fractionOFA; } - if(isOneFluid(isite2)){ + if (isOneFluid(isite2)) { nMoleculesOld2 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules2 = 1.0-(nTotal-nMoleculesOFA); fractionOld2 = fractionOFAold; @@ -122,7 +122,7 @@ void getMixingWeights( } } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; @@ -183,15 +183,15 @@ PairTableRXKokkos::~PairTableRXKokkos() template void PairTableRXKokkos::compute(int eflag_in, int vflag_in) { - if(update_table) + if (update_table) create_kokkos_tables(); - if(tabstyle == LOOKUP) + if (tabstyle == LOOKUP) compute_style(eflag_in,vflag_in); - if(tabstyle == LINEAR) + if (tabstyle == LINEAR) compute_style(eflag_in,vflag_in); - if(tabstyle == SPLINE) + if (tabstyle == SPLINE) compute_style(eflag_in,vflag_in); - if(tabstyle == BITMAP) + if (tabstyle == BITMAP) compute_style(eflag_in,vflag_in); } @@ -456,7 +456,7 @@ compute_item( auto rsq = delx*delx + dely*dely + delz*delz; auto jtype = type(j); - if(rsq < (STACKPARAMS ? m_cutsq[itype][jtype] : d_cutsq(itype,jtype))) { + if (rsq < (STACKPARAMS ? m_cutsq[itype][jtype] : d_cutsq(itype,jtype))) { auto mixWtSite1old_j = mixWtSite1old(j); auto mixWtSite2old_j = mixWtSite2old(j); auto mixWtSite1_j = mixWtSite1(j); @@ -669,7 +669,7 @@ void PairTableRXKokkos::compute_style(int eflag_in, int vflag_in) dynamic_cast*>(list); EV_FLOAT ev; - if(atom->ntypes > MAX_TYPES_STACKPARAMS) { + if (atom->ntypes > MAX_TYPES_STACKPARAMS) { if (neighflag == HALFTHREAD) { if (newton_pair) { compute_all_items( @@ -805,12 +805,12 @@ void PairTableRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->invdelta,h_table->invdelta,ntables,"Table::invdelta"); memoryKK->create_kokkos(d_table->deltasq6,h_table->deltasq6,ntables,"Table::deltasq6"); - if(tabstyle == LOOKUP) { + if (tabstyle == LOOKUP) { memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tlm1,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tlm1,"Table::f"); } - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,tablength,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tablength,"Table::f"); @@ -818,7 +818,7 @@ void PairTableRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->df,h_table->df,ntables,tlm1,"Table::df"); } - if(tabstyle == SPLINE) { + if (tabstyle == SPLINE) { memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,tablength,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,tablength,"Table::e"); memoryKK->create_kokkos(d_table->f,h_table->f,ntables,tablength,"Table::f"); @@ -826,7 +826,7 @@ void PairTableRXKokkos::create_kokkos_tables() memoryKK->create_kokkos(d_table->f2,h_table->f2,ntables,tablength,"Table::f2"); } - if(tabstyle == BITMAP) { + if (tabstyle == BITMAP) { int ntable = 1 << tablength; memoryKK->create_kokkos(d_table->rsq,h_table->rsq,ntables,ntable,"Table::rsq"); memoryKK->create_kokkos(d_table->e,h_table->e,ntables,ntable,"Table::e"); @@ -838,7 +838,7 @@ void PairTableRXKokkos::create_kokkos_tables() - for(int i=0; i < ntables; i++) { + for (int i=0; i < ntables; i++) { Table* tb = &tables[i]; h_table->nshiftbits[i] = tb->nshiftbits; @@ -847,21 +847,21 @@ void PairTableRXKokkos::create_kokkos_tables() h_table->invdelta[i] = tb->invdelta; h_table->deltasq6[i] = tb->deltasq6; - for(int j = 0; j < (int)h_table->rsq.extent(1); j++) + for (int j = 0; j < (int)h_table->rsq.extent(1); j++) h_table->rsq(i,j) = tb->rsq[j]; - for(int j = 0; j < (int)h_table->drsq.extent(1); j++) + for (int j = 0; j < (int)h_table->drsq.extent(1); j++) h_table->drsq(i,j) = tb->drsq[j]; - for(int j = 0; j < (int)h_table->e.extent(1); j++) + for (int j = 0; j < (int)h_table->e.extent(1); j++) h_table->e(i,j) = tb->e[j]; - for(int j = 0; j < (int)h_table->de.extent(1); j++) + for (int j = 0; j < (int)h_table->de.extent(1); j++) h_table->de(i,j) = tb->de[j]; - for(int j = 0; j < (int)h_table->f.extent(1); j++) + for (int j = 0; j < (int)h_table->f.extent(1); j++) h_table->f(i,j) = tb->f[j]; - for(int j = 0; j < (int)h_table->df.extent(1); j++) + for (int j = 0; j < (int)h_table->df.extent(1); j++) h_table->df(i,j) = tb->df[j]; - for(int j = 0; j < (int)h_table->e2.extent(1); j++) + for (int j = 0; j < (int)h_table->e2.extent(1); j++) h_table->e2(i,j) = tb->e2[j]; - for(int j = 0; j < (int)h_table->f2.extent(1); j++) + for (int j = 0; j < (int)h_table->f2.extent(1); j++) h_table->f2(i,j) = tb->f2[j]; } @@ -877,14 +877,14 @@ void PairTableRXKokkos::create_kokkos_tables() Kokkos::deep_copy(d_table->deltasq6,h_table->deltasq6); d_table_const.deltasq6 = d_table->deltasq6; - if(tabstyle == LOOKUP) { + if (tabstyle == LOOKUP) { Kokkos::deep_copy(d_table->e,h_table->e); d_table_const.e = d_table->e; Kokkos::deep_copy(d_table->f,h_table->f); d_table_const.f = d_table->f; } - if(tabstyle == LINEAR) { + if (tabstyle == LINEAR) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -897,7 +897,7 @@ void PairTableRXKokkos::create_kokkos_tables() d_table_const.df = d_table->df; } - if(tabstyle == SPLINE) { + if (tabstyle == SPLINE) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -910,7 +910,7 @@ void PairTableRXKokkos::create_kokkos_tables() d_table_const.f2 = d_table->f2; } - if(tabstyle == BITMAP) { + if (tabstyle == BITMAP) { Kokkos::deep_copy(d_table->rsq,h_table->rsq); d_table_const.rsq = d_table->rsq; Kokkos::deep_copy(d_table->e,h_table->e); @@ -1038,14 +1038,14 @@ void PairTableRXKokkos::coeff(int narg, char **arg) bcast_table(tb); nspecies = atom->nspecies_dpd; - if(nspecies==0) error->all(FLERR,"There are no rx species specified."); + if (nspecies==0) error->all(FLERR,"There are no rx species specified."); int n; n = strlen(arg[4]) + 1; site1 = new char[n]; strcpy(site1,arg[4]); int ispecies; - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site1,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) @@ -1055,7 +1055,7 @@ void PairTableRXKokkos::coeff(int narg, char **arg) site2 = new char[n]; strcpy(site2,arg[5]); - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site2,"1fluid") != 0) @@ -1122,8 +1122,8 @@ void PairTableRXKokkos::coeff(int narg, char **arg) else { isite1 = nspecies; - for (int k = 0; k < nspecies; k++){ - if (strcmp(site1, atom->dname[k]) == 0){ + for (int k = 0; k < nspecies; k++) { + if (strcmp(site1, atom->dname[k]) == 0) { isite1 = k; break; } @@ -1137,8 +1137,8 @@ void PairTableRXKokkos::coeff(int narg, char **arg) else { isite2 = nspecies; - for (int k = 0; k < nspecies; k++){ - if (strcmp(site2, atom->dname[k]) == 0){ + for (int k = 0; k < nspecies; k++) { + if (strcmp(site2, atom->dname[k]) == 0) { isite2 = ispecies; break; } @@ -1162,7 +1162,7 @@ double PairTableRXKokkos::init_one(int i, int j) tabindex[j][i] = tabindex[i][j]; - if(i::init_one(int i, int j) k_params.h_view(i,j).cutsq = cutone*cutone; k_params.h_view(j,i) = k_params.h_view(i,j); - if(i::init_one(int i, int j) k_sw4.modify(); k_sw5.modify(); - if(istamp(Timer::BOND); } - if(force->kspace) { + if (force->kspace) { force->kspace->setup(); if (kspace_compute_flag) { atomKK->sync(force->kspace->execution_space,force->kspace->datamask_read); @@ -271,7 +271,7 @@ void VerletKokkos::setup_minimal(int flag) timer->stamp(Timer::BOND); } - if(force->kspace) { + if (force->kspace) { force->kspace->setup(); if (kspace_compute_flag) { atomKK->sync(force->kspace->execution_space,force->kspace->datamask_read); @@ -480,11 +480,11 @@ void VerletKokkos::run(int n) timer->stamp(Timer::PAIR); } - if(execute_on_host) { - if(pair_compute_flag && force->pair->datamask_modify!=(F_MASK | ENERGY_MASK | VIRIAL_MASK)) + if (execute_on_host) { + if (pair_compute_flag && force->pair->datamask_modify!=(F_MASK | ENERGY_MASK | VIRIAL_MASK)) Kokkos::fence(); atomKK->sync_overlapping_device(Host,~(~datamask_read_host|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); - if(pair_compute_flag && force->pair->execution_space!=Host) { + if (pair_compute_flag && force->pair->execution_space!=Host) { Kokkos::deep_copy(LMPHostType(),atomKK->k_f.h_view,0.0); } } @@ -520,8 +520,8 @@ void VerletKokkos::run(int n) timer->stamp(Timer::KSPACE); } - if(execute_on_host && !std::is_same::value) { - if(f_merge_copy.extent(0)k_f.extent(0)) { + if (execute_on_host && !std::is_same::value) { + if (f_merge_copy.extent(0)k_f.extent(0)) { f_merge_copy = DAT::t_f_array("VerletKokkos::f_merge_copy",atomKK->k_f.extent(0)); } f = atomKK->k_f.d_view; diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 27f30ab3a8..ffe7de067b 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -530,7 +530,7 @@ void PairLJLongCoulLong::compute(int eflag, int vflag) if (rsq < cut_ljsqi[typej]) { // lj if (order6) { // long-range lj - if(!ndisptablebits || rsq <= tabinnerdispsq) { // series real space + if (!ndisptablebits || rsq <= tabinnerdispsq) { // series real space double rn = r2inv*r2inv*r2inv; double x2 = g2*rsq, a2 = 1.0/x2; x2 = a2*exp(-x2)*lj4i[typej]; diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 0c412cc923..2500336e8f 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -1220,7 +1220,7 @@ void PPPMDisp::compute(int eflag, int vflag) for (i = 0; i < 6; i++) virial[i] = 0.5*qscale*volume*virial_all[i]; MPI_Allreduce(virial_6,virial_all,6,MPI_DOUBLE,MPI_SUM,world); for (i = 0; i < 6; i++) virial[i] += 0.5*volume*virial_all[i]; - if (function[1]+function[2]+function[3]){ + if (function[1]+function[2]+function[3]) { double a = MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij; virial[0] -= a; virial[1] -= a; @@ -8155,7 +8155,7 @@ int PPPMDisp::timing_1d(int n, double &time1d) for (int i = 0; i < n; i++) { fft1->timing1d(work1,nfft_both,1); fft2->timing1d(work1,nfft_both,-1); - if (differentiation_flag != 1){ + if (differentiation_flag != 1) { fft2->timing1d(work1,nfft_both,-1); fft2->timing1d(work1,nfft_both,-1); } @@ -8173,7 +8173,7 @@ int PPPMDisp::timing_1d(int n, double &time1d) for (int i = 0; i < n; i++) { fft1_6->timing1d(work1_6,nfft_both_6,1); fft2_6->timing1d(work1_6,nfft_both_6,-1); - if (differentiation_flag != 1){ + if (differentiation_flag != 1) { fft2_6->timing1d(work1_6,nfft_both_6,-1); fft2_6->timing1d(work1_6,nfft_both_6,-1); } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 4edc38b112..75abba2f09 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -227,8 +227,8 @@ void FixQEQComb::post_force(int /*vflag*/) } comm->forward_comm_fix(this); - if(comb) enegtot = comb->yasu_char(qf,igroup); - if(comb3) enegtot = comb3->combqeq(qf,igroup); + if (comb) enegtot = comb->yasu_char(qf,igroup); + if (comb3) enegtot = comb3->combqeq(qf,igroup); enegtot /= ngroup; enegchk = enegmax = 0.0; diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 401c1f35ad..02af7bf308 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -543,7 +543,7 @@ void PairADP::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "adp"); try { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 4a0c2a874d..44042bd133 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -3489,7 +3489,7 @@ void PairAIREBO::read_file(char *filename) // global parameters current_section = "global parameters"; - for(int i = 0; i < (int)params.size(); i++) { + for (int i = 0; i < (int)params.size(); i++) { *params[i] = reader.next_double(); } @@ -4381,22 +4381,22 @@ void PairAIREBO::spline_init() // make top end of piCC flat instead of zero i = 4; - for (j = 0; j < 4; j++){ - for (k = 1; k < 11; k++){ + for (j = 0; j < 4; j++) { + for (k = 1; k < 11; k++) { piCCf[i][j][k] = piCCf[i-1][j][k]; } } - for (i = 0; i < 4; i++){ // also enforces some symmetry - for (j = i+1; j < 5; j++){ - for (k = 1; k < 11; k++){ + for (i = 0; i < 4; i++) { // also enforces some symmetry + for (j = i+1; j < 5; j++) { + for (k = 1; k < 11; k++) { piCCf[i][j][k] = piCCf[j][i][k]; } } } for (k = 1; k < 11; k++) piCCf[4][4][k] = piCCf[3][4][k]; k = 10; - for (i = 0; i < 5; i++){ - for (j = 0; j < 5; j++){ + for (i = 0; i < 5; i++) { + for (j = 0; j < 5; j++) { piCCf[i][j][k] = piCCf[i][j][k-1]; } } @@ -4424,22 +4424,22 @@ void PairAIREBO::spline_init() // also enforces some symmetry i = 4; - for (j = 0; j < 4; j++){ - for (k = 1; k < 11; k++){ + for (j = 0; j < 4; j++) { + for (k = 1; k < 11; k++) { piCHf[i][j][k] = piCHf[i-1][j][k]; } } - for (i = 0; i < 4; i++){ - for (j = i+1; j < 5; j++){ - for (k = 1; k < 11; k++){ + for (i = 0; i < 4; i++) { + for (j = i+1; j < 5; j++) { + for (k = 1; k < 11; k++) { piCHf[i][j][k] = piCHf[j][i][k]; } } } for (k = 1; k < 11; k++) piCHf[4][4][k] = piCHf[3][4][k]; k = 10; - for (i = 0; i < 5; i++){ - for (j = 0; j < 5; j++){ + for (i = 0; i < 5; i++) { + for (j = 0; j < 5; j++) { piCHf[i][j][k] = piCHf[i][j][k-1]; } } diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 29fd8b63c6..9f12b0755a 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -181,7 +181,7 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp) PairBOP::~PairBOP() { - if(allocated) { + if (allocated) { memory_theta_destroy(); if (otfly==0) memory->destroy(cos_index); delete [] map; @@ -319,16 +319,16 @@ void PairBOP::compute(int eflag, int vflag) itype=map[type[i]]+1; iilist=firstneigh[i]; nlisti=BOP_total[i]; - for(jj=0;jj=i_tag) { + if (j_tag>=i_tag) { sigB_0=sigmaBo(ii,jj); piB_0=PiBo(ii,jj); - if(otfly==0) { - if(neigh_flag[temp_ij]) { + if (otfly==0) { + if (neigh_flag[temp_ij]) { dpr1=(dRepul[temp_ij]-2.0*dBetaS[temp_ij]*sigB_0 -2.0*dBetaP[temp_ij]*piB_0)/rij[temp_ij]; ftmp1=dpr1*disij[0][temp_ij]; @@ -345,7 +345,7 @@ void PairBOP::compute(int eflag, int vflag) dE=-2.0*betaS[temp_ij]*sigB_0-2.0*betaP[temp_ij]*piB_0; totE+=dE+repul[temp_ij]; - if(evflag) { + if (evflag) { ev_tally_full(i,repul[temp_ij],dE,0.0,0.0,0.0,0.0); ev_tally_full(j,repul[temp_ij],dE,0.0,0.0,0.0,0.0); ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0,-ftmp1,-ftmp2,-ftmp3, @@ -354,9 +354,9 @@ void PairBOP::compute(int eflag, int vflag) } } else { - if(itype==jtype) + if (itype==jtype) iij=itype-1; - else if(itype1.0) + if (ps>1.0) ps=1.0; betaS_ij=((pBetaS3[iij][ks-1]*ps+pBetaS2[iij][ks-1])*ps +pBetaS1[iij][ks-1])*ps+pBetaS[iij][ks-1]; @@ -404,7 +404,7 @@ void PairBOP::compute(int eflag, int vflag) dE=-2.0*betaS_ij*sigB_0-2.0*betaP_ij*piB_0; totE+=dE+repul_ij; - if(evflag) { + if (evflag) { ev_tally_full(i,repul_ij,dE,0.0,0.0,0.0,0.0); ev_tally_full(j,repul_ij,dE,0.0,0.0,0.0,0.0); ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0,-ftmp1,-ftmp2,-ftmp3, @@ -423,16 +423,16 @@ void PairBOP::compute(int eflag, int vflag) itype=map[type[i]]+1; iilist=firstneigh[i]; nlisti=BOP_total3[i]; - for(jj=0;jj1.0) + if (ps>1.0) ps=1.0; value=((pLong3[i12][ks-1]*ps+pLong2[i12][ks-1])*ps+ pLong1[i12][ks-1])*ps+pLong[i12][ks-1]; - if(value<=0.0) value=pLong[i12][ks-1]; + if (value<=0.0) value=pLong[i12][ks-1]; dvalue=(pLong6[i12][ks-1]*ps+ pLong5[i12][ks-1])*ps+pLong4[i12][ks-1]; dpr1=-dvalue/r_ij; @@ -469,7 +469,7 @@ void PairBOP::compute(int eflag, int vflag) f[j][1]=f[j][1]-ftmp2; f[j][2]=f[j][2]-ftmp3; totE=totE-value; - if(evflag) { + if (evflag) { ev_tally_full(i,0,-value,0.0,0.0,0.0,0.0); ev_tally_full(j,0,-value,0.0,0.0,0.0,0.0); ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0,-ftmp1,-ftmp2,-ftmp3, @@ -717,7 +717,7 @@ double PairBOP::init_one(int i, int j) else ij=jj*bop_types-jj*(jj+1)/2+ii-1; - if(rcut[ij]>rcut3[ij]) { + if (rcut[ij]>rcut3[ij]) { cutghost[i][j] = rcut[ij]; cutghost[j][i] = cutghost[i][j]; cutsq[i][j] = rcut[ij]*rcut[ij]; @@ -759,7 +759,7 @@ void PairBOP::gneigh() double **x = atom->x; int *type = atom->type; - if(allocate_neigh==0) { + if (allocate_neigh==0) { memory->create(BOP_index,nall,"BOP_index"); memory->create(BOP_index3,nall,"BOP_index3"); memory->create(BOP_total,nall,"BOP_total"); @@ -777,7 +777,7 @@ void PairBOP::gneigh() ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - if(bop_step==0) { + if (bop_step==0) { maxneigh=0; maxneigh3=0; maxnall=0; @@ -786,7 +786,7 @@ void PairBOP::gneigh() neigh_total3=0; cos_total=0; for (ii = 0; ii < nall; ii++) { - if(ii=npairs) { + if (i12>=npairs) { error->one(FLERR,"Too many atom pairs for pair bop"); } dis[0]=x[j][0]-x[i][0]; @@ -814,10 +814,10 @@ void PairBOP::gneigh() +dis[1]*dis[1] +dis[2]*dis[2]; r=sqrt(rsq); - if(r<=rcut[i12]) { + if (r<=rcut[i12]) { max_check++; } - if(r<=rcut3[i12]) { + if (r<=rcut3[i12]) { max_check3++; } } @@ -829,23 +829,23 @@ void PairBOP::gneigh() neigh_total+=max_check; neigh_total3+=max_check3; - if(max_check>maxneigh||max_check3>maxneigh3){ + if (max_check>maxneigh||max_check3>maxneigh3) { maxneigh=max_check; maxneigh3=max_check3; } - if(otfly==0) { + if (otfly==0) { cos_index[i]=cos_total; cos_total+=max_check*(max_check-1)/2; } } maxnall=nall; - if(update_list!=0) + if (update_list!=0) memory_theta_grow(); else memory_theta_create(); neigh_t=0; for (ii = 0; ii < nall; ii++) { - if(ii=npairs) { + if (i12>=npairs) { error->one(FLERR,"Too many atom pairs for pair bop"); } dis[0]=x[j][0]-x[i][0]; @@ -872,15 +872,15 @@ void PairBOP::gneigh() +dis[1]*dis[1] +dis[2]*dis[2]; r=sqrt(rsq); - if(r<=rcut[i12]) { + if (r<=rcut[i12]) { temp_ij=BOP_index[i]+max_check; - if(i==0) { + if (i==0) { } neigh_index[temp_ij]=jj; neigh_flag[temp_ij]=1; max_check++; } - if(r<=rcut3[i12]) { + if (r<=rcut3[i12]) { temp_ij=BOP_index3[i]+max_check3; neigh_index3[temp_ij]=jj; neigh_flag3[temp_ij]=1; @@ -888,9 +888,9 @@ void PairBOP::gneigh() } } } - if(otfly==0) { + if (otfly==0) { for (ii = 0; ii < nall; ii++) { - if(ii=neigh_total) { + if (temp_ij>=neigh_total) { } - if(temp_ij<0) { + if (temp_ij<0) { } jtype = map[type[j]]+1; - if(itype==jtype) + if (itype==jtype) i12=itype-1; - else if(itype=npairs) { + if (i12>=npairs) { error->one(FLERR,"Too many atom pairs for pair bop"); } disij[0][temp_ij]=x[j][0]-x[i][0]; @@ -923,7 +923,7 @@ void PairBOP::gneigh() +disij[1][temp_ij]*disij[1][temp_ij] +disij[2][temp_ij]*disij[2][temp_ij]; rij[temp_ij]=sqrt(rsq); - if(rij[temp_ij]<=rcut[i12]) { + if (rij[temp_ij]<=rcut[i12]) { max_check++; } else @@ -932,7 +932,7 @@ void PairBOP::gneigh() } neigh_t+=max_check; for (ii = 0; ii < nall; ii++) { - if(ii=npairs) { + if (i12>=npairs) { error->one(FLERR,"Too many atom pairs for pair bop"); } ps=rij[temp_ij]*rdr[i12]+1.0; ks=(int)ps; - if(nr-11.0) + if (ps>1.0) ps=1.0; betaS[temp_ij]=((pBetaS3[i12][ks-1]*ps+pBetaS2[i12][ks-1])*ps+pBetaS1[i12][ks-1])*ps+pBetaS[i12][ks-1]; dBetaS[temp_ij]=(pBetaS6[i12][ks-1]*ps+pBetaS5[i12][ks-1])*ps @@ -977,29 +977,29 @@ void PairBOP::gneigh() } for (ii = 0; ii < nall; ii++) { n=0; - if(ii=cos_total) { + for (kk=jj+1;kk=cos_total) { error->one(FLERR,"Too many atom triplets for pair bop"); } temp_ik=BOP_index[i]+kk; temp_ijk=cos_index[i]+n; - if(temp_ijk>=cos_total) { + if (temp_ijk>=cos_total) { error->one(FLERR,"Too many atom triplets for pair bop"); } rk2=rij[temp_ik]*rij[temp_ik]; rj1k1=rij[temp_ij]*rij[temp_ik]; rj2k2=rj1k1*rj1k1; - if(temp_ijk>=cos_total) { + if (temp_ijk>=cos_total) { error->one(FLERR,"Too many atom triplets for pair bop"); } cosAng[temp_ijk]=(disij[0][temp_ij]*disij[0][temp_ik]+disij[1][temp_ij] @@ -1128,12 +1128,12 @@ double PairBOP::sigmaBo(int itmp, int jtmp) ilist = list->ilist; firstneigh = list->firstneigh; - if(nb_sg==0) { + if (nb_sg==0) { nb_sg=(maxneigh)*(maxneigh/2); } create_sigma(nb_sg); sigB=0; - if(itmpnb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -1166,27 +1166,27 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_ij].temp=temp_ij; bt_sg[nb_ij].i=i; bt_sg[nb_ij].j=j; - if(j_tag>=i_tag) { - if(itype==jtype) + if (j_tag>=i_tag) { + if (itype==jtype) iij=itype-1; - else if(itype1.0) + if (ps>1.0) ps=1.0; betaS_ij=((pBetaS3[iij][ks-1]*ps+pBetaS2[iij][ks-1])*ps +pBetaS1[iij][ks-1])*ps+pBetaS[iij][ks-1]; @@ -1209,7 +1209,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +pBetaS4[iij][ks-1]; } } else { - if(neigh_flag[temp_ij]) { + if (neigh_flag[temp_ij]) { pass_ij=1; dis_ij[0]=disij[0][temp_ij]; dis_ij[1]=disij[1][temp_ij]; @@ -1219,7 +1219,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dBetaS_ij=dBetaS[temp_ij]; } } - if(pass_ij==1) { + if (pass_ij==1) { nSigBk=0; //AA-EE1 are the components making up Eq. 30 (a) @@ -1249,16 +1249,16 @@ double PairBOP::sigmaBo(int itmp, int jtmp) //k is loop over all neighbors of i again with j neighbor of i nlisti=BOP_total[i]; - for(ktmp=0;ktmp1.0) + if (ps>1.0) ps=1.0; betaS_ik=((pBetaS3[iik][ks-1]*ps+pBetaS2[iik][ks-1])*ps +pBetaS1[iik][ks-1])*ps+pBetaS[iik][ks-1]; @@ -1301,7 +1301,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +pBetaS4[iik][ks-1]; } } else { - if(neigh_flag[temp_ik]) { + if (neigh_flag[temp_ik]) { pass_ik=1; dis_ik[0]=disij[0][temp_ik]; dis_ik[1]=disij[1][temp_ik]; @@ -1311,17 +1311,17 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dBetaS_ik=dBetaS[temp_ik]; } } - if(pass_ik==1) { + if (pass_ik==1) { //find neighbor of i that is equal to k nlistj=BOP_total[j]; - for(jNeik=0;jNeiknb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -1390,7 +1390,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_ik].j=k; nb_jk=nb_t; nb_t++; - if(nb_t>nb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -1398,7 +1398,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_jk].temp=temp_jk; bt_sg[nb_jk].i=j; bt_sg[nb_jk].j=k; - if(otfly==1) { + if (otfly==1) { cosAng_jik=(dis_ij[0]*dis_ik[0]+dis_ij[1]*dis_ik[1] +dis_ij[2]*dis_ik[2])/(r_ij*r_ik); dcA_jik[0][0]=(dis_ik[0]*r_ij*r_ik-cosAng_jik @@ -1415,8 +1415,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dcA_jik[2][1]=(dis_ij[2]*r_ij*r_ik-cosAng_jik *dis_ik[2]*r_ij*r_ij)/(r_ij*r_ij*r_ik*r_ik); } else { - if(ktmp!=jtmp) { - if(jtmp1.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor1=((gfunc3[jtype][itype][ktype][ks]*ps+ @@ -1458,7 +1458,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor1=gpara[jtype-1][itype-1][ktype-1][0]; gprime1=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_jkp=((pBetaS3[ijkp][ks-1]*ps+pBetaS2[ijkp][ks-1])*ps +pBetaS1[ijkp][ks-1])*ps+pBetaS[ijkp][ks-1]; @@ -1600,7 +1600,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *dis_jk[2]*r_ij*r_ij)/(r_ij*r_ij*r_jk*r_jk); } } else { - if(neigh_flag[temp_jkp]) { + if (neigh_flag[temp_jkp]) { pass_jkp=1; dis_jkp[0]=disij[0][temp_jkp]; dis_jkp[1]=disij[1][temp_jkp]; @@ -1608,7 +1608,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_jkp=rij[temp_jkp]; betaS_jkp=betaS[temp_jkp]; dBetaS_jkp=dBetaS[temp_jkp]; - if(ji1.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[itype][jtype][ktype][ks]*ps+ @@ -1651,13 +1651,13 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[itype-1][jtype-1][ktype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor3=((gfunc3[itype][jtype][jtype][ks]*ps+ @@ -1715,7 +1715,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor3=gpara[itype-1][ktype-1][jtype-1][0]; gprime3=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_ikp=((pBetaS3[iikp][ks-1]*ps+pBetaS2[iikp][ks-1])*ps +pBetaS1[iikp][ks-1])*ps+pBetaS[iikp][ks-1]; @@ -1824,7 +1824,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +pBetaS4[iikp][ks-1]; } } else { - if(neigh_flag[temp_ikp]) { + if (neigh_flag[temp_ikp]) { pass_ikp=1; dis_ikp[0]=disij[0][temp_ikp]; dis_ikp[1]=disij[1][temp_ikp]; @@ -1834,10 +1834,10 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dBetaS_ikp=dBetaS[temp_ikp]; } } - if(pass_ikp==1) { + if (pass_ikp==1) { nb_ikp=nb_t; nb_t++; - if(nb_t>nb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -1845,7 +1845,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_ikp].temp=temp_ikp; bt_sg[nb_ikp].i=i; bt_sg[nb_ikp].j=kp; - if(otfly==1) { + if (otfly==1) { cosAng_jikp=(dis_ij[0]*dis_ikp[0]+dis_ij[1]*dis_ikp[1] +dis_ij[2]*dis_ikp[2])/(r_ij*r_ikp); dcA_jikp[0][0]=(dis_ikp[0]*r_ij*r_ikp-cosAng_jikp @@ -1875,7 +1875,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dcA_kikp[2][1]=(dis_ik[2]*r_ik*r_ikp-cosAng_kikp *dis_ikp[2]*r_ik*r_ik)/(r_ik*r_ik*r_ikp*r_ikp); } else { - if(jtmp1.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[jtype][itype][kptype][ks]*ps+ @@ -1934,21 +1934,21 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[jtype-1][itype-1][kptype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor3=((gfunc3[ktype][itype][kptype][ks]*ps+ @@ -1962,7 +1962,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor3=gpara[ktype-1][itype-1][kptype-1][0]; gprime3=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_kkp=((pBetaS3[ikkp][ks-1]*ps+pBetaS2[ikkp][ks-1])*ps +pBetaS1[ikkp][ks-1])*ps+pBetaS[ikkp][ks-1]; @@ -2080,7 +2080,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +pBetaS4[ikkp][ks-1]; } } else { - if(neigh_flag[temp_kkp]) { + if (neigh_flag[temp_kkp]) { pass_kkp=1; dis_kkp[0]=disij[0][temp_kkp]; dis_kkp[1]=disij[1][temp_kkp]; @@ -2090,13 +2090,13 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dBetaS_kkp=dBetaS[temp_kkp]; } } - if(pass_kkp==1) { + if (pass_kkp==1) { sig_flag=0; - for(nsearch=0;nsearchnb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -2156,14 +2156,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_kkp].i=k; bt_sg[nb_kkp].j=kp; amean=cosAng_ikkp; - if(amean<-1.0) amean=-1.0; - if(npower<=2) { + if (amean<-1.0) amean=-1.0; + if (npower<=2) { ps=(amean-1.0)*rdtheta+1.0; ks=(int)ps; - if(ntheta-11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[itype][ktype][kptype][ks]*ps+ @@ -2177,7 +2177,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[itype-1][ktype-1][kptype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_jkp=((pBetaS3[ijkp][ks-1]*ps+pBetaS2[ijkp][ks-1])*ps +pBetaS1[ijkp][ks-1])*ps+pBetaS[ijkp][ks-1]; @@ -2350,10 +2350,10 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_kkp=sqrt(rsq_kkp); ps=r_kkp*rdr[ikkp]+1.0; ks=(int)ps; - if(nr-11.0) + if (ps>1.0) ps=1.0; betaS_kkp=((pBetaS3[ikkp][ks-1]*ps+pBetaS2[ikkp][ks-1])*ps +pBetaS1[ikkp][ks-1])*ps+pBetaS[ikkp][ks-1]; @@ -2414,7 +2414,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_kkp=rij[temp_kkp]; betaS_kkp=betaS[temp_kkp]; dBetaS_kkp=dBetaS[temp_kkp]; - if(jinb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -2500,7 +2500,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_jkp].j=kp; nb_kkp=nb_t; nb_t++; - if(nb_t>nb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -2509,14 +2509,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_kkp].i=k; bt_sg[nb_kkp].j=kp; amean=cosAng_ijkp; - if(amean<-1.0) amean=-1.0; - if(npower<=2) { + if (amean<-1.0) amean=-1.0; + if (npower<=2) { ps=(amean-1.0)*rdtheta+1.0; ks=(int)ps; - if(ntheta-11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[itype][jtype][kptype][ks]*ps+ @@ -2530,21 +2530,21 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[itype-1][jtype-1][kptype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor3=((gfunc3[itype][ktype][kptype][ks]*ps+ @@ -2558,21 +2558,21 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor3=gpara[itype-1][ktype-1][kptype-1][0]; gprime3=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor4=((gfunc3[jtype][kptype][ktype][ks]*ps+ @@ -2586,7 +2586,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor4=gpara[jtype-1][kptype-1][ktype-1][0]; gprime4=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_jk=((pBetaS3[ijk][ks-1]*ps+pBetaS2[ijk][ks-1])*ps +pBetaS1[ijk][ks-1])*ps+pBetaS[ijk][ks-1]; @@ -2753,7 +2753,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *dis_jk[2]*r_ij*r_ij)/(r_ij*r_ij*r_jk*r_jk); } } else { - if(neigh_flag[temp_jk]) { + if (neigh_flag[temp_jk]) { pass_jk=1; dis_jk[0]=disij[0][temp_jk]; dis_jk[1]=disij[1][temp_jk]; @@ -2761,7 +2761,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_jk=rij[temp_jk]; betaS_jk=betaS[temp_jk]; dBetaS_jk=dBetaS[temp_jk]; - if(ktmpnb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -2793,14 +2793,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_jk].i=j; bt_sg[nb_jk].j=k; amean=cosAng_ijk; - if(amean<-1.0) amean=-1.0; - if(npower<=2) { + if (amean<-1.0) amean=-1.0; + if (npower<=2) { ps=(amean-1.0)*rdtheta+1.0; ks=(int)ps; - if(ntheta-11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor1=((gfunc3[itype][jtype][ktype][ks]*ps+ @@ -2814,7 +2814,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor1=gpara[itype-1][jtype-1][ktype-1][0]; gprime1=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_jkp=((pBetaS3[ijkp][ks-1]*ps+pBetaS2[ijkp][ks-1])*ps +pBetaS1[ijkp][ks-1])*ps+pBetaS[ijkp][ks-1]; @@ -2947,7 +2947,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *dis_jkp[2]*r_jk*r_jk)/(r_jk*r_jk*r_jkp*r_jkp); } } else { - if(neigh_flag[temp_jkp]) { + if (neigh_flag[temp_jkp]) { pass_jkp=1; dis_jkp[0]=disij[0][temp_jkp]; dis_jkp[1]=disij[1][temp_jkp]; @@ -2955,7 +2955,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_jkp=rij[temp_jkp]; betaS_jkp=betaS[temp_jkp]; dBetaS_jkp=dBetaS[temp_jkp]; - if(jinb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -3005,14 +3005,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_jkp].i=j; bt_sg[nb_jkp].j=kp; amean=cosAng_ijkp; - if(amean<-1.0) amean=-1.0; - if(npower<=2) { + if (amean<-1.0) amean=-1.0; + if (npower<=2) { ps=(amean-1.0)*rdtheta+1.0; ks=(int)ps; - if(ntheta-11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[itype][jtype][kptype][ks]*ps+ @@ -3026,21 +3026,21 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[itype-1][jtype-1][kptype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor3=((gfunc3[ktype][jtype][kptype][ks]*ps+ @@ -3054,7 +3054,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor3=gpara[ktype-1][jtype-1][kptype-1][0]; gprime3=0.0; xrun=1.0; - for(lp1=1;lp11.0) + if (ps>1.0) ps=1.0; betaS_kkp=((pBetaS3[ikkp][ks-1]*ps+pBetaS2[ikkp][ks-1])*ps +pBetaS1[ikkp][ks-1])*ps+pBetaS[ikkp][ks-1]; @@ -3217,7 +3217,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *dis_kkp[2]*r_jk*r_jk)/(r_jk*r_jk*r_kkp*r_kkp); } } else { - if(neigh_flag[temp_kkp]) { + if (neigh_flag[temp_kkp]) { pass_kkp=1; dis_kkp[0]=disij[0][temp_kkp]; dis_kkp[1]=disij[1][temp_kkp]; @@ -3225,7 +3225,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_kkp=rij[temp_kkp]; betaS_kkp=betaS[temp_kkp]; dBetaS_kkp=dBetaS[temp_kkp]; - if(kNeijnb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -3257,14 +3257,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[nb_kkp].i=k; bt_sg[nb_kkp].j=kp; amean=cosAng_jkkp; - if(amean<-1.0) amean=-1.0; - if(npower<=2) { + if (amean<-1.0) amean=-1.0; + if (npower<=2) { ps=(amean-1.0)*rdtheta+1.0; ks=(int)ps; - if(ntheta-11.0) + if (ps>1.0) ps=1.0; ks=ks-1; gfactor2=((gfunc3[jtype][ktype][kptype][ks]*ps+ @@ -3278,7 +3278,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor2=gpara[jtype-1][ktype-1][kptype-1][0]; gprime2=0.0; xrun=1.0; - for(lp1=1;lp1-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { bt_sg[m].dAAC[0]=bt_sg[m].dAA[0] +bt_sg[m].dBB[0]; bt_sg[m].dAAC[1]=bt_sg[m].dAA[1] @@ -3372,10 +3372,10 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bndtmp1=bndtmp1*dBetaS_ij/r_ij; bndtmp2=betaS_ij*bndtmp*sigma_c[iij]; setting=0; - for(m=0;m-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { temp_kk=bt_sg[m].temp; - if(temp_kk==temp_ij&&setting==0) { + if (temp_kk==temp_ij&&setting==0) { bt_sg[m].dSigB1[0]=bndtmp1*dis_ij[0] +bndtmp2*bt_sg[m].dAAC[0]; bt_sg[m].dSigB1[1]=bndtmp1*dis_ij[1] @@ -3384,7 +3384,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +bndtmp2*bt_sg[m].dAAC[2]; setting=1; } - else if(temp_kk==temp_ji&&setting==0) { + else if (temp_kk==temp_ji&&setting==0) { bt_sg[m].dSigB1[0]=-bndtmp1*dis_ij[0] +bndtmp2*bt_sg[m].dAAC[0]; bt_sg[m].dSigB1[1]=-bndtmp1*dis_ij[1] @@ -3402,14 +3402,14 @@ double PairBOP::sigmaBo(int itmp, int jtmp) } } } else { - if(sig_flag==0) { - if(AA<0.0) + if (sig_flag==0) { + if (AA<0.0) AA=0.0; - if(BB<0.0) + if (BB<0.0) BB=0.0; - if(CC<0.0) + if (CC<0.0) CC=0.0; - if(DD<0.0) + if (DD<0.0) DD=0.0; // AA and BB are the representations of (a) Eq. 34 and (b) Eq. 9 @@ -3421,11 +3421,11 @@ double PairBOP::sigmaBo(int itmp, int jtmp) DDC=CC+DD; //EEC is a modified form of (a) Eq. 33 - if(DDC-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { bt_sg[m].dAAC[0]=bt_sg[m].dAA[0] +bt_sg[m].dBB[0]; bt_sg[m].dAAC[1]=bt_sg[m].dAA[1] @@ -3473,8 +3473,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *(1.0+sigma_a[iij]*GGC)+sigma_c[iij]*(AAC+sigma_a[iij]*EE +sigma_a[iij]*FFC*(2.0+GGC))+small4; UTcom=-0.5*UT*UT*UT; - for(m=0;m-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { bt_sg[m].dUT[0]=UTcom*(bt_sg[m].dEEC[0]*FF +EEC*bt_sg[m].dFF[0]+bt_sg[m].dBBC[0]); bt_sg[m].dUT[1]=UTcom*(bt_sg[m].dEEC[1]*FF @@ -3496,7 +3496,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) } } psign=1.0; - if(1.0+sigma_a[iij]*GGC<0.0) + if (1.0+sigma_a[iij]*GGC<0.0) psign=-1.0; bndtmp0=1.0/sqrt(bndtmp); sigB1=psign*betaS_ij*(1.0+sigma_a[iij]*GGC)*bndtmp0; @@ -3515,10 +3515,10 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *(2.0*(FF+sigma_delta[iij]*sigma_delta[iij])*(1.0 +sigma_a[iij]*GGC)*sigma_a[iij]+sigma_c[iij]*sigma_a[iij]*FFC); setting=0; - for(m=0;m-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { temp_kk=bt_sg[m].temp; - if(temp_kk==temp_ij&&setting==0) { + if (temp_kk==temp_ij&&setting==0) { bt_sg[m].dSigB1[0]=bndtmp1*dis_ij[0] +(bndtmp2*bt_sg[m].dAAC[0] +bndtmp3*bt_sg[m].dEE[0] @@ -3536,7 +3536,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) +bndtmp5*bt_sg[m].dGGC[2]); setting=1; } - else if(temp_kk==temp_ji&&setting==0) { + else if (temp_kk==temp_ji&&setting==0) { bt_sg[m].dSigB1[0]=-bndtmp1*dis_ij[0] +(bndtmp2*bt_sg[m].dAAC[0] +bndtmp3*bt_sg[m].dEE[0] @@ -3577,8 +3577,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp) // sigB is the final expression for (a) Eq. 6 and (b) Eq. 11 - if(nb_t==0) { - if(j>i) { + if (nb_t==0) { + if (j>i) { bt_sg[0].dSigB1[0]=bndtmp1*dis_ij[0]; bt_sg[0].dSigB1[1]=bndtmp1*dis_ij[1]; bt_sg[0].dSigB1[2]=bndtmp1*dis_ij[2]; @@ -3588,13 +3588,13 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[0].dSigB1[1]=-bndtmp1*dis_ij[1]; bt_sg[0].dSigB1[2]=-bndtmp1*dis_ij[2]; } - for(pp=0;pp<3;pp++) { + for (pp=0;pp<3;pp++) { bt_sg[0].dAA[pp]=0.0; bt_sg[0].dBB[pp]=0.0; bt_sg[0].dAAC[pp]=0.0; bt_sg[0].dSigB1[pp]=0.0; bt_sg[0].dSigB[pp]=0.0; - if(sigma_f[iij]!=0.5&&sigma_k[iij]!=0.0) { + if (sigma_f[iij]!=0.5&&sigma_k[iij]!=0.0) { bt_sg[0].dCC[pp]=0.0; bt_sg[0].dDD[pp]=0.0; bt_sg[0].dEE[pp]=0.0; @@ -3613,7 +3613,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) bt_sg[0].j=j; bt_sg[0].temp=temp_ij; nb_t++; - if(nb_t>nb_sg) { + if (nb_t>nb_sg) { new_n_tot=nb_sg+maxneigh; grow_sigma(nb_sg,new_n_tot); nb_sg=new_n_tot; @@ -3621,35 +3621,35 @@ double PairBOP::sigmaBo(int itmp, int jtmp) } ps=sigB1*rdBO+1.0; ks=(int)ps; - if(nBOt-11.0) + if (ps>1.0) ps=1.0; dsigB1=((FsigBO3[iij][ks-1]*ps+FsigBO2[iij][ks-1])*ps +FsigBO1[iij][ks-1])*ps+FsigBO[iij][ks-1]; dsigB2=(FsigBO6[iij][ks-1]*ps+FsigBO5[iij][ks-1])*ps+FsigBO4[iij][ks-1]; - for(m=0;m-1)&&(bt_sg[m].j>-1)) { + for (m=0;m-1)&&(bt_sg[m].j>-1)) { temp_kk=bt_sg[m].temp; bt_i=bt_sg[m].i; bt_j=bt_sg[m].j; - if(sigma_f[iij]==0.5&&sigma_k[iij]==0.0) { + if (sigma_f[iij]==0.5&&sigma_k[iij]==0.0) { sigB=dsigB1; pp1=2.0*betaS_ij; xtmp[0]=x[bt_j][0]-x[bt_i][0]; xtmp[1]=x[bt_j][1]-x[bt_i][1]; xtmp[2]=x[bt_j][2]-x[bt_i][2]; - for(pp=0;pp<3;pp++) { + for (pp=0;pp<3;pp++) { bt_sg[m].dSigB[pp]=dsigB2*bt_sg[m].dSigB1[pp]; } - for(pp=0;pp<3;pp++) { + for (pp=0;pp<3;pp++) { ftmp[pp]=pp1*bt_sg[m].dSigB[pp]; f[bt_i][pp]-=ftmp[pp]; f[bt_j][pp]+=ftmp[pp]; } - if(evflag) { + if (evflag) { ev_tally_xyz(bt_i,bt_j,nlocal,newton_pair,0.0,0.0,ftmp[0],ftmp[1] ,ftmp[2],xtmp[0],xtmp[1],xtmp[2]); } @@ -3668,18 +3668,18 @@ double PairBOP::sigmaBo(int itmp, int jtmp) xtmp[0]=x[bt_j][0]-x[bt_i][0]; xtmp[1]=x[bt_j][1]-x[bt_i][1]; xtmp[2]=x[bt_j][2]-x[bt_i][2]; - for(pp=0;pp<3;pp++) { + for (pp=0;pp<3;pp++) { bt_sg[m].dSigB[pp]=dsigB2*part2*bt_sg[m].dSigB1[pp] -part3*bt_sg[m].dEE1[pp] +part4*(bt_sg[m].dFF[pp] +0.5*bt_sg[m].dAAC[pp]); } - for(pp=0;pp<3;pp++) { + for (pp=0;pp<3;pp++) { ftmp[pp]=pp1*bt_sg[m].dSigB[pp]; f[bt_i][pp]-=ftmp[pp]; f[bt_j][pp]+=ftmp[pp]; } - if(evflag) { + if (evflag) { ev_tally_xyz(bt_i,bt_j,nlocal,newton_pair,0.0,0.0,ftmp[0],ftmp[1] ,ftmp[2],xtmp[0],xtmp[1],xtmp[2]); } @@ -3776,10 +3776,10 @@ double PairBOP::PiBo(int itmp, int jtmp) firstneigh = list->firstneigh; ilist = list->ilist; n=0; - if(nb_pi>16) { + if (nb_pi>16) { nb_pi=16; } - if(nb_pi==0) { + if (nb_pi==0) { nb_pi=(maxneigh)*(maxneigh/2); } @@ -3793,8 +3793,8 @@ double PairBOP::PiBo(int itmp, int jtmp) // j is a loop over all neighbors of i iilist=firstneigh[i]; - for(m=0;m=i_tag) { - if(itype==jtype) + if (j_tag>=i_tag) { + if (itype==jtype) iij=itype-1; - else if(itypenb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -3849,7 +3849,7 @@ double PairBOP::PiBo(int itmp, int jtmp) bt_pi[nb_ij].j=j; bt_pi[nb_ij].temp=temp_ij; pass_ij=0; - if(otfly==1) { + if (otfly==1) { dis_ij[0]=x[j][0]-x[i][0]; dis_ij[1]=x[j][1]-x[i][1]; dis_ij[2]=x[j][2]-x[i][2]; @@ -3857,14 +3857,14 @@ double PairBOP::PiBo(int itmp, int jtmp) +dis_ij[1]*dis_ij[1] +dis_ij[2]*dis_ij[2]; r_ij=sqrt(rsq_ij); - if(r_ij<=rcut[iij]) { + if (r_ij<=rcut[iij]) { pass_ij=1; ps=r_ij*rdr[iij]+1.0; ks=(int)ps; - if(nr-11.0) + if (ps>1.0) ps=1.0; betaP_ij=((pBetaP3[iij][ks-1]*ps+pBetaP2[iij][ks-1])*ps +pBetaP1[iij][ks-1])*ps+pBetaP[iij][ks-1]; @@ -3872,7 +3872,7 @@ double PairBOP::PiBo(int itmp, int jtmp) +pBetaP4[iij][ks-1]; } } else { - if(neigh_flag[temp_ij]) { + if (neigh_flag[temp_ij]) { pass_ij=1; dis_ij[0]=disij[0][temp_ij]; dis_ij[1]=disij[1][temp_ij]; @@ -3887,23 +3887,23 @@ double PairBOP::PiBo(int itmp, int jtmp) AA=0.0; BB=0.0; - if(pass_ij==1) { + if (pass_ij==1) { nPiBk=0; nlisti=BOP_total[i]; - for(ktmp=0;ktmp1.0) + if (ps>1.0) ps=1.0; betaS_ik=((pBetaS3[iik][ks-1]*ps+pBetaS2[iik][ks-1])*ps +pBetaS1[iik][ks-1])*ps+pBetaS[iik][ks-1]; @@ -3944,7 +3944,7 @@ double PairBOP::PiBo(int itmp, int jtmp) *dis_ik[2]*r_ij*r_ij)/(r_ij*r_ij*r_ik*r_ik); } } else { - if(neigh_flag[temp_ik]) { + if (neigh_flag[temp_ik]) { pass_ik=1; dis_ik[0]=disij[0][temp_ik]; dis_ik[1]=disij[1][temp_ik]; @@ -3954,7 +3954,7 @@ double PairBOP::PiBo(int itmp, int jtmp) dBetaS_ik=dBetaS[temp_ik]; betaP_ik=betaP[temp_ik]; dBetaP_ik=dBetaP[temp_ik]; - if(jtmpnb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -4043,30 +4043,30 @@ double PairBOP::PiBo(int itmp, int jtmp) // j and k and k' are different neighbors of i - for(ltmp=0;ltmp1.0) + if (ps>1.0) ps=1.0; betaS_ikp=((pBetaS3[iikp][ks-1]*ps+pBetaS2[iikp][ks-1])*ps +pBetaS1[iikp][ks-1])*ps+pBetaS[iikp][ks-1]; @@ -4121,7 +4121,7 @@ double PairBOP::PiBo(int itmp, int jtmp) *dis_ikp[2]*r_ik*r_ik)/(r_ik*r_ik*r_ikp*r_ikp); } } else { - if(neigh_flag[temp_ikp]) { + if (neigh_flag[temp_ikp]) { pass_ikp=1; dis_ikp[0]=disij[0][temp_ikp]; dis_ikp[1]=disij[1][temp_ikp]; @@ -4132,7 +4132,7 @@ double PairBOP::PiBo(int itmp, int jtmp) betaP_ikp=betaP[temp_ikp]; dBetaP_ikp=dBetaP[temp_ikp]; nkikp=ltmp*(2*nlisti-ltmp-1)/2+(ktmp-ltmp)-1; - if(jtmpnb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -4242,13 +4242,13 @@ double PairBOP::PiBo(int itmp, int jtmp) //j is a neighbor of i and k is a neighbor of j and equal to i - for(ki=0;ki1.0) + if (ps>1.0) ps=1.0; betaS_jk=((pBetaS3[ijk][ks-1]*ps+pBetaS2[ijk][ks-1])*ps +pBetaS1[ijk][ks-1])*ps+pBetaS[ijk][ks-1]; @@ -4325,7 +4325,7 @@ double PairBOP::PiBo(int itmp, int jtmp) *dis_jk[2]*r_ij*r_ij)/(r_ij*r_ij*r_jk*r_jk); } } else { - if(neigh_flag[temp_jk]) { + if (neigh_flag[temp_jk]) { pass_jk=1; dis_jk[0]=disij[0][temp_jk]; dis_jk[1]=disij[1][temp_jk]; @@ -4335,7 +4335,7 @@ double PairBOP::PiBo(int itmp, int jtmp) dBetaS_jk=dBetaS[temp_jk]; betaP_jk=betaP[temp_jk]; dBetaP_jk=dBetaP[temp_jk]; - if(ktmpnb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -4425,30 +4425,30 @@ double PairBOP::PiBo(int itmp, int jtmp) //j is a neighbor of i and k and k' are different neighbors of j not equal to i - for(ltmp=0;ltmp1.0) + if (ps>1.0) ps=1.0; betaS_jkp=((pBetaS3[ijkp][ks-1]*ps+pBetaS2[ijkp][ks-1])*ps +pBetaS1[ijkp][ks-1])*ps+pBetaS[ijkp][ks-1]; @@ -4503,7 +4503,7 @@ double PairBOP::PiBo(int itmp, int jtmp) *dis_jkp[2]*r_jk*r_jk)/(r_jk*r_jk*r_jkp*r_jkp); } } else { - if(neigh_flag[temp_jkp]) { + if (neigh_flag[temp_jkp]) { pass_jkp=1; dis_jkp[0]=disij[0][temp_jkp]; dis_jkp[1]=disij[1][temp_jkp]; @@ -4514,7 +4514,7 @@ double PairBOP::PiBo(int itmp, int jtmp) betaP_jkp=betaP[temp_jkp]; dBetaP_jkp=dBetaP[temp_jkp]; nkjkp=ltmp*(2*nlistj-ltmp-1)/2+(ktmp-ltmp)-1; - if(kinb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -4621,30 +4621,30 @@ double PairBOP::PiBo(int itmp, int jtmp) //j and k' are different neighbors of i and k is a neighbor of j not equal to i - for(ltmp=0;ltmp1.0) + if (ps>1.0) ps=1.0; betaS_ikp=((pBetaS3[iikp][ks-1]*ps+pBetaS2[iikp][ks-1])*ps +pBetaS1[iikp][ks-1])*ps+pBetaS[iikp][ks-1]; @@ -4685,7 +4685,7 @@ double PairBOP::PiBo(int itmp, int jtmp) *dis_ikp[2]*r_ij*r_ij)/(r_ij*r_ij*r_ikp*r_ikp); } } else { - if(neigh_flag[temp_ikp]) { + if (neigh_flag[temp_ikp]) { pass_ikp=1; dis_ikp[0]=disij[0][temp_ikp]; dis_ikp[1]=disij[1][temp_ikp]; @@ -4695,7 +4695,7 @@ double PairBOP::PiBo(int itmp, int jtmp) dBetaS_ikp=dBetaS[temp_ikp]; betaP_ikp=betaP[temp_ikp]; dBetaP_ikp=dBetaP[temp_ikp]; - if(ltmpnb_pi) { + if (nb_t>nb_pi) { new_n_tot=nb_pi+maxneigh; grow_pi(nb_pi,new_n_tot); nb_pi=new_n_tot; @@ -4799,14 +4799,14 @@ double PairBOP::PiBo(int itmp, int jtmp) } } } - if(pi_flag==0) + if (pi_flag==0) nPiBk=nPiBk+1; } } } n++; pp2=2.0*betaP_ij; - for(m=0;m cutmax) cutmax = rcut[i]; @@ -4995,67 +4995,67 @@ void _noopt PairBOP::read_table(char *filename) small3[i] = values.next_double(); } - if(format == 3) { - for(int i = 0; i < bop_types; i++) - for(int j = 0; j < bop_types; j++) - for(int k = j; k < bop_types; k++) { - if(npower <= 2) { + if (format == 3) { + for (int i = 0; i < bop_types; i++) + for (int j = 0; j < bop_types; j++) + for (int k = j; k < bop_types; k++) { + if (npower <= 2) { reader.next_dvector(&gfunc[j][i][k][0], ntheta); } else { reader.next_dvector(&gpara[j][i][k][0], npower+1); } } } else { - for(int i = 0; i < bop_types; i++) - for(int j = 0; j < bop_types; j++) - for(int k = 0; k < bop_types; k++) { + for (int i = 0; i < bop_types; i++) + for (int j = 0; j < bop_types; j++) + for (int k = 0; k < bop_types; k++) { reader.next_dvector(&gpara[i][j][k][0], 3); gpara[j][i][k][3] = 0; } } - for(int i = 0; i < npairs; i++) { + for (int i = 0; i < npairs; i++) { reader.next_dvector(&pRepul[i][0], nr); } - for(int i = 0; i < npairs; i++) { + for (int i = 0; i < npairs; i++) { reader.next_dvector(&pBetaS[i][0], nr); } - for(int i = 0; i < npairs; i++) { + for (int i = 0; i < npairs; i++) { reader.next_dvector(&pBetaP[i][0], nr); } - for(int i = 0; i < npairs; i++) { + for (int i = 0; i < npairs; i++) { reader.next_dvector(&FsigBO[i][0], nBOt); } - for(int i = 0; i < bop_types; i++) { + for (int i = 0; i < bop_types; i++) { pro_delta[i] = reader.next_double(); } - for(int i = 0; i < bop_types; i++) { + for (int i = 0; i < bop_types; i++) { pro[i] = reader.next_double(); } - for(int i=0;ircutall) + for (int i=0; i < npairs; i++) { + if (rcut[i]>rcutall) rcutall=rcut[i]; - if(rcut3[i]>rcutall) + if (rcut3[i]>rcutall) rcutall=rcut3[i]; rcutsq[i]=rcut[i]*rcut[i]; dr[i]=rcut[i]/((double)nr-1.0); @@ -5238,7 +5238,7 @@ void _noopt PairBOP::read_table(char *filename) MPI_Bcast(&npairs,1,MPI_INT,0,world); MPI_Bcast(&npower,1,MPI_INT,0,world); - if (comm->me != 0){ + if (comm->me != 0) { allocate_tables(); allocate(); } @@ -5312,7 +5312,7 @@ void _noopt PairBOP::read_table(char *filename) MPI_Bcast(&FsigBO4[0][0],npairs*nBOt,MPI_DOUBLE,0,world); MPI_Bcast(&FsigBO5[0][0],npairs*nBOt,MPI_DOUBLE,0,world); MPI_Bcast(&FsigBO6[0][0],npairs*nBOt,MPI_DOUBLE,0,world); - if(npower<=2){ + if (npower<=2) { MPI_Bcast(&gfunc[0][0][0][0],bop_types*bop_types*bop_types*ntheta,MPI_DOUBLE,0,world); MPI_Bcast(&gfunc1[0][0][0][0],bop_types*bop_types*bop_types*ntheta,MPI_DOUBLE,0,world); MPI_Bcast(&gfunc2[0][0][0][0],bop_types*bop_types*bop_types*ntheta,MPI_DOUBLE,0,world); @@ -5440,7 +5440,7 @@ double PairBOP::memory_usage() bytes += nall * sizeof(double); // BOP_total bytes += nall * sizeof(double); - if(otfly==0) { + if (otfly==0) { // cosAng bytes += cos_total* sizeof(double); // dcAng @@ -5542,7 +5542,7 @@ double PairBOP::memory_usage() bytes += maxneigh*(maxneigh/2) *sizeof(B_PI); // bt_sigma bytes += maxneigh*(maxneigh/2) *sizeof(B_SG); - if(npower<=2) { + if (npower<=2) { // gfunc bytes += bop_types*bop_types*bop_types*ntheta *sizeof(double); // gfunc1 @@ -5568,14 +5568,14 @@ double PairBOP::memory_usage() void PairBOP::memory_theta_create() { neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - if(neigh_ct<1) neigh_ct=1; + if (neigh_ct<1) neigh_ct=1; memory->create(itypeSigBk,neigh_ct,"itypeSigBk"); memory->create(itypePiBk,neigh_ct,"itypePiBk"); memory->create(neigh_flag,neigh_total,"neigh_flag"); memory->create(neigh_flag3,neigh_total3,"neigh_flag3"); memory->create(neigh_index,neigh_total,"neigh_index"); memory->create(neigh_index3,neigh_total3,"neigh_index3"); - if(otfly==0) { + if (otfly==0) { memory->create(cosAng,cos_total,"BOP:cosAng"); memory->create(dcAng,cos_total,3,2,"BOP:dcAng"); memory->create(disij,3,neigh_total,"disij"); @@ -5595,14 +5595,14 @@ void PairBOP::memory_theta_create() void PairBOP::memory_theta_grow() { neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - if(neigh_ct<1) neigh_ct=1; + if (neigh_ct<1) neigh_ct=1; memory->grow(itypeSigBk,neigh_ct,"itypeSigBk"); memory->grow(itypePiBk,neigh_ct,"itypePiBk"); memory->grow(neigh_flag,neigh_total,"neigh_flag"); memory->grow(neigh_flag3,neigh_total3,"neigh_flag3"); memory->grow(neigh_index,neigh_total,"neigh_index"); memory->grow(neigh_index3,neigh_total3,"neigh_index3"); - if(otfly==0) { + if (otfly==0) { memory->grow(cosAng,cos_total,"BOP:cosAng"); memory->grow(dcAng,cos_total,3,2,"BOP:dcAng"); memory->grow(disij,3,neigh_total,"disij"); @@ -5634,7 +5634,7 @@ void PairBOP::memory_theta_destroy() neigh_flag3 = nullptr; neigh_index = nullptr; neigh_index3 = nullptr; - if(otfly==0) { + if (otfly==0) { memory->destroy(cosAng); memory->destroy(dcAng); memory->destroy(disij); @@ -5670,11 +5670,11 @@ void PairBOP::grow_pi(int n1, int n2) int i,j; B_PI *bt_temp; bt_temp = (B_PI *) memory->smalloc(n1*sizeof(B_PI),"BOP:b_temp"); - for(i=0;idestroy(bt_pi); bt_pi=nullptr; bt_pi = (B_PI *) memory->smalloc(n2*sizeof(B_PI),"BOP:bt_pi"); - for(i=0;ismalloc(n1*sizeof(B_SG),"BOP:bt_temp"); - for(i=0;idestroy(bt_sg); bt_sg=nullptr; bt_sg = (B_SG *) memory->smalloc(n2*sizeof(B_SG),"BOP:bt_sg"); - for(i=0;i 0.0 ) { + if (params[iparam_ij].hfocor > 0.0 ) { delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -727,7 +727,7 @@ void PairComb::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index ddf4695df7..30abb43dfc 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -346,7 +346,7 @@ void PairComb3::read_lib() ntab = reader.next_int(); - for (i = 0; i < (ntab + 1); i++){ + for (i = 0; i < (ntab + 1); i++) { values = reader.next_values(4); values.skip(1); pang[i] = values.next_double(); @@ -381,7 +381,7 @@ void PairComb3::read_lib() jj = values.next_int(); kk = values.next_int(); - for(iii = 0; iii < 2; iii++) { + for (iii = 0; iii < 2; iii++) { mm = iii*32; reader.next_dvector(&pcn_cubs[ll][ii][jj][kk][mm], 32); } @@ -446,7 +446,7 @@ void PairComb3::read_lib() ii = values.next_int(); jj = values.next_int(); kk = values.next_int() - 1; - for(iii=0; iii<2; iii++) { + for (iii=0; iii<2; iii++) { mm=iii*32; reader.next_dvector(&tor_spl[ll][ii][jj][kk][mm], 32); } @@ -672,7 +672,7 @@ void PairComb3::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } @@ -1143,11 +1143,11 @@ void PairComb3::compute(int eflag, int vflag) srmu = vec3_dot(delrj,delrk)/(sqrt(rsq1*rsq2)); srmu = sqrt(1.0-srmu*srmu); - if(srmu > 0.1) { + if (srmu > 0.1) { for (ll = 0; ll < sht_lnum; ll++) { // ll is neighbor of jj l = sht_llist[ll]; - if(l==i || l==j || l==k) continue; + if (l==i || l==j || l==k) continue; ltype = map[type[l]]; @@ -1199,7 +1199,7 @@ void PairComb3::compute(int eflag, int vflag) , rsq1, rsq2, delrl, delrk, j, ycn); // radical initialization: apply only to CC,CO,OC bonds - if(params[iparam_ji].rad_flag > 0 + if (params[iparam_ji].rad_flag > 0 && params[iparam_jl].ielementgp == 1 && params[iparam_jl].jelementgp == 1) { iparam_lj = elem2param[ltype][jtype][jtype]; @@ -1275,7 +1275,7 @@ void PairComb3::compute(int eflag, int vflag) srmu = vec3_dot(delrj,delrk)/(sqrt(rsq1*rsq2)); srmu = sqrt(1.0-srmu*srmu); - if(srmu > 0.1) { + if (srmu > 0.1) { for (ll = 0; ll < sht_lnum; ll++) { // ll is neighbor of jj l = sht_llist[ll]; if (l==i||l==j||l==k) continue; @@ -1304,7 +1304,7 @@ void PairComb3::compute(int eflag, int vflag) } } - if( params[iparam_ijk].rad_flag>=1 && + if ( params[iparam_ijk].rad_flag>=1 && params[iparam_ijk].ielementgp==1 && params[iparam_ijk].kelementgp==1) { iparam_ki = elem2param[ktype][itype][itype]; @@ -1400,7 +1400,7 @@ void PairComb3::compute(int eflag, int vflag) } // radical i-j-l-p: apply to all CC,CO,OC bonds - if( params[iparam_jil].rad_flag >= 1 && + if ( params[iparam_jil].rad_flag >= 1 && params[iparam_jil].ielementgp == 1 && params[iparam_jil].kelementgp == 1 ) { iparam_lj = elem2param[ltype][jtype][jtype]; @@ -1894,7 +1894,7 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, zeta = pow(zetang,pow_n)+pcorn; tmp_tbij=pow_n*pow(zetang,(pow_n-1.0)); - if ((1.0 + zeta) < 0.1 ){ + if ((1.0 + zeta) < 0.1 ) { zeta=0.1-1.0; tbij = pow(1.0 + zeta, -0.5/pow_n); tbij1=0.0; @@ -1948,22 +1948,22 @@ void PairComb3::coord(Param *param, double r, int i, pcorn = dpcorn = dxccij = dxchij = dxcoij = 0.0; pcorn = 0.0; dpcorn = 0.0; - if(xcntot < 0.0) xcntot = 0.0; + if (xcntot < 0.0) xcntot = 0.0; if (tri_flag>0) { - if(jele_gp==1) xcccn = xcccn-comb_fc(r,param)*param->pcross; - if(jele_gp==2) xchcn = xchcn-comb_fc(r,param)*param->pcross; - if(jele_gp==3) xcocn = xcocn-comb_fc(r,param)*param->pcross; - if(xcccn < 0.0) xcccn = 0.0; - if(xchcn < 0.0) xchcn = 0.0; - if(xcocn < 0.0) xcocn = 0.0; - if(xcccn > maxx) xcccn = maxx; - if(xchcn > maxy) xchcn = maxy; - if(xcocn > maxz) xcocn = maxz; + if (jele_gp==1) xcccn = xcccn-comb_fc(r,param)*param->pcross; + if (jele_gp==2) xchcn = xchcn-comb_fc(r,param)*param->pcross; + if (jele_gp==3) xcocn = xcocn-comb_fc(r,param)*param->pcross; + if (xcccn < 0.0) xcccn = 0.0; + if (xchcn < 0.0) xchcn = 0.0; + if (xcocn < 0.0) xcocn = 0.0; + if (xcccn > maxx) xcccn = maxx; + if (xchcn > maxy) xchcn = maxy; + if (xcocn > maxz) xcocn = maxz; double xcntritot=xcccn+xchcn+xcocn; - if(xcntritot > maxxcn[tri_flag-1]) { + if (xcntritot > maxxcn[tri_flag-1]) { pcorn = vmaxxcn[tri_flag-1]+(xcntot-maxxcn[tri_flag-1])*dvmaxxcn[tri_flag-1]; dxccij = dxchij = dxcoij = dvmaxxcn[tri_flag-1]; } @@ -1998,17 +1998,17 @@ void PairComb3::cntri_int(int tri_flag, double xval, double yval, { double x; vval = 0.0; dvalx = 0.0; dvaly = 0.0; dvalz = 0.0; - if(ixmin >= maxx-1) { ixmin=maxx-1; } - if(iymin >= maxy-1) { iymin=maxy-1; } - if(izmin >= maxz-1) { izmin=maxz-1; } + if (ixmin >= maxx-1) { ixmin=maxx-1; } + if (iymin >= maxy-1) { iymin=maxy-1; } + if (izmin >= maxz-1) { izmin=maxz-1; } for (int j=0; j<64; j++) { x = pcn_cubs[tri_flag-1][ixmin][iymin][izmin][j] *pow(xval,iin3[j][0])*pow(yval,iin3[j][1]) *pow(zval,iin3[j][2]); vval += x; - if(xval>1.0e-8) {dvalx += x*iin3[j][0]/xval;} - if(yval>1.0e-8) {dvaly += x*iin3[j][1]/yval;} - if(zval>1.0e-8) {dvalz += x*iin3[j][2]/zval;} + if (xval>1.0e-8) {dvalx += x*iin3[j][0]/xval;} + if (yval>1.0e-8) {dvaly += x*iin3[j][1]/yval;} + if (zval>1.0e-8) {dvalz += x*iin3[j][2]/zval;} } } @@ -2045,7 +2045,7 @@ double PairComb3::comb_gijk(double costheta, Param *param, double nco_tmp) gmu = gmu2+qtheta*(gmu1-gmu2); return gmu*pcross; - } else if (param->ang_flag==2){ + } else if (param->ang_flag==2) { double qtheta, gmu1, gmu2; double ch6 = ch_a[6]*rmu6; double ch5 = ch_a[5]*rmu5; @@ -2104,7 +2104,7 @@ void PairComb3::comb_gijk_d(double costheta, Param *param, double nco_tmp, dgmu2 = dpang[k]+(dpang[k+1]-dpang[k])*(rrmu-k); gijk_d = pcross*(dgmu2+qtheta*(dgmu1-dgmu2)); com3jk = dqtheta * (gmu1-gmu2); - } else if(param->ang_flag==2) { + } else if (param->ang_flag==2) { double qtheta, dqtheta, gmu1, gmu2, dgmu1,dgmu2; double ch6 = ch_a[6]; double ch5 = ch_a[5]; @@ -2191,11 +2191,11 @@ void PairComb3::comb_zetaterm_d(double prefac_ij1, double prefac_ij2, costheta_d(rij_hat,rij,rik_hat,rik,dcosdri,dcosdrj,dcosdrk); // com6 & com7 - if(icontrol > 0){ - if(parami->kelementgp==1) {com6 = prefac_ij3*pcrossk*dfc_k;} - if(parami->kelementgp==2) {com6 = prefac_ij4*pcrossk*dfc_k;} - if(parami->kelementgp==3) {com6 = prefac_ij5*pcrossk*dfc_k;} - if(parami->rad_flag>=1 || parami->tor_flag!=0) + if (icontrol > 0) { + if (parami->kelementgp==1) {com6 = prefac_ij3*pcrossk*dfc_k;} + if (parami->kelementgp==2) {com6 = prefac_ij4*pcrossk*dfc_k;} + if (parami->kelementgp==3) {com6 = prefac_ij5*pcrossk*dfc_k;} + if (parami->rad_flag>=1 || parami->tor_flag!=0) {com6+=prefac_ij2*pcrossk*dfc_k;} } else { com6 = prefac_ij2*pcrossi*dfc_k; @@ -2475,9 +2475,9 @@ void PairComb3::tables() iparam_ij = elem2param[itype][jtype][jtype]; // parameter check: eps > 0 - if(params[iparam_ij].vdwflag > 0) { + if (params[iparam_ij].vdwflag > 0) { - if(params[iparam_ij].vdwflag==1){ + if (params[iparam_ij].vdwflag==1) { rvdw[0][inty] = params[iparam_ij].bigr + params[iparam_ij].bigd; } else { @@ -2530,8 +2530,8 @@ void PairComb3::tables() vepst = params[iparam_ij].veps; vsigt = vsigt*vsigt*vsigt*vsigt*vsigt*vsigt; - if(params[iparam_ij].vdwflag>0) { - if(r <= rvdw[0][inty]) { + if (params[iparam_ij].vdwflag>0) { + if (r <= rvdw[0][inty]) { vvdw[k][inty] = 0.0; vdvdw[k][inty] = 0.0; } @@ -2656,27 +2656,27 @@ void PairComb3::direct(Param *parami, Param *paramj, int mr1, pot_tmp = for_tmp = 0.0; icurl=jcurl=0; - if(ielegp==2 && curli>curlij0) { + if (ielegp==2 && curli>curlij0) { icurl=1; curlij1=curli; } - if(jelegp==2 && curlj>curlji0) { + if (jelegp==2 && curlj>curlji0) { jcurl=1; curlji1=curlj; } - if(icurl==1 || jcurl ==1) { + if (icurl==1 || jcurl ==1) { xcoij = xcotmp[i]; xcoji = xcotmp[j]; fcp1j = comb_fc_d(r,parami); - if(icurl==1) { + if (icurl==1) { curli=curlij1+(curlij0-curlij1)*comb_fc_curl(xcoij,parami); dcurlij=fcp1j*(curlij0-curlij1)*comb_fc_curl_d(xcoij,parami); } - if(jcurl==1) { + if (jcurl==1) { curlj=curlji1+(curlji0-curlji1)*comb_fc_curl(xcoji,paramj); dcurlji=fcp1j*(curlji0-curlji1)*comb_fc_curl_d(xcoji,paramj); } @@ -2705,10 +2705,10 @@ void PairComb3::direct(Param *parami, Param *paramj, int mr1, smf1n = iq * curlj * (dafbn-dfafbnl)*esucon/r; smf1j = jq * curli * (dafbj-dfafbnl)*esucon/r; - if(jcurl==1 && ielegp == 3 && dcurlji != 0.0){ + if (jcurl==1 && ielegp == 3 && dcurlji != 0.0) { smf1n += dcurlji*iq*(afbn-fafbnl)*esucon/r; } - if(icurl==1 && jelegp == 3 && dcurlij != 0.0){ + if (icurl==1 && jelegp == 3 && dcurlij != 0.0) { smf1j += dcurlij*jq*(afbj-fafbnl)*esucon/r; } @@ -2798,12 +2798,12 @@ void PairComb3::rad_calc(double r, Param *parami, Param *paramj, yrad = -comb_fc(r,paramj)*paramj->pcross + ycn; zcon = 1.0 + pow(kconjug,2) + pow(lconjug,2); - if(xrad < 0.0) xrad = 0.0; - if(yrad < 0.0) yrad = 0.0; - if(zcon < 1.0) zcon = 1.0; - if(xrad > maxxc) xrad = maxxc; - if(yrad > maxyc) yrad = maxyc; - if(zcon > maxconj) zcon = maxconj; + if (xrad < 0.0) xrad = 0.0; + if (yrad < 0.0) yrad = 0.0; + if (zcon < 1.0) zcon = 1.0; + if (xrad > maxxc) xrad = maxxc; + if (yrad > maxyc) yrad = maxyc; + if (zcon > maxconj) zcon = maxconj; ixmin = int(xrad+1.0e-12); iymin = int(yrad+1.0e-12); izmin = int(zcon+1.0e-12); @@ -2835,17 +2835,17 @@ void PairComb3::rad_int(int radindx,double xrad, double yrad, double zcon, int l int j; double x; vrad = pradx = prady = pradz = 0.0; - if(l >= maxxc-1) { l=maxxc-1;} - if(m >= maxyc-1) { m=maxyc-1; } - if(n >= maxconj-1) { n=maxconj-1;} + if (l >= maxxc-1) { l=maxxc-1;} + if (m >= maxyc-1) { m=maxyc-1; } + if (n >= maxconj-1) { n=maxconj-1;} for (j=0; j<64; j++) { x = rad_spl[radindx][l][m][n-1][j] * pow(xrad,iin3[j][0]) * pow(yrad,iin3[j][1]) * pow(zcon,iin3[j][2]); vrad += x; - if(xrad > 1.0e-8) pradx += x*iin3[j][0]/xrad; - if(yrad > 1.0e-8) prady += x*iin3[j][1]/yrad; - if(zcon > 1.0e-8) pradz += x*iin3[j][2]/zcon; + if (xrad > 1.0e-8) pradx += x*iin3[j][0]/xrad; + if (yrad > 1.0e-8) prady += x*iin3[j][1]/yrad; + if (zcon > 1.0e-8) pradz += x*iin3[j][2]/zcon; } } @@ -2933,7 +2933,7 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, vec3_scale(-1.0,delrl,delrl); rmul = sqrt(1.0-rmul*rmul); - if(rmul > 0.1 ) { + if (rmul > 0.1 ) { double fc1k, fc1l, TT1, TT2, rmut, btt, tork[3], torl[3]; fc1k = comb_fc(rik,paramk); @@ -2948,7 +2948,7 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, torl[2] = delrj[0]*delrl[1] - delrj[1]*delrl[0]; TT2 = vec3_dot(tork,torl); rmut = pow((TT2/TT1),2); - if(torindx>=1) { + if (torindx>=1) { btt = 1.0 - rmut; return btt * fc1k * fc1l; } @@ -2976,7 +2976,7 @@ void PairComb3::tor_calc(double r, Param *parami, Param *paramj, vtor = dtorx = dtory = dtorz = 0.0; torindx=parami->tor_flag; - if(torindx<0){ + if (torindx<0) { vtor=1.0; dtorx=0.0; dtory=0.0; @@ -3026,18 +3026,18 @@ void PairComb3::tor_int(int torindx,double xtor, double ytor, double zcon, int l double x; vtor = dtorx = dtory = dtorz = 0.0; - if(l >= maxxc-1) { l=maxxc-1; } //boundary condition changed - if(m >= maxyc-1) { m=maxyc-1; } - if(n >= maxconj-1) { n=maxconj-1; } + if (l >= maxxc-1) { l=maxxc-1; } //boundary condition changed + if (m >= maxyc-1) { m=maxyc-1; } + if (n >= maxconj-1) { n=maxconj-1; } for (j=0; j<64; j++) { x = tor_spl[torindx][l][m][n-1][j] * pow(xtor,iin3[j][0]) * pow(ytor,iin3[j][1]) * pow(zcon,iin3[j][2]); vtor += x; - if(xtor > 1.0e-8 ) dtorx += x*iin3[j][0]/xtor; - if(ytor > 1.0e-8 ) dtory += x*iin3[j][1]/ytor; - if(zcon > 1.0e-8 ) dtorz += x*iin3[j][2]/zcon; + if (xtor > 1.0e-8 ) dtorx += x*iin3[j][0]/xtor; + if (ytor > 1.0e-8 ) dtory += x*iin3[j][1]/ytor; + if (zcon > 1.0e-8 ) dtorz += x*iin3[j][2]/zcon; } } @@ -3063,9 +3063,9 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, rmul = vec3_dot(delrj,delrl)/(rij*rjl); vec3_scale(-1.0,delrl,delrl); srmul = sqrt(1.0-rmul*rmul); - if(acos(rmul) > MY_PI) srmul = -srmul; + if (acos(rmul) > MY_PI) srmul = -srmul; - if(srmul > 0.1 ) { + if (srmul > 0.1 ) { double fc1k, fcp1k, fc1l, fcp1l, srmul2, dt1dik, dt1djl; double TT1, TT2, rmut, btt, tork[3], torl[3]; double dt2dik[3], dt2djl[3], dt2dij[3], AA, AA2; @@ -3104,7 +3104,7 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, rmut = TT2/TT1; - if(torindx>=1) { + if (torindx>=1) { btt = 1.0 - pow(rmut,2); AA = -2.0 * ptorr * rmut * fc1k * fc1l / TT1; } @@ -3325,7 +3325,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) double eneg = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { eneg += qf[i]; itag=tag[i]; } @@ -3386,23 +3386,23 @@ void PairComb3::qfo_direct(Param *parami, Param *paramj, int mr1, esucon=force->qqr2e; icurl = jcurl = 0; - if(ielegp==2 && curli>curlij0) { + if (ielegp==2 && curli>curlij0) { icurl=1; curlij1=curli; } - if(jelegp==2 && curlj>curlji0) { + if (jelegp==2 && curlj>curlji0) { jcurl=1; curlji1=curlj; } - if(icurl==1 || jcurl ==1) { + if (icurl==1 || jcurl ==1) { double xcoij= xcotmp[i]; double xcoji= xcotmp[j]; - if(icurl==1) { + if (icurl==1) { curli=curlij1+(curlij0-curlij1)*comb_fc_curl(xcoij,parami); } - if(jcurl==1) { + if (jcurl==1) { curlj=curlji1+(curlji0-curlji1)*comb_fc_curl(xcoji,paramj); } } @@ -3584,7 +3584,7 @@ void PairComb3::dipole_init(Param *parami, Param *paramj, double fac11, int intj = paramj->ielement; int inty = intype[inti][intj]; - for(nm=0; nm<3; nm++) Qext[nm] = 0.0; + for (nm=0; nm<3; nm++) Qext[nm] = 0.0; r = sqrt(rsq); r3 = r * rsq; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 343363a691..d8760cd55a 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -466,7 +466,7 @@ void PairEAM::read_file(char *filename) Funcfl *file = &funcfl[nfuncfl-1]; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam", unit_convert_flag); // transparently convert units for supported conversions @@ -518,7 +518,7 @@ void PairEAM::read_file(char *filename) MPI_Bcast(&file->dr, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&file->cut, 1, MPI_DOUBLE, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { memory->create(file->frho, (file->nrho+1), "pair:frho"); memory->create(file->rhor, (file->nr+1), "pair:rhor"); memory->create(file->zr, (file->nr+1), "pair:zr"); diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 50d73f89c2..e1c43b9d99 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -117,7 +117,7 @@ void PairEAMAlloy::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/alloy", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index 463166d22a..05e5e2b323 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -117,7 +117,7 @@ void PairEAMFS::read_file(char *filename) Fs *file = fs; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/fs", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index dbb16125c7..f95a43ed67 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -476,7 +476,7 @@ void PairEIM::read_file(char *filename) setfl->tp = new int[npair]; // read potential file - if( comm->me == 0) { + if ( comm->me == 0) { EIMPotentialFileReader reader(lmp, filename, unit_convert_flag); reader.get_global(setfl); diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 675ec1b3fe..32ace05546 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -467,7 +467,7 @@ void PairGW::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index c8fe598e46..bee8efb692 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -165,7 +165,7 @@ void PairGWZBL::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index df43aac9d2..09ea20df52 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -1220,7 +1220,7 @@ void PairLCBOP::spline_init() { // for( double y=0; y<=3.0+0.0001; y+=0.1 ) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ){ +// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { // file << x << " "; // for( double y=0; y<=3.0+0.0001; y+=0.1 ) // file << F_conj( x, y, 0, &dummy, &dummy, &dummy ) << " "; @@ -1231,7 +1231,7 @@ void PairLCBOP::spline_init() { // for( double y=0; y<=3.0+0.0001; y+=0.1 ) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ){ +// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { // file << x << " "; // for( double y=0; y<=3.0+0.0001; y+=0.1 ) { // double dF_dx; @@ -1247,7 +1247,7 @@ void PairLCBOP::spline_init() { // for( double y=0; y<=3.0+0.0001; y+=0.1 ) // file << y << " "; // file << std::endl; -// for( double x=0; x<=3.0+0.0001; x+=0.1 ){ +// for( double x=0; x<=3.0+0.0001; x+=0.1 ) { // file << x << " "; // for( double y=0; y<=3.0+0.0001; y+=0.1 ) // file << F_conj( x, y, 0, &dummy, &dummy, &dummy ) << " "; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 8e1468271e..7e53dcc39c 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -360,7 +360,7 @@ void PairNb3bHarmonic::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index e256063b73..ee736cfe5b 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -646,7 +646,7 @@ void PairPolymorphic::read_file(char *file) MPI_Bcast(&npair, 1, MPI_INT, 0, world); MPI_Bcast(&ntriple, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { delete [] match; match = new int[nelements]; delete [] pairParameters; diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 708027913c..c94e75b4a2 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -437,7 +437,7 @@ void PairSW::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index dbb7cd2f48..bcfcb149b4 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -496,7 +496,7 @@ void PairTersoff::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 6ea7758d61..f5e4d21ffc 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -148,7 +148,7 @@ void PairTersoffMOD::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index 8582e39ef1..c2cbcdd2d9 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -142,7 +142,7 @@ void PairTersoffMODC::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index 0c0c58322a..aee9eda71f 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -173,7 +173,7 @@ void PairTersoffZBL::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index d5a1374a80..32f3212d75 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -452,7 +452,7 @@ void PairVashishta::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index 135e4eab91..e81dd81c86 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -216,7 +216,7 @@ double ComputeTI::compute_scalar() eng = force->kspace->energy; else { double *eatom = force->kspace->eatom; - for(int i = 0; i < nlocal; i++) + for (int i = 0; i < nlocal; i++) if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i]; MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 282a98b4f8..d78dd67bdb 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -67,7 +67,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : int seed = utils::inumeric(FLERR,arg[6],false,lmp); // 7 = series type - if(strcmp(arg[7],"pprony") == 0) { + if (strcmp(arg[7],"pprony") == 0) { series_type = 1; // series type 1 is 'positive Prony series' } else { error->all(FLERR,"Fix gld series type must be pprony for now"); diff --git a/src/MISC/xdr_compat.cpp b/src/MISC/xdr_compat.cpp index 7483b4aa18..675afb835e 100644 --- a/src/MISC/xdr_compat.cpp +++ b/src/MISC/xdr_compat.cpp @@ -60,7 +60,7 @@ static xdr_uint32_t xdr_swapbytes(xdr_uint32_t x) char *px=(char *)&x; char *py=(char *)&y; - for(i=0;i<4;i++) + for (i=0;i<4;i++) py[i]=px[3-i]; return y; @@ -469,7 +469,7 @@ xdr_double(XDR *xdrs, double *dp) int *ip; xdr_int32_t tmp[2]; - if(LSW<0) { + if (LSW<0) { double x=0.987654321; /* Just a number */ /* Possible representations in IEEE double precision: @@ -484,9 +484,9 @@ xdr_double(XDR *xdrs, double *dp) unsigned char ix = *((char *)&x); - if(ix==0xdd || ix==0x3f) + if (ix==0xdd || ix==0x3f) LSW=1; /* Big endian word order */ - else if(ix==0xb8 || ix==0x3c) + else if (ix==0xb8 || ix==0x3c) LSW=0; /* Small endian word order */ else { /* Catch strange errors */ printf("Error when detecting floating-point word order.\n" diff --git a/src/MLIAP/mliap_descriptor.cpp b/src/MLIAP/mliap_descriptor.cpp index ac168dc94b..29b1736f4e 100644 --- a/src/MLIAP/mliap_descriptor.cpp +++ b/src/MLIAP/mliap_descriptor.cpp @@ -26,5 +26,5 @@ MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp) : Pointers(lmp) {} /* ---------------------------------------------------------------------- */ -MLIAPDescriptor::~MLIAPDescriptor(){} +MLIAPDescriptor::~MLIAPDescriptor() {} diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 2cb88de6b4..275eadd74e 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -171,7 +171,7 @@ void MLIAPDescriptorSNAP::compute_forces(class MLIAPData* data) for (int jj = 0; jj < ninside; jj++) { int j = snaptr->inside[jj]; - if(chemflag) + if (chemflag) snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], snaptr->rcutij[jj],jj, snaptr->element[jj]); else @@ -245,7 +245,7 @@ void MLIAPDescriptorSNAP::compute_force_gradients(class MLIAPData* data) for (int jj = 0; jj < ninside; jj++) { const int j = snaptr->inside[jj]; - if(chemflag) + if (chemflag) snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], snaptr->rcutij[jj],jj, snaptr->element[jj]); else @@ -318,7 +318,7 @@ void MLIAPDescriptorSNAP::compute_descriptor_gradients(class MLIAPData* data) ij = ij0; for (int jj = 0; jj < ninside; jj++) { - if(chemflag) + if (chemflag) snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], snaptr->rcutij[jj],jj, snaptr->element[jj]); else @@ -500,7 +500,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) cut = 2.0*radelem[ielem]*rcutfac; if (cut > cutmax) cutmax = cut; cutsq[ielem][ielem] = cut*cut; - for(int jelem = ielem+1; jelem < nelements; jelem++) { + for (int jelem = ielem+1; jelem < nelements; jelem++) { cut = (radelem[ielem]+radelem[jelem])*rcutfac; cutsq[ielem][jelem] = cutsq[jelem][ielem] = cut*cut; } diff --git a/src/MLIAP/mliap_model_linear.cpp b/src/MLIAP/mliap_model_linear.cpp index 3c8f9aa39a..9d19dcf381 100644 --- a/src/MLIAP/mliap_model_linear.cpp +++ b/src/MLIAP/mliap_model_linear.cpp @@ -32,7 +32,7 @@ MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) : /* ---------------------------------------------------------------------- */ -MLIAPModelLinear::~MLIAPModelLinear(){} +MLIAPModelLinear::~MLIAPModelLinear() {} /* ---------------------------------------------------------------------- get number of parameters diff --git a/src/MLIAP/mliap_model_python.cpp b/src/MLIAP/mliap_model_python.cpp index e47356390f..823cee711f 100644 --- a/src/MLIAP/mliap_model_python.cpp +++ b/src/MLIAP/mliap_model_python.cpp @@ -73,7 +73,7 @@ MLIAPModelPython::MLIAPModelPython(LAMMPS* lmp, char* coefffilename) : /* ---------------------------------------------------------------------- */ -MLIAPModelPython::~MLIAPModelPython(){ +MLIAPModelPython::~MLIAPModelPython() { MLIAPPY_unload_model(this); } diff --git a/src/MLIAP/mliap_model_quadratic.cpp b/src/MLIAP/mliap_model_quadratic.cpp index 915ec30435..0b640189b4 100644 --- a/src/MLIAP/mliap_model_quadratic.cpp +++ b/src/MLIAP/mliap_model_quadratic.cpp @@ -35,7 +35,7 @@ MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) : /* ---------------------------------------------------------------------- */ -MLIAPModelQuadratic::~MLIAPModelQuadratic(){} +MLIAPModelQuadratic::~MLIAPModelQuadratic() {} /* ---------------------------------------------------------------------- get number of parameters diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index a8c57918b4..4dfb4f0988 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -241,7 +241,7 @@ void AngleTable::coeff(int narg, char **arg) // convert theta from degrees to radians - for (int i = 0; i < tb->ninput; i++){ + for (int i = 0; i < tb->ninput; i++) { tb->afile[i] *= MY_PI/180.0; tb->ffile[i] *= 180.0/MY_PI; } diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index f48d5254cf..d8aee3e181 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -1376,7 +1376,7 @@ void FixCMAP::copy_arrays(int i, int j, int /*delflag*/) { num_crossterm[j] = num_crossterm[i]; - for (int k = 0; k < num_crossterm[j]; k++){ + for (int k = 0; k < num_crossterm[j]; k++) { crossterm_type[j][k] = crossterm_type[i][k]; crossterm_atom1[j][k] = crossterm_atom1[i][k]; crossterm_atom2[j][k] = crossterm_atom2[i][k]; diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 055ac539c8..3f30122a65 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -264,7 +264,7 @@ void PairTIP4PCut::compute(int eflag, int vflag) f[iH2][1] += fH[1]; f[iH2][2] += fH[2]; - if(vflag) { + if (vflag) { xH1 = x[iH1]; xH2 = x[iH2]; v[0] = x[i][0]*fO[0] + xH1[0]*fH[0] + xH2[0]*fH[0]; diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index 7238927367..c89afad705 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -116,7 +116,7 @@ void PairEAMOpt::eval() for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t* _noalias tab = &fast_alpha[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { - for(int m = 1; m <= nr; m++) { + for (int m = 1; m <= nr; m++) { tab[m].rhor0i = rhor_spline[type2rhor[i+1][j+1]][m][6]; tab[m].rhor1i = rhor_spline[type2rhor[i+1][j+1]][m][5]; tab[m].rhor2i = rhor_spline[type2rhor[i+1][j+1]][m][4]; @@ -124,7 +124,7 @@ void PairEAMOpt::eval() } } if (type2rhor[j+1][i+1] >= 0) { - for(int m = 1; m <= nr; m++) { + for (int m = 1; m <= nr; m++) { tab[m].rhor0j = rhor_spline[type2rhor[j+1][i+1]][m][6]; tab[m].rhor1j = rhor_spline[type2rhor[j+1][i+1]][m][5]; tab[m].rhor2j = rhor_spline[type2rhor[j+1][i+1]][m][4]; @@ -139,14 +139,14 @@ void PairEAMOpt::eval() for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_gamma_t* _noalias tab = &fast_gamma[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { - for(int m = 1; m <= nr; m++) { + for (int m = 1; m <= nr; m++) { tab[m].rhor4i = rhor_spline[type2rhor[i+1][j+1]][m][2]; tab[m].rhor5i = rhor_spline[type2rhor[i+1][j+1]][m][1]; tab[m].rhor6i = rhor_spline[type2rhor[i+1][j+1]][m][0]; } } if (type2rhor[j+1][i+1] >= 0) { - for(int m = 1; m <= nr; m++) { + for (int m = 1; m <= nr; m++) { tab[m].rhor4j = rhor_spline[type2rhor[j+1][i+1]][m][2]; tab[m].rhor5j = rhor_spline[type2rhor[j+1][i+1]][m][1]; tab[m].rhor6j = rhor_spline[type2rhor[j+1][i+1]][m][0]; @@ -154,7 +154,7 @@ void PairEAMOpt::eval() } } if (type2z2r[i+1][j+1] >= 0) { - for(int m = 1; m <= nr; m++) { + for (int m = 1; m <= nr; m++) { tab[m].z2r0 = z2r_spline[type2z2r[i+1][j+1]][m][6]; tab[m].z2r1 = z2r_spline[type2z2r[i+1][j+1]][m][5]; tab[m].z2r2 = z2r_spline[type2z2r[i+1][j+1]][m][4]; diff --git a/src/OPT/pair_lj_long_coul_long_opt.cpp b/src/OPT/pair_lj_long_coul_long_opt.cpp index 592f93a656..0ead71befb 100644 --- a/src/OPT/pair_lj_long_coul_long_opt.cpp +++ b/src/OPT/pair_lj_long_coul_long_opt.cpp @@ -616,7 +616,7 @@ void PairLJLongCoulLongOpt::eval() if (rsq < cut_ljsqi[typej]) { // lj if (ORDER6) { // long-range lj - if(!LJTABLE || rsq <= tabinnerdispsq) { // series real space + if (!LJTABLE || rsq <= tabinnerdispsq) { // series real space double rn = r2inv*r2inv*r2inv; double x2 = g2*rsq, a2 = 1.0/x2; x2 = a2*exp(-x2)*lj4i[typej]; diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index d738d21c5b..18047b794e 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -109,7 +109,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : FixPythonMove::~FixPythonMove() { PyGILState_STATE gstate = PyGILState_Ensure(); - if(py_move) Py_DECREF((PyObject*) py_move); + if (py_move) Py_DECREF((PyObject*) py_move); PyGILState_Release(gstate); } diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 42b1135ceb..260454d150 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -72,7 +72,7 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) // With Python 3.7 this function is now called by Py_Initialize() // Deprecated since version 3.9, will be removed in version 3.11 #if PY_MAJOR_VERSION < 3 || PY_MINOR_VERSION < 7 - if(!PyEval_ThreadsInitialized()) { + if (!PyEval_ThreadsInitialized()) { PyEval_InitThreads(); } #endif @@ -90,7 +90,7 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) PythonImpl::~PythonImpl() { - if(pyMain) { + if (pyMain) { // clean up PyGILState_STATE gstate = PyGILState_Ensure(); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 9f47d89097..555b9d2770 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -103,7 +103,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - for( int i = 0; i < atom->nmax; i++ ) + for ( int i = 0; i < atom->nmax; i++ ) for (int j = 0; j < nprev; ++j ) s_hist[i][j] = t_hist[i][j] = atom->q[i]; @@ -234,7 +234,7 @@ void FixQEq::allocate_matrix() numneigh = list->numneigh; m = 0; - for( ii = 0; ii < inum; ii++ ) { + for ( ii = 0; ii < inum; ii++ ) { i = ilist[ii]; m += numneigh[i]; } @@ -306,7 +306,7 @@ void FixQEq::init_storage() nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; - for( int i = 0; i < nall; i++ ) { + for ( int i = 0; i < nall; i++ ) { Hdia_inv[i] = 1. / eta[atom->type[i]]; b_s[i] = -chi[atom->type[i]]; b_t[i] = -1.0; @@ -352,7 +352,7 @@ int FixQEq::CG( double *b, double *x ) vector_sum( r , 1., b, -1., q, inum ); - for( ii = 0; ii < inum; ++ii ) { + for ( ii = 0; ii < inum; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) d[i] = r[i] * Hdia_inv[i]; @@ -362,7 +362,7 @@ int FixQEq::CG( double *b, double *x ) b_norm = parallel_norm( b, inum ); sig_new = parallel_dot( r, d, inum); - for( loop = 1; loop < maxiter && sqrt(sig_new)/b_norm > tolerance; ++loop ) { + for ( loop = 1; loop < maxiter && sqrt(sig_new)/b_norm > tolerance; ++loop ) { comm->forward_comm_fix(this); sparse_matvec( &H, d, q ); comm->reverse_comm_fix(this); @@ -373,7 +373,7 @@ int FixQEq::CG( double *b, double *x ) vector_add( x, alfa, d, inum ); vector_add( r, -alfa, q, inum ); - for( ii = 0; ii < inum; ++ii ) { + for ( ii = 0; ii < inum; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) p[i] = r[i] * Hdia_inv[i]; @@ -406,19 +406,19 @@ void FixQEq::sparse_matvec( sparse_matrix *A, double *x, double *b ) nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; - for( i = 0; i < nlocal; ++i ) { + for ( i = 0; i < nlocal; ++i ) { if (atom->mask[i] & groupbit) b[i] = eta[ atom->type[i] ] * x[i]; } - for( i = nlocal; i < nall; ++i ) { + for ( i = nlocal; i < nall; ++i ) { if (atom->mask[i] & groupbit) b[i] = 0; } - for( i = 0; i < nlocal; ++i ) { + for ( i = 0; i < nlocal; ++i ) { if (atom->mask[i] & groupbit) { - for( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { + for ( itr_j=A->firstnbr[i]; itr_jfirstnbr[i]+A->numnbrs[i]; itr_j++) { j = A->jlist[itr_j]; b[i] += A->val[itr_j] * x[j]; b[j] += A->val[itr_j] * x[i]; @@ -444,12 +444,12 @@ void FixQEq::calculate_Q() t_sum = parallel_vector_acc( t, inum); u = s_sum / t_sum; - for( ii = 0; ii < inum; ++ii ) { + for ( ii = 0; ii < inum; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) { q[i] = s[i] - u * t[i]; - for( k = 4; k > 0; --k ) { + for ( k = 4; k > 0; --k ) { s_hist[i][k] = s_hist[i][k-1]; t_hist[i][k] = t_hist[i][k-1]; } @@ -470,13 +470,13 @@ int FixQEq::pack_forward_comm(int n, int *list, double *buf, int m; if (pack_flag == 1) - for(m = 0; m < n; m++) buf[m] = d[list[m]]; - else if( pack_flag == 2 ) - for(m = 0; m < n; m++) buf[m] = s[list[m]]; - else if( pack_flag == 3 ) - for(m = 0; m < n; m++) buf[m] = t[list[m]]; - else if( pack_flag == 4 ) - for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; + for (m = 0; m < n; m++) buf[m] = d[list[m]]; + else if ( pack_flag == 2 ) + for (m = 0; m < n; m++) buf[m] = s[list[m]]; + else if ( pack_flag == 3 ) + for (m = 0; m < n; m++) buf[m] = t[list[m]]; + else if ( pack_flag == 4 ) + for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; else m = 0; return m; @@ -489,13 +489,13 @@ void FixQEq::unpack_forward_comm(int n, int first, double *buf) int i, m; if (pack_flag == 1) - for(m = 0, i = first; m < n; m++, i++) d[i] = buf[m]; - else if( pack_flag == 2) - for(m = 0, i = first; m < n; m++, i++) s[i] = buf[m]; - else if( pack_flag == 3) - for(m = 0, i = first; m < n; m++, i++) t[i] = buf[m]; - else if( pack_flag == 4) - for(m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) d[i] = buf[m]; + else if ( pack_flag == 2) + for (m = 0, i = first; m < n; m++, i++) s[i] = buf[m]; + else if ( pack_flag == 3) + for (m = 0, i = first; m < n; m++, i++) t[i] = buf[m]; + else if ( pack_flag == 4) + for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; } /* ---------------------------------------------------------------------- */ @@ -503,7 +503,7 @@ void FixQEq::unpack_forward_comm(int n, int first, double *buf) int FixQEq::pack_reverse_comm(int n, int first, double *buf) { int i, m; - for(m = 0, i = first; m < n; m++, i++) buf[m] = q[i]; + for (m = 0, i = first; m < n; m++, i++) buf[m] = q[i]; return m; } @@ -513,7 +513,7 @@ void FixQEq::unpack_reverse_comm(int n, int *list, double *buf) { int m; - for(m = 0; m < n; m++) q[list[m]] += buf[m]; + for (m = 0; m < n; m++) q[list[m]] += buf[m]; } /* ---------------------------------------------------------------------- @@ -591,7 +591,7 @@ double FixQEq::parallel_norm( double *v, int n ) my_sum = 0.0; norm_sqr = 0.0; - for( ii = 0; ii < n; ++ii ) { + for ( ii = 0; ii < n; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_sum += v[i]*v[i]; @@ -616,7 +616,7 @@ double FixQEq::parallel_dot( double *v1, double *v2, int n) my_dot = 0.0; res = 0.0; - for( ii = 0; ii < n; ++ii ) { + for ( ii = 0; ii < n; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_dot += v1[i] * v2[i]; @@ -641,7 +641,7 @@ double FixQEq::parallel_vector_acc( double *v, int n ) my_acc = 0.0; res = 0.0; - for( ii = 0; ii < n; ++ii ) { + for ( ii = 0; ii < n; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) my_acc += v[i]; @@ -662,7 +662,7 @@ void FixQEq::vector_sum( double* dest, double c, double* v, ilist = list->ilist; - for( --k; k>=0; --k ) { + for ( --k; k>=0; --k ) { kk = ilist[k]; if (atom->mask[kk] & groupbit) dest[kk] = c * v[kk] + d * y[kk]; @@ -678,7 +678,7 @@ void FixQEq::vector_add( double* dest, double c, double* v, int k ) ilist = list->ilist; - for( --k; k>=0; --k ) { + for ( --k; k>=0; --k ) { kk = ilist[k]; if (atom->mask[kk] & groupbit) dest[kk] += c * v[kk]; diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index da4ef98591..6fc98410eb 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -249,9 +249,9 @@ int FixQEqDynamic::pack_forward_comm(int n, int *list, double *buf, int m=0; if (pack_flag == 1) - for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; - else if( pack_flag == 2 ) - for(m = 0; m < n; m++) buf[m] = qf[list[m]]; + for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; + else if ( pack_flag == 2 ) + for (m = 0; m < n; m++) buf[m] = qf[list[m]]; return m; } @@ -263,9 +263,9 @@ void FixQEqDynamic::unpack_forward_comm(int n, int first, double *buf) int i, m; if (pack_flag == 1) - for(m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; - else if( pack_flag == 2) - for(m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; + else if ( pack_flag == 2) + for (m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; } /* ---------------------------------------------------------------------- */ @@ -273,7 +273,7 @@ void FixQEqDynamic::unpack_forward_comm(int n, int first, double *buf) int FixQEqDynamic::pack_reverse_comm(int n, int first, double *buf) { int i, m; - for(m = 0, i = first; m < n; m++, i++) buf[m] = qf[i]; + for (m = 0, i = first; m < n; m++, i++) buf[m] = qf[i]; return m; } @@ -283,7 +283,7 @@ void FixQEqDynamic::unpack_reverse_comm(int n, int *list, double *buf) { int m; - for(m = 0; m < n; m++) qf[list[m]] += buf[m]; + for (m = 0; m < n; m++) qf[list[m]] += buf[m]; } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 3d0313c789..613d6998aa 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -313,9 +313,9 @@ int FixQEqFire::pack_forward_comm(int n, int *list, double *buf, int m = 0; if (pack_flag == 1) - for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; - else if( pack_flag == 2 ) - for(m = 0; m < n; m++) buf[m] = qf[list[m]]; + for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; + else if ( pack_flag == 2 ) + for (m = 0; m < n; m++) buf[m] = qf[list[m]]; return m; } @@ -327,9 +327,9 @@ void FixQEqFire::unpack_forward_comm(int n, int first, double *buf) int i, m; if (pack_flag == 1) - for(m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; - else if( pack_flag == 2) - for(m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; + else if ( pack_flag == 2) + for (m = 0, i = first; m < n; m++, i++) qf[i] = buf[m]; } /* ---------------------------------------------------------------------- */ @@ -337,7 +337,7 @@ void FixQEqFire::unpack_forward_comm(int n, int first, double *buf) int FixQEqFire::pack_reverse_comm(int n, int first, double *buf) { int i, m; - for(m = 0, i = first; m < n; m++, i++) buf[m] = qf[i]; + for (m = 0, i = first; m < n; m++, i++) buf[m] = qf[i]; return m; } @@ -347,7 +347,7 @@ void FixQEqFire::unpack_reverse_comm(int n, int *list, double *buf) { int m; - for(m = 0; m < n; m++) qf[list[m]] += buf[m]; + for (m = 0; m < n; m++) qf[list[m]] += buf[m]; } /* ---------------------------------------------------------------------- */ diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 73776d5220..a3346b3d1c 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -273,7 +273,7 @@ void FixEHEX::rescale() { vsub[1] = (scale-1.0) * vcm[1]; vsub[2] = (scale-1.0) * vcm[2]; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (scalingmask[i]) { diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index d96849915f..8e26d44f61 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -64,9 +64,9 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : rfac0 = atof(arg[4]); twojmax = atoi(arg[5]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) radelem[i+1] = atof(arg[6+i]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) wjelem[i+1] = atof(arg[6+ntypes+i]); // construct cutsq @@ -74,11 +74,11 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : double cut; cutmax = 0.0; memory->create(cutsq,ntypes+1,ntypes+1,"sna/atom:cutsq"); - for(int i = 1; i <= ntypes; i++) { + for (int i = 1; i <= ntypes; i++) { cut = 2.0*radelem[i]*rcutfac; if (cut > cutmax) cutmax = cut; cutsq[i][i] = cut*cut; - for(int j = i+1; j <= ntypes; j++) { + for (int j = i+1; j <= ntypes; j++) { cut = (radelem[i]+radelem[j])*rcutfac; cutsq[i][j] = cutsq[j][i] = cut*cut; } @@ -115,7 +115,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : chemflag = 1; memory->create(map,ntypes+1,"compute_sna_atom:map"); nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - for(int i = 0; i < ntypes; i++) { + for (int i = 0; i < ntypes; i++) { int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute sna/atom command"); diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index 35cbb9225c..b9ab2f54ae 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -62,9 +62,9 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : rcutfac = atof(arg[3]); rfac0 = atof(arg[4]); twojmax = atoi(arg[5]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) radelem[i+1] = atof(arg[6+i]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) wjelem[i+1] = atof(arg[6+ntypes+i]); // construct cutsq @@ -72,11 +72,11 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : double cut; cutmax = 0.0; memory->create(cutsq,ntypes+1,ntypes+1,"sna/atom:cutsq"); - for(int i = 1; i <= ntypes; i++) { + for (int i = 1; i <= ntypes; i++) { cut = 2.0*radelem[i]*rcutfac; if (cut > cutmax) cutmax = cut; cutsq[i][i] = cut*cut; - for(int j = i+1; j <= ntypes; j++) { + for (int j = i+1; j <= ntypes; j++) { cut = (radelem[i]+radelem[j])*rcutfac; cutsq[i][j] = cutsq[j][i] = cut*cut; } @@ -113,7 +113,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : chemflag = 1; memory->create(map,ntypes+1,"compute_snad_atom:map"); nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - for(int i = 0; i < ntypes; i++) { + for (int i = 0; i < ntypes; i++) { int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snad/atom command"); diff --git a/src/SNAP/compute_snap.cpp b/src/SNAP/compute_snap.cpp index 9f25fdbff9..eca832f665 100644 --- a/src/SNAP/compute_snap.cpp +++ b/src/SNAP/compute_snap.cpp @@ -68,9 +68,9 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : rcutfac = atof(arg[3]); rfac0 = atof(arg[4]); twojmax = atoi(arg[5]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) radelem[i+1] = atof(arg[6+i]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) wjelem[i+1] = atof(arg[6+ntypes+i]); // construct cutsq @@ -78,11 +78,11 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : double cut; cutmax = 0.0; memory->create(cutsq,ntypes+1,ntypes+1,"snap:cutsq"); - for(int i = 1; i <= ntypes; i++) { + for (int i = 1; i <= ntypes; i++) { cut = 2.0*radelem[i]*rcutfac; if (cut > cutmax) cutmax = cut; cutsq[i][i] = cut*cut; - for(int j = i+1; j <= ntypes; j++) { + for (int j = i+1; j <= ntypes; j++) { cut = (radelem[i]+radelem[j])*rcutfac; cutsq[i][j] = cutsq[j][i] = cut*cut; } @@ -119,7 +119,7 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : chemflag = 1; memory->create(map,ntypes+1,"compute_snap:map"); nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - for(int i = 0; i < ntypes; i++) { + for (int i = 0; i < ntypes; i++) { int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snap command"); diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index 3772a92ad7..42a54e6cb1 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -61,17 +61,17 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : rcutfac = atof(arg[3]); rfac0 = atof(arg[4]); twojmax = atoi(arg[5]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) radelem[i+1] = atof(arg[6+i]); - for(int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) wjelem[i+1] = atof(arg[6+ntypes+i]); // construct cutsq double cut; memory->create(cutsq,ntypes+1,ntypes+1,"sna/atom:cutsq"); - for(int i = 1; i <= ntypes; i++) { + for (int i = 1; i <= ntypes; i++) { cut = 2.0*radelem[i]*rcutfac; cutsq[i][i] = cut*cut; - for(int j = i+1; j <= ntypes; j++) { + for (int j = i+1; j <= ntypes; j++) { cut = (radelem[i]+radelem[j])*rcutfac; cutsq[i][j] = cutsq[j][i] = cut*cut; } @@ -108,7 +108,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : chemflag = 1; memory->create(map,ntypes+1,"compute_sna_atom:map"); nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - for(int i = 0; i < ntypes; i++) { + for (int i = 0; i < ntypes; i++) { int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snav/atom command"); diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index a7ea6de591..6240059a68 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -177,7 +177,7 @@ void PairSNAP::compute(int eflag, int vflag) for (int jj = 0; jj < ninside; jj++) { int j = snaptr->inside[jj]; - if(chemflag) + if (chemflag) snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], snaptr->rcutij[jj],jj, snaptr->element[jj]); else @@ -344,7 +344,7 @@ void PairSNAP::compute_bispectrum() else snaptr->compute_bi(0); - for (int icoeff = 0; icoeff < ncoeff; icoeff++){ + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { bispectrum[ii][icoeff] = snaptr->blist[icoeff]; } } diff --git a/src/SNAP/sna.cpp b/src/SNAP/sna.cpp index 3c7a40c0dc..d2b423d5db 100644 --- a/src/SNAP/sna.cpp +++ b/src/SNAP/sna.cpp @@ -152,7 +152,7 @@ SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in, if (bzero_flag) { double www = wself*wself*wself; - for(int j = 0; j <= twojmax; j++) + for (int j = 0; j <= twojmax; j++) if (bnorm_flag) bzero[j] = www; else @@ -187,9 +187,9 @@ void SNA::build_indexlist() "sna:idxcg_block"); int idxcg_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { idxcg_block[j1][j2][j] = idxcg_count; for (int m1 = 0; m1 <= j1; m1++) for (int m2 = 0; m2 <= j2; m2++) @@ -205,10 +205,10 @@ void SNA::build_indexlist() int idxu_count = 0; - for(int j = 0; j <= twojmax; j++) { + for (int j = 0; j <= twojmax; j++) { idxu_block[j] = idxu_count; - for(int mb = 0; mb <= j; mb++) - for(int ma = 0; ma <= j; ma++) + for (int mb = 0; mb <= j; mb++) + for (int ma = 0; ma <= j; ma++) idxu_count++; } idxu_max = idxu_count; @@ -216,18 +216,18 @@ void SNA::build_indexlist() // index list for beta and B int idxb_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) if (j >= j1) idxb_count++; idxb_max = idxb_count; idxb = new SNA_BINDICES[idxb_max]; idxb_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) if (j >= j1) { idxb[idxb_count].j1 = j1; idxb[idxb_count].j2 = j2; @@ -240,9 +240,9 @@ void SNA::build_indexlist() memory->create(idxb_block, jdim, jdim, jdim, "sna:idxb_block"); idxb_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { if (j >= j1) { idxb_block[j1][j2][j] = idxb_count; idxb_count++; @@ -253,9 +253,9 @@ void SNA::build_indexlist() int idxz_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) for (int mb = 0; 2*mb <= j; mb++) for (int ma = 0; ma <= j; ma++) idxz_count++; @@ -267,9 +267,9 @@ void SNA::build_indexlist() "sna:idxz_block"); idxz_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { idxz_block[j1][j2][j] = idxz_count; // find right beta[jjb] entry @@ -309,7 +309,7 @@ void SNA::init() void SNA::grow_rij(int newnmax) { - if(newnmax <= nmax) return; + if (newnmax <= nmax) return; nmax = newnmax; @@ -345,7 +345,7 @@ void SNA::compute_ui(int jnum, int ielem) zero_uarraytot(ielem); - for(int j = 0; j < jnum; j++) { + for (int j = 0; j < jnum; j++) { x = rij[j][0]; y = rij[j][1]; z = rij[j][2]; @@ -375,8 +375,8 @@ void SNA::compute_zi() int idouble = 0; double * zptr_r; double * zptr_i; - for(int elem1 = 0; elem1 < nelements; elem1++) - for(int elem2 = 0; elem2 < nelements; elem2++) { + for (int elem1 = 0; elem1 < nelements; elem1++) + for (int elem2 = 0; elem2 < nelements; elem2++) { zptr_r = &zlist_r[idouble*idxz_max]; zptr_i = &zlist_i[idouble*idxz_max]; @@ -448,18 +448,18 @@ void SNA::compute_yi(const double* beta) double betaj; int itriple; - for(int ielem1 = 0; ielem1 < nelements; ielem1++) - for(int j = 0; j <= twojmax; j++) { + for (int ielem1 = 0; ielem1 < nelements; ielem1++) + for (int j = 0; j <= twojmax; j++) { jju = idxu_block[j]; - for(int mb = 0; 2*mb <= j; mb++) - for(int ma = 0; ma <= j; ma++) { + for (int mb = 0; 2*mb <= j; mb++) + for (int ma = 0; ma <= j; ma++) { ylist_r[ielem1*idxu_max+jju] = 0.0; ylist_i[ielem1*idxu_max+jju] = 0.0; jju++; } // end loop over ma, mb } // end loop over j - for(int elem1 = 0; elem1 < nelements; elem1++) + for (int elem1 = 0; elem1 < nelements; elem1++) for (int elem2 = 0; elem2 < nelements; elem2++) { for (int jjz = 0; jjz < idxz_max; jjz++) { const int j1 = idxz[jjz].j1; @@ -522,7 +522,7 @@ void SNA::compute_yi(const double* beta) } jju = idxz[jjz].jju; - for(int elem3 = 0; elem3 < nelements; elem3++) { + for (int elem3 = 0; elem3 < nelements; elem3++) { // pick out right beta value if (j >= j1) { const int jjb = idxb_block[j1][j2][j]; @@ -560,22 +560,22 @@ void SNA::compute_yi(const double* beta) void SNA::compute_deidrj(double* dedr) { - for(int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) dedr[k] = 0.0; int jelem = elem_duarray; - for(int j = 0; j <= twojmax; j++) { + for (int j = 0; j <= twojmax; j++) { int jju = idxu_block[j]; - for(int mb = 0; 2*mb < j; mb++) - for(int ma = 0; ma <= j; ma++) { + for (int mb = 0; 2*mb < j; mb++) + for (int ma = 0; ma <= j; ma++) { double* dudr_r = dulist_r[jju]; double* dudr_i = dulist_i[jju]; double jjjmambyarray_r = ylist_r[jelem*idxu_max+jju]; double jjjmambyarray_i = ylist_i[jelem*idxu_max+jju]; - for(int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) dedr[k] += dudr_r[k] * jjjmambyarray_r + dudr_i[k] * jjjmambyarray_i; @@ -587,13 +587,13 @@ void SNA::compute_deidrj(double* dedr) if (j%2 == 0) { int mb = j/2; - for(int ma = 0; ma < mb; ma++) { + for (int ma = 0; ma < mb; ma++) { double* dudr_r = dulist_r[jju]; double* dudr_i = dulist_i[jju]; double jjjmambyarray_r = ylist_r[jelem*idxu_max+jju]; double jjjmambyarray_i = ylist_i[jelem*idxu_max+jju]; - for(int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) dedr[k] += dudr_r[k] * jjjmambyarray_r + dudr_i[k] * jjjmambyarray_i; @@ -605,7 +605,7 @@ void SNA::compute_deidrj(double* dedr) double jjjmambyarray_r = ylist_r[jelem*idxu_max+jju]; double jjjmambyarray_i = ylist_i[jelem*idxu_max+jju]; - for(int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) dedr[k] += (dudr_r[k] * jjjmambyarray_r + dudr_i[k] * jjjmambyarray_i)*0.5; @@ -615,7 +615,7 @@ void SNA::compute_deidrj(double* dedr) } // end loop over j - for(int k = 0; k < 3; k++) + for (int k = 0; k < 3; k++) dedr[k] *= 2.0; } @@ -693,9 +693,9 @@ void SNA::compute_bi(int ielem) { } // end loop over JJ } else { int itriple = 0; - for(int elem1 = 0; elem1 < nelements; elem1++) - for(int elem2 = 0; elem2 < nelements; elem2++) { - for(int elem3 = 0; elem3 < nelements; elem3++) { + for (int elem1 = 0; elem1 < nelements; elem1++) + for (int elem2 = 0; elem2 < nelements; elem2++) { + for (int elem3 = 0; elem3 < nelements; elem3++) { for (int jjb = 0; jjb < idxb_max; jjb++) { const int j = idxb[jjb].j; blist[itriple*idxb_max+jjb] -= bzero[j]; @@ -749,11 +749,11 @@ void SNA::compute_dbidrj() // set all the derivatives to zero once - for(int jjb = 0; jjb < idxb_max; jjb++) { + for (int jjb = 0; jjb < idxb_max; jjb++) { - for(int elem1 = 0; elem1 < nelements; elem1++) - for(int elem2 = 0; elem2 < nelements; elem2++) - for(int elem3 = 0; elem3 < nelements; elem3++) { + for (int elem1 = 0; elem1 < nelements; elem1++) + for (int elem2 = 0; elem2 < nelements; elem2++) + for (int elem3 = 0; elem3 < nelements; elem3++) { itriple = (elem1 * nelements + elem2) * nelements + elem3; @@ -767,7 +767,7 @@ void SNA::compute_dbidrj() int elem3 = elem_duarray; - for(int jjb = 0; jjb < idxb_max; jjb++) { + for (int jjb = 0; jjb < idxb_max; jjb++) { const int j1 = idxb[jjb].j1; const int j2 = idxb[jjb].j2; const int j = idxb[jjb].j; @@ -775,8 +775,8 @@ void SNA::compute_dbidrj() // Sum terms Conj(dudr(j,ma,mb))*z(j1,j2,j,ma,mb) - for(int elem1 = 0; elem1 < nelements; elem1++) - for(int elem2 = 0; elem2 < nelements; elem2++) { + for (int elem1 = 0; elem1 < nelements; elem1++) + for (int elem2 = 0; elem2 < nelements; elem2++) { jjz = idxz_block[j1][j2][j]; jju = idxu_block[j]; @@ -975,7 +975,7 @@ void SNA::compute_duidrj(double* rij, double wj, double rcut, int jj, int jelem) void SNA::zero_uarraytot(int ielem) { - for(int jelem = 0; jelem < nelements; jelem++) + for (int jelem = 0; jelem < nelements; jelem++) for (int j = 0; j <= twojmax; j++) { int jju = idxu_block[j]; for (int mb = 0; mb <= j; mb++) { @@ -1389,9 +1389,9 @@ void SNA::init_clebsch_gordan() int ifac; int idxcg_count = 0; - for(int j1 = 0; j1 <= twojmax; j1++) - for(int j2 = 0; j2 <= j1; j2++) - for(int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { + for (int j1 = 0; j1 <= twojmax; j1++) + for (int j2 = 0; j2 <= j1; j2++) + for (int j = j1 - j2; j <= MIN(twojmax, j1 + j2); j += 2) { for (int m1 = 0; m1 <= j1; m1++) { aa2 = 2 * m1 - j1; @@ -1402,7 +1402,7 @@ void SNA::init_clebsch_gordan() bb2 = 2 * m2 - j2; m = (aa2 + bb2 + j) / 2; - if(m < 0 || m > j) { + if (m < 0 || m > j) { cglist[idxcg_count] = 0.0; idxcg_count++; continue; @@ -1516,8 +1516,8 @@ double SNA::compute_sfac(double r, double rcut) { if (switch_flag == 0) return 1.0; if (switch_flag == 1) { - if(r <= rmin0) return 1.0; - else if(r > rcut) return 0.0; + if (r <= rmin0) return 1.0; + else if (r > rcut) return 0.0; else { double rcutfac = MY_PI / (rcut - rmin0); return 0.5 * (cos((r - rmin0) * rcutfac) + 1.0); @@ -1532,8 +1532,8 @@ double SNA::compute_dsfac(double r, double rcut) { if (switch_flag == 0) return 0.0; if (switch_flag == 1) { - if(r <= rmin0) return 0.0; - else if(r > rcut) return 0.0; + if (r <= rmin0) return 0.0; + else if (r > rcut) return 0.0; else { double rcutfac = MY_PI / (rcut - rmin0); return -0.5 * sin((r - rmin0) * rcutfac) * rcutfac; diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 6d4ff8bedd..30a18fb301 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -323,13 +323,13 @@ void FixNVESpin::initial_integrate(int /*vflag*/) } } else if (sector_flag == 0) { // serial seq. update comm->forward_comm(); // comm. positions of ghost atoms - for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal + for (int i = 0; i < nlocal; i++) { // advance quarter s for nlocal if (mask[i] & groupbit) { ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } } - for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal + for (int i = nlocal-1; i >= 0; i--) { // advance quarter s for nlocal if (mask[i] & groupbit) { ComputeInteractionsSpin(i); AdvanceSingleSpin(i); @@ -376,13 +376,13 @@ void FixNVESpin::initial_integrate(int /*vflag*/) } } else if (sector_flag == 0) { // serial seq. update comm->forward_comm(); // comm. positions of ghost atoms - for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1 + for (int i = 0; i < nlocal; i++) { // advance quarter s for nlocal-1 if (mask[i] & groupbit) { ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } } - for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal-1 + for (int i = nlocal-1; i >= 0; i--) { // advance quarter s for nlocal-1 if (mask[i] & groupbit) { ComputeInteractionsSpin(i); AdvanceSingleSpin(i); diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index 094986dc7b..de2bd5c3ae 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -103,7 +103,7 @@ void MinSpinCG::init() // set back use_line_search to 0 if more than one replica - if (linestyle == 3 && nreplica == 1){ + if (linestyle == 3 && nreplica == 1) { use_line_search = 1; } else{ @@ -208,7 +208,7 @@ int MinSpinCG::iterate(int maxiter) if (use_line_search) { // here we need to do line search - if (local_iter == 0){ + if (local_iter == 0) { calc_gradient(); } @@ -344,7 +344,7 @@ void MinSpinCG::calc_search_direction() factor = 0.0; - if (local_iter == 0 || local_iter % 5 == 0){ // steepest descent direction + if (local_iter == 0 || local_iter % 5 == 0) { // steepest descent direction for (int i = 0; i < 3 * nlocal; i++) { p_s[i] = -g_cur[i] * factor; g_old[i] = g_cur[i] * factor; @@ -425,12 +425,12 @@ void MinSpinCG::rodrigues_rotation(const double *upp_tr, double *out) if (fabs(upp_tr[0]) < 1.0e-40 && fabs(upp_tr[1]) < 1.0e-40 && - fabs(upp_tr[2]) < 1.0e-40){ + fabs(upp_tr[2]) < 1.0e-40) { // if upp_tr is zero, return unity matrix - for(int k = 0; k < 3; k++){ - for(int m = 0; m < 3; m++){ + for (int k = 0; k < 3; k++) { + for (int m = 0; m < 3; m++) { if (m == k) out[3 * k + m] = 1.0; else out[3 * k + m] = 0.0; } @@ -481,9 +481,9 @@ void MinSpinCG::rodrigues_rotation(const double *upp_tr, double *out) void MinSpinCG::vm3(const double *m, const double *v, double *out) { - for(int i = 0; i < 3; i++){ + for (int i = 0; i < 3; i++) { out[i] = 0.0; - for(int j = 0; j < 3; j++) out[i] += *(m + 3 * j + i) * v[j]; + for (int j = 0; j < 3; j++) out[i] += *(m + 3 * j + i) * v[j]; } } @@ -550,7 +550,7 @@ int MinSpinCG::calc_and_make_step(double a, double b, int index) der_e_cur = e_and_d[1]; index++; - if (adescent(eprevious,e_and_d[0]) || index == 5){ + if (adescent(eprevious,e_and_d[0]) || index == 5) { MPI_Bcast(&b,1,MPI_DOUBLE,0,world); for (int i = 0; i < 3 * nlocal; i++) { p_s[i] = b * p_s[i]; @@ -590,7 +590,7 @@ int MinSpinCG::calc_and_make_step(double a, double b, int index) Approximate descent ------------------------------------------------------------------------- */ -int MinSpinCG::adescent(double phi_0, double phi_j){ +int MinSpinCG::adescent(double phi_0, double phi_j) { double eps = 1.0e-6; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index b11cdf16f3..1f8d72664d 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -108,7 +108,7 @@ void MinSpinLBFGS::init() // set back use_line_search to 0 if more than one replica - if (linestyle == 3 && nreplica == 1){ + if (linestyle == 3 && nreplica == 1) { use_line_search = 1; } else{ @@ -221,7 +221,7 @@ int MinSpinLBFGS::iterate(int maxiter) if (use_line_search) { // here we need to do line search - if (local_iter == 0){ + if (local_iter == 0) { eprevious = ecurrent; ecurrent = energy_force(0); calc_gradient(); @@ -370,7 +370,7 @@ void MinSpinLBFGS::calc_search_direction() factor = 1.0; } - if (local_iter == 0){ // steepest descent direction + if (local_iter == 0) { // steepest descent direction //if no line search then calculate maximum rotation if (use_line_search == 0) @@ -379,7 +379,7 @@ void MinSpinLBFGS::calc_search_direction() for (int i = 0; i < 3 * nlocal; i++) { p_s[i] = -g_cur[i] * factor * scaling;; g_old[i] = g_cur[i] * factor; - for (int k = 0; k < num_mem; k++){ + for (int k = 0; k < num_mem; k++) { ds[k][i] = 0.0; dy[k][i] = 0.0; } @@ -405,7 +405,7 @@ void MinSpinLBFGS::calc_search_direction() if (fabs(dyds_global) > 1.0e-60) rho[m_index] = 1.0 / dyds_global; else rho[m_index] = 1.0e60; - if (rho[m_index] < 0.0){ + if (rho[m_index] < 0.0) { local_iter = 0; return calc_search_direction(); } @@ -418,7 +418,7 @@ void MinSpinLBFGS::calc_search_direction() } // loop over last m indecies - for(int k = num_mem - 1; k > -1; k--) { + for (int k = num_mem - 1; k > -1; k--) { // this loop should run from the newest memory to the oldest one. c_ind = (k + m_index + 1) % num_mem; @@ -473,7 +473,7 @@ void MinSpinLBFGS::calc_search_direction() } } - for (int k = 0; k < num_mem; k++){ + for (int k = 0; k < num_mem; k++) { // this loop should run from the oldest memory to the newest one. if (local_iter < num_mem) c_ind = k; @@ -551,11 +551,11 @@ void MinSpinLBFGS::rodrigues_rotation(const double *upp_tr, double *out) if (fabs(upp_tr[0]) < 1.0e-40 && fabs(upp_tr[1]) < 1.0e-40 && - fabs(upp_tr[2]) < 1.0e-40){ + fabs(upp_tr[2]) < 1.0e-40) { // if upp_tr is zero, return unity matrix - for(int k = 0; k < 3; k++){ - for(int m = 0; m < 3; m++){ + for (int k = 0; k < 3; k++) { + for (int m = 0; m < 3; m++) { if (m == k) out[3 * k + m] = 1.0; else out[3 * k + m] = 0.0; } @@ -606,9 +606,9 @@ void MinSpinLBFGS::rodrigues_rotation(const double *upp_tr, double *out) void MinSpinLBFGS::vm3(const double *m, const double *v, double *out) { - for(int i = 0; i < 3; i++){ + for (int i = 0; i < 3; i++) { out[i] = 0.0; - for(int j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) out[i] += *(m + 3 * j + i) * v[j]; } } @@ -673,7 +673,7 @@ int MinSpinLBFGS::calc_and_make_step(double a, double b, int index) der_e_cur = e_and_d[1]; index++; - if (adescent(eprevious,e_and_d[0]) || index == 5){ + if (adescent(eprevious,e_and_d[0]) || index == 5) { MPI_Bcast(&b,1,MPI_DOUBLE,0,world); for (int i = 0; i < 3 * nlocal; i++) { p_s[i] = b * p_s[i]; @@ -713,7 +713,7 @@ int MinSpinLBFGS::calc_and_make_step(double a, double b, int index) Approximate descent ------------------------------------------------------------------------- */ -int MinSpinLBFGS::adescent(double phi_0, double phi_j){ +int MinSpinLBFGS::adescent(double phi_0, double phi_j) { double eps = 1.0e-6; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 2aa1b7f84d..cbb495db8e 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -242,7 +242,7 @@ void NEBSpin::run() timer->init(); timer->barrier_start(); - // if(ireplica != 0 && ireplica != nreplica -1) + // if (ireplica != 0 && ireplica != nreplica -1) while (update->minimize->niter < n1steps) { update->minimize->run(nevery); diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index dfccfe4c92..d8c5ef2cee 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -993,7 +993,7 @@ void FixSRD::reset_velocities() if (shifts[shiftflag].commflag) xbin_comm(shiftflag,1); if (tstat) { - for (i = 0; i < nbins; i++){ + for (i = 0; i < nbins; i++) { n = vbin[i].n; if (n <= 1) continue; @@ -1034,7 +1034,7 @@ void FixSRD::reset_velocities() if (shifts[shiftflag].commflag) xbin_comm(shiftflag,1); } - for (i = 0; i < nbins; i++){ + for (i = 0; i < nbins; i++) { if (vbin[i].owner) { if (vbin[i].n > 1) { srd_bin_temp += vbin[i].value[0]/(vbin[i].n-dof_temp); diff --git a/src/USER-ADIOS/dump_atom_adios.cpp b/src/USER-ADIOS/dump_atom_adios.cpp index e08485b0fa..5d4bbd2377 100644 --- a/src/USER-ADIOS/dump_atom_adios.cpp +++ b/src/USER-ADIOS/dump_atom_adios.cpp @@ -39,7 +39,7 @@ class DumpAtomADIOSInternal { public: - DumpAtomADIOSInternal(){}; + DumpAtomADIOSInternal() {}; ~DumpAtomADIOSInternal() = default; // name of adios group, referrable in adios2_config.xml diff --git a/src/USER-ADIOS/dump_custom_adios.cpp b/src/USER-ADIOS/dump_custom_adios.cpp index 8fbce9f847..18a3c7ef9e 100644 --- a/src/USER-ADIOS/dump_custom_adios.cpp +++ b/src/USER-ADIOS/dump_custom_adios.cpp @@ -110,7 +110,7 @@ class DumpCustomADIOSInternal { public: - DumpCustomADIOSInternal(){}; + DumpCustomADIOSInternal() {}; ~DumpCustomADIOSInternal() = default; // name of adios group, referrable in adios2_config.xml diff --git a/src/USER-ADIOS/reader_adios.cpp b/src/USER-ADIOS/reader_adios.cpp index 2acf6dedfa..5cb0cb12ea 100644 --- a/src/USER-ADIOS/reader_adios.cpp +++ b/src/USER-ADIOS/reader_adios.cpp @@ -50,7 +50,7 @@ class ReadADIOSInternal { public: - ReadADIOSInternal(){}; + ReadADIOSInternal() {}; ~ReadADIOSInternal() = default; // name of adios group, referrable in adios2_config.xml diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index cf7339c75d..82fbfcc958 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -669,7 +669,7 @@ void FixATC::unpack_forward_comm(int n, int first, double *buf) pack values in local atom-based arrays for restart file ------------------------------------------------------------------------- */ -int FixATC::pack_restart(int /* i */, double * /* buf */){ +int FixATC::pack_restart(int /* i */, double * /* buf */) { return 0; } @@ -677,14 +677,14 @@ int FixATC::pack_restart(int /* i */, double * /* buf */){ unpack values from atom->extra array to restart the fix ------------------------------------------------------------------------- */ -void FixATC::unpack_restart(int /* nlocal */, int /* nth */){ +void FixATC::unpack_restart(int /* nlocal */, int /* nth */) { } /* ---------------------------------------------------------------------- maxsize of any atom's restart data ------------------------------------------------------------------------- */ -int FixATC::maxsize_restart(){ +int FixATC::maxsize_restart() { return 0; } @@ -692,7 +692,7 @@ int FixATC::maxsize_restart(){ size of atom nlocal's restart data ------------------------------------------------------------------------- */ -int FixATC::size_restart(int /* nlocal */){ +int FixATC::size_restart(int /* nlocal */) { return 0; } @@ -700,7 +700,7 @@ int FixATC::size_restart(int /* nlocal */){ pack entire state of Fix into one write ------------------------------------------------------------------------- */ -void FixATC::write_restart(FILE * /* fp */){ +void FixATC::write_restart(FILE * /* fp */) { char ** args = new char*[2]; args[0] = new char[50]; @@ -722,7 +722,7 @@ void FixATC::write_restart(FILE * /* fp */){ use state info from restart file to restart the Fix ------------------------------------------------------------------------- */ -void FixATC::restart(char * /* buf */){ +void FixATC::restart(char * /* buf */) { char ** args = new char*[2]; args[0] = new char[50]; diff --git a/src/USER-AWPMD/fix_nve_awpmd.cpp b/src/USER-AWPMD/fix_nve_awpmd.cpp index 2b837b8905..bd2668da09 100644 --- a/src/USER-AWPMD/fix_nve_awpmd.cpp +++ b/src/USER-AWPMD/fix_nve_awpmd.cpp @@ -96,7 +96,7 @@ void FixNVEAwpmd::initial_integrate(int /* vflag */) if (mask[i] & groupbit) { double dtfm = dtf / mass[type[i]]; double dtfmr=dtfm; - for(int j=0;j<3;j++){ + for (int j=0;j<3;j++) { x[i][j] += dtv*vforce[i][j]; v[i][j] += dtfm*f[i][j]; } @@ -109,7 +109,7 @@ void FixNVEAwpmd::initial_integrate(int /* vflag */) /* ---------------------------------------------------------------------- */ -void FixNVEAwpmd::final_integrate(){} +void FixNVEAwpmd::final_integrate() {} /* ---------------------------------------------------------------------- */ diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index c714f4e8ab..19bb06ad87 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -82,21 +82,21 @@ PairAWPMDCut::~PairAWPMDCut() struct cmp_x{ double **xx; double tol; - cmp_x(double **xx_=nullptr, double tol_=1e-12):xx(xx_),tol(tol_){} + cmp_x(double **xx_=nullptr, double tol_=1e-12):xx(xx_),tol(tol_) {} bool operator()(const pair &left, const pair &right) const { - if(left.first==right.first){ + if (left.first==right.first) { double d=xx[left.second][0]-xx[right.second][0]; - if(d<-tol) + if (d<-tol) return true; - else if(d>tol) + else if (d>tol) return false; d=xx[left.second][1]-xx[right.second][1]; - if(d<-tol) + if (d<-tol) return true; - else if(d>tol) + else if (d>tol) return false; d=xx[left.second][2]-xx[right.second][2]; - if(d<-tol) + if (d<-tol) return true; else return false; @@ -139,7 +139,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) // width pbc - if(width_pbc<0) + if (width_pbc<0) wpmd->Lextra=2*half_box_length; else wpmd->Lextra=width_pbc; @@ -163,7 +163,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; - if(j>=nlocal){ // this is a ghost + if (j>=nlocal) { // this is a ghost Vector_3 rj=Vector_3(x[j][0],x[j][1],x[j][2]); int jtype = type[j]; double rsq=(ri-rj).norm2(); @@ -186,9 +186,9 @@ void PairAWPMDCut::compute(int eflag, int vflag) // local particles are all there idmap[make_pair(atom->tag[i],i)]=i; bool i_local= i res=idmap.insert(make_pair(make_pair(atom->tag[j],j),j)); bool have_it=!res.second; - if(have_it){ // the clone of this particle is already listed - if(res.first->second!=j) // check that was not the very same particle + if (have_it) { // the clone of this particle is already listed + if (res.first->second!=j) // check that was not the very same particle gmap[j]=-1; // filter out continue; } bool j_local= jadd_ion(q[i], Vector_3(x[i][0],x[i][1],x[i][2]),itag[i] : -atom->tag[i]); - else if(spin[i]==1 || spin[i]==-1){ // electron, sort them according to the tag + else if (spin[i]==1 || spin[i]==-1) { // electron, sort them according to the tag etmap[etag[i]].push_back(i); } else @@ -242,19 +242,19 @@ void PairAWPMDCut::compute(int eflag, int vflag) } // ion force vector Vector_3 *fi=nullptr; - if(wpmd->ni) + if (wpmd->ni) fi= new Vector_3[wpmd->ni]; // adding electrons - for(map >::iterator it=etmap.begin(); it!= etmap.end(); ++it){ + for (map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { vector &el=it->second; - if(!el.size()) // should not happen + if (!el.size()) // should not happen continue; int s=spin[el[0]] >0 ? 0 : 1; wpmd->add_electron(s); // starts adding the spits - for(size_t k=0;kall(FLERR,logfmt("WP splits for one electron should have the same spin (at particles %d, %d)!",el[0],i)); double m= atom->mass ? atom->mass[type[i]] : force->e_mass; Vector_3 xx=Vector_3(x[i][0],x[i][1],x[i][2]); @@ -275,7 +275,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) // get forces from the AWPMD solver object for (int ii = 0; ii < inum; ii++) { int i = ilist[ii]; - if(gmap[i]<0) // this particle was filtered out + if (gmap[i]<0) // this particle was filtered out continue; if (spin[i]==0) { // this is an ion, copying forces int ion=gmap[i]; @@ -289,12 +289,12 @@ void PairAWPMDCut::compute(int eflag, int vflag) } } - if(fi) + if (fi) delete [] fi; // update LAMMPS energy if (eflag_either) { - if (eflag_global){ + if (eflag_global) { eng_coul+= wpmd->get_energy(); // pvector = [KE, Pauli, ecoul, radial_restraint] pvector[0] = wpmd->Ee[0]+wpmd->Ee[1]; @@ -405,7 +405,7 @@ void PairAWPMDCut::allocate() // [flex_press] -- set flexible pressure flag // -1 for length means default setting (L/2 for cutoff and L for width PBC) -void PairAWPMDCut::settings(int narg, char **arg){ +void PairAWPMDCut::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal pair_style command"); cut_global = utils::numeric(FLERR,arg[0],false,lmp); @@ -413,46 +413,46 @@ void PairAWPMDCut::settings(int narg, char **arg){ ermscale=1.; width_pbc=0.; - for(int i=1;iapprox=AWPMD::HARTREE; - else if(!strcmp(arg[i],"dproduct")) + else if (!strcmp(arg[i],"dproduct")) wpmd->approx=AWPMD::DPRODUCT; - else if(!strcmp(arg[i],"uhf")) + else if (!strcmp(arg[i],"uhf")) wpmd->approx=AWPMD::UHF; - else if(!strcmp(arg[i],"free")) + else if (!strcmp(arg[i],"free")) wpmd->constraint=AWPMD::NONE; - else if(!strcmp(arg[i],"fix")){ + else if (!strcmp(arg[i],"fix")) { wpmd->constraint=AWPMD::FIX; i++; - if(i>=narg) + if (i>=narg) error->all(FLERR,"Setting 'fix' should be followed by a number in awpmd/cut"); wpmd->w0=utils::numeric(FLERR,arg[i],false,lmp); } - else if(!strcmp(arg[i],"harm")){ + else if (!strcmp(arg[i],"harm")) { wpmd->constraint=AWPMD::HARM; i++; - if(i>=narg) + if (i>=narg) error->all(FLERR,"Setting 'harm' should be followed by a number in awpmd/cut"); wpmd->w0=utils::numeric(FLERR,arg[i],false,lmp); wpmd->set_harm_constr(wpmd->w0); } - else if(!strcmp(arg[i],"pbc")){ + else if (!strcmp(arg[i],"pbc")) { i++; - if(i>=narg) + if (i>=narg) error->all(FLERR,"Setting 'pbc' should be followed by a number in awpmd/cut"); width_pbc=utils::numeric(FLERR,arg[i],false,lmp); } - else if(!strcmp(arg[i],"relax")) + else if (!strcmp(arg[i],"relax")) wpmd->constraint=AWPMD::RELAX; - else if(!strcmp(arg[i],"ermscale")){ + else if (!strcmp(arg[i],"ermscale")) { i++; - if(i>=narg) + if (i>=narg) error->all(FLERR,"Setting 'ermscale' should be followed by a number in awpmd/cut"); ermscale=utils::numeric(FLERR,arg[i],false,lmp); } - else if(!strcmp(arg[i],"flex_press")) + else if (!strcmp(arg[i],"flex_press")) flexible_pressure_flag = 1; } } @@ -472,7 +472,7 @@ void PairAWPMDCut::coeff(int narg, char **arg) double delz = domain->boxhi[2]-domain->boxlo[2]; half_box_length = 0.5 * MIN(delx, MIN(dely, delz)); //} - if(cut_global<0) + if (cut_global<0) cut_global=half_box_length; if (!allocated) { @@ -517,7 +517,7 @@ void PairAWPMDCut::init_style() "q, spin, eradius, erforce"); /* - if(vflag_atom){ // can't compute virial per atom + if (vflag_atom) { // can't compute virial per atom //warning-> error->all(FLERR,"Pair style awpmd can't compute per atom virials"); }*/ @@ -550,7 +550,7 @@ void PairAWPMDCut::init_style() int irequest = neighbor->request(this,instance_me); neighbor->requests[irequest]->newton = 2; - if(force->e_mass==0. || force->hhmrr2e==0. || force->mvh2r==0.) + if (force->e_mass==0. || force->hhmrr2e==0. || force->mvh2r==0.) error->all(FLERR,"Pair style awpmd requires e_mass and conversions hhmrr2e, mvh2r to be properly set for unit system"); wpmd->me=force->e_mass; @@ -685,7 +685,7 @@ void PairAWPMDCut::min_xf_get(int /* ignore */) if (spin[i]) { min_var[7*i] = log(eradius[i]); min_varforce[7*i] = eradius[i]*erforce[i]; - for(int j=0;j<3;j++){ + for (int j=0;j<3;j++) { min_var[7*i+1+3*j] = v[i][j]; min_varforce[7*i+1+3*j] = vforce[i][j]; } @@ -697,7 +697,7 @@ void PairAWPMDCut::min_xf_get(int /* ignore */) min_varforce[7*i+6] = csforce[i][1]; } else { - for(int j=0;j<7;j++) + for (int j=0;j<7;j++) min_var[7*i+j] = min_varforce[7*i+j] = 0.0; } } @@ -717,9 +717,9 @@ void PairAWPMDCut::min_x_set(int /* ignore */) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (spin[i]){ + if (spin[i]) { eradius[i]=exp(min_var[7*i]); - for(int j=0;j<3;j++) + for (int j=0;j<3;j++) v[i][j]=min_var[7*i+1+3*j]; ervel[i]=min_var[7*i+4]; cs[i][0]=min_var[7*i+5]; diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index b3cf98a8f5..6a984edf60 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -804,7 +804,7 @@ int FixBocs::build_cubic_splines(double **data) double *a, *b, *d, *h, *alpha, *c, *l, *mu, *z; // 2020-07-17 ag: // valgrind says that we read/write a[n] down in the - // for(int j=n-1; j>=0; j--) loop below + // for (int j=n-1; j>=0; j--) loop below // and I agree. // So the size of a must be n+1, not n as was found // in the original code. @@ -858,7 +858,7 @@ int FixBocs::build_cubic_splines(double **data) c[n] = 0.0; d[n] = 0.0; - for(int j=n-1; j>=0; j--) + for (int j=n-1; j>=0; j--) { c[j] = z[j] - mu[j]*c[j+1]; diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index c5f40c41e5..96c3663ca0 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -115,7 +115,7 @@ static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me, if (me == 0) { int i, j; - for(i=0, j=0; i < num; ++i) { + for (i=0, j=0; i < num; ++i) { fprintf(fp,fmt,recvlist[i]); ++j; if (j == cols) { diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index b0c52b06fc..a241d084be 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -79,11 +79,11 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : // Define atom types for atomic scattering factor coefficients int iarg = 4; ztype = new int[ntypes]; - for (int i = 0; i < ntypes; i++){ + for (int i = 0; i < ntypes; i++) { ztype[i] = SAEDmaxType + 1; } for (int i=0; iprd; - if (periodicity[0]){ + if (periodicity[0]) { prd_inv[0] = 1 / prd[0]; ave_inv += prd_inv[0]; } - if (periodicity[1]){ + if (periodicity[1]) { prd_inv[1] = 1 / prd[1]; ave_inv += prd_inv[1]; } - if (periodicity[2]){ + if (periodicity[2]) { prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; } // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); - if (!periodicity[0]){ + if (!periodicity[0]) { prd_inv[0] = ave_inv; } - if (!periodicity[1]){ + if (!periodicity[1]) { prd_inv[1] = ave_inv; } - if (!periodicity[2]){ + if (!periodicity[2]) { prd_inv[2] = ave_inv; } } @@ -213,7 +213,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : double K[3]; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { for (int i = -Knmax[0]; i <= Knmax[0]; i++) { @@ -293,7 +293,7 @@ void ComputeSAED::init() int n = 0; // Zone 0 0 0 flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { for (int i = -Knmax[0]; i <= Knmax[0]; i++) { @@ -452,16 +452,16 @@ void ComputeSAED::compute_vector() // Calculate the atomic structure factor by type // determining parameter set to use based on S = sin(theta)/lambda <> 2 - for (int ii = 0; ii < ntypes; ii++){ + for (int ii = 0; ii < ntypes; ii++) { f[ii] = 0; - for (int C = 0; C < 5; C++){ + for (int C = 0; C < 5; C++) { int D = C + offset; f[ii] += ASFSAED[ztype[ii]][D] * exp(-1*ASFSAED[ztype[ii]][5+D] * SinTheta_lambda * SinTheta_lambda); } } // Evaluate the structure factor equation -- looping over all atoms - for (int ii = 0; ii < nlocalgroup; ii++){ + for (int ii = 0; ii < nlocalgroup; ii++) { typei=typelocal[ii]-1; inners = 2 * MY_PI * (K[0] * xlocal[3*ii+0] + K[1] * xlocal[3*ii+1] + K[2] * xlocal[3*ii+2]); diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index c168b032ca..3d3bc17c74 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -80,11 +80,11 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : // Define atom types for atomic scattering factor coefficients int iarg = 4; ztype = new int[ntypes]; - for (int i = 0; i < ntypes; i++){ + for (int i = 0; i < ntypes; i++) { ztype[i] = XRDmaxType + 1; } for (int i = 0; i < ntypes; i++) { - for(int j = 0; j < XRDmaxType; j++){ + for (int j = 0; j < XRDmaxType; j++) { if (strcasecmp(arg[iarg],XRDtypeList[j]) == 0) { ztype[i] = j; } @@ -109,7 +109,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : if (iarg+3 > narg) error->all(FLERR,"Illegal Compute XRD Command"); Min2Theta = atof(arg[iarg+1]) / 2; Max2Theta = atof(arg[iarg+2]) / 2; - if (Max2Theta > MY_PI ){ + if (Max2Theta > MY_PI ) { Min2Theta = Min2Theta * MY_PI / 180; // converting to radians if necessary Max2Theta = Max2Theta * MY_PI / 180; radflag = 0; @@ -162,28 +162,28 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : double ave_inv = 0.0; prd = domain->prd; - if (periodicity[0]){ + if (periodicity[0]) { prd_inv[0] = 1 / prd[0]; ave_inv += prd_inv[0]; } - if (periodicity[1]){ + if (periodicity[1]) { prd_inv[1] = 1 / prd[1]; ave_inv += prd_inv[1]; } - if (periodicity[2]){ + if (periodicity[2]) { prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; } // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); - if (!periodicity[0]){ + if (!periodicity[0]) { prd_inv[0] = ave_inv; } - if (!periodicity[1]){ + if (!periodicity[1]) { prd_inv[1] = ave_inv; } - if (!periodicity[2]){ + if (!periodicity[2]) { prd_inv[2] = ave_inv; } } @@ -261,7 +261,7 @@ void ComputeXRD::init() double ang = 0.0; double convf = 360 / MY_PI; - if (radflag ==1){ + if (radflag ==1) { convf = 1; } @@ -400,16 +400,16 @@ void ComputeXRD::compute_array() Fatom2 = 0.0; // Calculate the atomic structure factor by type - for (int ii = 0; ii < ntypes; ii++){ + for (int ii = 0; ii < ntypes; ii++) { f[ii] = 0; - for (int C = 0; C < 8 ; C+=2){ + for (int C = 0; C < 8 ; C+=2) { f[ii] += ASFXRD[ztype[ii]][C] * exp(-1 * ASFXRD[ztype[ii]][C+1] * SinTheta_lambda * SinTheta_lambda ); } f[ii] += ASFXRD[ztype[ii]][8]; } // Evaluate the structure factor equation -- looping over all atoms - for (int ii = 0; ii < nlocalgroup; ii++){ + for (int ii = 0; ii < nlocalgroup; ii++) { typei=typelocal[ii]-1; inners = 2 * MY_PI * (K[0] * xlocal[3*ii] + K[1] * xlocal[3*ii+1] + K[2] * xlocal[3*ii+2]); @@ -456,16 +456,16 @@ void ComputeXRD::compute_array() Fatom2 = 0.0; // Calculate the atomic structure factor by type - for (int ii = 0; ii < ntypes; ii++){ + for (int ii = 0; ii < ntypes; ii++) { f[ii] = 0; - for (int C = 0; C < 8 ; C+=2){ + for (int C = 0; C < 8 ; C+=2) { f[ii] += ASFXRD[ztype[ii]][C] * exp(-1 * ASFXRD[ztype[ii]][C+1] * SinTheta_lambda * SinTheta_lambda ); } f[ii] += ASFXRD[ztype[ii]][8]; } // Evaluate the structure factor equation -- looping over all atoms - for (int ii = 0; ii < nlocalgroup; ii++){ + for (int ii = 0; ii < nlocalgroup; ii++) { typei=typelocal[ii]-1; inners = 2 * MY_PI * (K[0] * xlocal[3*ii] + K[1] * xlocal[3*ii+1] + K[2] * xlocal[3*ii+2]); diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index e5480bfd33..0791b25aaa 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -56,7 +56,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : nvalues = 0; int iarg = 6; while (iarg < narg) { - if (strncmp(arg[iarg],"c_",2) == 0){ + if (strncmp(arg[iarg],"c_",2) == 0) { nvalues++; iarg++; } else break; @@ -153,7 +153,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // SAED specific paramaters needed int *periodicity = domain->periodicity; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { } else { R_Ewald = (1 / lambda); double Rnorm = R_Ewald/ sqrt(Zone[0] * Zone[0] + @@ -167,28 +167,28 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : double ave_inv = 0.0; prd = domain->prd; - if (periodicity[0]){ + if (periodicity[0]) { prd_inv[0] = 1 / prd[0]; ave_inv += prd_inv[0]; } - if (periodicity[1]){ + if (periodicity[1]) { prd_inv[1] = 1 / prd[1]; ave_inv += prd_inv[1]; } - if (periodicity[2]){ + if (periodicity[2]) { prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; } // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); - if (!periodicity[0]){ + if (!periodicity[0]) { prd_inv[0] = ave_inv; } - if (!periodicity[1]){ + if (!periodicity[1]) { prd_inv[1] = ave_inv; } - if (!periodicity[2]){ + if (!periodicity[2]) { prd_inv[2] = ave_inv; } @@ -200,7 +200,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : } // Find integer dimensions of the reciprocal lattice box bounds - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; Knmax[i] = ceil(Kmax / dK[i]); @@ -233,7 +233,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : r=0.0; for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0); r = sqrt(r); - if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ){ + if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ) { if ( i < Knmin[0] ) Knmin[0] = i; if ( j < Knmin[1] ) Knmin[1] = j; @@ -251,7 +251,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // Finding dimensions for vtk files for (int i=0; i<3; i++) { - if ( ( (Knmin[i] > 0) && (Knmax[i] > 0) ) || ( (Knmin[i] < 0) && (Knmax[i] < 0) ) ){ + if ( ( (Knmin[i] > 0) && (Knmax[i] > 0) ) || ( (Knmin[i] < 0) && (Knmax[i] < 0) ) ) { Dim[i] = abs( (int) Knmin[i] ) + abs( (int) Knmax[i] ); } else Dim[i] = abs( (int) Knmin[i] ) + abs( (int) Knmax[i] ) + 1; } @@ -452,7 +452,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) double K[3]; // Zone flag to capture entire recrocal space volume - if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ + if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ) { for (int k = Knmin[2]; k <= Knmax[2]; k++) { for (int j = Knmin[1]; j <= Knmax[1]; j++) { for (int i = Knmin[0]; i <= Knmax[0]; i++) { @@ -485,7 +485,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) r=0.0; for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0); r = sqrt(r); - if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ){ + if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ) { fprintf(fp,"%g\n",vector_total[NROW1]/norm); fflush(fp); NROW2++; diff --git a/src/USER-DPD/compute_dpd.cpp b/src/USER-DPD/compute_dpd.cpp index e92be891f1..437d4c9bc6 100644 --- a/src/USER-DPD/compute_dpd.cpp +++ b/src/USER-DPD/compute_dpd.cpp @@ -66,8 +66,8 @@ void ComputeDpd::compute_vector() for (int i = 0; i < size_vector; i++) dpdU[i] = 0.0; - for (int i = 0; i < nlocal; i++){ - if (mask[i] & groupbit){ + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { dpdU[0] += uCond[i]; dpdU[1] += uMech[i]; dpdU[2] += uChem[i]; diff --git a/src/USER-DPD/compute_dpd_atom.cpp b/src/USER-DPD/compute_dpd_atom.cpp index ae6b6217a3..8b203b4c0b 100644 --- a/src/USER-DPD/compute_dpd_atom.cpp +++ b/src/USER-DPD/compute_dpd_atom.cpp @@ -81,8 +81,8 @@ void ComputeDpdAtom::compute_peratom() array_atom = dpdAtom; } - for (int i = 0; i < nlocal; i++){ - if (mask[i] & groupbit){ + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { dpdAtom[i][0] = uCond[i]; dpdAtom[i][1] = uMech[i]; dpdAtom[i][2] = uChem[i]; diff --git a/src/USER-DPD/fix_dpd_energy.cpp b/src/USER-DPD/fix_dpd_energy.cpp index 9bbd9f59d8..dae250203d 100644 --- a/src/USER-DPD/fix_dpd_energy.cpp +++ b/src/USER-DPD/fix_dpd_energy.cpp @@ -63,7 +63,7 @@ void FixDPDenergy::initial_integrate(int /*vflag*/) double *duCond = pairDPDE->duCond; double *duMech = pairDPDE->duMech; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { uCond[i] += 0.5*update->dt*duCond[i]; uMech[i] += 0.5*update->dt*duMech[i]; } @@ -81,7 +81,7 @@ void FixDPDenergy::final_integrate() double *duCond = pairDPDE->duCond; double *duMech = pairDPDE->duMech; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { uCond[i] += 0.5*update->dt*duCond[i]; uMech[i] += 0.5*update->dt*duMech[i]; } diff --git a/src/USER-DPD/fix_eos_cv.cpp b/src/USER-DPD/fix_eos_cv.cpp index dabcfec46a..1bcdb9dbc6 100644 --- a/src/USER-DPD/fix_eos_cv.cpp +++ b/src/USER-DPD/fix_eos_cv.cpp @@ -30,7 +30,7 @@ FixEOScv::FixEOScv(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal fix eos/cv command"); cvEOS = utils::numeric(FLERR,arg[3],false,lmp); - if(cvEOS <= 0.0) error->all(FLERR,"EOS cv must be > 0.0"); + if (cvEOS <= 0.0) error->all(FLERR,"EOS cv must be > 0.0"); nevery = 1; @@ -58,14 +58,14 @@ void FixEOScv::init() double *uMech = atom->uMech; double *dpdTheta = atom->dpdTheta; - if(this->restart_reset){ + if (this->restart_reset) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) dpdTheta[i] = (uCond[i]+uMech[i])/cvEOS; } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); uCond[i] = 0.0; uMech[i] = cvEOS*dpdTheta[i]; @@ -84,9 +84,9 @@ void FixEOScv::post_integrate() double *dpdTheta = atom->dpdTheta; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { dpdTheta[i] = (uCond[i]+uMech[i])/cvEOS; - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } @@ -102,9 +102,9 @@ void FixEOScv::end_of_step() double *dpdTheta = atom->dpdTheta; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { dpdTheta[i] = (uCond[i]+uMech[i])/cvEOS; - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } diff --git a/src/USER-DPD/fix_eos_table.cpp b/src/USER-DPD/fix_eos_table.cpp index b827c1e42f..0d23f32b4e 100644 --- a/src/USER-DPD/fix_eos_table.cpp +++ b/src/USER-DPD/fix_eos_table.cpp @@ -111,14 +111,14 @@ void FixEOStable::init() double *dpdTheta = atom->dpdTheta; double tmp; - if(this->restart_reset){ + if (this->restart_reset) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) temperature_lookup(uCond[i]+uMech[i],dpdTheta[i]); } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); energy_lookup(dpdTheta[i],tmp); uCond[i] = 0.0; @@ -138,9 +138,9 @@ void FixEOStable::post_integrate() double *dpdTheta = atom->dpdTheta; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { temperature_lookup(uCond[i]+uMech[i],dpdTheta[i]); - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } @@ -156,9 +156,9 @@ void FixEOStable::end_of_step() double *dpdTheta = atom->dpdTheta; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { temperature_lookup(uCond[i]+uMech[i],dpdTheta[i]); - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } @@ -406,7 +406,7 @@ void FixEOStable::energy_lookup(double t, double &u) double fraction; Table *tb = &tables[0]; - if(t < tb->lo || t > tb->hi){ + if (t < tb->lo || t > tb->hi) { printf("Temperature=%lf TableMin=%lf TableMax=%lf\n",t,tb->lo,tb->hi); error->one(FLERR,"Temperature is not within table cutoffs"); } @@ -428,7 +428,7 @@ void FixEOStable::temperature_lookup(double u, double &t) double fraction; Table *tb = &tables[1]; - if(u < tb->lo || u > tb->hi){ + if (u < tb->lo || u > tb->hi) { printf("Energy=%lf TableMin=%lf TableMax=%lf\n",u,tb->lo,tb->hi); error->one(FLERR,"Energy is not within table cutoffs"); } diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index 6193effe62..28cd4eb4c3 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -54,7 +54,7 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (utils::strmatch(modify->fix[i]->style,"^rx")) { rx_flag = true; nspecies = atom->nspecies_dpd; - if(nspecies==0) error->all(FLERR,"There are no rx species specified."); + if (nspecies==0) error->all(FLERR,"There are no rx species specified."); } if (strcmp(arg[3],"linear") == 0) tabstyle = LINEAR; @@ -70,7 +70,7 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : int me; MPI_Comm_rank(world,&me); - for (int ii=0;iisrealloc(tables,(ntables+1)*sizeof(Table),"eos:table/rx"); tables2 = (Table *) @@ -91,7 +91,7 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (me == 0) read_table(tb,tb2,arg[4],arg[6]); - for (int ii=0;iiuCG; double *uCGnew = atom->uCGnew; - if(!this->restart_reset){ + if (!this->restart_reset) { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { duChem = uCG[i] - uCGnew[i]; uChem[i] += duChem; uCG[i] = 0.0; @@ -222,14 +222,14 @@ void FixEOStableRX::init() double *dpdTheta = atom->dpdTheta; double tmp; - if(this->restart_reset){ + if (this->restart_reset) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) temperature_lookup(i,uCond[i]+uMech[i]+uChem[i],dpdTheta[i]); } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); energy_lookup(i,dpdTheta[i],tmp); uCond[i] = 0.0; @@ -252,9 +252,9 @@ void FixEOStableRX::post_integrate() double *dpdTheta = atom->dpdTheta; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { temperature_lookup(i,uCond[i]+uMech[i]+uChem[i],dpdTheta[i]); - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } @@ -277,7 +277,7 @@ void FixEOStableRX::end_of_step() comm->reverse_comm_fix(this); for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { duChem = uCG[i] - uCGnew[i]; uChem[i] += duChem; uCG[i] = 0.0; @@ -288,9 +288,9 @@ void FixEOStableRX::end_of_step() comm->forward_comm_fix(this); for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { temperature_lookup(i,uCond[i]+uMech[i]+uChem[i],dpdTheta[i]); - if(dpdTheta[i] <= 0.0) + if (dpdTheta[i] <= 0.0) error->one(FLERR,"Internal temperature <= zero"); } } @@ -371,9 +371,9 @@ void FixEOStableRX::read_file(char *file) for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; - if (ispecies < nspecies){ + if (ispecies < nspecies) { dHf[ispecies] = atof(words[1]); - if(nwords > min_params_per_line+1){ + if (nwords > min_params_per_line+1) { energyCorr[ispecies] = atof(words[2]); tempCorrCoeff[ispecies] = atof(words[3]); moleculeCorrCoeff[ispecies] = atof(words[4]); @@ -451,7 +451,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) memory->create(tb2->rfile,tb2->ninput,"eos:rfile"); memory->create(tb2->efile,tb2->ninput,"eos:efile"); - for (int ispecies=1;ispeciesninput = tb->ninput; @@ -476,7 +476,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) utils::sfgets(FLERR,line,MAXLINE,fp,file,error); nwords = utils::count_words(utils::trim_comment(line)); - if(nwords != nspecies+2){ + if (nwords != nspecies+2) { printf("nwords=%d nspecies=%d\n",nwords,nspecies); error->all(FLERR,"Illegal fix eos/table/rx command"); } @@ -485,7 +485,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); - for (int icolumn=0;icolumnone(FLERR,"Invalid keyword in fix eos/table/rx parameters"); word = strtok(nullptr," \t\n\r\f"); - if(rx_flag){ + if (rx_flag) { while (word) { for (ispecies = 0; ispecies < nspecies; ispecies++) - if (strcmp(word,&atom->dname[ispecies][0]) == 0){ + if (strcmp(word,&atom->dname[ispecies][0]) == 0) { eosSpecies[ncolumn] = ispecies; ncolumn++; break; } - if (ispecies == nspecies){ + if (ispecies == nspecies) { printf("name=%s not found in species list\n",word); error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); } @@ -596,9 +596,9 @@ void FixEOStableRX::param_extract(Table *tb, char *line) } for (int icolumn = 0; icolumn < ncolumn; icolumn++) - if(eosSpecies[icolumn]==-1) + if (eosSpecies[icolumn]==-1) error->one(FLERR,"EOS data is missing from fix eos/table/rx tabe"); - if(ncolumn != nspecies){ + if (ncolumn != nspecies) { printf("ncolumns=%d nspecies=%d\n",ncolumn,nspecies); error->one(FLERR,"The number of columns in fix eos/table/rx does not match the number of species"); } @@ -703,10 +703,10 @@ void FixEOStableRX::energy_lookup(int id, double thetai, double &ui) nTotalPG = 0.0; nPG = 0; - if(rx_flag){ - for(int ispecies=0;ispeciesdvector[ispecies][id]; - if(fabs(moleculeCorrCoeff[ispecies]) > tolerance){ + if (fabs(moleculeCorrCoeff[ispecies]) > tolerance) { nPG++; nTotalPG += atom->dvector[ispecies][id]; } @@ -715,7 +715,7 @@ void FixEOStableRX::energy_lookup(int id, double thetai, double &ui) nTotal = 1.0; } - for(int ispecies=0;ispecieslo); thetai = MIN(thetai,tb->hi); @@ -728,9 +728,9 @@ void FixEOStableRX::energy_lookup(int id, double thetai, double &ui) uTmp += dHf[ispecies]; uTmp += tempCorrCoeff[ispecies]*thetai; // temperature correction uTmp += energyCorr[ispecies]; // energy correction - if(nPG > 0) ui += moleculeCorrCoeff[ispecies]*nTotalPG/double(nPG); // molecule correction + if (nPG > 0) ui += moleculeCorrCoeff[ispecies]*nTotalPG/double(nPG); // molecule correction - if(rx_flag) nMolecules = atom->dvector[ispecies][id]; + if (rx_flag) nMolecules = atom->dvector[ispecies][id]; else nMolecules = 1.0; ui += nMolecules*uTmp; } @@ -756,7 +756,7 @@ void FixEOStableRX::temperature_lookup(int id, double ui, double &thetai) // Store the current thetai in t1 t1 = MAX(thetai,tb->lo); t1 = MIN(t1,tb->hi); - if(t1==tb->hi) delta = -delta; + if (t1==tb->hi) delta = -delta; // Compute u1 at thetai energy_lookup(id,t1,u1); @@ -774,9 +774,9 @@ void FixEOStableRX::temperature_lookup(int id, double ui, double &thetai) f2 = u2 - ui; // Apply the Secant Method - for(it=0; itone(FLERR,"NaN detected in secant solver."); + for (it=0; itone(FLERR,"NaN detected in secant solver."); temp = t1; temp = MAX(temp,tb->lo); temp = MIN(temp,tb->hi); @@ -786,17 +786,17 @@ void FixEOStableRX::temperature_lookup(int id, double ui, double &thetai) break; } temp = t2 - f2*(t2-t1)/(f2-f1); - if(fabs(temp-t2) < tolerance) break; + if (fabs(temp-t2) < tolerance) break; f1 = f2; t1 = t2; t2 = temp; energy_lookup(id,t2,u2); f2 = u2 - ui; } - if(it==maxit){ + if (it==maxit) { char str[256]; sprintf(str,"Maxit exceeded in secant solver: id=%d ui=%lf thetai=%lf t1=%lf t2=%lf f1=%lf f2=%lf\n",id,ui,thetai,t1,t2,f1,f2); - if(std::isnan(f1) || std::isnan(f2) || std::isnan(ui) || std::isnan(thetai) || std::isnan(t1) || std::isnan(t2)) + if (std::isnan(f1) || std::isnan(f2) || std::isnan(ui) || std::isnan(thetai) || std::isnan(t1) || std::isnan(t2)) error->one(FLERR,"NaN detected in secant solver."); error->one(FLERR,str); } @@ -833,7 +833,7 @@ void FixEOStableRX::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n ; - for (ii = first; ii < last; ii++){ + for (ii = first; ii < last; ii++) { uChem[ii] = buf[m++]; uCG[ii] = buf[m++]; uCGnew[ii] = buf[m++]; diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index 4f7edfe14a..ad3bf7c30c 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -99,11 +99,11 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : { char *word = arg[iarg++]; - if (strcmp(word,"none") == 0){ + if (strcmp(word,"none") == 0) { wtFlag = 0; localTempFlag = NONE; } - else if (strcmp(word,"lucy") == 0){ + else if (strcmp(word,"lucy") == 0) { wtFlag = LUCY; localTempFlag = HARMONIC; } @@ -127,7 +127,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, errmsg); } - if (comm->me == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { std::string msg = "FixRX: matrix format is "; if (useSparseKinetics) msg += std::string("sparse"); @@ -164,25 +164,25 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : absTol = 1.0e-8; diagnosticFrequency = 0; - for (int i = 0; i < numDiagnosticCounters; ++i){ + for (int i = 0; i < numDiagnosticCounters; ++i) { diagnosticCounter[i] = 0; diagnosticCounterPerODE[i] = nullptr; } - if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg==8){ + if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg==8) { char *word = arg[iarg++]; minSteps = atoi( word ); - if (comm->me == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { char msg[128]; sprintf(msg, "FixRX: RK4 numSteps= %d", minSteps); error->message(FLERR, msg); } } - else if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg>8){ + else if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg>8) { error->all(FLERR,"Illegal fix rx command. Too many arguments for RK4 solver."); } - else if (odeIntegrationFlag == ODE_LAMMPS_RKF45){ + else if (odeIntegrationFlag == ODE_LAMMPS_RKF45) { // Must have four options. if (narg < 11) error->all(FLERR,"Illegal fix rx command. Too few arguments for RKF45 solver."); @@ -198,7 +198,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : // maxIters must be at least minSteps. maxIters = std::max( minSteps, maxIters ); - if (comm->me == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { //printf("FixRX: RKF45 minSteps= %d maxIters= %d absTol= %e relTol= %e\n", minSteps, maxIters, absTol, relTol); char msg[128]; sprintf(msg, "FixRX: RKF45 minSteps= %d maxIters= %d relTol= %.1e absTol= %.1e diagnosticFrequency= %d", minSteps, maxIters, relTol, absTol, diagnosticFrequency); @@ -224,7 +224,7 @@ FixRX::~FixRX() if (copymode) return; // De-Allocate memory to prevent memory leak - for (int ii = 0; ii < nreactions; ii++){ + for (int ii = 0; ii < nreactions; ii++) { delete [] stoich[ii]; delete [] stoichReactants[ii]; delete [] stoichProducts[ii]; @@ -240,7 +240,7 @@ FixRX::~FixRX() delete [] id_fix_species; delete [] id_fix_species_old; - if (useSparseKinetics){ + if (useSparseKinetics) { memory->destroy( sparseKinetics_nu ); memory->destroy( sparseKinetics_nuk ); memory->destroy( sparseKinetics_inu ); @@ -258,7 +258,7 @@ void FixRX::post_constructor() char **tmpspecies = new char*[maxspecies]; int tmpmaxstrlen = 0; - for(int jj=0; jj < maxspecies; jj++) + for (int jj=0; jj < maxspecies; jj++) tmpspecies[jj] = nullptr; // open file on proc 0 @@ -304,17 +304,17 @@ void FixRX::post_constructor() nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != nullptr){ + while (word != nullptr) { word = strtok(nullptr, " \t\n\r\f"); match=false; - for(int jj=0;jj=maxspecies) + if (!match) { + if (nUniqueSpecies+1>=maxspecies) error->all(FLERR,"Exceeded the maximum number of species permitted in fix rx."); tmpspecies[nUniqueSpecies] = new char[strlen(word)+1]; strcpy(tmpspecies[nUniqueSpecies],word); @@ -322,7 +322,7 @@ void FixRX::post_constructor() nUniqueSpecies++; } word = strtok(nullptr, " \t\n\r\f"); - if(strcmp(word,"+") != 0 && strcmp(word,"=") != 0) break; + if (strcmp(word,"+") != 0 && strcmp(word,"=") != 0) break; word = strtok(nullptr, " \t\n\r\f"); } } @@ -355,7 +355,7 @@ void FixRX::post_constructor() newarg2[2] = (char *) "property/atom"; char *str1 = new char[tmpmaxstrlen+3]; char *str2 = new char[tmpmaxstrlen+6]; - for(int ii=0; iiadd_fix(nspecies+5,newarg2,1); fix_species_old = (FixPropertyAtom *) modify->fix[modify->nfix-1]; - if(nspecies==0) error->all(FLERR,"There are no rx species specified."); + if (nspecies==0) error->all(FLERR,"There are no rx species specified."); - for(int jj=0;jjme == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { for (int k = 0; k < nspecies; ++k) printf("atom->dname[%d]= %s\n", k, atom->dname[k]); printf("stoich[][]\n"); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { int nreac_i = 0, nprod_i = 0; printf("%d: ", i); - for (int k = 0; k < nspecies; ++k){ + for (int k = 0; k < nspecies; ++k) { printf(" %g", stoich[i][k]); if (stoich[i][k] < 0.0) nreac_i++; else if (stoich[i][k] > 0.0) nprod_i++; @@ -425,10 +425,10 @@ void FixRX::initSparse() } printf("stoichReactants[][]\n"); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { int nreac_i = 0; printf("%d: ", i); - for (int k = 0; k < nspecies; ++k){ + for (int k = 0; k < nspecies; ++k) { printf(" %g", stoichReactants[i][k]); if (stoichReactants[i][k] > 0.0) nreac_i++; } @@ -436,10 +436,10 @@ void FixRX::initSparse() } printf("stoichProducts[][]\n"); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { int nprod_i = 0; printf("%d: ", i); - for (int k = 0; k < nspecies; ++k){ + for (int k = 0; k < nspecies; ++k) { printf(" %g", stoichProducts[i][k]); if (stoichProducts[i][k] > 0.0) nprod_i++; } @@ -453,15 +453,15 @@ void FixRX::initSparse() int mxreac = 0; int mxspec = 0; int nIntegral = 0; - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { int nreac_i = 0, nprod_i = 0; std::string pstr, rstr; bool allAreIntegral = true; - for (int k = 0; k < nspecies; ++k){ + for (int k = 0; k < nspecies; ++k) { if (stoichReactants[i][k] == 0 and stoichProducts[i][k] == 0) nzeros++; - if (stoichReactants[i][k] > 0.0){ + if (stoichReactants[i][k] > 0.0) { allAreIntegral &= (std::fmod( stoichReactants[i][k], 1.0 ) == 0.0); nreac_i++; @@ -472,7 +472,7 @@ void FixRX::initSparse() sprintf(digit, "%4.1f ", stoichReactants[i][k]); rstr += digit; rstr += atom->dname[k]; } - if (stoichProducts[i][k] > 0.0){ + if (stoichProducts[i][k] > 0.0) { allAreIntegral &= (std::fmod( stoichProducts[i][k], 1.0 ) == 0.0); nprod_i++; @@ -494,7 +494,7 @@ void FixRX::initSparse() if (allAreIntegral) nIntegral++; } - if (comm->me == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { char msg[256]; sprintf(msg, "FixRX: Sparsity of Stoichiometric Matrix= %.1f%% non-zeros= %d nspecies= %d nreactions= %d maxReactants= %d maxProducts= %d maxSpecies= %d integralReactions= %d", 100*(double(nzeros) / (nspecies * nreactions)), nzeros, nspecies, nreactions, mxreac, mxprod, (mxreac + mxprod), SparseKinetics_enableIntegralReactions); error->message(FLERR, msg); @@ -510,16 +510,16 @@ void FixRX::initSparse() memory->create( sparseKinetics_nuk, nreactions, sparseKinetics_maxSpecies, "sparseKinetics_nuk"); for (int i = 0; i < nreactions; ++i) - for (int k = 0; k < sparseKinetics_maxSpecies; ++k){ + for (int k = 0; k < sparseKinetics_maxSpecies; ++k) { sparseKinetics_nu [i][k] = 0.0; sparseKinetics_nuk[i][k] = SparseKinetics_invalidIndex; // Initialize with an invalid index. } - if (SparseKinetics_enableIntegralReactions){ + if (SparseKinetics_enableIntegralReactions) { memory->create( sparseKinetics_inu, nreactions, sparseKinetics_maxSpecies, "sparseKinetics_inu"); memory->create( sparseKinetics_isIntegralReaction, nreactions, "sparseKinetics_isIntegralReaction"); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { sparseKinetics_isIntegralReaction[i] = false; for (int k = 0; k < sparseKinetics_maxSpecies; ++k) sparseKinetics_inu[i][k] = 0; @@ -530,19 +530,19 @@ void FixRX::initSparse() // Measure the distribution of the # of moles for the ::fastpowi function. std::vector nu_bin(10); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { int nreac_i = 0, nprod_i = 0; bool isIntegral_i = true; - for (int k = 0; k < nspecies; ++k){ - if (stoichReactants[i][k] > 0.0){ + for (int k = 0; k < nspecies; ++k) { + if (stoichReactants[i][k] > 0.0) { const int idx = nreac_i; sparseKinetics_nu [i][idx] = stoichReactants[i][k]; sparseKinetics_nuk[i][idx] = k; isIntegral_i &= (std::fmod( stoichReactants[i][k], 1.0 ) == 0.0); - if (SparseKinetics_enableIntegralReactions){ + if (SparseKinetics_enableIntegralReactions) { sparseKinetics_inu[i][idx] = (int)sparseKinetics_nu[i][idx]; - if (isIntegral_i){ + if (isIntegral_i) { if (sparseKinetics_inu[i][idx] >= (int)nu_bin.size()) nu_bin.resize( sparseKinetics_inu[i][idx] ); @@ -552,15 +552,15 @@ void FixRX::initSparse() nreac_i++; } - if (stoichProducts[i][k] > 0.0){ + if (stoichProducts[i][k] > 0.0) { const int idx = sparseKinetics_maxReactants + nprod_i; sparseKinetics_nu [i][idx] = stoichProducts[i][k]; sparseKinetics_nuk[i][idx] = k; isIntegral_i &= (std::fmod( sparseKinetics_nu[i][idx], 1.0 ) == 0.0); - if (SparseKinetics_enableIntegralReactions){ + if (SparseKinetics_enableIntegralReactions) { sparseKinetics_inu[i][idx] = (int) sparseKinetics_nu[i][idx]; - if (isIntegral_i){ + if (isIntegral_i) { if (sparseKinetics_inu[i][idx] >= (int)nu_bin.size()) nu_bin.resize( sparseKinetics_inu[i][idx] ); @@ -576,17 +576,17 @@ void FixRX::initSparse() sparseKinetics_isIntegralReaction[i] = isIntegral_i; } - if (comm->me == 0 and Verbosity > 1){ + if (comm->me == 0 and Verbosity > 1) { for (int i = 1; i < nu_bin.size(); ++i) if (nu_bin[i] > 0) printf("nu_bin[%d] = %d\n", i, nu_bin[i]); - for (int i = 0; i < nreactions; ++i){ + for (int i = 0; i < nreactions; ++i) { std::string pstr, rstr; - for (int kk = 0; kk < sparseKinetics_maxReactants; kk++){ + for (int kk = 0; kk < sparseKinetics_maxReactants; kk++) { const int k = sparseKinetics_nuk[i][kk]; - if (k != SparseKinetics_invalidIndex){ + if (k != SparseKinetics_invalidIndex) { if (rstr.length() > 0) rstr += " + "; @@ -600,9 +600,9 @@ void FixRX::initSparse() } } - for (int kk = sparseKinetics_maxReactants; kk < sparseKinetics_maxSpecies; kk++){ + for (int kk = sparseKinetics_maxReactants; kk < sparseKinetics_maxSpecies; kk++) { const int k = sparseKinetics_nuk[i][kk]; - if (k != SparseKinetics_invalidIndex){ + if (k != SparseKinetics_invalidIndex) { if (pstr.length() > 0) pstr += " + "; @@ -646,7 +646,7 @@ void FixRX::init() bool eos_flag = false; for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"eos/table/rx") == 0) eos_flag = true; - if(!eos_flag) error->all(FLERR,"fix rx requires fix eos/table/rx to be specified"); + if (!eos_flag) error->all(FLERR,"fix rx requires fix eos/table/rx to be specified"); // need a half neighbor list // built whenever re-neighboring occurs @@ -673,7 +673,7 @@ void FixRX::setup_pre_force(int /*vflag*/) int newton_pair = force->newton_pair; double tmp; - if(restartFlag){ + if (restartFlag) { restartFlag = 0; } else @@ -686,7 +686,7 @@ void FixRX::setup_pre_force(int /*vflag*/) double *rwork = new double[8*nspecies]; - if(localTempFlag){ + if (localTempFlag) { int count = nlocal + (newton_pair ? nghost : 0); dpdThetaLocal = new double[count]; memset(dpdThetaLocal, 0, sizeof(double)*count); @@ -694,16 +694,16 @@ void FixRX::setup_pre_force(int /*vflag*/) } for (int id = 0; id < nlocal; id++) - for (int ispecies=0; ispeciesdvector[ispecies][id]; atom->dvector[ispecies+nspecies][id] = tmp; } for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { // Set the reaction rate constants to zero: no reactions occur at step 0 - for(int irxn=0;irxnforward_comm_fix(this); - if(localTempFlag) delete [] dpdThetaLocal; + if (localTempFlag) delete [] dpdThetaLocal; delete [] userData.kFor; delete [] userData.rxnRateLaw; @@ -734,7 +734,7 @@ void FixRX::pre_force(int /*vflag*/) double *dpdTheta = atom->dpdTheta; int newton_pair = force->newton_pair; - if(localTempFlag){ + if (localTempFlag) { int count = nlocal + (newton_pair ? nghost : 0); dpdThetaLocal = new double[count]; memset(dpdThetaLocal, 0, sizeof(double)*count); @@ -805,7 +805,7 @@ void FixRX::pre_force(int /*vflag*/) // Communicate the updated momenta and velocities to all nodes comm->forward_comm_fix(this); - if(localTempFlag) delete [] dpdThetaLocal; + if (localTempFlag) delete [] dpdThetaLocal; //TimerType timer_stop = getTimeStamp(); @@ -818,14 +818,14 @@ void FixRX::pre_force(int /*vflag*/) // getElapsedTime(timer_ODE, timer_stop), nlocal, nFuncs, nSteps); // Warn the user if a failure was detected in the ODE solver. - if (nFails > 0){ + if (nFails > 0) { char sbuf[128]; sprintf(sbuf,"in FixRX::pre_force, ODE solver failed for %d atoms.", nFails); error->warning(FLERR, sbuf); } // Compute and report ODE diagnostics, if requested. - if (odeIntegrationFlag == ODE_LAMMPS_RKF45 && diagnosticFrequency != 0){ + if (odeIntegrationFlag == ODE_LAMMPS_RKF45 && diagnosticFrequency != 0) { // Update the counters. diagnosticCounter[StepSum] += nSteps; diagnosticCounter[FuncSum] += nFuncs; @@ -907,14 +907,14 @@ void FixRX::read_file(char *file) stoich = new double*[nreactions]; stoichReactants = new double*[nreactions]; stoichProducts = new double*[nreactions]; - for (int ii=0;iidname[ispecies][0]) == 0){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { + if (strcmp(word,&atom->dname[ispecies][0]) == 0) { stoich[nreactions][ispecies] += sign*tmpStoich; - if(sign<0.0) + if (sign<0.0) stoichReactants[nreactions][ispecies] += tmpStoich; else stoichProducts[nreactions][ispecies] += tmpStoich; break; } } - if(ispecies==nspecies){ + if (ispecies==nspecies) { if (comm->me) { fprintf(stderr,"%s mol fraction is not found in data file\n",word); fprintf(stderr,"nspecies=%d ispecies=%d\n",nspecies,ispecies); @@ -966,16 +966,16 @@ void FixRX::read_file(char *file) error->all(FLERR,"Illegal fix rx command"); } word = strtok(nullptr, " \t\n\r\f"); - if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); - if(strcmp(word,"=") == 0) sign = 1.0; - if(strcmp(word,"+") != 0 && strcmp(word,"=") != 0){ - if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if (word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if (strcmp(word,"=") == 0) sign = 1.0; + if (strcmp(word,"+") != 0 && strcmp(word,"=") != 0) { + if (word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Arr[nreactions] = atof(word); word = strtok(nullptr, " \t\n\r\f"); - if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if (word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); nArr[nreactions] = atof(word); word = strtok(nullptr, " \t\n\r\f"); - if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if (word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Ea[nreactions] = atof(word); sign = -1.0; break; @@ -1063,10 +1063,10 @@ void FixRX::rk4(int id, double *rwork, void* v_params) } // end for (int step... // Store the solution back in atom->dvector. - for (int ispecies = 0; ispecies < nspecies; ispecies++){ - if(y[ispecies] < -MY_EPSILON) + for (int ispecies = 0; ispecies < nspecies; ispecies++) { + if (y[ispecies] < -MY_EPSILON) error->one(FLERR,"Computed concentration in RK4 solver is < -10*DBL_EPSILON"); - else if(y[ispecies] < MY_EPSILON) + else if (y[ispecies] < MY_EPSILON) y[ispecies] = 0.0; atom->dvector[ispecies][id] = y[ispecies]; } @@ -1128,7 +1128,7 @@ void FixRX::rkf45_step (const int neq, const double h, double y[], double y_out[ // 1) rhs (0.0, y, f1, v_param); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f1[k] *= h; ytmp[k] = y[k] + c21 * f1[k]; } @@ -1136,7 +1136,7 @@ void FixRX::rkf45_step (const int neq, const double h, double y[], double y_out[ // 2) rhs(0.0, ytmp, f2, v_param); - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { f2[k] *= h; ytmp[k] = y[k] + c31 * f1[k] + c32 * f2[k]; } @@ -1232,7 +1232,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/, // Compute WRMS norm of y'' double yddnrm = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { double ydd = (ydot1[k] - ydot[k]) / hg; double wterr = ydd / (relTol * fabs( y[k] ) + absTol); yddnrm += wterr * wterr; @@ -1244,7 +1244,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/, //std::cout << "ydot " << ydot[neq-1] << std::endl; // should we accept this? - if (hnew_is_ok || iter == max_iters){ + if (hnew_is_ok || iter == max_iters) { hnew = hg; if (iter == max_iters) fprintf(stderr, "ERROR_HIN_MAX_ITERS\n"); @@ -1319,7 +1319,7 @@ void FixRX::odeDiagnostics(void) double max_per_proc[numCounters]; double min_per_proc[numCounters]; - if(1) + if (1) { static bool firstStep = true; @@ -1392,7 +1392,7 @@ void FixRX::odeDiagnostics(void) } // Compute counters per dpd time-step. - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { my_vals[i] = this->diagnosticCounter[i] / nTimes; //printf("my sum[%d] = %f %d\n", i, my_vals[i], comm->me); } @@ -1407,7 +1407,7 @@ void FixRX::odeDiagnostics(void) double avg_per_atom[numCounters], avg_per_proc[numCounters]; // Averages per-ODE and per-proc per time-step. - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { avg_per_atom[i] = sums[i] / nODEs; avg_per_proc[i] = sums[i] / comm->nprocs; } @@ -1415,7 +1415,7 @@ void FixRX::odeDiagnostics(void) // Sum up the differences from each task. double sum_sq[2*numCounters]; double my_sum_sq[2*numCounters]; - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { double diff_i = my_vals[i] - avg_per_proc[i]; my_sum_sq[i] = diff_i * diff_i; } @@ -1423,20 +1423,20 @@ void FixRX::odeDiagnostics(void) double max_per_ODE[numCounters], min_per_ODE[numCounters]; // Process the per-ODE RMS of the # of steps/funcs - if (diagnosticFrequency == 1){ + if (diagnosticFrequency == 1) { double my_max[numCounters], my_min[numCounters]; const int nlocal = atom->nlocal; const int *mask = atom->mask; - for (int i = 0; i < numCounters; ++i){ + for (int i = 0; i < numCounters; ++i) { my_sum_sq[i+numCounters] = 0; my_max[i] = 0; my_min[i] = DBL_MAX; - if (diagnosticCounterPerODE[i] != nullptr){ + if (diagnosticCounterPerODE[i] != nullptr) { for (int j = 0; j < nlocal; ++j) - if (mask[j] & groupbit){ + if (mask[j] & groupbit) { double diff = double(diagnosticCounterPerODE[i][j]) - avg_per_atom[i]; my_sum_sq[i+numCounters] += diff*diff; @@ -1457,7 +1457,7 @@ void FixRX::odeDiagnostics(void) TimerType timer_stop = getTimeStamp(); double time_local = getElapsedTime( timer_start, timer_stop ); - if (comm->me == 0){ + if (comm->me == 0) { char smesg[128]; #define print_mesg(smesg) {\ @@ -1471,7 +1471,7 @@ void FixRX::odeDiagnostics(void) print_mesg(smesg); // only valid for single time-step! - if (diagnosticFrequency == 1){ + if (diagnosticFrequency == 1) { double rms_per_ODE[numCounters]; for (int i = 0; i < numCounters; ++i) rms_per_ODE[i] = sqrt( sum_sq[i+numCounters] / nODEs ); @@ -1489,7 +1489,7 @@ void FixRX::odeDiagnostics(void) sprintf(smesg, " AVG per Proc : %-12.5g | %-12.5g | %-12.5g | %-12.5g", avg_per_proc[StepSum], avg_per_proc[FuncSum], avg_per_proc[TimeSum], avg_per_proc[AtomSum]); print_mesg(smesg); - if (comm->nprocs > 1){ + if (comm->nprocs > 1) { double rms_per_proc[numCounters]; for (int i = 0; i < numCounters; ++i) rms_per_proc[i] = sqrt( sum_sq[i] / comm->nprocs ); @@ -1534,7 +1534,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) const int neq = nspecies; // Update ConcOld and initialize the ODE solution vector y[]. - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { const double tmp = atom->dvector[ispecies][id]; atom->dvector[ispecies+nspecies][id] = tmp; y[ispecies] = tmp; @@ -1563,7 +1563,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) double t = 0.0; - if (h < h_min){ + if (h < h_min) { //fprintf(stderr,"hin not implemented yet\n"); //exit(-1); nfe = rkf45_h0 (neq, t, t_stop, h_min, h_max, h, y, y + neq, v_param); @@ -1572,7 +1572,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) //printf("t= %e t_stop= %e h= %e\n", t, t_stop, h); // Integrate until we reach the end time. - while (fabs(t - t_stop) > tround){ + while (fabs(t - t_stop) > tround) { double *yout = y + neq; double *eout = yout + neq; @@ -1582,7 +1582,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) // Estimate the solution error. // ... weighted 2-norm of the error. double err2 = 0.0; - for (int k = 0; k < neq; k++){ + for (int k = 0; k < neq; k++) { const double wterr = eout[k] / (relTol * fabs( y[k] ) + absTol); err2 += wterr * wterr; } @@ -1590,7 +1590,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) double err = fmax( uround, sqrt( err2 / double(nspecies) )); // Accept the solution? - if (err <= 1.0 || h <= h_min){ + if (err <= 1.0 || h <= h_min) { t += h; nst++; @@ -1623,7 +1623,7 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) nit++; nfe += 6; - if (maxIters && nit > maxIters){ + if (maxIters && nit > maxIters) { //fprintf(stderr,"atom[%d] took too many iterations in rkf45 %d %e %e\n", id, nit, t, t_stop); //nFails ++; ode_counter[3] ++; @@ -1638,17 +1638,17 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) ode_counter[2] += nfe; //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != nullptr) - if (diagnosticCounterPerODE[StepSum] != nullptr){ + if (diagnosticCounterPerODE[StepSum] != nullptr) { diagnosticCounterPerODE[StepSum][id] = nst; diagnosticCounterPerODE[FuncSum][id] = nfe; } //printf("id= %d nst= %d nit= %d\n", id, nst, nit); // Store the solution back in atom->dvector. - for (int ispecies = 0; ispecies < nspecies; ispecies++){ - if(y[ispecies] < -1.0e-10) + for (int ispecies = 0; ispecies < nspecies; ispecies++) { + if (y[ispecies] < -1.0e-10) error->one(FLERR,"Computed concentration in RKF45 solver is < -1.0e-10"); - else if(y[ispecies] < MY_EPSILON) + else if (y[ispecies] < MY_EPSILON) y[ispecies] = 0.0; atom->dvector[ispecies][id] = y[ispecies]; } @@ -1677,14 +1677,14 @@ int FixRX::rhs_dense(double /*t*/, const double *y, double *dydt, void *params) const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; const int nspecies = atom->nspecies_dpd; - for(int ispecies=0; ispeciesreverse_comm_fix(this); // self-interaction for local temperature - for (i = 0; i < nlocal; i++){ + for (i = 0; i < nlocal; i++) { // Lucy Weight Function - if(wtFlag==LUCY){ + if (wtFlag==LUCY) { wij = 1.0; dpdThetaLocal[i] += wij / dpdTheta[i]; } @@ -1874,7 +1874,7 @@ void FixRX::computeLocalTemperature() // Normalized local temperature dpdThetaLocal[i] = dpdThetaLocal[i] / sumWeights[i]; - if(localTempFlag == HARMONIC) + if (localTempFlag == HARMONIC) dpdThetaLocal[i] = 1.0 / dpdThetaLocal[i]; } @@ -1892,7 +1892,7 @@ int FixRX::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, in m = 0; for (ii = 0; ii < n; ii++) { jj = list[ii]; - for(int ispecies=0;ispeciesdvector[ispecies][jj]; buf[m++] = tmp; tmp = atom->dvector[ispecies+nspecies][jj]; @@ -1911,8 +1911,8 @@ void FixRX::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n ; - for (ii = first; ii < last; ii++){ - for(int ispecies=0;ispeciesdvector[ispecies][ii] = tmp; tmp = buf[m++]; diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index 98e043fe08..e5bccf4192 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -99,7 +99,7 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); maxRNG = 0; - if(pairDPDE){ + if (pairDPDE) { comm_forward = 3; comm_reverse = 5; } else { @@ -107,7 +107,7 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; } - if(pairDPD == nullptr && pairDPDE == nullptr) + if (pairDPD == nullptr && pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow"); } @@ -159,10 +159,10 @@ void FixShardlow::setup(int /*vflag*/) strstr(modify->fix[i]->style,"gle") || strstr(modify->fix[i]->style,"gld")) error->all(FLERR,"Cannot use constant temperature integration routines with USER-DPD."); - for (int i = 0; i < modify->nfix; i++){ + for (int i = 0; i < modify->nfix; i++) { if (utils::strmatch(modify->fix[i]->style,"^shardlow")) fixShardlow = true; - if (utils::strmatch(modify->fix[i]->style,"^nve") || utils::strmatch(modify->fix[i]->style,"^nph")){ - if(fixShardlow) break; + if (utils::strmatch(modify->fix[i]->style,"^nve") || utils::strmatch(modify->fix[i]->style,"^nph")) { + if (fixShardlow) break; else error->all(FLERR,"The deterministic integrator must follow fix shardlow in the input file."); } if (i == modify->nfix-1) error->all(FLERR,"A deterministic integrator (e.g. fix nve or fix nph) is required when using fix shardlow."); @@ -547,7 +547,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) if (domain->triclinic) error->all(FLERR,"Fix shardlow does not yet support triclinic geometries"); - if(rcut >= bbx || rcut >= bby || rcut>= bbz ) + if (rcut >= bbx || rcut >= bby || rcut>= bbz ) { char fmt[] = {"Shardlow algorithm requires sub-domain length > 2*(rcut+skin). Either reduce the number of processors requested, or change the cutoff/skin: rcut= %e bbx= %e bby= %e bbz= %e\n"}; char *msg = (char *) malloc(sizeof(fmt) + 4*15); @@ -611,7 +611,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) // Communicate the updated velocities to all nodes comm->forward_comm_fix(this); - if(useDPDE){ + if (useDPDE) { // Zero out the ghosts' uCond & uMech to be used as delta accumulators memset(&(atom->uCond[nlocal]), 0, sizeof(double)*nghost); memset(&(atom->uMech[nlocal]), 0, sizeof(double)*nghost); @@ -693,7 +693,7 @@ int FixShardlow::pack_reverse_comm(int n, int first, double *buf) buf[m++] = v[i][0] - v_t0[i - nlocal][0]; buf[m++] = v[i][1] - v_t0[i - nlocal][1]; buf[m++] = v[i][2] - v_t0[i - nlocal][2]; - if(pairDPDE){ + if (pairDPDE) { buf[m++] = uCond[i]; // for ghosts, this is an accumulated delta buf[m++] = uMech[i]; // for ghosts, this is an accumulated delta } @@ -717,7 +717,7 @@ void FixShardlow::unpack_reverse_comm(int n, int *list, double *buf) v[j][0] += buf[m++]; v[j][1] += buf[m++]; v[j][2] += buf[m++]; - if(pairDPDE){ + if (pairDPDE) { uCond[j] += buf[m++]; // add in the accumulated delta uMech[j] += buf[m++]; // add in the accumulated delta } diff --git a/src/USER-DPD/nbin_ssa.cpp b/src/USER-DPD/nbin_ssa.cpp index 81eeb68ceb..db3425c259 100644 --- a/src/USER-DPD/nbin_ssa.cpp +++ b/src/USER-DPD/nbin_ssa.cpp @@ -142,9 +142,9 @@ int NBinSSA::coord2ssaAIR(const double *x) if (x[0] < domain->sublo[0]) ix = -1; if (x[0] >= domain->subhi[0]) ix = 1; - if(iz < 0){ + if (iz < 0) { return -1; - } else if(iz == 0){ + } else if (iz == 0) { if (iy<0) return -1; // bottom left/middle/right if ((iy==0) && (ix<0) ) return -1; // left atoms if ((iy==0) && (ix==0)) return 0; // Locally owned atoms @@ -152,10 +152,10 @@ int NBinSSA::coord2ssaAIR(const double *x) if ((iy>0) && (ix==0)) return 1; // Top-middle atoms if ((iy>0) && (ix!=0)) return 3; // Top-right and top-left atoms } else { // iz > 0 - if((ix==0) && (iy==0)) return 4; // Back atoms - if((ix==0) && (iy!=0)) return 5; // Top-back and bottom-back atoms - if((ix!=0) && (iy==0)) return 6; // Left-back and right-back atoms - if((ix!=0) && (iy!=0)) return 7; // Back corner atoms + if ((ix==0) && (iy==0)) return 4; // Back atoms + if ((ix==0) && (iy!=0)) return 5; // Top-back and bottom-back atoms + if ((ix!=0) && (iy==0)) return 6; // Left-back and right-back atoms + if ((ix!=0) && (iy!=0)) return 7; // Back corner atoms } return -2; diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index 98eb4e8315..a97abcc84c 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -420,7 +420,7 @@ void PairDPDfdtEnergy::init_style() bool eos_flag = false; for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^eos")) eos_flag = true; - if(!eos_flag) error->all(FLERR,"pair_style dpd/fdt/energy requires an EOS fix to be specified"); + if (!eos_flag) error->all(FLERR,"pair_style dpd/fdt/energy requires an EOS fix to be specified"); } /* ---------------------------------------------------------------------- diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index fa28c75f6c..d387ffa3c5 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -99,7 +99,7 @@ PairExp6rx::~PairExp6rx() memory->destroy(cutsq); memory->destroy(cut); } - if(scalingFlag == POLYNOMIAL){ + if (scalingFlag == POLYNOMIAL) { memory->destroy(coeffAlpha); memory->destroy(coeffEps); memory->destroy(coeffRm); @@ -306,8 +306,8 @@ void PairExp6rx::compute(int eflag, int vflag) fpairOldEXP6_12 = 0.0; fpairOldEXP6_21 = 0.0; - if(rmOld12_ij!=0.0 && rmOld21_ij!=0.0){ - if(alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0) + if (rmOld12_ij!=0.0 && rmOld21_ij!=0.0) { + if (alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0) error->all(FLERR,"alpha_ij is 6.0 in pair exp6"); // A3. Compute some convenient quantities for evaluating the force @@ -323,7 +323,7 @@ void PairExp6rx::compute(int eflag, int vflag) urc = buck1*(6.0*rCutExp - alphaOld12_ij*rm6ij*rCut6inv); durc = -buck1*buck2*(rCutExp* rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rmOld12_ij*func_rin(alphaOld12_ij); - if(r < rin1){ + if (r < rin1) { rin6 = rin1*rin1*rin1*rin1*rin1*rin1; rin6inv = 1.0/rin6; @@ -363,7 +363,7 @@ void PairExp6rx::compute(int eflag, int vflag) durc = -buck1*buck2*(rCutExp* rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rmOld21_ij*func_rin(alphaOld21_ij); - if(r < rin1){ + if (r < rin1) { rin6 = rin1*rin1*rin1*rin1*rin1*rin1; rin6inv = 1.0/rin6; @@ -400,8 +400,8 @@ void PairExp6rx::compute(int eflag, int vflag) uCG[j] += 0.5*evdwlOld; } - if(rm12_ij!=0.0 && rm21_ij!=0.0){ - if(alpha21_ij == 6.0 || alpha12_ij == 6.0) + if (rm12_ij!=0.0 && rm21_ij!=0.0) { + if (alpha21_ij == 6.0 || alpha12_ij == 6.0) error->all(FLERR,"alpha_ij is 6.0 in pair exp6"); // A3. Compute some convenient quantities for evaluating the force @@ -418,7 +418,7 @@ void PairExp6rx::compute(int eflag, int vflag) durc = -buck1*buck2*(rCutExp*rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rm12_ij*func_rin(alpha12_ij); - if(r < rin1){ + if (r < rin1) { rin6 = rin1*rin1*rin1*rin1*rin1*rin1; rin6inv = 1.0/rin6; @@ -450,7 +450,7 @@ void PairExp6rx::compute(int eflag, int vflag) durc = -buck1*buck2*(rCutExp*rminv - rCutInv*rm6ij*rCut6inv); rin1 = shift*rm21_ij*func_rin(alpha21_ij); - if(r < rin1){ + if (r < rin1) { rin6 = rin1*rin1*rin1*rin1*rin1*rin1; rin6inv = 1.0/rin6; @@ -593,7 +593,7 @@ void PairExp6rx::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); nspecies = atom->nspecies_dpd; - if(nspecies==0) error->all(FLERR,"There are no rx species specified."); + if (nspecies==0) error->all(FLERR,"There are no rx species specified."); read_file(arg[2]); n = strlen(arg[3]) + 1; @@ -601,7 +601,7 @@ void PairExp6rx::coeff(int narg, char **arg) strcpy(site1,arg[3]); int ispecies; - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site1,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) @@ -611,7 +611,7 @@ void PairExp6rx::coeff(int narg, char **arg) site2 = new char[n]; strcpy(site2,arg[4]); - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site2,"1fluid") != 0) @@ -664,13 +664,13 @@ void PairExp6rx::coeff(int narg, char **arg) setup(); double cut_one = cut_global; - if (strcmp(arg[5],"exponent") == 0){ + if (strcmp(arg[5],"exponent") == 0) { scalingFlag = EXPONENT; exponentR = utils::numeric(FLERR,arg[6],false,lmp); exponentEpsilon = utils::numeric(FLERR,arg[7],false,lmp); if (narg > 9) error->all(FLERR,"Incorrect args for pair coefficients"); if (narg == 9) cut_one = utils::numeric(FLERR,arg[8],false,lmp); - } else if (strcmp(arg[5],"polynomial") == 0){ + } else if (strcmp(arg[5],"polynomial") == 0) { scalingFlag = POLYNOMIAL; memory->create(coeffAlpha,6,"pair:coeffAlpha"); memory->create(coeffEps,6,"pair:coeffEps"); @@ -678,7 +678,7 @@ void PairExp6rx::coeff(int narg, char **arg) read_file2(arg[6]); if (narg > 8) error->all(FLERR,"Incorrect args for pair coefficients"); if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); - } else if (strcmp(arg[5],"none") == 0){ + } else if (strcmp(arg[5],"none") == 0) { scalingFlag = NONE; if (narg > 7) error->all(FLERR,"Incorrect args for pair coefficients"); if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); @@ -813,7 +813,7 @@ void PairExp6rx::read_file(char *file) n = strlen(words[1]) + 1; params[nparams].potential = new char[n]; strcpy(params[nparams].potential,words[1]); - if (strcmp(params[nparams].potential,"exp6") == 0){ + if (strcmp(params[nparams].potential,"exp6") == 0) { params[nparams].alpha = atof(words[2]); params[nparams].epsilon = atof(words[3]); params[nparams].rm = atof(words[4]); @@ -901,15 +901,15 @@ void PairExp6rx::read_file2(char *file) words[nwords++] = strtok(line," \t\n\r\f"); while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; - if (strcmp(words[0],"alpha") == 0){ + if (strcmp(words[0],"alpha") == 0) { for (int ii=1; iidvector[ispecies][id]; nTotalOld += atom->dvector[ispecies+nspecies][id]; @@ -1062,7 +1062,7 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double nMoleculesOFA += atom->dvector[ispecies][id]; } } - if(nTotal < MY_EPSILON || nTotalOld < MY_EPSILON) + if (nTotal < MY_EPSILON || nTotalOld < MY_EPSILON) error->all(FLERR,"The number of molecules in CG particle is less than 10*DBL_EPSILON."); // Compute the mole fraction of molecules within the fluid portion of the particle (One Fluid Approximation) @@ -1074,7 +1074,7 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double if (iparam < 0 || params[iparam].potentialType != exp6PotentialType ) continue; // If Site1 matches a pure species, then grab the parameters - if (isite1 == params[iparam].ispecies){ + if (isite1 == params[iparam].ispecies) { rm1_old = params[iparam].rm; rm1 = params[iparam].rm; epsilon1_old = params[iparam].epsilon; @@ -1090,7 +1090,7 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double } // If Site2 matches a pure species, then grab the parameters - if (isite2 == params[iparam].ispecies){ + if (isite2 == params[iparam].ispecies) { rm2_old = params[iparam].rm; rm2 = params[iparam].rm; epsilon2_old = params[iparam].epsilon; @@ -1111,9 +1111,9 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double rmi = params[iparam].rm; epsiloni = params[iparam].epsilon; alphai = params[iparam].alpha; - if(nMoleculesOFAdvector[ispecies][id]/nMoleculesOFA; - if(nMoleculesOFAolddvector[ispecies+nspecies][id]/nMoleculesOFAold; for (int jspecies = 0; jspecies < nspecies; jspecies++) { @@ -1123,9 +1123,9 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double rmj = params[jparam].rm; epsilonj = params[jparam].epsilon; alphaj = params[jparam].alpha; - if(nMoleculesOFAdvector[jspecies][id]/nMoleculesOFA; - if(nMoleculesOFAolddvector[jspecies+nspecies][id]/nMoleculesOFAold; rmij = (rmi+rmj)/2.0; @@ -1133,12 +1133,12 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double epsilonij = sqrt(epsiloni*epsilonj); alphaij = sqrt(alphai*alphaj); - if(fractionOFAold > 0.0){ + if (fractionOFAold > 0.0) { rm3_old += xMolei_old*xMolej_old*rm3ij; epsilon_old += xMolei_old*xMolej_old*rm3ij*epsilonij; alpha_old += xMolei_old*xMolej_old*rm3ij*epsilonij*alphaij; } - if(fractionOFA > 0.0){ + if (fractionOFA > 0.0) { rm3 += xMolei*xMolej*rm3ij; epsilon += xMolei*xMolej*rm3ij*epsilonij; alpha += xMolei*xMolej*rm3ij*epsilonij*alphaij; @@ -1147,9 +1147,9 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double } } - if (isOneFluidApprox(isite1)){ + if (isOneFluidApprox(isite1)) { rm1 = cbrt(rm3); - if(rm1 < MY_EPSILON) { + if (rm1 < MY_EPSILON) { rm1 = 0.0; epsilon1 = 0.0; alpha1 = 0.0; @@ -1161,7 +1161,7 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double fraction1 = fractionOFA; rm1_old = cbrt(rm3_old); - if(rm1_old < MY_EPSILON) { + if (rm1_old < MY_EPSILON) { rm1_old = 0.0; epsilon1_old = 0.0; alpha1_old = 0.0; @@ -1172,18 +1172,18 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double nMoleculesOld1 = 1.0-(nTotalOld-nMoleculesOFAold); fractionOld1 = fractionOFAold; - if(scalingFlag == EXPONENT){ + if (scalingFlag == EXPONENT) { exponentScaling(nMoleculesOFA,epsilon1,rm1); exponentScaling(nMoleculesOFAold,epsilon1_old,rm1_old); - } else if(scalingFlag == POLYNOMIAL){ + } else if (scalingFlag == POLYNOMIAL) { polynomialScaling(nMoleculesOFA,alpha1,epsilon1,rm1); polynomialScaling(nMoleculesOFAold,alpha1_old,epsilon1_old,rm1_old); } } - if (isOneFluidApprox(isite2)){ + if (isOneFluidApprox(isite2)) { rm2 = cbrt(rm3); - if(rm2 < MY_EPSILON) { + if (rm2 < MY_EPSILON) { rm2 = 0.0; epsilon2 = 0.0; alpha2 = 0.0; @@ -1195,7 +1195,7 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double fraction2 = fractionOFA; rm2_old = cbrt(rm3_old); - if(rm2_old < MY_EPSILON) { + if (rm2_old < MY_EPSILON) { rm2_old = 0.0; epsilon2_old = 0.0; alpha2_old = 0.0; @@ -1206,46 +1206,46 @@ void PairExp6rx::getMixingWeights(int id,double &epsilon1,double &alpha1,double nMoleculesOld2 = 1.0-(nTotalOld-nMoleculesOFAold); fractionOld2 = fractionOFAold; - if(scalingFlag == EXPONENT){ + if (scalingFlag == EXPONENT) { exponentScaling(nMoleculesOFA,epsilon2,rm2); exponentScaling(nMoleculesOFAold,epsilon2_old,rm2_old); - } else if(scalingFlag == POLYNOMIAL){ + } else if (scalingFlag == POLYNOMIAL) { polynomialScaling(nMoleculesOFA,alpha2,epsilon2,rm2); polynomialScaling(nMoleculesOFAold,alpha2_old,epsilon2_old,rm2_old); } } // Check that no fractions are less than zero - if(fraction1 < 0.0 || nMolecules1 < 0.0){ - if(fraction1 < -MY_EPSILON || nMolecules1 < -MY_EPSILON){ + if (fraction1 < 0.0 || nMolecules1 < 0.0) { + if (fraction1 < -MY_EPSILON || nMolecules1 < -MY_EPSILON) { error->all(FLERR,"Computed fraction less than -10*DBL_EPSILON"); } nMolecules1 = 0.0; fraction1 = 0.0; } - if(fraction2 < 0.0 || nMolecules2 < 0.0){ - if(fraction2 < -MY_EPSILON || nMolecules2 < -MY_EPSILON){ + if (fraction2 < 0.0 || nMolecules2 < 0.0) { + if (fraction2 < -MY_EPSILON || nMolecules2 < -MY_EPSILON) { error->all(FLERR,"Computed fraction less than -10*DBL_EPSILON"); } nMolecules2 = 0.0; fraction2 = 0.0; } - if(fractionOld1 < 0.0 || nMoleculesOld1 < 0.0){ - if(fractionOld1 < -MY_EPSILON || nMoleculesOld1 < -MY_EPSILON){ + if (fractionOld1 < 0.0 || nMoleculesOld1 < 0.0) { + if (fractionOld1 < -MY_EPSILON || nMoleculesOld1 < -MY_EPSILON) { error->all(FLERR,"Computed fraction less than -10*DBL_EPSILON"); } nMoleculesOld1 = 0.0; fractionOld1 = 0.0; } - if(fractionOld2 < 0.0 || nMoleculesOld2 < 0.0){ - if(fractionOld2 < -MY_EPSILON || nMoleculesOld2 < -MY_EPSILON){ + if (fractionOld2 < 0.0 || nMoleculesOld2 < 0.0) { + if (fractionOld2 < -MY_EPSILON || nMoleculesOld2 < -MY_EPSILON) { error->all(FLERR,"Computed fraction less than -10*DBL_EPSILON"); } nMoleculesOld2 = 0.0; fractionOld2 = 0.0; } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; @@ -1264,17 +1264,17 @@ void PairExp6rx::exponentScaling(double phi, double &epsilon, double &rm) const { double powfuch; - if(exponentEpsilon < 0.0){ + if (exponentEpsilon < 0.0) { powfuch = pow(phi,-exponentEpsilon); - if(powfuchone(FLERR,"Density < table inner cutoff"); itable = static_cast (((rho[i]*rho[i]) - tb->innersq) * tb->invdelta); if (tabstyle == LOOKUP) evdwl = tb->e[itable]; - else if (tabstyle == LINEAR){ + else if (tabstyle == LINEAR) { if (itable >= tlm1) error->one(FLERR,"Density > table outer cutoff"); - if(itable==0) fraction_i=0.0; + if (itable==0) fraction_i=0.0; else fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta); evdwl = tb->e[itable] + fraction_i*tb->de[itable]; } else error->one(FLERR,"Only LOOKUP and LINEAR table styles have been implemented for pair multi/lucy"); diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index c4cc537b18..e1a263b7dc 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -193,7 +193,7 @@ void PairMultiLucyRX::compute(int eflag, int vflag) mixWtSite2old_j = mixWtSite2old[j]; tb = &tables[tabindex[itype][jtype]]; - if (rho[i]*rho[i] < tb->innersq || rho[j]*rho[j] < tb->innersq){ + if (rho[i]*rho[i] < tb->innersq || rho[j]*rho[j] < tb->innersq) { printf("Table inner cutoff = %lf\n",sqrt(tb->innersq)); printf("rho[%d]=%lf\n",i,rho[i]); printf("rho[%d]=%lf\n",j,rho[j]); @@ -202,7 +202,7 @@ void PairMultiLucyRX::compute(int eflag, int vflag) if (tabstyle == LOOKUP) { itable = static_cast (((rho[i]*rho[i]) - tb->innersq) * tb->invdelta); jtable = static_cast (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); - if (itable >= tlm1 || jtable >= tlm1){ + if (itable >= tlm1 || jtable >= tlm1) { printf("Table outer index = %d\n",tlm1); printf("itableIndex=%d rho[%d]=%lf\n",itable,i,rho[i]); printf("jtableIndex=%d rho[%d]=%lf\n",jtable,j,rho[j]); @@ -218,23 +218,23 @@ void PairMultiLucyRX::compute(int eflag, int vflag) } else if (tabstyle == LINEAR) { itable = static_cast ((rho[i]*rho[i] - tb->innersq) * tb->invdelta); jtable = static_cast (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); - if (itable >= tlm1 || jtable >= tlm1){ + if (itable >= tlm1 || jtable >= tlm1) { printf("Table outer index = %d\n",tlm1); printf("itableIndex=%d rho[%d]=%lf\n",itable,i,rho[i]); printf("jtableIndex=%d rho[%d]=%lf\n",jtable,j,rho[j]); error->one(FLERR,"Density > table outer cutoff"); } - if(itable<0) itable=0; - if(itable>=tlm1) itable=tlm1; - if(jtable<0) jtable=0; - if(jtable>=tlm1)jtable=tlm1; + if (itable<0) itable=0; + if (itable>=tlm1) itable=tlm1; + if (jtable<0) jtable=0; + if (jtable>=tlm1)jtable=tlm1; fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta); fraction_j = (((rho[j]*rho[j]) - tb->rsq[jtable]) * tb->invdelta); - if(itable==0) fraction_i=0.0; - if(itable==tlm1) fraction_i=0.0; - if(jtable==0) fraction_j=0.0; - if(jtable==tlm1) fraction_j=0.0; + if (itable==0) fraction_i=0.0; + if (itable==tlm1) fraction_i=0.0; + if (jtable==0) fraction_j=0.0; + if (jtable==tlm1) fraction_j=0.0; A_i = tb->f[itable] + fraction_i*tb->df[itable]; A_j = tb->f[jtable] + fraction_j*tb->df[jtable]; @@ -267,12 +267,12 @@ void PairMultiLucyRX::compute(int eflag, int vflag) tb = &tables[tabindex[itype][itype]]; itable = static_cast (((rho[i]*rho[i]) - tb->innersq) * tb->invdelta); if (tabstyle == LOOKUP) evdwl = tb->e[itable]; - else if (tabstyle == LINEAR){ - if (itable >= tlm1){ + else if (tabstyle == LINEAR) { + if (itable >= tlm1) { printf("itableIndex=%d rho[%d]=%lf\n",itable,i,rho[i]); error->one(FLERR,"Density > table outer cutoff"); } - if(itable==0) fraction_i=0.0; + if (itable==0) fraction_i=0.0; else fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta); evdwl = tb->e[itable] + fraction_i*tb->de[itable]; } else error->one(FLERR,"Only LOOKUP and LINEAR table styles have been implemented for pair multi/lucy/rx"); @@ -442,7 +442,7 @@ void PairMultiLucyRX::coeff(int narg, char **arg) else { isite1 = nspecies; for (int ispecies = 0; ispecies < nspecies; ++ispecies) - if (strcmp(site1, atom->dname[ispecies]) == 0){ + if (strcmp(site1, atom->dname[ispecies]) == 0) { isite1 = ispecies; break; } @@ -456,7 +456,7 @@ void PairMultiLucyRX::coeff(int narg, char **arg) else { isite2 = nspecies; for (int ispecies = 0; ispecies < nspecies; ++ispecies) - if (strcmp(site2, atom->dname[ispecies]) == 0){ + if (strcmp(site2, atom->dname[ispecies]) == 0) { isite2 = ispecies; break; } @@ -894,7 +894,7 @@ void PairMultiLucyRX::computeLocalDensity() // rho = density at each atom // loop over neighbors of my atoms - for (int ii = 0; ii < inum; ii++){ + for (int ii = 0; ii < inum; ii++) { const int i = ilist[ii]; const double xtmp = x[i][0]; @@ -907,7 +907,7 @@ void PairMultiLucyRX::computeLocalDensity() const int *jlist = firstneigh[i]; const int jnum = numneigh[i]; - for (int jj = 0; jj < jnum; jj++){ + for (int jj = 0; jj < jnum; jj++) { const int j = (jlist[jj] & NEIGHMASK); const int jtype = type[j]; @@ -960,44 +960,44 @@ void PairMultiLucyRX::getMixingWeights(int id, double &mixWtSite1old, double &mi nTotal = 0.0; nTotalOld = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { nTotal += atom->dvector[ispecies][id]; nTotalOld += atom->dvector[ispecies+nspecies][id]; } - if (isOneFluid(isite1) == false){ + if (isOneFluid(isite1) == false) { nMoleculesOld1 = atom->dvector[isite1+nspecies][id]; nMolecules1 = atom->dvector[isite1][id]; fractionOld1 = nMoleculesOld1/nTotalOld; fraction1 = nMolecules1/nTotal; } - if (isOneFluid(isite2) == false){ + if (isOneFluid(isite2) == false) { nMoleculesOld2 = atom->dvector[isite2+nspecies][id]; nMolecules2 = atom->dvector[isite2][id]; fractionOld2 = nMoleculesOld2/nTotalOld; fraction2 = nMolecules2/nTotal; } - if (isOneFluid(isite1) || isOneFluid(isite2)){ + if (isOneFluid(isite1) || isOneFluid(isite2)) { nMoleculesOFAold = 0.0; nMoleculesOFA = 0.0; fractionOFAold = 0.0; fractionOFA = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { if (isite1 == ispecies || isite2 == ispecies) continue; nMoleculesOFAold += atom->dvector[ispecies+nspecies][id]; nMoleculesOFA += atom->dvector[ispecies][id]; fractionOFAold += atom->dvector[ispecies+nspecies][id] / nTotalOld; fractionOFA += atom->dvector[ispecies][id] / nTotal; } - if (isOneFluid(isite1)){ + if (isOneFluid(isite1)) { nMoleculesOld1 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules1 = 1.0-(nTotal-nMoleculesOFA); fractionOld1 = fractionOFAold; fraction1 = fractionOFA; } - if (isOneFluid(isite2)){ + if (isOneFluid(isite2)) { nMoleculesOld2 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules2 = 1.0-(nTotal-nMoleculesOFA); fractionOld2 = fractionOFAold; @@ -1005,7 +1005,7 @@ void PairMultiLucyRX::getMixingWeights(int id, double &mixWtSite1old, double &mi } } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index c418ebd4b3..6c975c97f3 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -198,14 +198,14 @@ void PairTableRX::compute(int eflag, int vflag) if (tabstyle == LOOKUP) evdwl = tb->e[itable]; - else if (tabstyle == LINEAR || tabstyle == BITMAP){ + else if (tabstyle == LINEAR || tabstyle == BITMAP) { evdwl = tb->e[itable] + fraction*tb->de[itable]; } else evdwl = a * tb->e[itable] + b * tb->e[itable+1] + ((a*a*a-a)*tb->e2[itable] + (b*b*b-b)*tb->e2[itable+1]) * tb->deltasq6; - if (isite1 == isite2){ + if (isite1 == isite2) { evdwlOld = sqrt(mixWtSite1old_i*mixWtSite2old_j)*evdwl; evdwl = sqrt(mixWtSite1_i*mixWtSite2_j)*evdwl; } else { @@ -321,14 +321,14 @@ void PairTableRX::coeff(int narg, char **arg) bcast_table(tb); nspecies = atom->nspecies_dpd; - if(nspecies==0) error->all(FLERR,"There are no rx species specified."); + if (nspecies==0) error->all(FLERR,"There are no rx species specified."); int n; n = strlen(arg[4]) + 1; site1 = new char[n]; strcpy(site1,arg[4]); int ispecies; - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site1,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) @@ -338,7 +338,7 @@ void PairTableRX::coeff(int narg, char **arg) site2 = new char[n]; strcpy(site2,arg[5]); - for (ispecies = 0; ispecies < nspecies; ispecies++){ + for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; } if (ispecies == nspecies && strcmp(site2,"1fluid") != 0) @@ -405,8 +405,8 @@ void PairTableRX::coeff(int narg, char **arg) else { isite1 = nspecies; - for (int k = 0; k < nspecies; k++){ - if (strcmp(site1, atom->dname[k]) == 0){ + for (int k = 0; k < nspecies; k++) { + if (strcmp(site1, atom->dname[k]) == 0) { isite1 = k; break; } @@ -420,8 +420,8 @@ void PairTableRX::coeff(int narg, char **arg) else { isite2 = nspecies; - for (int k = 0; k < nspecies; k++){ - if (strcmp(site2, atom->dname[k]) == 0){ + for (int k = 0; k < nspecies; k++) { + if (strcmp(site2, atom->dname[k]) == 0) { isite2 = ispecies; break; } @@ -519,46 +519,46 @@ void PairTableRX::getMixingWeights(int id, double &mixWtSite1old, double &mixWtS nTotal = 0.0; nTotalOld = 0.0; - for (int ispecies = 0; ispecies < nspecies; ++ispecies){ + for (int ispecies = 0; ispecies < nspecies; ++ispecies) { nTotal += atom->dvector[ispecies][id]; nTotalOld += atom->dvector[ispecies+nspecies][id]; } - if(nTotal < MY_EPSILON || nTotalOld < MY_EPSILON) + if (nTotal < MY_EPSILON || nTotalOld < MY_EPSILON) error->all(FLERR,"The number of molecules in CG particle is less than 10*DBL_EPSILON."); - if (isOneFluid(isite1) == false){ + if (isOneFluid(isite1) == false) { nMoleculesOld1 = atom->dvector[isite1+nspecies][id]; nMolecules1 = atom->dvector[isite1][id]; fractionOld1 = nMoleculesOld1/nTotalOld; fraction1 = nMolecules1/nTotal; } - if (isOneFluid(isite2) == false){ + if (isOneFluid(isite2) == false) { nMoleculesOld2 = atom->dvector[isite2+nspecies][id]; nMolecules2 = atom->dvector[isite2][id]; fractionOld2 = nMoleculesOld2/nTotalOld; fraction2 = nMolecules2/nTotal; } - if (isOneFluid(isite1) || isOneFluid(isite2)){ + if (isOneFluid(isite1) || isOneFluid(isite2)) { nMoleculesOFAold = 0.0; nMoleculesOFA = 0.0; fractionOFAold = 0.0; fractionOFA = 0.0; - for (int ispecies = 0; ispecies < nspecies; ispecies++){ + for (int ispecies = 0; ispecies < nspecies; ispecies++) { if (isite1 == ispecies || isite2 == ispecies) continue; nMoleculesOFAold += atom->dvector[ispecies+nspecies][id]; nMoleculesOFA += atom->dvector[ispecies][id]; fractionOFAold += atom->dvector[ispecies+nspecies][id]/nTotalOld; fractionOFA += atom->dvector[ispecies][id]/nTotal; } - if(isOneFluid(isite1)){ + if (isOneFluid(isite1)) { nMoleculesOld1 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules1 = 1.0-(nTotal-nMoleculesOFA); fractionOld1 = fractionOFAold; fraction1 = fractionOFA; } - if(isOneFluid(isite2)){ + if (isOneFluid(isite2)) { nMoleculesOld2 = 1.0-(nTotalOld-nMoleculesOFAold); nMolecules2 = 1.0-(nTotal-nMoleculesOFA); fractionOld2 = fractionOFAold; @@ -566,7 +566,7 @@ void PairTableRX::getMixingWeights(int id, double &mixWtSite1old, double &mixWtS } } - if(fractionalWeighting){ + if (fractionalWeighting) { mixWtSite1old = fractionOld1; mixWtSite1 = fraction1; mixWtSite2old = fractionOld2; diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index b2e07bd68d..fe75c10fe3 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -155,8 +155,8 @@ void ComputeTempDrude::compute_vector() double ecore, edrude; double *vcore, *vdrude; double kineng_core_loc = 0., kineng_drude_loc = 0.; - for (int i=0; inlocal; int *type = atom->type; @@ -113,10 +113,10 @@ void FixDrude::build_drudeid(){ if (atom->molecular == Atom::MOLECULAR) { // Build list of my atoms' bond partners - for (int i=0; inum_bond[i]; k++){ + for (int k=0; knum_bond[i]; k++) { core_drude_vec.push_back(atom->tag[i]); core_drude_vec.push_back(atom->bond_atom[i][k]); } @@ -129,7 +129,7 @@ void FixDrude::build_drudeid(){ atommols = atom->avec->onemols; // Build list of my atoms' bond partners - for (int i=0; imolindex[i]; int iatom = atom->molatom[i]; tagint *batom = atommols[imol]->bond_atom[iatom]; @@ -138,7 +138,7 @@ void FixDrude::build_drudeid(){ if (drudetype[type[i]] == NOPOL_TYPE) continue; drudeid[i] = 0; - for (int k=0; ktag[i]); core_drude_vec.push_back(batom[k]+tagprev); } @@ -152,8 +152,8 @@ void FixDrude::build_drudeid(){ // Build the list of my Drudes' tags // The only bond partners of a Drude particle is its core, // so fill drudeid for my Drudes. - for (int i=0; itag[i]); drudeid[i] = *partner_set[i].begin(); // only one 1-2 neighbor, the core } @@ -172,7 +172,7 @@ void FixDrude::build_drudeid(){ * Look in my cores' bond partner tags if there is a Drude tag. * If so fill this core's dureid. ------------------------------------------------------------------------- */ -void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr){ +void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { // Search for the drude partner of my cores FixDrude *fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; @@ -190,7 +190,7 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr){ for (int i=0; i 0) continue; for (it = partner_set[i].begin(); it != partner_set[i].end(); it++) { // Drude-core are 1-2 neighbors - if (drude_set.count(*it) > 0){ + if (drude_set.count(*it) > 0) { drudeid[i] = *it; break; } @@ -202,7 +202,7 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr){ * buffer contains bond partners. Look for my atoms and add their partner's * tag in its set of bond partners. ------------------------------------------------------------------------- */ -void FixDrude::ring_build_partner(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; Atom *atom = fdptr->atom; @@ -270,7 +270,7 @@ int FixDrude::unpack_exchange(int nlocal, double *buf) int FixDrude::pack_border(int n, int *list, double *buf) { int m = 0; - for (int i=0; inlocal; @@ -330,7 +330,7 @@ void FixDrude::rebuild_special(){ for (int i=0; itag[i]); - } else if (drudetype[type[i]] == CORE_TYPE){ + } else if (drudetype[type[i]] == CORE_TYPE) { core_drude_vec.push_back(atom->tag[i]); core_drude_vec.push_back(drudeid[i]); } @@ -380,7 +380,7 @@ void FixDrude::rebuild_special(){ * When receive buffer, build a set of drude tags, look into my atoms' * special list if some tags are drude particles. If so, remove it. ------------------------------------------------------------------------- */ -void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr){ +void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr) { // Remove all drude particles from special list FixDrude *fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; @@ -416,7 +416,7 @@ void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr){ * Loop on my atoms' special list to find core tags. Insert their Drude * particle if they have one. ------------------------------------------------------------------------- */ -void FixDrude::ring_add_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; @@ -473,7 +473,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr){ * in the buffer. Loop on my Drude particles and copy their special * info from that of their core if the latter is found in the map. ------------------------------------------------------------------------- */ -void FixDrude::ring_copy_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; Atom *atom = fdptr->atom; @@ -520,8 +520,8 @@ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr){ * Set drudeid when a new atom is created, * special list must be up-to-date * ----------------------------------------------------------------------*/ -void FixDrude::set_arrays(int i){ - if (drudetype[atom->type[i]] != NOPOL_TYPE){ +void FixDrude::set_arrays(int i) { + if (drudetype[atom->type[i]] != NOPOL_TYPE) { if (atom->nspecial[i] ==0) error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template"); drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list } else { diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index 659984131c..d75481c2c8 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -83,7 +83,7 @@ void FixDrudeTransform::setup(int) { int j = atom->map(drudeid[i]); // i is drude, j is core if (mcoeff_loc[type[i]] < 1.5) { // already done - if (mcoeff_loc[type[j]] > 1.5){ // not yet done ?? + if (mcoeff_loc[type[j]] > 1.5) { // not yet done ?? error->all(FLERR,"There must be one Drude type per core type");} continue; } @@ -103,28 +103,28 @@ void FixDrudeTransform::setup(int) { /* ---------------------------------------------------------------------- */ namespace LAMMPS_NS { // required for specialization template <> -void FixDrudeTransform::initial_integrate(int){ +void FixDrudeTransform::initial_integrate(int) { comm->forward_comm_fix(this); real_to_reduced(); //comm->forward_comm_fix(this); // Normally not needed } template <> -void FixDrudeTransform::final_integrate(){ +void FixDrudeTransform::final_integrate() { comm->forward_comm_fix(this); real_to_reduced(); //comm->forward_comm_fix(this); // Normally not needed } template <> -void FixDrudeTransform::initial_integrate(int){ +void FixDrudeTransform::initial_integrate(int) { comm->forward_comm_fix(this); reduced_to_real(); //comm->forward_comm_fix(this); // Normally not needed } template <> -void FixDrudeTransform::final_integrate(){ +void FixDrudeTransform::final_integrate() { comm->forward_comm_fix(this); reduced_to_real(); //comm->forward_comm_fix(this); // Normally not needed diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index 2b45862868..4e905d16d3 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -271,7 +271,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) Gcore = mi / t_period_core / ftm2v; Ccore = sqrt(2.0 * Gcore * kb * t_target_core / dt / ftm2v / mvv2e); if (temperature) temperature->remove_bias(i, v[i]); - for(int k = 0; k < dim; k++){ + for (int k = 0; k < dim; k++) { fcore[k] = Ccore * random_core->gaussian() - Gcore * v[i][k]; if (zero) fcoreloc[k] += fcore[k]; f[i][k] += fcore[k]; @@ -326,7 +326,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) } } - if(zero) { // Remove the drift + if (zero) { // Remove the drift MPI_Allreduce(fcoreloc, fcoresum, dim, MPI_DOUBLE, MPI_SUM, world); for (int k=0; k (list[n++]); if (tstat_flag && m == mtchain) { - for (int ich = 0; ich < mtchain; ich++){ + for (int ich = 0; ich < mtchain; ich++) { etamol[ich] = list[n++]; etaint[ich] = list[n++]; etadrude[ich] = list[n++]; } - for (int ich = 0; ich < mtchain; ich++){ + for (int ich = 0; ich < mtchain; ich++) { etamol_dot[ich] = list[n++]; etaint_dot[ich] = list[n++]; etadrude_dot[ich] = list[n++]; @@ -1509,7 +1509,7 @@ double FixTGNHDrude::compute_scalar() energy += ke2mol_target * etamol[0] + 0.5 * etamol_mass[0] * etamol_dot[0] * etamol_dot[0]; energy += ke2int_target * etaint[0] + 0.5 * etaint_mass[0] * etaint_dot[0] * etaint_dot[0]; energy += ke2drude_target * etadrude[0] + 0.5 * etadrude_mass[0] * etadrude_dot[0] * etadrude_dot[0]; - for (ich = 1; ich < mtchain; ich++){ + for (ich = 1; ich < mtchain; ich++) { energy += kt * etamol[ich] + 0.5*etamol_mass[ich]*etamol_dot[ich]*etamol_dot[ich]; energy += kt * etaint[ich] + 0.5*etaint_mass[ich]*etaint_dot[ich]*etaint_dot[ich]; energy += kt_drude * etadrude[ich] + 0.5*etadrude_mass[ich]*etadrude_dot[ich]*etadrude_dot[ich]; @@ -1565,7 +1565,7 @@ double FixTGNHDrude::compute_vector(int n) { if (!temp_computed_end_of_step) compute_temp_mol_int_drude(true); - switch (n){ + switch (n) { case 0: return t_mol; case 1: @@ -1711,7 +1711,7 @@ void FixTGNHDrude::nhc_temp_integrate() // update masses of thermostat in case target temperature changes etamol_mass[0] = ke2mol_target / (t_freq*t_freq); etaint_mass[0] = ke2int_target / (t_freq*t_freq); - for (int ich = 1; ich < mtchain; ich++){ + for (int ich = 1; ich < mtchain; ich++) { etamol_mass[ich] = boltz * t_target / (t_freq*t_freq); etaint_mass[ich] = boltz * t_target / (t_freq*t_freq); } diff --git a/src/USER-DRUDE/pair_coul_tt.cpp b/src/USER-DRUDE/pair_coul_tt.cpp index a051b6e3c6..a807ea3c16 100644 --- a/src/USER-DRUDE/pair_coul_tt.cpp +++ b/src/USER-DRUDE/pair_coul_tt.cpp @@ -163,7 +163,7 @@ void PairCoulTT::compute(int eflag, int vflag) dcoul = qqrd2e * qi * qj *scale[itype][jtype] * rinv; factor_f = (-beta*gamma + r*betaprime*gamma + r*beta*gammaprime)*factor_coul; - if(eflag) factor_e = - beta*gamma*factor_coul; + if (eflag) factor_e = - beta*gamma*factor_coul; fpair = factor_f * dcoul * r2inv; f[i][0] += delx*fpair; diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index 6046061aa5..84437f408a 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -131,7 +131,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) jlist = firstneigh[i]; jnum = numneigh[i]; - if (drudetype[type[i]] != NOPOL_TYPE){ + if (drudetype[type[i]] != NOPOL_TYPE) { di = atom->map(drudeid[i]); if (di < 0) error->all(FLERR, "Drude partner not found"); di_closest = domain->closest_image(i, di); @@ -187,9 +187,9 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) } if (drudetype[type[i]] != NOPOL_TYPE && - drudetype[type[j]] != NOPOL_TYPE){ - if (j != di_closest){ - if (drudetype[type[j]] == CORE_TYPE){ + drudetype[type[j]] != NOPOL_TYPE) { + if (j != di_closest) { + if (drudetype[type[j]] == CORE_TYPE) { dj = atom->map(drudeid[j]); dqj = -q[dj]; } else dqj = qj; @@ -231,7 +231,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) } if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; if (drudetype[type[i]] != NOPOL_TYPE && - drudetype[type[j]] != NOPOL_TYPE && j != di_closest){ + drudetype[type[j]] != NOPOL_TYPE && j != di_closest) { ecoul += factor_e * dcoul; } } else ecoul = 0.0; diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index d95309406a..418705e0a3 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -137,7 +137,7 @@ void PairThole::compute(int eflag, int vflag) exp_asr = exp(-asr); dcoul = qqrd2e * qi * qj *scale[itype][jtype] * rinv; factor_f = 0.5*(2. + (exp_asr * (-2. - asr * (2. + asr)))) - factor_coul; - if(eflag) factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; + if (eflag) factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; fpair = factor_f * dcoul * r2inv; f[i][0] += delx*fpair; diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index f7216829d6..d429503237 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -35,7 +35,7 @@ using namespace MathSpecial; PairMorseSoft::~PairMorseSoft() { - if(allocated){ + if (allocated) { memory->destroy(lambda); } } @@ -108,7 +108,7 @@ void PairMorseSoft::compute(int eflag, int vflag) V0 = D * dexp * ( dexp - 2.0 ); B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; - if (l >= shift_range){ + if (l >= shift_range) { s1 = (l - 1.0) / (shift_range - 1.0); phi = V0 + B*dexp3 * s1; @@ -121,7 +121,7 @@ void PairMorseSoft::compute(int eflag, int vflag) phi *= llf; // Force computation: - if (r == 0.0){ + if (r == 0.0) { fpair = 0.0; } else { fpair = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp); @@ -256,7 +256,7 @@ double PairMorseSoft::init_one(int i, int j) V0 = D * dexp * ( dexp - 2.0 ); B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; - if (l >= shift_range){ + if (l >= shift_range) { s1 = (l - 1.0) / (shift_range - 1.0); offset[i][j] = V0 + B*dexp3 * s1; } else { @@ -415,7 +415,7 @@ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double V0 = D * dexp * ( dexp - 2.0 ); B = -2.0 * D * iea2 * ( ea - 1.0 ) / 3.0; - if (l >= shift_range){ + if (l >= shift_range) { s1 = (l - 1.0) / (shift_range - 1.0); phi = V0 + B*dexp3 * s1; @@ -428,7 +428,7 @@ double PairMorseSoft::single(int /*i*/, int /*j*/, int itype, int jtype, double phi *= llf; // Force computation: - if (r == 0.0){ + if (r == 0.0) { fforce = 0.0; } else { fforce = 3.0*a*B*dexp3 + 2.0*a*D*(dexp2 - dexp); diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index 95c2ec320a..ea65a91953 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -783,7 +783,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, if (_nthreads > INTEL_HTHREADS) packthreads = _nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { #if defined(_OPENMP) @@ -1266,7 +1266,7 @@ int FixIntel::set_host_affinity(const int nomp) if (nlwp <= plwp) continue; CPU_ZERO(&cpuset); - for(int i=0; i * buffers) { if (comm->nthreads > INTEL_HTHREADS) nthreads = comm->nthreads; else nthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(nthreads > INTEL_HTHREADS) + #pragma omp parallel if (nthreads > INTEL_HTHREADS) #endif { int ifrom, ito, tid; diff --git a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp index 2475b69b8f..d15c5d9d4e 100644 --- a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp @@ -216,7 +216,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const int * _noalias const bins = this->bins; const int cop = _fix->coprocessor_number(); const int separate_buffers = _fix->separate_buffers(); - #pragma offload target(mic:cop) if(offload) \ + #pragma offload target(mic:cop) if (offload) \ in(x:length(e_nall+1) alloc_if(0) free_if(0)) \ in(tag:length(tag_size) alloc_if(0) free_if(0)) \ in(special:length(special_size*maxspecial) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/npair_halffull_newton_intel.cpp b/src/USER-INTEL/npair_halffull_newton_intel.cpp index de0fa9c17d..b45c1a8023 100644 --- a/src/USER-INTEL/npair_halffull_newton_intel.cpp +++ b/src/USER-INTEL/npair_halffull_newton_intel.cpp @@ -151,7 +151,7 @@ void NPairHalffullNewtonIntel::build_t3(NeighList *list, int *numhalf) if (comm->nthreads > INTEL_HTHREADS) packthreads = comm->nthreads; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int tid, ifrom, ito; diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index 5c6a0cf1b5..c224775a26 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -211,7 +211,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, const int * _noalias const bins = this->bins; const int cop = _fix->coprocessor_number(); const int separate_buffers = _fix->separate_buffers(); - #pragma offload target(mic:cop) if(offload) \ + #pragma offload target(mic:cop) if (offload) \ in(x:length(e_nall+1) alloc_if(0) free_if(0)) \ in(tag:length(tag_size) alloc_if(0) free_if(0)) \ in(special:length(special_size*maxspecial) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/npair_skip_intel.cpp b/src/USER-INTEL/npair_skip_intel.cpp index 5d88fe511d..4f6648ddc1 100644 --- a/src/USER-INTEL/npair_skip_intel.cpp +++ b/src/USER-INTEL/npair_skip_intel.cpp @@ -95,7 +95,7 @@ void NPairSkipIntel::build_t(NeighList *list, int *numhalf, int *cnumneigh, packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int tid, ifrom, ito; diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index a25a2d403d..f8f094ec9f 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -308,7 +308,7 @@ void PairAIREBOIntel::compute( if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -450,7 +450,7 @@ void PairAIREBOIntel::eval( if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ in(numneigh:length(0) alloc_if(0) free_if(0)) \ in(numneighhalf:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index 3da131684c..1aec1dcbf7 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -90,7 +90,7 @@ void PairBuckCoulCutIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -177,7 +177,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const int ncoulshiftbits = this->ncoulshiftbits; if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj,special_coul:length(0) alloc_if(0) free_if(0)) \ in(c_force, c_energy, c_cut:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ @@ -273,10 +273,10 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, forcecoul = qqrd2e * qtmp*q[j]/r; if (EFLAG) ecoul = forcecoul; - if (sbindex){ + if (sbindex) { const flt_t factor_coul = special_coul[sbindex]; forcecoul *= factor_coul; - if(EFLAG) + if (EFLAG) ecoul *= factor_coul; } diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index 6ab255d5d7..d56b0dfd24 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -90,7 +90,7 @@ void PairBuckCoulLongIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -200,7 +200,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, #endif if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj,special_coul:length(0) alloc_if(0) free_if(0)) \ in(c_force, c_energy:length(0) alloc_if(0) free_if(0)) \ in(rho_inv:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index afa9b448b5..77f6a1136c 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -83,7 +83,7 @@ void PairBuckIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -162,7 +162,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, // Redeclare as local variables for offload if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj:length(0) alloc_if(0) free_if(0)) \ in(c_force, c_energy:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_dpd_intel.cpp b/src/USER-INTEL/pair_dpd_intel.cpp index a0a71e4a37..45da3cccd7 100644 --- a/src/USER-INTEL/pair_dpd_intel.cpp +++ b/src/USER-INTEL/pair_dpd_intel.cpp @@ -99,7 +99,7 @@ void PairDPDIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index 0da792b4e0..04ee07ca82 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -116,7 +116,7 @@ void PairEAMAlloyIntel::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/alloy", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 8b1437203f..0eb2cda43d 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -116,7 +116,7 @@ void PairEAMFSIntel::read_file(char *filename) Fs *file = fs; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(lmp, filename, "eam/fs", unit_convert_flag); // transparently convert units for supported conversions diff --git a/src/USER-INTEL/pair_eam_intel.cpp b/src/USER-INTEL/pair_eam_intel.cpp index a25d588ecf..206bdd5ee6 100644 --- a/src/USER-INTEL/pair_eam_intel.cpp +++ b/src/USER-INTEL/pair_eam_intel.cpp @@ -95,7 +95,7 @@ void PairEAMIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index c34c6965de..fd79b5812b 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -93,7 +93,7 @@ void PairGayBerneIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -276,7 +276,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, double *timer_compute = fix->off_watch_pair(); if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj:length(0) alloc_if(0) free_if(0)) \ in(ijc,lj34,ic:length(0) alloc_if(0) free_if(0)) \ in(rsq_formi, delx_formi, dely_formi: length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index 8f4dba4a24..850af0de6f 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -86,7 +86,7 @@ void PairLJCharmmCoulCharmmIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -184,7 +184,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, double *timer_compute = fix->off_watch_pair(); if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj,special_coul:length(0) alloc_if(0) free_if(0)) \ in(cutsq,lj:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index ffed4853ba..ad15c045ab 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -87,7 +87,7 @@ void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -202,7 +202,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, #endif if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj,special_coul:length(0) alloc_if(0) free_if(0)) \ in(cutsq,lj:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index c1d85ad37f..d6d763677c 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -88,7 +88,7 @@ void PairLJCutCoulLongIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -197,7 +197,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, #endif if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(special_lj,special_coul:length(0) alloc_if(0) free_if(0)) \ in(c_force, c_energy:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index 8697a4f548..6499f1cec8 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -79,7 +79,7 @@ void PairLJCutIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 1af8d3e972..984b2100a3 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -110,7 +110,7 @@ void PairSWIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -227,7 +227,7 @@ void PairSWIntel::eval(const int offload, const int vflag, int *overflow = fix->get_off_overflow_flag(); if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(p2,p2f,p2f2,p2e,p3:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ in(cnumneigh:length(0) alloc_if(0) free_if(0)) \ @@ -646,7 +646,7 @@ void PairSWIntel::eval(const int offload, const int vflag, int *overflow = fix->get_off_overflow_flag(); if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(p2,p2f,p2f2,p2e,p3:length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ in(cnumneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index b86be522bf..bce2045f26 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -123,7 +123,7 @@ void PairTersoffIntel::compute(int eflag, int vflag, if (nthreads > INTEL_HTHREADS) packthreads = nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; @@ -309,7 +309,7 @@ void PairTersoffIntel::eval(const int offload, const int vflag, int *overflow = fix->get_off_overflow_flag(); double *timer_compute = fix->off_watch_pair(); if (offload) fix->start_watch(TIME_OFFLOAD_LATENCY); - #pragma offload target(mic:_cop) if(offload) \ + #pragma offload target(mic:_cop) if (offload) \ in(c_inner, c_outer :length(0) alloc_if(0) free_if(0)) \ in(c_inner_cutoff :length(0) alloc_if(0) free_if(0)) \ in(firstneigh:length(0) alloc_if(0) free_if(0)) \ diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 5a119e4470..88fb6374ab 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -148,7 +148,7 @@ void PPPMDispIntel::init() memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, "pppmdispintel:rho6_lookup"); - if(differentiation_flag == 1) { + if (differentiation_flag == 1) { memory->destroy(drho_lookup); memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, "pppmdispintel:drho_lookup"); @@ -198,7 +198,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) memory->destroy(particle_ekx); memory->destroy(particle_eky); memory->destroy(particle_ekz); - if (function[2] == 1){ + if (function[2] == 1) { memory->destroy(particle_ekx0); memory->destroy(particle_eky0); memory->destroy(particle_ekz0); @@ -231,7 +231,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) memory->create(particle_ekx, nmax, "pppmdispintel:pekx"); memory->create(particle_eky, nmax, "pppmdispintel:peky"); memory->create(particle_ekz, nmax, "pppmdispintel:pekz"); - if (function[2] == 1){ + if (function[2] == 1) { memory->create(particle_ekx0, nmax, "pppmdispintel:pekx0"); memory->create(particle_eky0, nmax, "pppmdispintel:peky0"); memory->create(particle_ekz0, nmax, "pppmdispintel:pekz0"); @@ -752,7 +752,7 @@ void PPPMDispIntel::particle_map(double delx, double dely, double delz, #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ shared(nlocal, nthr, delx, dely, delz, sft, p2g, nup, nlow, nxlo,\ - nylo, nzlo, nxhi, nyhi, nzhi) reduction(+:flag) if(!_use_lrt) + nylo, nzlo, nxhi, nyhi, nzhi) reduction(+:flag) if (!_use_lrt) #endif { double **x = atom->x; @@ -825,7 +825,7 @@ void PPPMDispIntel::make_rho_c(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, nlocal, global_density) if(!_use_lrt) + shared(nthr, nlocal, global_density) if (!_use_lrt) #endif { double *q = atom->q; @@ -877,7 +877,7 @@ void PPPMDispIntel::make_rho_c(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho_lookup[idx][k]; rho[1][k] = rho_lookup[idy][k]; rho[2][k] = rho_lookup[idz][k]; @@ -931,7 +931,7 @@ void PPPMDispIntel::make_rho_c(IntelBuffers * /*buffers*/) // reduce all the perthread_densities into global_density #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, global_density) if(!_use_lrt) + shared(nthr, global_density) if (!_use_lrt) #endif { int ifrom, ito, tid; @@ -941,7 +941,7 @@ void PPPMDispIntel::make_rho_c(IntelBuffers * /*buffers*/) #pragma simd #endif for (int i = ifrom; i < ito; i++) { - for(int j = 1; j < nthr; j++) { + for (int j = 1; j < nthr; j++) { global_density[i] += perthread_density[j-1][i]; } } @@ -973,7 +973,7 @@ void PPPMDispIntel::make_rho_g(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, nlocal, global_density) if(!_use_lrt) + shared(nthr, nlocal, global_density) if (!_use_lrt) #endif { int type; @@ -1026,7 +1026,7 @@ void PPPMDispIntel::make_rho_g(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -1081,7 +1081,7 @@ void PPPMDispIntel::make_rho_g(IntelBuffers * /*buffers*/) // reduce all the perthread_densities into global_density #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, global_density) if(!_use_lrt) + shared(nthr, global_density) if (!_use_lrt) #endif { int ifrom, ito, tid; @@ -1091,7 +1091,7 @@ void PPPMDispIntel::make_rho_g(IntelBuffers * /*buffers*/) #pragma simd #endif for (int i = ifrom; i < ito; i++) { - for(int j = 1; j < nthr; j++) { + for (int j = 1; j < nthr; j++) { global_density[i] += perthread_density[j-1][i]; } } @@ -1174,7 +1174,7 @@ void PPPMDispIntel::make_rho_a(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -1256,7 +1256,7 @@ void PPPMDispIntel::make_rho_none(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, nlocal, global_density) if(!_use_lrt) + shared(nthr, nlocal, global_density) if (!_use_lrt) #endif { int type; @@ -1308,7 +1308,7 @@ void PPPMDispIntel::make_rho_none(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -1354,7 +1354,7 @@ void PPPMDispIntel::make_rho_none(IntelBuffers * /*buffers*/) for (int l = 0; l < order; l++) { int mzyx = l + mzy; FFT_SCALAR w0 = x0*rho[0][l]; - for(int k = 0; k < nsplit; k++) + for (int k = 0; k < nsplit; k++) my_density[mzyx + k*ngrid_6] += x0*rho[0][l]; } } @@ -1365,7 +1365,7 @@ void PPPMDispIntel::make_rho_none(IntelBuffers * /*buffers*/) // reduce all the perthread_densities into global_density #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, global_density) if(!_use_lrt) + shared(nthr, global_density) if (!_use_lrt) #endif { int ifrom, ito, tid; @@ -1375,7 +1375,7 @@ void PPPMDispIntel::make_rho_none(IntelBuffers * /*buffers*/) #pragma simd #endif for (int i = ifrom; i < ito; i++) { - for(int j = 1; j < nthr; j++) { + for (int j = 1; j < nthr; j++) { global_density[i] += perthread_density[j-1][i]; } } @@ -1408,7 +1408,7 @@ void PPPMDispIntel::fieldforce_c_ik(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -1558,7 +1558,7 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -1625,7 +1625,7 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho_lookup[idx][k]; rho[1][k] = rho_lookup[idy][k]; rho[2][k] = rho_lookup[idz][k]; @@ -1694,7 +1694,7 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma loop_count min(2), max(INTEL_P3M_ALIGNED_MAXORDER), avg(7) #endif - for (int l = 0; l < order; l++){ + for (int l = 0; l < order; l++) { particle_ekx[i] += ekx[l]; particle_eky[i] += eky[l]; particle_ekz[i] += ekz[l]; @@ -1756,7 +1756,7 @@ void PPPMDispIntel::fieldforce_g_ik(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -1903,7 +1903,7 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -1968,7 +1968,7 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -2037,7 +2037,7 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma loop_count min(2), max(INTEL_P3M_ALIGNED_MAXORDER), avg(7) #endif - for (int l = 0; l < order; l++){ + for (int l = 0; l < order; l++) { particle_ekx[i] += ekx[l]; particle_eky[i] += eky[l]; particle_ekz[i] += ekz[l]; @@ -2100,7 +2100,7 @@ void PPPMDispIntel::fieldforce_a_ik(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { double **x = atom->x; @@ -2334,7 +2334,7 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -2399,7 +2399,7 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -2515,7 +2515,7 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma loop_count min(2), max(INTEL_P3M_ALIGNED_MAXORDER), avg(7) #endif - for (int l = 0; l < order; l++){ + for (int l = 0; l < order; l++) { particle_ekx0[i] += ekx0[l]; particle_eky0[i] += eky0[l]; particle_ekz0[i] += ekz0[l]; @@ -2625,7 +2625,7 @@ void PPPMDispIntel::fieldforce_none_ik(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -2784,7 +2784,7 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { @@ -2849,7 +2849,7 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho6_lookup[idx][k]; rho[1][k] = rho6_lookup[idy][k]; rho[2][k] = rho6_lookup[idz][k]; @@ -2934,7 +2934,7 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) #if defined(LMP_SIMD_COMPILER) #pragma loop_count min(2), max(INTEL_P3M_ALIGNED_MAXORDER), avg(7) #endif - for (int l = 0; l < order; l++){ + for (int l = 0; l < order; l++) { for (int k = 0; k < nsplit; k++) { ekx_tot[k] += ekx[k*INTEL_P3M_ALIGNED_MAXORDER+l]; eky_tot[k] += eky[k*INTEL_P3M_ALIGNED_MAXORDER+l]; @@ -2993,9 +2993,9 @@ void PPPMDispIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for (int k=nlower; k<=nupper;k++){ + for (int k=nlower; k<=nupper;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order-1; l>=0; l--){ + for (int l=order-1; l>=0; l--) { r1 = rho_coeff[l][k] + r1*dx; } rho_lookup[i][k-nlower] = r1; @@ -3007,9 +3007,9 @@ void PPPMDispIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k=nlower; k<=nupper;k++){ + for (int k=nlower; k<=nupper;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order-2; l>=0; l--){ + for (int l=order-2; l>=0; l--) { r1 = drho_coeff[l][k] + r1*dx; } drho_lookup[i][k-nlower] = r1; @@ -3027,9 +3027,9 @@ void PPPMDispIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for (int k=nlower_6; k<=nupper_6;k++){ + for (int k=nlower_6; k<=nupper_6;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order_6-1; l>=0; l--){ + for (int l=order_6-1; l>=0; l--) { r1 = rho_coeff_6[l][k] + r1*dx; } rho6_lookup[i][k-nlower_6] = r1; @@ -3041,9 +3041,9 @@ void PPPMDispIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k=nlower_6; k<=nupper_6;k++){ + for (int k=nlower_6; k<=nupper_6;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order_6-2; l>=0; l--){ + for (int l=order_6-2; l>=0; l--) { r1 = drho_coeff_6[l][k] + r1*dx; } drho6_lookup[i][k-nlower_6] = r1; diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index bf55dc3d2e..6e836dd3b3 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -125,7 +125,7 @@ void PPPMIntel::init() memory->destroy(rho_lookup); memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, "pppmintel:rho_lookup"); - if(differentiation_flag == 1) { + if (differentiation_flag == 1) { memory->destroy(drho_lookup); memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, "pppmintel:drho_lookup"); @@ -378,7 +378,7 @@ void PPPMIntel::particle_map(IntelBuffers *buffers) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) reduction(+:flag) if(!_use_lrt) + shared(nlocal, nthr) reduction(+:flag) if (!_use_lrt) #endif { const flt_t lo0 = boxlo[0]; @@ -452,7 +452,7 @@ void PPPMIntel::make_rho(IntelBuffers *buffers) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, nlocal, global_density) if(!_use_lrt) + shared(nthr, nlocal, global_density) if (!_use_lrt) #endif { const int nix = nxhi_out - nxlo_out + 1; @@ -501,7 +501,7 @@ void PPPMIntel::make_rho(IntelBuffers *buffers) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho_lookup[idx][k]; rho[1][k] = rho_lookup[idy][k]; rho[2][k] = rho_lookup[idz][k]; @@ -555,7 +555,7 @@ void PPPMIntel::make_rho(IntelBuffers *buffers) if (nthr > 1) { #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nthr, global_density) if(!_use_lrt) + shared(nthr, global_density) if (!_use_lrt) #endif { int ifrom, ito, tid; @@ -565,7 +565,7 @@ void PPPMIntel::make_rho(IntelBuffers *buffers) #pragma simd #endif for (int i = ifrom; i < ito; i++) { - for(int j = 1; j < nthr; j++) { + for (int j = 1; j < nthr; j++) { global_density[i] += perthread_density[j-1][i]; } } @@ -604,7 +604,7 @@ void PPPMIntel::fieldforce_ik(IntelBuffers *buffers) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { const flt_t lo0 = boxlo[0]; @@ -755,7 +755,7 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) #if defined(_OPENMP) #pragma omp parallel LMP_DEFAULT_NONE \ - shared(nlocal, nthr) if(!_use_lrt) + shared(nlocal, nthr) if (!_use_lrt) #endif { const flt_t ftwo_pi = MY_PI * 2.0; @@ -814,7 +814,7 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { + for (int k = 0; k < INTEL_P3M_ALIGNED_MAXORDER; k++) { rho[0][k] = rho_lookup[idx][k]; rho[1][k] = rho_lookup[idy][k]; rho[2][k] = rho_lookup[idz][k]; @@ -884,7 +884,7 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) #if defined(LMP_SIMD_COMPILER) #pragma loop_count min(2), max(INTEL_P3M_ALIGNED_MAXORDER), avg(7) #endif - for (int l = 0; l < order; l++){ + for (int l = 0; l < order; l++) { particle_ekx[i] += ekx[l]; particle_eky[i] += eky[l]; particle_ekz[i] += ekz[l]; @@ -943,9 +943,9 @@ void PPPMIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for (int k=nlower; k<=nupper;k++){ + for (int k=nlower; k<=nupper;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order-1; l>=0; l--){ + for (int l=order-1; l>=0; l--) { r1 = rho_coeff[l][k] + r1*dx; } rho_lookup[i][k-nlower] = r1; @@ -957,9 +957,9 @@ void PPPMIntel::precompute_rho() #if defined(LMP_SIMD_COMPILER) #pragma simd #endif - for(int k=nlower; k<=nupper;k++){ + for (int k=nlower; k<=nupper;k++) { FFT_SCALAR r1 = ZEROF; - for(int l=order-2; l>=0; l--){ + for (int l=order-2; l>=0; l--) { r1 = drho_coeff[l][k] + r1*dx; } drho_lookup[i][k-nlower] = r1; @@ -1005,7 +1005,7 @@ void PPPMIntel::pack_buffers() if (comm->nthreads > INTEL_HTHREADS) packthreads = comm->nthreads; else packthreads = 1; #if defined(_OPENMP) - #pragma omp parallel if(packthreads > 1) + #pragma omp parallel if (packthreads > 1) #endif { int ifrom, ito, tid; diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index bf67502759..351e078dad 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -84,7 +84,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : // the 15 velocity D3Q15 model is used. //===================================================================================================== - if(narg <7) error->all(FLERR,"Illegal fix lb/fluid command"); + if (narg <7) error->all(FLERR,"Illegal fix lb/fluid command"); if (comm->style != 0) error->universe_all(FLERR,"Fix lb/fluid can only currently be used with " @@ -120,73 +120,73 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : NodeArea = nullptr; int iarg = 7; - while (iarg < narg){ - if(strcmp(arg[iarg],"setArea")==0){ - if(setGamma == 1) + while (iarg < narg) { + if (strcmp(arg[iarg],"setArea")==0) { + if (setGamma == 1) error->all(FLERR,"Illegal fix lb/fluid command: cannot use a combination of default and user-specified gamma values"); setArea = 1; int itype = atoi(arg[iarg+1]); double areafactor = atof(arg[iarg+2]); - if(itype <= 0 || itype > atom->ntypes || areafactor < 0.0) + if (itype <= 0 || itype > atom->ntypes || areafactor < 0.0) error->all(FLERR,"Illegal fix lb/fluid command: setArea"); - if(NodeArea == nullptr){ + if (NodeArea == nullptr) { NodeArea = new double[atom->ntypes+1]; - for(int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; + for (int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; } NodeArea[itype] = areafactor; iarg += 3; } - else if(strcmp(arg[iarg],"setGamma")==0){ - if(setArea == 1) + else if (strcmp(arg[iarg],"setGamma")==0) { + if (setArea == 1) error->all(FLERR,"Illegal fix lb/fluid command: cannot use a combination of default and user-specified gamma values"); setGamma = 1; double Gammaone; Gammaone = atof(arg[iarg+1]); - if(Gamma == nullptr) + if (Gamma == nullptr) Gamma = new double[atom->ntypes+1]; - for(int i=0; i<=atom->ntypes; i++) Gamma[i] = Gammaone; + for (int i=0; i<=atom->ntypes; i++) Gamma[i] = Gammaone; iarg += 2; } - else if(strcmp(arg[iarg],"scaleGamma")==0){ - if(setGamma == 0) + else if (strcmp(arg[iarg],"scaleGamma")==0) { + if (setGamma == 0) error->all(FLERR,"Illegal fix lb/fluid command: must set a value for Gamma before scaling it"); int itype = atoi(arg[iarg+1]); double scalefactor = atof(arg[iarg+2]); - if(itype <= 0 || itype > atom->ntypes || scalefactor < 0.0) + if (itype <= 0 || itype > atom->ntypes || scalefactor < 0.0) error->all(FLERR,"Illegal fix lb/fluid command: scaleGamma"); Gamma[itype] *= scalefactor; iarg += 3; } - else if(strcmp(arg[iarg],"dx")==0){ + else if (strcmp(arg[iarg],"dx")==0) { dx_lb = atof(arg[iarg+1]); iarg += 2; setdx = 0; } - else if(strcmp(arg[iarg],"dm")==0){ + else if (strcmp(arg[iarg],"dm")==0) { dm_lb = atof(arg[iarg+1]); iarg += 2; } - else if(strcmp(arg[iarg],"a0")==0){ + else if (strcmp(arg[iarg],"a0")==0) { a_0_real = atof(arg[iarg+1]); iarg += 2; seta0 = 0; } - else if(strcmp(arg[iarg],"noise")== 0){ + else if (strcmp(arg[iarg],"noise")== 0) { noisestress = 1; T = atof(arg[iarg+1]); seed = atoi(arg[iarg+2]); iarg += 3; } - else if(strcmp(arg[iarg],"calcforce")==0){ + else if (strcmp(arg[iarg],"calcforce")==0) { force_diagnostic = atoi(arg[iarg+1]); igroupforce=group->find(arg[iarg+2]); iarg += 3; } - else if(strcmp(arg[iarg],"trilinear")==0){ + else if (strcmp(arg[iarg],"trilinear")==0) { trilinear_stencil = 1; iarg += 1; } - else if(strcmp(arg[iarg],"read_restart")==0){ + else if (strcmp(arg[iarg],"read_restart")==0) { readrestart = 1; int nlength = strlen(arg[iarg+1]) + 16; char *filename = new char[nlength]; @@ -195,28 +195,28 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : delete [] filename; iarg += 2; } - else if(strcmp(arg[iarg],"write_restart")==0){ + else if (strcmp(arg[iarg],"write_restart")==0) { printrestart = atoi(arg[iarg+1]); iarg += 2; } - else if(strcmp(arg[iarg],"zwall_velocity")==0){ - if(domain->periodicity[2]!=0) error->all(FLERR,"fix lb/fluid error: setting \ + else if (strcmp(arg[iarg],"zwall_velocity")==0) { + if (domain->periodicity[2]!=0) error->all(FLERR,"fix lb/fluid error: setting \ a z wall velocity without implementing fixed BCs in z"); vwbt = atof(arg[iarg+1]); vwtp = atof(arg[iarg+2]); iarg += 3; } - else if(strcmp(arg[iarg],"bodyforce")==0){ + else if (strcmp(arg[iarg],"bodyforce")==0) { bodyforcex = atof(arg[iarg+1]); bodyforcey = atof(arg[iarg+2]); bodyforcez = atof(arg[iarg+3]); iarg += 4; } - else if(strcmp(arg[iarg],"printfluid")==0){ + else if (strcmp(arg[iarg],"printfluid")==0) { printfluid = atoi(arg[iarg+1]); iarg += 2; } - else if(strcmp(arg[iarg],"D3Q19")==0){ + else if (strcmp(arg[iarg],"D3Q19")==0) { numvel = 19; iarg += 1; } @@ -226,7 +226,7 @@ a z wall velocity without implementing fixed BCs in z"); //-------------------------------------------------------------------------- //Choose between D3Q15 and D3Q19 functions: //-------------------------------------------------------------------------- - if(numvel == 15){ + if (numvel == 15) { initializeLB = &FixLbFluid::initializeLB15; equilibriumdist = &FixLbFluid::equilibriumdist15; update_full = &FixLbFluid::update_full15; @@ -244,8 +244,8 @@ a z wall velocity without implementing fixed BCs in z"); grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - for(int i=0; inmax; i++) - for(int j=0; j<3; j++) + for (int i=0; inmax; i++) + for (int j=0; j<3; j++) hydroF[i][j] = 0.0; Ng_lb = nullptr; @@ -276,12 +276,12 @@ a z wall velocity without implementing fixed BCs in z"); // Set the lattice Boltzmann dx if it wasn't specified in the // input. //-------------------------------------------------------------------------- - if(setdx == 1){ + if (setdx == 1) { double dx_lb1 = sqrt(3.0*viscosity*dt_lb/densityinit_real); double mindomain = std::min(std::min(domain->xprd/comm->procgrid[0],domain->yprd/comm->procgrid[1]),domain->zprd/comm->procgrid[2]); dx_lb = mindomain/floor(mindomain/dx_lb1); - if(comm->me==0){ + if (comm->me==0) { char str[128]; sprintf(str,"Setting the lattice-Boltzmann dx to %10.6f",dx_lb); error->message(FLERR,str); @@ -291,21 +291,21 @@ a z wall velocity without implementing fixed BCs in z"); // If the area per node has not been set by the user, set to the // default value of dx_lb*dx_lb. //-------------------------------------------------------------------------- - if(setGamma == 0){ - if(setArea == 0){ - if(comm->me==0){ + if (setGamma == 0) { + if (setArea == 0) { + if (comm->me==0) { error->message(FLERR,"Assuming an area per node of dx*dx for all of the MD particles. This should only be used if these all correspond to point particles; otherwise, change using the setArea keyword"); } NodeArea = new double[atom->ntypes+1]; - for(int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; + for (int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; } - for(int i=0; i<=atom->ntypes; i++) - if(NodeArea[i] < 0.0) NodeArea[i] = dx_lb*dx_lb; + for (int i=0; i<=atom->ntypes; i++) + if (NodeArea[i] < 0.0) NodeArea[i] = dx_lb*dx_lb; } //-------------------------------------------------------------------------- // Set a0 if it wasn't specified in the input //-------------------------------------------------------------------------- - if(seta0 == 1) + if (seta0 == 1) a_0_real = 0.33333333*dx_lb*dx_lb/dt_lb/dt_lb; //-------------------------------------------------------------------------- @@ -319,8 +319,8 @@ a z wall velocity without implementing fixed BCs in z"); double aa; double eps=1.0e-8; aa = (domain->xprd/comm->procgrid[0])/dx_lb; - if(fabs(aa - floor(aa+0.5)) > eps){ - if(domain->boundary[0][0] != 0){ + if (fabs(aa - floor(aa+0.5)) > eps) { + if (domain->boundary[0][0] != 0) { error->all(FLERR,"the x-direction must be periodic"); } char errormessage[200]; @@ -328,8 +328,8 @@ a z wall velocity without implementing fixed BCs in z"); error->all(FLERR,errormessage); } aa = (domain->yprd/comm->procgrid[1])/dx_lb; - if(fabs(aa - floor(aa+0.5)) > eps){ - if(domain->boundary[1][0] != 0){ + if (fabs(aa - floor(aa+0.5)) > eps) { + if (domain->boundary[1][0] != 0) { error->all(FLERR,"the y-direction must be periodic"); } char errormessage[200]; @@ -337,8 +337,8 @@ a z wall velocity without implementing fixed BCs in z"); error->all(FLERR,errormessage); } aa = (domain->zprd/comm->procgrid[2])/dx_lb; - if(fabs(aa - floor(aa+0.5)) > eps){ - if(domain->boundary[2][0] == 2 || domain->boundary[2][0] == 3){ + if (fabs(aa - floor(aa+0.5)) > eps) { + if (domain->boundary[2][0] == 2 || domain->boundary[2][0] == 3) { error->all(FLERR,"the z-direction can not have shrink-wrap boundary conditions"); } char errormessage[200]; @@ -364,19 +364,19 @@ a z wall velocity without implementing fixed BCs in z"); // In order to calculate the fluid forces correctly, need to have atleast // 5 grid points in each direction per processor. //-------------------------------------------------------------------------- - if(subNbx<7 || subNby < 7 || subNbz<7) + if (subNbx<7 || subNby < 7 || subNbz<7) error->all(FLERR,"Need at least 5 grid points in each direction per processor"); // If there are walls in the z-direction add an extra grid point. - if(domain->periodicity[2]==0){ + if (domain->periodicity[2]==0) { Nbz += 1; - if(comm->myloc[2]==comm->procgrid[2]-1) + if (comm->myloc[2]==comm->procgrid[2]-1) subNbz += 1; } - if(comm->me==0){ + if (comm->me==0) { char str[128]; - if(setdx == 1){ + if (setdx == 1) { sprintf(str,"Using a lattice-Boltzmann grid of %i by %i by %i total grid points. To change, use the dx keyword",Nbx,Nby,Nbz); } else { sprintf(str,"Using a lattice-Boltzmann grid of %i by %i by %i total grid points.",Nbx,Nby,Nbz); @@ -471,7 +471,7 @@ a z wall velocity without implementing fixed BCs in z"); memory->create(mg_lb,numvel,numvel,"FixLbFluid:mg_lb"); memory->create(e,numvel,3,"FixLbFluid:e"); memory->create(feq,subNbx,subNby,subNbz,numvel,"FixLbFluid:feq"); - if(typeLB == 2){ + if (typeLB == 2) { memory->create(feqold,subNbx,subNby,subNbz,numvel,"FixLbFluid:feqold"); memory->create(feqn,subNbx,subNby,subNbz,numvel,"FixLbFluid:feqn"); memory->create(feqoldn,subNbx,subNby,subNbz,numvel,"FixLbFluid:feqoldn"); @@ -480,9 +480,9 @@ a z wall velocity without implementing fixed BCs in z"); memory->create(fnew,subNbx,subNby,subNbz,numvel,"FixLbFluid:fnew"); memory->create(density_lb,subNbx+3,subNby+3,subNbz+3,"FixLbFluid:density_lb"); memory->create(u_lb,subNbx+3,subNby+3,subNbz+3,3,"FixLbFluid:u_lb"); - if(printfluid > 0){ + if (printfluid > 0) { memory->create(buf,subNbx,subNby,subNbzmax,4,"FixLbFluid:buf"); - if(me==0) + if (me==0) memory->create(altogether,Nbx,Nby,Nbz,4,"FixLbFluid:altogether"); } memory->create(Ff,subNbx+3,subNby+3,subNbz+3,3,"FixLbFluid:Ff"); @@ -490,7 +490,7 @@ a z wall velocity without implementing fixed BCs in z"); memory->create(Fftempy,subNbx+3,5,subNbz+3,3,"FixLbFluid:Fftempy"); memory->create(Fftempz,subNbx+3,subNby+3,5,3,"FixLbFluid:Fftempz"); - if(noisestress==1){ + if (noisestress==1) { random = new RanMars(lmp,seed + comm->me); } @@ -518,7 +518,7 @@ FixLbFluid::~FixLbFluid() memory->destroy(mg_lb); memory->destroy(e); memory->destroy(feq); - if(typeLB == 2){ + if (typeLB == 2) { memory->destroy(feqold); memory->destroy(feqn); memory->destroy(feqoldn); @@ -527,8 +527,8 @@ FixLbFluid::~FixLbFluid() memory->destroy(fnew); memory->destroy(density_lb); memory->destroy(u_lb); - if(printfluid>0){ - if(me==0) + if (printfluid>0) { + if (me==0) memory->destroy(altogether); memory->destroy(buf); } @@ -537,11 +537,11 @@ FixLbFluid::~FixLbFluid() memory->destroy(Fftempy); memory->destroy(Fftempz); - if(noisestress==1){ + if (noisestress==1) { delete random; } - if(setGamma == 1){ + if (setGamma == 1) { delete [] Gamma; } else { delete [] NodeArea; @@ -583,7 +583,7 @@ void FixLbFluid::init(void) double dt_lb_now; dt_lb_now=nevery*(update->dt); - if(fabs(dt_lb_now - dt_lb) > 1.0e-12){ + if (fabs(dt_lb_now - dt_lb) > 1.0e-12) { error->warning(FLERR,"Timestep has changed between runs with the same lb/fluid. Unphysical results may occur"); } @@ -596,11 +596,11 @@ void FixLbFluid::init(void) Nby_now = (int)(domain->yprd/dx_lb + 0.5); Nbz_now = (int)(domain->zprd/dx_lb + 0.5); // If there are walls in the z-direction add an extra grid point. - if(domain->periodicity[2]==0){ + if (domain->periodicity[2]==0) { Nbz_now += 1; } - if(Nbx_now != Nbx || Nby_now != Nby || Nbz_now != Nbz){ + if (Nbx_now != Nbx || Nby_now != Nby || Nbz_now != Nbz) { error->all(FLERR,"the simulation domain can not change shape between runs with the same lb/fluid"); } @@ -610,13 +610,13 @@ void FixLbFluid::init(void) // shrink-wrap is not compatible in any dimension. // fixed only works in the z-direction. //-------------------------------------------------------------------------- - if(domain->boundary[0][0] != 0){ + if (domain->boundary[0][0] != 0) { error->all(FLERR,"the x-direction must be periodic"); } - if(domain->boundary[1][0] != 0){ + if (domain->boundary[1][0] != 0) { error->all(FLERR,"the y-direction must be periodic"); } - if(domain->boundary[2][0] == 2 || domain->boundary[2][0] == 3){ + if (domain->boundary[2][0] == 2 || domain->boundary[2][0] == 3) { error->all(FLERR,"the z-direction can not have shrink-wrap boundary conditions"); } @@ -624,33 +624,33 @@ void FixLbFluid::init(void) // Check if the lb/viscous fix is also called: //-------------------------------------------------------------------------- groupbit_viscouslb = groupbit_pc = groupbit_rigid_pc_sphere = 0; - for (i = 0; i < modify->nfix; i++){ - if (strcmp(modify->fix[i]->style,"lb/viscous") == 0){ + for (i = 0; i < modify->nfix; i++) { + if (strcmp(modify->fix[i]->style,"lb/viscous") == 0) { fixviscouslb = 1; groupbit_viscouslb = group->bitmask[modify->fix[i]->igroup]; } - if(strcmp(modify->fix[i]->style,"lb/pc")==0){ + if (strcmp(modify->fix[i]->style,"lb/pc")==0) { groupbit_pc = group->bitmask[modify->fix[i]->igroup]; } - if(strcmp(modify->fix[i]->style,"lb/rigid/pc/sphere")==0){ + if (strcmp(modify->fix[i]->style,"lb/rigid/pc/sphere")==0) { groupbit_rigid_pc_sphere = group->bitmask[modify->fix[i]->igroup]; } } // Warn if the fluid force is not applied to any of the particles. - if(!(groupbit_viscouslb || groupbit_pc || groupbit_rigid_pc_sphere) && comm->me==0){ + if (!(groupbit_viscouslb || groupbit_pc || groupbit_rigid_pc_sphere) && comm->me==0) { error->message(FLERR,"Not adding the fluid force to any of the MD particles. To add this force use one of the lb/viscous, lb/pc, or lb/rigid/pc/sphere fixes"); } // If fix lb/viscous is called for a particular atom, make sure // lb/pc or lb/rigid/pc/sphere are not: - if(fixviscouslb == 1){ + if (fixviscouslb == 1) { int *mask = atom->mask; int nlocal = atom->nlocal; - for(j=0; jone(FLERR,"should not use the lb/viscous command when integrating with the lb/pc fix"); - if((mask[j] & groupbit) && (mask[j] & groupbit_viscouslb) && (mask[j] & groupbit_rigid_pc_sphere)) + if ((mask[j] & groupbit) && (mask[j] & groupbit_viscouslb) && (mask[j] & groupbit_rigid_pc_sphere)) error->one(FLERR,"should not use the lb/viscous command when integrating with the lb/rigid/pc/sphere fix"); } } @@ -662,7 +662,7 @@ void FixLbFluid::setup(int /*vflag*/) //-------------------------------------------------------------------------- // Need to calculate the force on the fluid for a restart run. //-------------------------------------------------------------------------- - if(step > 0) + if (step > 0) calc_fluidforce(); } @@ -673,14 +673,14 @@ void FixLbFluid::initial_integrate(int /*vflag*/) //-------------------------------------------------------------------------- static int printheader = 1; - if(printheader == 1){ - if(force_diagnostic > 0 && me == 0){ + if (printheader == 1) { + if (force_diagnostic > 0 && me == 0) { printf("-------------------------------------------------------------------------------\n"); printf(" F_x F_y F_z T_x T_y T_z\n"); printf("-------------------------------------------------------------------------------\n"); } - if(printfluid > 0 && me == 0){ + if (printfluid > 0 && me == 0) { printf("---------------------------------------------------------------------\n"); printf(" density u_x u_y u_z \n"); printf("---------------------------------------------------------------------\n"); @@ -710,7 +710,7 @@ void FixLbFluid::initial_integrate(int /*vflag*/) // Store the equilibrium distribution function, it is needed in // the next time step by the update routine. //-------------------------------------------------------------------------- - if(typeLB == 2){ + if (typeLB == 2) { std::swap(feqold,feq); std::swap(feqoldn,feqn); } @@ -718,23 +718,23 @@ void FixLbFluid::initial_integrate(int /*vflag*/) //-------------------------------------------------------------------------- // Perform diagnostics, and print output for the graphics program //-------------------------------------------------------------------------- - if(printfluid > 0 && update->ntimestep > 0 && (update->ntimestep % printfluid == 0)) + if (printfluid > 0 && update->ntimestep > 0 && (update->ntimestep % printfluid == 0)) streamout(); } void FixLbFluid::post_force(int /*vflag*/) { - if(fixviscouslb==1) + if (fixviscouslb==1) calc_fluidforce(); } void FixLbFluid::end_of_step() { - if(fixviscouslb==0) + if (fixviscouslb==0) calc_fluidforce(); - if(printrestart>0){ - if((update->ntimestep)%printrestart == 0){ + if (printrestart>0) { + if ((update->ntimestep)%printrestart == 0) { write_restartfile(); } } @@ -807,8 +807,8 @@ void FixLbFluid::calc_fluidforce(void) forceloc[0] = forceloc[1] = forceloc[2] = 0.0; torqueloc[0] = torqueloc[1] = torqueloc[2] = 0.0; - for(i=0; inmax; i++) - for(j=0; j<3; j++) + for (i=0; inmax; i++) + for (j=0; j<3; j++) hydroF[i][j] = 0.0; @@ -821,16 +821,16 @@ void FixLbFluid::calc_fluidforce(void) int *type = atom->type; double sum[4],xcm[4]; - if(force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)){ + if (force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)) { //Calculate the center of mass of the particle group //(needed to calculate the torque). sum[0] = sum[1] = sum[2] = sum[3] = 0.0; - for(i=0; ibitmask[igroupforce]){ + for (i=0; ibitmask[igroupforce]) { domain->unmap(x[i],image[i],unwrap); - if(rmass) massone = rmass[i]; + if (rmass) massone = rmass[i]; else massone = mass[type[i]]; sum[0] += unwrap[0]*massone; @@ -848,16 +848,16 @@ void FixLbFluid::calc_fluidforce(void) //-------------------------------------------------------------------------- //Calculate the contribution to the force on the fluid. //-------------------------------------------------------------------------- - for(i=0; i 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)){ - if(mask[i] & group->bitmask[igroupforce]){ + if (force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)) { + if (mask[i] & group->bitmask[igroupforce]) { domain->unmap(x[i],image[i],unwrap); dx = unwrap[0] - xcm[0]; @@ -879,7 +879,7 @@ void FixLbFluid::calc_fluidforce(void) //Communicate the force contributions which lie outside the local processor //sub domain. //-------------------------------------------------------------------------- - for(i=0; i<10; i++) + for (i=0; i<10; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&Ff[0][0][0][0],1,passxu,comm->procneigh[0][0],10,world,&requests[0]); MPI_Isend(&Ff[subNbx+2][0][0][0],1,passxu,comm->procneigh[0][0],20,world,&requests[1]); @@ -893,9 +893,9 @@ void FixLbFluid::calc_fluidforce(void) MPI_Irecv(&Fftempx[4][0][0][0],1,passxtemp,comm->procneigh[0][0],50,world,&requests[9]); MPI_Waitall(10,requests,MPI_STATUS_IGNORE); - for(j=0; jprocneigh[1][0],10,world,&requests[0]); MPI_Isend(&Ff[0][subNby+2][0][0],1,passyu,comm->procneigh[1][0],20,world,&requests[1]); @@ -919,9 +919,9 @@ void FixLbFluid::calc_fluidforce(void) MPI_Irecv(&Fftempy[0][4][0][0],1,passytemp,comm->procneigh[1][0],50,world,&requests[9]); MPI_Waitall(10,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],10,world,&requests[0]); MPI_Isend(&Ff[0][0][subNbz+2][0],1,passzu,comm->procneigh[2][0],20,world,&requests[1]); @@ -945,9 +945,9 @@ void FixLbFluid::calc_fluidforce(void) MPI_Irecv(&Fftempz[0][0][4][0],1,passztemp,comm->procneigh[2][0],50,world,&requests[9]); MPI_Waitall(10,requests,MPI_STATUS_IGNORE); - for(i=0; i 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)){ + if (force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)) { force[0] = force[1] = force[2] = 0.0; torque[0] = torque[1] = torque[2] =0.0; MPI_Allreduce(&forceloc[0],&force[0],3,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&torqueloc[0],&torque[0],3,MPI_DOUBLE,MPI_SUM,world); - if(me==0){ + if (me==0) { printf("%E %E %E %E %E %E\n",force[0],force[1],force[2], torque[0],torque[1],torque[2]); @@ -1025,38 +1025,38 @@ void FixLbFluid::peskin_interpolation(int i) // Calculate the interpolation weights, and interpolated values of // the fluid velocity, and density. //-------------------------------------------------------------------------- - for(ii=-1; ii<3; ii++){ + for (ii=-1; ii<3; ii++) { rsq=(-dx1+ii)*(-dx1+ii); - if(rsq>=4) { + if (rsq>=4) { weightx=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightx=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightx=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(jj=-1; jj<3; jj++){ + for (jj=-1; jj<3; jj++) { rsq=(-dy1+jj)*(-dy1+jj); - if(rsq>=4) { + if (rsq>=4) { weighty=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weighty=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weighty=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(kk=-1; kk<3; kk++){ + for (kk=-1; kk<3; kk++) { rsq=(-dz1+kk)*(-dz1+kk); - if(rsq>=4) { + if (rsq>=4) { weightz=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightz=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightz=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; @@ -1068,35 +1068,35 @@ void FixLbFluid::peskin_interpolation(int i) //The atom is allowed to be within one lattice grid point outside the //local processor sub-domain. - if(ixp < -1 || ixp > (subNbx+1) || iyp < -1 || iyp > (subNby+1) || izp < -1 || izp > (subNbz+1)) + if (ixp < -1 || ixp > (subNbx+1) || iyp < -1 || iyp > (subNby+1) || izp < -1 || izp > (subNbz+1)) error->one(FLERR,"Atom outside local processor simulation domain. Either unstable fluid pararmeters, or \ require more frequent neighborlist rebuilds"); - if(domain->periodicity[2] == 0 && comm->myloc[2] == 0 && izp < 1) + if (domain->periodicity[2] == 0 && comm->myloc[2] == 0 && izp < 1) error->warning(FLERR,"Atom too close to lower z wall. Unphysical results may occur"); - if(domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) )) + if (domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) )) error->warning(FLERR,"Atom too close to upper z wall. Unphysical results may occur"); - if(ixp==-1) ixp=subNbx+2; - if(iyp==-1) iyp=subNby+2; - if(izp==-1) izp=subNbz+2; + if (ixp==-1) ixp=subNbx+2; + if (iyp==-1) iyp=subNby+2; + if (izp==-1) izp=subNbz+2; FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. - for(k=0; k<3; k++){ + for (k=0; k<3; k++) { unode[k] += u_lb[ixp][iyp][izp][k]*FfP[isten]; } - if(setGamma==0) + if (setGamma==0) mnode += density_lb[ixp][iyp][izp]*FfP[isten]; isten++; } } } - if(setGamma==0){ + if (setGamma==0) { mnode *= NodeArea[type[i]]; - if(rmass) massone = rmass[i]; + if (rmass) massone = rmass[i]; else massone = mass[type[i]]; massone = massone/dm_lb; @@ -1106,25 +1106,25 @@ require more frequent neighborlist rebuilds"); } isten=0; - for(ii=-1; ii<3; ii++) - for(jj=-1; jj<3; jj++) - for(kk=-1; kk<3; kk++){ + for (ii=-1; ii<3; ii++) + for (jj=-1; jj<3; jj++) + for (kk=-1; kk<3; kk++) { ixp = ix+ii; iyp = iy+jj; izp = iz+kk; - if(ixp==-1) ixp=subNbx+2; - if(iyp==-1) iyp=subNby+2; - if(izp==-1) izp=subNbz+2; + if (ixp==-1) ixp=subNbx+2; + if (iyp==-1) iyp=subNby+2; + if (izp==-1) izp=subNbz+2; // Compute the force on the fluid. Need to convert the velocity from // LAMMPS units to LB units. - for(k=0; k<3; k++){ + for (k=0; k<3; k++) { Ff[ixp][iyp][izp][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[isten]; } isten++; } - for(k=0; k<3; k++) + for (k=0; k<3; k++) hydroF[i][k] = -1.0*gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*dm_lb*dx_lb/dt_lb/dt_lb; } @@ -1191,13 +1191,13 @@ void FixLbFluid::trilinear_interpolation(int i) //The atom is allowed to be within one lattice grid point outside the //local processor sub-domain. - if(ix < 0 || ixp > (subNbx+1) || iy < 0 || iyp > (subNby+1) || iz < 0 || izp > (subNbz+1)) + if (ix < 0 || ixp > (subNbx+1) || iy < 0 || iyp > (subNby+1) || iz < 0 || izp > (subNbz+1)) error->one(FLERR,"Atom outside local processor simulation domain. Either unstable fluid pararmeters, or \ require more frequent neighborlist rebuilds"); - if(domain->periodicity[2] == 0 && comm->myloc[2] == 0 && (iz < 1 || izp < 1)) + if (domain->periodicity[2] == 0 && comm->myloc[2] == 0 && (iz < 1 || izp < 1)) error->warning(FLERR,"Atom too close to lower z wall. Unphysical results may occur"); - if(domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) || iz > (subNbz-2))) + if (domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) || iz > (subNbz-2))) error->warning(FLERR,"Atom too close to upper z wall. Unphysical results may occur"); @@ -1212,7 +1212,7 @@ require more frequent neighborlist rebuilds"); + u_lb[ixp][iyp][izp][k]*FfP[7]; } - if(setGamma==0){ + if (setGamma==0) { mnode = density_lb[ix][iy][iz]*FfP[0] + density_lb[ix][iy][izp]*FfP[1] + density_lb[ix][iyp][iz]*FfP[2] @@ -1224,7 +1224,7 @@ require more frequent neighborlist rebuilds"); mnode *= NodeArea[type[i]]; - if(rmass) massone = rmass[i]; + if (rmass) massone = rmass[i]; else massone = mass[type[i]]; massone = massone/dm_lb; @@ -1234,7 +1234,7 @@ require more frequent neighborlist rebuilds"); } - for(k=0; k<3; k++){ + for (k=0; k<3; k++) { Ff[ix][iy][iz][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[0]; Ff[ix][iy][izp][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[1]; Ff[ix][iyp][iz][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[2]; @@ -1245,7 +1245,7 @@ require more frequent neighborlist rebuilds"); Ff[ixp][iyp][izp][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[7]; } - for(k=0; k<3; k++) + for (k=0; k<3; k++) hydroF[i][k] = -1.0*gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*dm_lb*dx_lb/dt_lb/dt_lb; } @@ -1266,7 +1266,7 @@ void FixLbFluid::read_restartfile(void) int gsizes[4] = {Nbx,Nby,Nbz,numvel}; int lsizes[4] = {subNbx-2,subNby-2,subNbz-2,numvel}; int starts[4] = {comm->myloc[0]*(subNbx-2),comm->myloc[1]*(subNby-2),comm->myloc[2]*(subNbz-2),0}; - if(domain->periodicity[2]==0 && comm->myloc[2]==comm->procgrid[2]-1){ + if (domain->periodicity[2]==0 && comm->myloc[2]==comm->procgrid[2]-1) { starts[2] = comm->myloc[2]*(subNbz-3); } @@ -1280,7 +1280,7 @@ void FixLbFluid::read_restartfile(void) MPI_INFO_NULL); MPI_File_seek(pFileRead,0,MPI_SEEK_SET); MPI_File_read_all(pFileRead,&f_lb[0][0][0][0],1,realtype,&status); - if(typeLB == 2){ + if (typeLB == 2) { MPI_File_read_all(pFileRead,&feqold[0][0][0][0],1,realtype,&status); MPI_File_read_all(pFileRead,&feqoldn[0][0][0][0],1,realtype,&status); } @@ -1313,7 +1313,7 @@ void FixLbFluid::write_restartfile(void) int gsizes[4] = {Nbx,Nby,Nbz,numvel}; int lsizes[4] = {subNbx-2,subNby-2,subNbz-2,numvel}; int starts[4] = {comm->myloc[0]*(subNbx-2),comm->myloc[1]*(subNby-2),comm->myloc[2]*(subNbz-2),0}; - if(domain->periodicity[2]==0 && comm->myloc[2]==comm->procgrid[2]-1){ + if (domain->periodicity[2]==0 && comm->myloc[2]==comm->procgrid[2]-1) { starts[2] = comm->myloc[2]*(subNbz-3); } @@ -1325,7 +1325,7 @@ void FixLbFluid::write_restartfile(void) MPI_File_set_view(fh,0,MPI_DOUBLE,filetype,(char *) "native",MPI_INFO_NULL); MPI_File_write_all(fh,&f_lb[0][0][0][0],1,realtype,&status); - if(typeLB == 2){ + if (typeLB == 2) { MPI_File_write_all(fh,&feqold[0][0][0][0],1,realtype,&status); MPI_File_write_all(fh,&feqoldn[0][0][0][0],1,realtype,&status); } @@ -1353,15 +1353,15 @@ void FixLbFluid::rescale(void) tau=(3.0*viscosity/densityinit_real)*dt_lb*dt_lb/dx_lb/dx_lb; tau /= dt_lb; - if(typeLB==1) + if (typeLB==1) tau = tau + 0.5; - if(setGamma == 0){ - for(int i=0; i<= atom->ntypes; i++){ + if (setGamma == 0) { + for (int i=0; i<= atom->ntypes; i++) { NodeArea[i] = NodeArea[i]/dx_lb/dx_lb; } } else { - for(int i=0; i<= atom->ntypes; i++){ + for (int i=0; i<= atom->ntypes; i++) { Gamma[i] = Gamma[i]*dt_lb/dm_lb; } } @@ -1371,38 +1371,38 @@ void FixLbFluid::rescale(void) a_0 = a_0_real*dt_lb*dt_lb/(dx_lb*dx_lb); // Warn if using the D3Q19 model with noise, and a0 is too small. - if(numvel==19 && noisestress==1 && a_0 < 0.2){ + if (numvel==19 && noisestress==1 && a_0 < 0.2) { error->warning(FLERR,"Fix lb/fluid WARNING: Chosen value for a0 may be too small. \ Check temperature reproduction.\n"); } - if(noisestress==1){ - if(a_0>0.5555555){ + if (noisestress==1) { + if (a_0>0.5555555) { error->all(FLERR,"Fix lb/fluid ERROR: the Lattice Boltzmann dx and dt need \ to be chosen such that the scaled a_0 < 5/9\n"); } } // Courant Condition: - if(a_0 >= 1.0){ + if (a_0 >= 1.0) { error->all(FLERR,"Fix lb/fluid ERROR: the lattice Boltzmann dx and dt do not \ satisfy the Courant condition.\n"); } kB = (force->boltz/force->mvv2e)*dt_lb*dt_lb/dx_lb/dx_lb/dm_lb; - if(typeLB==1){ + if (typeLB==1) { expminusdtovertau = 0.0; Dcoeff = 0.0; namp = 2.0*kB*T*(tau-0.5)/3.0; noisefactor = 1.0; - if(a_0 <= 0.333333333333333){ + if (a_0 <= 0.333333333333333) { K_0 = 5.17*(0.333333333333333 - a_0); } else { K_0 = 2.57*(a_0 - 0.333333333333333); } dtoverdtcollision = dt_lb*6.0*viscosity/densityinit_real/dx_lb/dx_lb; - } else if(typeLB==2){ + } else if (typeLB==2) { expminusdtovertau=exp(-1.0/tau); Dcoeff=(1.0-(1.0-expminusdtovertau)*tau); namp = 2.0*kB*T/3.; @@ -1565,18 +1565,18 @@ void FixLbFluid::initializeLB15(void) mg_lb[14][10]=sqrt(2.);mg_lb[14][11]=sqrt(2.);mg_lb[14][12]=sqrt(2.); mg_lb[14][13]=sqrt(2.);mg_lb[14][14]=sqrt(2.); - for(i=0; iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feq[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); MPI_Isend(&feq[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],25,world,&requests[2]); MPI_Irecv(&feq[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); @@ -1860,13 +1860,13 @@ void FixLbFluid::initialize_feq(void) } MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); @@ -1874,13 +1874,13 @@ void FixLbFluid::initialize_feq(void) } MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feq[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); MPI_Irecv(&feq[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); @@ -1889,11 +1889,11 @@ void FixLbFluid::initialize_feq(void) MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); //Save feqold. - if(typeLB == 2){ - for(i=0; iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feqold[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); @@ -1916,7 +1916,7 @@ void FixLbFluid::initialize_feq(void) MPI_Irecv(&feqoldn[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],10,world,&requests[7]); MPI_Waitall(8,requests,MPI_STATUS_IGNORE); - for(i=0; i<8; i++) + for (i=0; i<8; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feqold[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feqold[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); @@ -1928,7 +1928,7 @@ void FixLbFluid::initialize_feq(void) MPI_Irecv(&feqoldn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); MPI_Waitall(8,requests,MPI_STATUS_IGNORE); - for(i=0; i<8; i++) + for (i=0; i<8; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feqold[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feqold[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); @@ -1994,14 +1994,14 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i // Need one-sided derivatives for the boundary of the domain, if fixed boundary // conditions are used. - if(domain->periodicity[2]==0){ - if(comm->myloc[2]==0 && k==1){ + if (domain->periodicity[2]==0) { + if (comm->myloc[2]==0 && k==1) { drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - density_lb[i][j][k+2])/2.0; drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - 5.0*density_lb[i][j][k+1] + 2.0*rho); } - if(comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2){ + if (comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2) { drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - density_lb[i][j][k-2])/2.0; drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - @@ -2017,7 +2017,7 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i dPdrho = a_0; //assuming here that kappa_lb = 0. - if(typeLB==1){ + if (typeLB==1) { Pxx = p0 + kappa_lb*(drhox*drhox - 0.5*grs)+(tau-0.5)*(1.0/3.0-dPdrho)* (3.0*u_lb[i][j][k][0]*drhox+u_lb[i][j][k][1]*drhoy+u_lb[i][j][k][2]*drhoz); Pyy = p0 + kappa_lb*(drhoy*drhoy - 0.5*grs)+(tau-0.5)*(1.0/3.0-dPdrho)* @@ -2030,7 +2030,7 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i (u_lb[i][j][k][0]*drhoz+u_lb[i][j][k][2]*drhox); Pyz = kappa_lb*drhoy*drhoz+(tau-0.5)*(1.0/3.0-dPdrho)* (u_lb[i][j][k][1]*drhoz+u_lb[i][j][k][2]*drhoy); - } else if(typeLB==2){ + } else if (typeLB==2) { Pxx = p0 + kappa_lb*(drhox*drhox - 0.5*grs)+tau*(1.0/3.0-dPdrho)* (3.0*u_lb[i][j][k][0]*drhox+u_lb[i][j][k][1]*drhoy+u_lb[i][j][k][2]*drhoz); Pyy = p0 + kappa_lb*(drhoy*drhoy - 0.5*grs)+tau*(1.0/3.0-dPdrho)* @@ -2079,17 +2079,17 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i for (int ii=0; ii<15; ii++) feq[i][j][k][l] += w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; - if(typeLB == 2){ + if (typeLB == 2) { feqn[i][j][k][l] = feq[i][j][k][l]; } } - if(noisestress==1){ + if (noisestress==1) { std = sqrt(namp*rho); - for(jj=0; jj<3; jj++) + for (jj=0; jj<3; jj++) S[0][jj] = std*random->gaussian(); - for(jj=0; jj<3; jj++) + for (jj=0; jj<3; jj++) S[1][jj] = std*random->gaussian(); etacov[4] = (S[0][0]*sqrt(3.0-3.0*a_0)); @@ -2172,14 +2172,14 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i // Need one-sided derivatives for the boundary of the domain, if fixed boundary // conditions are used. - if(domain->periodicity[2]==0){ - if(comm->myloc[2]==0 && k==1){ + if (domain->periodicity[2]==0) { + if (comm->myloc[2]==0 && k==1) { drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - density_lb[i][j][k+2])/2.0; drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - 5.0*density_lb[i][j][k+1] + 2.0*rho); } - if(comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2){ + if (comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2) { drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - density_lb[i][j][k-2])/2.0; drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - @@ -2195,7 +2195,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i dPdrho = a_0; //assuming here that kappa_lb = 0. - if(typeLB==1){ + if (typeLB==1) { Pxx = p0 + kappa_lb*(drhox*drhox - 0.5*grs)+(tau-0.5)*(1.0/3.0-dPdrho)* (3.0*u_lb[i][j][k][0]*drhox+u_lb[i][j][k][1]*drhoy+u_lb[i][j][k][2]*drhoz); Pyy = p0 + kappa_lb*(drhoy*drhoy - 0.5*grs)+(tau-0.5)*(1.0/3.0-dPdrho)* @@ -2208,7 +2208,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i (u_lb[i][j][k][0]*drhoz+u_lb[i][j][k][2]*drhox); Pyz = kappa_lb*drhoy*drhoz+(tau-0.5)*(1.0/3.0-dPdrho)* (u_lb[i][j][k][1]*drhoz+u_lb[i][j][k][2]*drhoy); - } else if(typeLB==2){ + } else if (typeLB==2) { Pxx = p0 + kappa_lb*(drhox*drhox - 0.5*grs)+tau*(1.0/3.0-dPdrho)* (3.0*u_lb[i][j][k][0]*drhox+u_lb[i][j][k][1]*drhoy+u_lb[i][j][k][2]*drhoz); Pyy = p0 + kappa_lb*(drhoy*drhoy - 0.5*grs)+tau*(1.0/3.0-dPdrho)* @@ -2260,17 +2260,17 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i for (int ii=0; ii<19; ii++) feq[i][j][k][l] += w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; - if(typeLB == 2){ + if (typeLB == 2) { feqn[i][j][k][l] = feq[i][j][k][l]; } } - if(noisestress==1){ + if (noisestress==1) { std = sqrt(namp*rho); - for(jj=0; jj<3; jj++) + for (jj=0; jj<3; jj++) S[0][jj] = std*random->gaussian(); - for(jj=0; jj<3; jj++) + for (jj=0; jj<3; jj++) S[1][jj] = std*random->gaussian(); etacov[4] = (S[0][0]*sqrt(3.0-3.0*a_0)); @@ -2322,7 +2322,7 @@ void FixLbFluid::parametercalc_full(void) // routine, and use these to calculate the density and velocity on the // boundary. //-------------------------------------------------------------------------- - for(i=0; i<4; i++) + for (i=0; i<4; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&f_lb[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[0]); MPI_Irecv(&f_lb[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[1]); @@ -2331,7 +2331,7 @@ void FixLbFluid::parametercalc_full(void) parametercalc_part(1,subNbx-1,1,subNby-1,1,subNbz-1); MPI_Waitall(4,requests,MPI_STATUS_IGNORE); - for(i=0; i<4; i++) + for (i=0; i<4; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&f_lb[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[0]); MPI_Irecv(&f_lb[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[1]); @@ -2341,7 +2341,7 @@ void FixLbFluid::parametercalc_full(void) parametercalc_part(subNbx-1,subNbx,1,subNby-1,1,subNbz-1); MPI_Waitall(4,requests,MPI_STATUS_IGNORE); - for(i=0; i<4; i++) + for (i=0; i<4; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&f_lb[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[0]); MPI_Irecv(&f_lb[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[1]); @@ -2358,10 +2358,10 @@ void FixLbFluid::parametercalc_full(void) // Send the remaining portions of the u array (and density array if Gamma // is set the default way). //-------------------------------------------------------------------------- - if(setGamma == 0) numrequests = 12; + if (setGamma == 0) numrequests = 12; else numrequests = 6; - for(i=0; iprocneigh[0][0],10,world,&requests2[0]); MPI_Isend(&u_lb[3][0][0][0],1,passxu,comm->procneigh[0][0],20,world,&requests2[1]); @@ -2369,7 +2369,7 @@ void FixLbFluid::parametercalc_full(void) MPI_Irecv(&u_lb[subNbx][0][0][0],1,passxu,comm->procneigh[0][1],10,world,&requests2[3]); MPI_Irecv(&u_lb[subNbx+1][0][0][0],1,passxu,comm->procneigh[0][1],20,world,&requests2[4]); MPI_Irecv(&u_lb[subNbx+2][0][0][0],1,passxu,comm->procneigh[0][0],30,world,&requests2[5]); - if(setGamma==0){ + if (setGamma==0) { MPI_Isend(&density_lb[2][0][0],1,passxrho,comm->procneigh[0][0],40,world,&requests2[6]); MPI_Isend(&density_lb[3][0][0],1,passxrho,comm->procneigh[0][0],50,world,&requests2[7]); MPI_Isend(&density_lb[subNbx-3][0][0],1,passxrho,comm->procneigh[0][1],60,world,&requests2[8]); @@ -2379,7 +2379,7 @@ void FixLbFluid::parametercalc_full(void) } MPI_Waitall(numrequests,requests2,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],10,world,&requests2[0]); MPI_Isend(&u_lb[0][3][0][0],1,passyu,comm->procneigh[1][0],20,world,&requests2[1]); @@ -2387,7 +2387,7 @@ void FixLbFluid::parametercalc_full(void) MPI_Irecv(&u_lb[0][subNby][0][0],1,passyu,comm->procneigh[1][1],10,world,&requests2[3]); MPI_Irecv(&u_lb[0][subNby+1][0][0],1,passyu,comm->procneigh[1][1],20,world,&requests2[4]); MPI_Irecv(&u_lb[0][subNby+2][0][0],1,passyu,comm->procneigh[1][0],30,world,&requests2[5]); - if(setGamma==0){ + if (setGamma==0) { MPI_Isend(&density_lb[0][2][0],1,passyrho,comm->procneigh[1][0],40,world,&requests2[6]); MPI_Isend(&density_lb[0][3][0],1,passyrho,comm->procneigh[1][0],50,world,&requests2[7]); MPI_Isend(&density_lb[0][subNby-3][0],1,passyrho,comm->procneigh[1][1],60,world,&requests2[8]); @@ -2397,27 +2397,27 @@ void FixLbFluid::parametercalc_full(void) } MPI_Waitall(numrequests,requests2,MPI_STATUS_IGNORE); - for(i=0; i<12; i++) + for (i=0; i<12; i++) requests2[i]=MPI_REQUEST_NULL; int requestcount=0; - if(domain->periodicity[2]!=0 || comm->myloc[2] != 0){ + if (domain->periodicity[2]!=0 || comm->myloc[2] != 0) { MPI_Isend(&u_lb[0][0][2][0],1,passzu,comm->procneigh[2][0],10,world,&requests2[requestcount]); MPI_Isend(&u_lb[0][0][3][0],1,passzu,comm->procneigh[2][0],20,world,&requests2[requestcount+1]); MPI_Irecv(&u_lb[0][0][subNbz+2][0],1,passzu,comm->procneigh[2][0],30,world,&requests2[requestcount+2]); requestcount=requestcount+3; - if(setGamma==0){ + if (setGamma==0) { MPI_Isend(&density_lb[0][0][2],1,passzrho,comm->procneigh[2][0],40,world,&requests2[requestcount]); MPI_Isend(&density_lb[0][0][3],1,passzrho,comm->procneigh[2][0],50,world,&requests2[requestcount+1]); MPI_Irecv(&density_lb[0][0][subNbz+2],1,passzrho,comm->procneigh[2][0],60,world,&requests2[requestcount+2]); requestcount=requestcount+3; } } - if(domain->periodicity[2]!=0 || comm->myloc[2] != (comm->procgrid[2]-1)){ + if (domain->periodicity[2]!=0 || comm->myloc[2] != (comm->procgrid[2]-1)) { MPI_Isend(&u_lb[0][0][subNbz-3][0],1,passzu,comm->procneigh[2][1],30,world,&requests2[requestcount]); MPI_Irecv(&u_lb[0][0][subNbz][0],1,passzu,comm->procneigh[2][1],10,world,&requests2[requestcount+1]); MPI_Irecv(&u_lb[0][0][subNbz+1][0],1,passzu,comm->procneigh[2][1],20,world,&requests2[requestcount+2]); requestcount=requestcount+3; - if(setGamma==0){ + if (setGamma==0) { MPI_Isend(&density_lb[0][0][subNbz-3],1,passzrho,comm->procneigh[2][1],60,world,&requests2[requestcount]); MPI_Irecv(&density_lb[0][0][subNbz],1,passzrho,comm->procneigh[2][1],40,world,&requests2[requestcount+1]); MPI_Irecv(&density_lb[0][0][subNbz+1],1,passzrho,comm->procneigh[2][1],50,world,&requests2[requestcount+2]); @@ -2436,9 +2436,9 @@ void FixLbFluid::parametercalc_part(int xstart, int xend, int ystart, int yend, { int i,j,k,m; - for(i=xstart; iperiodicity[2]==0){ - if(comm->myloc[2]==0){ - if(k==1){ + if (domain->periodicity[2]==0) { + if (comm->myloc[2]==0) { + if (k==1) { u_lb[i][j][k][2]=0.0; } } - if(comm->myloc[2]==comm->procgrid[2]-1){ - if(k==subNbz-2){ + if (comm->myloc[2]==comm->procgrid[2]-1) { + if (k==subNbz-2) { u_lb[i][j][k][2]=0.0; } } @@ -2487,20 +2487,20 @@ void FixLbFluid::update_periodic(int xstart, int xend, int ystart, int yend, int int i,j,k,m; int imod,jmod,kmod,imodm,jmodm,kmodm; - for(i=xstart; ime==0){ + // if (comm->me==0) { // printf("%16.12f %16.12f %16.12f %16.12f\n",mass*dm_lb,momentum[0]*dm_lb*dx_lb/dt_lb,momentum[1]*dm_lb*dx_lb/dt_lb,momentum[2]*dm_lb*dx_lb/dt_lb); // } sizeloc=(subNbx*subNby*subNbz*4); MPI_Allreduce(&sizeloc,&size,1,MPI_INT,MPI_MAX,world); - if(me==0){ - for(iproc=0; iproc < comm->nprocs; iproc++){ - if(iproc){ + if (me==0) { + for (iproc=0; iproc < comm->nprocs; iproc++) { + if (iproc) { MPI_Irecv(&buf[0][0][0][0],size,MPI_DOUBLE,iproc,0,world,&request_recv); MPI_Wait(&request_recv,&status); @@ -2577,19 +2577,19 @@ void FixLbFluid::streamout(void) jend=static_cast (buf[0][0][1][1]); kend=static_cast (buf[0][0][1][2]); - for(i=istart; imyloc[0]*(subNbx-2); jstart=comm->myloc[1]*(subNby-2); - if(domain->periodicity[2]==0){ - if(comm->myloc[2]==comm->procgrid[2]-1){ + if (domain->periodicity[2]==0) { + if (comm->myloc[2]==comm->procgrid[2]-1) { kstart=comm->myloc[2]*(subNbz-3); } else { kstart=comm->myloc[2]*(subNbz-2); @@ -2623,9 +2623,9 @@ void FixLbFluid::streamout(void) iend=istart+subNbx-2; jend=jstart+subNby-2; kend=kstart+subNbz-2; - for(i=0; iperiodicity[2]==0){ + if (domain->periodicity[2]==0) { - for(i=0; iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feq[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); MPI_Isend(&feq[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],25,world,&requests[2]); MPI_Irecv(&feq[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); @@ -2694,13 +2694,13 @@ void FixLbFluid::update_full15(void) MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); @@ -2710,13 +2710,13 @@ void FixLbFluid::update_full15(void) update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feq[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); MPI_Irecv(&feq[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); @@ -2726,15 +2726,15 @@ void FixLbFluid::update_full15(void) update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - if(typeLB==1){ + if (typeLB==1) { update_periodic(1,subNbx-1,1,subNby-1,1,2); update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); - } else if(typeLB==2){ - if(comm->myloc[2]==0){ - for(i=1; imyloc[2]==0) { + for (i=1; imyloc[2]==comm->procgrid[2]-1){ - for(i=1;imyloc[2]==comm->procgrid[2]-1) { + for (i=1;imyloc[2]==0){ + if (comm->myloc[2]==0) { MPI_Isend(&fnew[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&req_send15); MPI_Irecv(&fnew[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&req_recv25); } - if(comm->myloc[2]==comm->procgrid[2]-1){ + if (comm->myloc[2]==comm->procgrid[2]-1) { MPI_Isend(&fnew[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&req_send25); MPI_Irecv(&fnew[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&req_recv15); } - if(comm->myloc[2]==0){ + if (comm->myloc[2]==0) { MPI_Wait(&req_send15,&status); MPI_Wait(&req_recv25,&status); - for(i=1;imyloc[2]==comm->procgrid[2]-1){ + if (comm->myloc[2]==comm->procgrid[2]-1) { MPI_Wait(&req_send25,&status); MPI_Wait(&req_recv15,&status); - for(i=1;iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feq[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); MPI_Isend(&feq[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],25,world,&requests[2]); MPI_Irecv(&feq[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); @@ -2965,13 +2965,13 @@ void FixLbFluid::update_full15(void) update_periodic(2,subNbx-2,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); @@ -2981,13 +2981,13 @@ void FixLbFluid::update_full15(void) update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feq[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); MPI_Irecv(&feq[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); @@ -3024,7 +3024,7 @@ void FixLbFluid::update_full19(void) //-------------------------------------------------------------------------- // If using the standard LB integrator, do not need to send info about feqn. //-------------------------------------------------------------------------- - if(typeLB == 1){ + if (typeLB == 1) { numrequests = 4; } else { numrequests = 8; @@ -3033,15 +3033,15 @@ void FixLbFluid::update_full19(void) //-------------------------------------------------------------------------- // Fixed z boundary conditions. //-------------------------------------------------------------------------- - if(domain->periodicity[2]==0){ + if (domain->periodicity[2]==0) { - for(i=0; iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feq[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); MPI_Isend(&feq[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],25,world,&requests[2]); MPI_Irecv(&feq[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); @@ -3050,13 +3050,13 @@ void FixLbFluid::update_full19(void) update_periodic(2,subNbx-2,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); @@ -3066,13 +3066,13 @@ void FixLbFluid::update_full19(void) update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feq[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); MPI_Irecv(&feq[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); @@ -3082,15 +3082,15 @@ void FixLbFluid::update_full19(void) update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - if(typeLB==1){ + if (typeLB==1) { update_periodic(1,subNbx-1,1,subNby-1,1,2); update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); - } else if(typeLB==2){ - if(comm->myloc[2]==0){ - for(i=1; imyloc[2]==0) { + for (i=1; imyloc[2]==comm->procgrid[2]-1){ - for(i=1;imyloc[2]==comm->procgrid[2]-1) { + for (i=1;imyloc[2]==0){ + if (comm->myloc[2]==0) { MPI_Isend(&fnew[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&req_send15); MPI_Irecv(&fnew[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&req_recv25); } - if(comm->myloc[2]==comm->procgrid[2]-1){ + if (comm->myloc[2]==comm->procgrid[2]-1) { MPI_Isend(&fnew[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&req_send25); MPI_Irecv(&fnew[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&req_recv15); } - if(comm->myloc[2]==0){ + if (comm->myloc[2]==0) { MPI_Wait(&req_send15,&status); MPI_Wait(&req_recv25,&status); - for(i=1;imyloc[2]==comm->procgrid[2]-1){ + if (comm->myloc[2]==comm->procgrid[2]-1) { MPI_Wait(&req_send25,&status); MPI_Wait(&req_recv15,&status); - for(i=1;iprocneigh[0][0],15,world,&requests[0]); MPI_Irecv(&feq[0][1][1][0],1,passxf,comm->procneigh[0][0],25,world,&requests[1]); MPI_Isend(&feq[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],25,world,&requests[2]); MPI_Irecv(&feq[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); @@ -3311,13 +3311,13 @@ void FixLbFluid::update_full19(void) update_periodic(2,subNbx-2,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[1][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); @@ -3327,13 +3327,13 @@ void FixLbFluid::update_full19(void) update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - for(i=0; iprocneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feq[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feq[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); MPI_Irecv(&feq[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); - if(typeLB == 2){ + if (typeLB == 2) { MPI_Isend(&feqn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); diff --git a/src/USER-LB/fix_lb_momentum.cpp b/src/USER-LB/fix_lb_momentum.cpp index 81acdbef45..9a305f6fe1 100644 --- a/src/USER-LB/fix_lb_momentum.cpp +++ b/src/USER-LB/fix_lb_momentum.cpp @@ -70,8 +70,8 @@ FixLbMomentum::FixLbMomentum(LAMMPS *lmp, int narg, char **arg) : if (group->count(igroup) == 0.0) error->all(FLERR,"Fix lb/momentum group has no atoms"); - for(int ifix=0; ifixnfix; ifix++) - if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0) + for (int ifix=0; ifixnfix; ifix++) + if (strcmp(modify->fix[ifix]->style,"lb/fluid")==0) fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; @@ -135,9 +135,9 @@ void FixLbMomentum::end_of_step() masslbloc = 0.0; momentumlbloc[0] = momentumlbloc[1] = momentumlbloc[2] = 0.0; - for(int i = 1; ie; //Subtract vcm from the fluid. - for(int i=0; ifeqold; double ****feqoldn = fix_lb_fluid->feqoldn; density_old = 0.0; u_old[0] = u_old[1] = u_old[2] = 0.0; - for(int l=0; lntypes+1]; int groupbit_lb_fluid = 0; - for(int ifix=0; ifixnfix; ifix++) - if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0){ + for (int ifix=0; ifixnfix; ifix++) + if (strcmp(modify->fix[ifix]->style,"lb/fluid")==0) { fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; groupbit_lb_fluid = group->bitmask[modify->fix[ifix]->igroup]; } - if(groupbit_lb_fluid == 0) + if (groupbit_lb_fluid == 0) error->all(FLERR,"the lb/fluid fix must also be used if using the lb/pc fix"); int *mask = atom->mask; int nlocal = atom->nlocal; - for(int j=0; jone(FLERR,"can only use the lb/pc fix for an atom if also using the lb/fluid fix for that atom"); } @@ -109,7 +109,7 @@ void FixLbPC::init() dtv = update->dt; dtf = update->dt * force->ftm2v; - for(int i=0; i<=atom->ntypes; i++) + for (int i=0; i<=atom->ntypes; i++) Gamma_MD[i] = Gamma[i]*dm_lb/dt_lb; } @@ -132,7 +132,7 @@ void FixLbPC::initial_integrate(int /*vflag*/) { compute_up(); - for(int i=0; itrilinear_stencil; - for(i=0; i=4) { + if (rsq>=4) { weightx=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightx=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightx=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(jj=-1; jj<3; jj++){ + for (jj=-1; jj<3; jj++) { rsq=(-dy1+jj)*(-dy1+jj); - if(rsq>=4) { + if (rsq>=4) { weighty=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weighty=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weighty=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(kk=-1; kk<3; kk++){ + for (kk=-1; kk<3; kk++) { rsq=(-dz1+kk)*(-dz1+kk); - if(rsq>=4) { + if (rsq>=4) { weightz=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightz=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightz=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; @@ -423,13 +423,13 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) izp = iz+kk; - if(ixp==-1) ixp=subNbx+2; - if(iyp==-1) iyp=subNby+2; - if(izp==-1) izp=subNbz+2; + if (ixp==-1) ixp=subNbx+2; + if (iyp==-1) iyp=subNby+2; + if (izp==-1) izp=subNbz+2; FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. - for(k=0; k<3; k++){ + for (k=0; k<3; k++) { up[i][k] += u_lb[ixp][iyp][izp][k]*FfP[isten]; } } @@ -460,7 +460,7 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) + u_lb[ixp][iyp][izp][k]*FfP[7]; } } - for(k=0; k<3; k++) + for (k=0; k<3; k++) up[i][k] = up[i][k]*dx_lb/dt_lb; } diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index dd4b7b8647..88eb54593a 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -286,10 +286,10 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : iarg += 5; // specify if certain particles are inside the rigid spherical body, // and therefore should not - } else if(strcmp(arg[iarg],"innerNodes")==0){ + } else if (strcmp(arg[iarg],"innerNodes")==0) { inner_nodes = 1; igroupinner = group->find(arg[iarg+1]); - if(igroupinner == -1) + if (igroupinner == -1) error->all(FLERR,"Could not find fix lb/rigid/pc/sphere innerNodes group ID"); iarg += 2; } else error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); @@ -328,16 +328,16 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : //count the number of atoms in the shell. if (inner_nodes == 1) { int *mask = atom->mask; - for(ibody=0; ibodybitmask[igroupinner])){ - if(body[i] >= 0) ncount[body[i]]++; + for (ibody=0; ibodybitmask[igroupinner])) { + if (body[i] >= 0) ncount[body[i]]++; } } MPI_Allreduce(ncount,nrigid_shell,nbody,MPI_INT,MPI_SUM,world); } else { - for(ibody=0; ibody < nbody; ibody++) nrigid_shell[ibody]=nrigid[ibody]; + for (ibody=0; ibody < nbody; ibody++) nrigid_shell[ibody]=nrigid[ibody]; } delete [] ncount; @@ -365,29 +365,29 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : int groupbit_lb_fluid = 0; - for(int ifix=0; ifixnfix; ifix++) - if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0){ + for (int ifix=0; ifixnfix; ifix++) + if (strcmp(modify->fix[ifix]->style,"lb/fluid")==0) { fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; groupbit_lb_fluid = group->bitmask[modify->fix[ifix]->igroup]; } - if(groupbit_lb_fluid == 0) + if (groupbit_lb_fluid == 0) error->all(FLERR,"the lb/fluid fix must also be used if using the lb/rigid/pc/sphere fix"); int *mask = atom->mask; - if(inner_nodes == 1){ - for(int j=0; jbitmask[igroupinner]) && !(mask[j] & groupbit_lb_fluid)) + if (inner_nodes == 1) { + for (int j=0; jbitmask[igroupinner]) && !(mask[j] & groupbit_lb_fluid)) error->one(FLERR,"use the innerNodes keyword in the lb/rigid/pc/sphere fix for atoms which do not interact with the lb/fluid"); // If inner nodes are present, which should not interact with the fluid, make // sure these are not used by the lb/fluid fix to apply a force to the fluid. - if((mask[j] & groupbit) && (mask[j] & groupbit_lb_fluid) && (mask[j] & group->bitmask[igroupinner])) + if ((mask[j] & groupbit) && (mask[j] & groupbit_lb_fluid) && (mask[j] & group->bitmask[igroupinner])) error->one(FLERR,"the inner nodes specified in lb/rigid/pc/sphere should not be included in the lb/fluid fix"); } } else { - for(int j=0; jone(FLERR,"use the innerNodes keyword in the lb/rigid/pc/sphere fix for atoms which do not interact with the lb/fluid"); } } @@ -497,7 +497,7 @@ void FixLbRigidPCSphere::init() MPI_Allreduce(&flag,&extended,1,MPI_INT,MPI_MAX,world); } - if(extended) + if (extended) error->warning(FLERR,"Fix lb/rigid/pc/sphere assumes point particles"); // compute masstotal & center-of-mass of each rigid body @@ -530,8 +530,8 @@ void FixLbRigidPCSphere::init() sum[ibody][1] += yunwrap * massone; sum[ibody][2] += zunwrap * massone; sum[ibody][3] += massone; - if(inner_nodes == 1){ - if(!(mask[i] & group->bitmask[igroupinner])){ + if (inner_nodes == 1) { + if (!(mask[i] & group->bitmask[igroupinner])) { sum[ibody][4] += massone; } } else { @@ -558,10 +558,10 @@ void FixLbRigidPCSphere::init() for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; - for (i=0; ibitmask[igroupinner])){ + for (i=0; ibitmask[igroupinner])) { ibody = body[i]; xbox = (image[i] & IMGMASK) - IMGMAX; @@ -601,26 +601,26 @@ void FixLbRigidPCSphere::init() MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); - for(ibody=0; ibody < nbody; ibody++){ + for (ibody=0; ibody < nbody; ibody++) { sphereradius[ibody] = sqrt(all[ibody][0]/nrigid_shell[ibody]); Gamma_MD[ibody] = all[ibody][1]*dm_lb/dt_lb/nrigid_shell[ibody]; } // Check that all atoms in the rigid body have the same value of gamma. double eps = 1.0e-7; - for (i=0; ibitmask[igroupinner])){ + for (i=0; ibitmask[igroupinner])) { ibody = body[i]; - if(Gamma_MD[ibody]*dt_lb/dm_lb - Gamma[type[i]] > eps) + if (Gamma_MD[ibody]*dt_lb/dm_lb - Gamma[type[i]] > eps) error->one(FLERR,"All atoms in a rigid body must have the same gamma value"); } } else { ibody = body[i]; - if(Gamma_MD[ibody]*dt_lb/dm_lb - Gamma[type[i]] > eps) + if (Gamma_MD[ibody]*dt_lb/dm_lb - Gamma[type[i]] > eps) error->one(FLERR,"All atoms in a rigid body must have the same gamma value"); } } @@ -790,8 +790,8 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) if (rmass) massone = rmass[i]; else massone = mass[type[i]]; - if(inner_nodes == 1){ - if(!(mask[i] & group->bitmask[igroupinner])){ + if (inner_nodes == 1) { + if (!(mask[i] & group->bitmask[igroupinner])) { sum[ibody][0] += up[i][0]*massone; sum[ibody][1] += up[i][1]*massone; sum[ibody][2] += up[i][2]*massone; @@ -812,10 +812,10 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) //Store the total torque due to the fluid. for (ibody = 0; ibody < nbody; ibody++) - for(i = 0; i < 6; i++) sum[ibody][i] = 0.0; + for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; - for(i = 0; iunmap(x[i],image[i],unwrap); @@ -827,8 +827,8 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) if (rmass) massone = rmass[i]; else massone = mass[type[i]]; - if(inner_nodes == 1){ - if(!(mask[i] & group->bitmask[igroupinner])){ + if (inner_nodes == 1) { + if (!(mask[i] & group->bitmask[igroupinner])) { sum[ibody][0] += Gamma_MD[ibody]*(dy * ((up[i][2]-vcm[ibody][2])) - dz * ((up[i][1]-vcm[ibody][1]))); sum[ibody][1] += Gamma_MD[ibody]*(dz * ((up[i][0]-vcm[ibody][0])) - @@ -898,15 +898,15 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) expminusdttimesgamma = exp(-Gamma_MD[ibody]*dtv*nrigid_shell[ibody]/masstotal[ibody]); force_factor = force->ftm2v/Gamma_MD[ibody]/nrigid_shell[ibody]; - if(fflag[ibody][0]==1){ + if (fflag[ibody][0]==1) { vcm[ibody][0] = expminusdttimesgamma*(vcm[ibody][0] - ucm[ibody][0] - fcm[ibody][0]*force_factor) + ucm[ibody][0] + fcm[ibody][0]*force_factor; } - if(fflag[ibody][1]==1){ + if (fflag[ibody][1]==1) { vcm[ibody][1] = expminusdttimesgamma*(vcm[ibody][1] - ucm[ibody][1] - fcm[ibody][1]*force_factor) + ucm[ibody][1] + fcm[ibody][1]*force_factor; } - if(fflag[ibody][2]==1){ + if (fflag[ibody][2]==1) { vcm[ibody][2] = expminusdttimesgamma*(vcm[ibody][2] - ucm[ibody][2] - fcm[ibody][2]*force_factor) + ucm[ibody][2] + fcm[ibody][2]*force_factor; } @@ -916,19 +916,19 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) expminusdttimesgamma = exp(-dtv*torque_factor); - if(tflag[ibody][0]==1){ + if (tflag[ibody][0]==1) { omega[ibody][0] = expminusdttimesgamma*(omega[ibody][0] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][0] + torque_fluid[ibody][0])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][0] + torque_fluid[ibody][0]); } - if(tflag[ibody][1]==1){ + if (tflag[ibody][1]==1) { omega[ibody][1] = expminusdttimesgamma*(omega[ibody][1] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][1] + torque_fluid[ibody][1])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][1] + torque_fluid[ibody][1]); } - if(tflag[ibody][2]==1){ + if (tflag[ibody][2]==1) { omega[ibody][2] = expminusdttimesgamma*(omega[ibody][2] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][2] + torque_fluid[ibody][2])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* @@ -1040,8 +1040,8 @@ void FixLbRigidPCSphere::final_integrate() dy = unwrap[1] - xcm[ibody][1]; dz = unwrap[2] - xcm[ibody][2]; - if(inner_nodes == 1){ - if(!(mask[i] & group->bitmask[igroupinner])){ + if (inner_nodes == 1) { + if (!(mask[i] & group->bitmask[igroupinner])) { sum[ibody][0] += up[i][0]*massone; sum[ibody][1] += up[i][1]*massone; sum[ibody][2] += up[i][2]*massone; @@ -1148,7 +1148,7 @@ void FixLbRigidPCSphere::set_v() dz = zunwrap - xcm[ibody][2]; // save old velocities for virial. - if(evflag){ + if (evflag) { v0 = v[i][0]; v1 = v[i][1]; v2 = v[i][2]; @@ -1242,7 +1242,7 @@ void FixLbRigidPCSphere::set_xv() dz = zunwrap - xcm_old[ibody][2]; // save old positions and velocities for virial - if(evflag){ + if (evflag) { x0 = xunwrap; x1 = yunwrap; x2 = zunwrap; @@ -1578,8 +1578,8 @@ double FixLbRigidPCSphere::compute_array(int i, int j) double FfP[64]; - for(i=0; i=4) { + if (rsq>=4) { weightx=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightx=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightx=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(jj=-1; jj<3; jj++){ + for (jj=-1; jj<3; jj++) { rsq=(-dy1+jj)*(-dy1+jj); - if(rsq>=4) { + if (rsq>=4) { weighty=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weighty=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weighty=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; } } - for(kk=-1; kk<3; kk++){ + for (kk=-1; kk<3; kk++) { rsq=(-dz1+kk)*(-dz1+kk); - if(rsq>=4) { + if (rsq>=4) { weightz=0.0; } else { r=sqrt(rsq); - if(rsq>1){ + if (rsq>1) { weightz=(5.0-2.0*r-sqrt(-7.0+12.0*r-4.0*rsq))/8.; } else { weightz=(3.0-2.0*r+sqrt(1.0+4.0*r-4.0*rsq))/8.; @@ -1646,13 +1646,13 @@ double FixLbRigidPCSphere::compute_array(int i, int j) izp = iz+kk; - if(ixp==-1) ixp=subNbx+2; - if(iyp==-1) iyp=subNby+2; - if(izp==-1) izp=subNbz+2; + if (ixp==-1) ixp=subNbx+2; + if (iyp==-1) iyp=subNby+2; + if (izp==-1) izp=subNbz+2; FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. - for(k=0; k<3; k++){ + for (k=0; k<3; k++) { up[i][k] += u_lb[ixp][iyp][izp][k]*FfP[isten]; } } @@ -1683,7 +1683,7 @@ double FixLbRigidPCSphere::compute_array(int i, int j) + u_lb[ixp][iyp][izp][k]*FfP[7]; } } - for(k=0; k<3; k++) + for (k=0; k<3; k++) up[i][k] = up[i][k]*dx_lb/dt_lb; } diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index d796942941..08a0a10356 100644 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -37,19 +37,19 @@ FixLbViscous::FixLbViscous(LAMMPS *lmp, int narg, char **arg) : int groupbit_lb_fluid = 0; - for(int ifix=0; ifixnfix; ifix++) - if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0){ + for (int ifix=0; ifixnfix; ifix++) + if (strcmp(modify->fix[ifix]->style,"lb/fluid")==0) { fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; groupbit_lb_fluid = group->bitmask[modify->fix[ifix]->igroup]; } - if(groupbit_lb_fluid == 0) + if (groupbit_lb_fluid == 0) error->all(FLERR,"the lb/fluid fix must also be used if using the lb/viscous fix"); int *mask = atom->mask; int nlocal = atom->nlocal; - for(int j=0; jone(FLERR,"to apply a fluid force onto an atom, the lb/fluid fix must be used for that atom."); } diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 37f9fac522..bcb14ce1f9 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -86,7 +86,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : // equal style vars (so that they are not overwritten each time step). double *params = ptr_m->params; - for( int i = 0; i < nvars; ++i ){ + for( int i = 0; i < nvars; ++i ) { if (was_var( arg[i+4] )) error->all(FLERR,"Equal-style variables not allowed with fix manifoldforce"); @@ -157,7 +157,7 @@ void FixManifoldForce::post_force(int /*vflag*/) double n[3]; double invn2; double dot; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { // Determine normal of particle: ptr_m->n(x[i],n); diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index 49f24fb5b6..bea7955d33 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -117,7 +117,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, error->all(FLERR, msg); } // Loop over manifold args: - for( int i = 0; i < nvars; ++i ){ + for( int i = 0; i < nvars; ++i ) { int len = 0, offset = 0; if (was_var( arg[i+6] )) { len = strlen(arg[i+6]) - 1; // -1 because -2 for v_, +1 for \0. @@ -135,7 +135,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, ptr_m->params = new double[nvars]; if (!ptr_m->params ) error->all(FLERR,"Failed to allocate params!"); - for( int i = 0; i < nvars; ++i ){ + for( int i = 0; i < nvars; ++i ) { // If param i was variable type, it will be set later... ptr_m->params[i] = is_var[i] ? 0.0 : utils::numeric( FLERR, arg[i+6] ,false,lmp); } @@ -144,7 +144,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, // Loop over rest of args: int argi = 6 + nvars; - while( argi < narg ){ + while( argi < narg ) { if (strcmp(arg[argi], "every") == 0) { nevery = utils::inumeric(FLERR,arg[argi+1],false,lmp); next_output = update->ntimestep + nevery; @@ -170,7 +170,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, FixNVEManifoldRattle::~FixNVEManifoldRattle() { if (tstrs) { - for( int i = 0; i < nvars; ++i ){ + for( int i = 0; i < nvars; ++i ) { delete [] tstrs[i]; } delete [] tstrs; @@ -277,7 +277,7 @@ void FixNVEManifoldRattle::update_var_params() double *ptr_params = ptr_m->params; - for( int i = 0; i < nvars; ++i ){ + for( int i = 0; i < nvars; ++i ) { if (is_var[i]) { tvars[i] = input->variable->find(tstrs[i]); if (tvars[i] < 0) { @@ -306,8 +306,8 @@ int FixNVEManifoldRattle::dof(int /*igroup*/) int *mask = atom->mask; int nlocal = atom->nlocal; int natoms = 0; - for( int i = 0; i < nlocal; ++i ){ - if(mask[i] & groupbit) ++natoms; + for( int i = 0; i < nlocal; ++i ) { + if (mask[i] & groupbit) ++natoms; } int dofs; @@ -362,7 +362,7 @@ void FixNVEManifoldRattle::final_integrate() ---------------------------------------------------------------------------*/ void FixNVEManifoldRattle::end_of_step() { - if (nevery && (update->ntimestep == next_output)){ + if (nevery && (update->ntimestep == next_output)) { if (comm->me == 0) { print_stats( "nve/manifold/rattle" ); next_output += nevery; @@ -386,21 +386,21 @@ void FixNVEManifoldRattle::nve_x_rattle(int igroup, int groupbit) int nlocal = atom->nlocal; int natoms = 0; - if (igroup == atom->firstgroup){ + if (igroup == atom->firstgroup) { nlocal = atom->nfirst; } if (rmass) { - for (int i = 0; i < nlocal; i++){ - if (mask[i] & groupbit){ + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { natoms++; dtfm = dtf / rmass[i]; rattle_manifold_x( x[i], v[i], f[i], dtv, dtfm, atom->tag[i] ); } } } else { - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { natoms++; dtfm = dtf / mass[type[i]]; @@ -442,7 +442,7 @@ void FixNVEManifoldRattle::nve_v_rattle(int igroup, int groupbit) } } } else { - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf / mass[type[i]]; rattle_manifold_v( v[i], f[i], x[i], dtfm, atom->tag[i] ); diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp index 76f6ddb3df..d8a5360506 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -165,7 +165,7 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, eta_dot[mtchain] = 0.0; eta_dot[mtchain] = 0.0; - for( int ich = 0; ich < mtchain; ++ich ){ + for( int ich = 0; ich < mtchain; ++ich ) { eta[ich] = eta_dot[ich] = eta_dotdot[ich] = 0.0; } @@ -232,11 +232,11 @@ void FixNVTManifoldRattle::setup(int /*vflag*/) // Compute/set eta-masses: double inv_t_freq2 = 1.0 / (t_freq*t_freq); eta_mass[0] = tdof * boltz * t_target * inv_t_freq2; - for( int ich = 1; ich < mtchain; ++ich ){ + for( int ich = 1; ich < mtchain; ++ich ) { eta_mass[ich] = boltz * t_target * inv_t_freq2; } - for( int ich = 1; ich < mtchain; ++ich ){ + for( int ich = 1; ich < mtchain; ++ich ) { eta_dotdot[ich] = (eta_mass[ich-1]*eta_dot[ich-1]*eta_dot[ich-1] - boltz * t_target ) / eta_mass[ich]; } @@ -249,7 +249,7 @@ void FixNVTManifoldRattle::compute_temp_target() tdof = temperature->dof; double delta = update->ntimestep - update->beginstep; - if (delta != 0.0){ + if (delta != 0.0) { delta /= update->endstep - update->beginstep; } @@ -268,7 +268,7 @@ void FixNVTManifoldRattle::nhc_temp_integrate() double expfac, kecurrent = tdof * boltz * t_current; double inv_t_freq2 = 1.0 / (t_freq*t_freq); eta_mass[0] = tdof * boltz * t_target * inv_t_freq2; - for( int ich = 1; ich < mtchain; ++ich ){ + for( int ich = 1; ich < mtchain; ++ich ) { eta_mass[ich] = boltz * t_target * inv_t_freq2; } @@ -278,7 +278,7 @@ void FixNVTManifoldRattle::nhc_temp_integrate() eta_dotdot[0] = 0; } - for( ich = mtchain-1; ich > 0; --ich ){ + for( ich = mtchain-1; ich > 0; --ich ) { expfac = exp(-dt8*eta_dot[ich+1]); eta_dot[ich] *= expfac; eta_dot[ich] += eta_dotdot[ich] * dt4; @@ -311,14 +311,14 @@ void FixNVTManifoldRattle::nhc_temp_integrate() eta_dotdot[0] = 0.0; } - for( int ich = 1; ich < mtchain; ++ich ){ + for( int ich = 1; ich < mtchain; ++ich ) { eta[ich] += dthalf*eta_dot[ich]; } eta_dot[0] *= expfac; eta_dot[0] += eta_dotdot[0]*dt4; eta_dot[0] *= expfac; - for( int ich = 1; ich < mtchain; ++ich ){ + for( int ich = 1; ich < mtchain; ++ich ) { expfac = exp(-dt8*eta_dot[ich+1]); eta_dot[ich] *= expfac; eta_dotdot[ich] = (eta_mass[ich-1]*eta_dot[ich-1]*eta_dot[ich-1] @@ -340,7 +340,7 @@ void FixNVTManifoldRattle::nh_v_temp() if (which == NOBIAS) { - for( int i = 0; i < nlocal; ++i ){ + for( int i = 0; i < nlocal; ++i ) { if (mask[i] & groupbit) { v[i][0] *= factor_eta; v[i][1] *= factor_eta; @@ -348,7 +348,7 @@ void FixNVTManifoldRattle::nh_v_temp() } } } else if (which == BIAS) { - for( int i = 0; i < nlocal; ++i ){ + for( int i = 0; i < nlocal; ++i ) { if (mask[i] & groupbit) { temperature->remove_bias(i,v[i]); v[i][0] *= factor_eta; diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index 7b0d7d4d3a..0864e1e2f2 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -69,7 +69,7 @@ public: double ff = x(t) - xx; double ffp = xp(t); // double l = 1.0 / ( 1 + res*res ); - for( int i = 0; i < maxit; ++i ){ + for( int i = 0; i < maxit; ++i ) { t -= ff / ffp; ff = x(t) - xx; ffp = xp(t); @@ -294,7 +294,7 @@ void manifold_gaussian_bump::make_lut() cubic_hermite pchip( lut_x0, lut_x1, f_at_rc, 0.0, fp_at_rc, 0.0, error ); double xx = lut_x0; - for( int i = 0; i <= lut_Nbins; ++i ){ + for( int i = 0; i <= lut_Nbins; ++i ) { lut_z[i] = pchip.y_from_x( xx ); lut_zp[i] = pchip.yp_from_x( xx ); xx += lut_dx; @@ -355,7 +355,7 @@ void manifold_gaussian_bump::test_lut() FILE *fp = fopen( "test_lut_gaussian.dat", "w" ); double dx = 0.1; - for( double xx = 0; xx < 20; xx += dx ){ + for( double xx = 0; xx < 20; xx += dx ) { x[0] = xx; x[1] = 0.0; x[2] = 0.0; diff --git a/src/USER-MANIFOLD/manifold_thylakoid.cpp b/src/USER-MANIFOLD/manifold_thylakoid.cpp index a1d2c7a62f..c4dfd33c30 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid.cpp @@ -25,7 +25,7 @@ manifold_thylakoid::manifold_thylakoid( LAMMPS *lmp, int /*narg*/, char ** /*arg manifold_thylakoid::~manifold_thylakoid() { - for(std::size_t i = 0; i < parts.size(); ++i) { + for (std::size_t i = 0; i < parts.size(); ++i) { delete parts[i]; } } @@ -60,14 +60,14 @@ void manifold_thylakoid::checkup() if (comm->me == 0 ) { fprintf(screen,"This is checkup of thylakoid %p\n", this); fprintf(screen,"I have %ld parts. They are:\n", parts.size()); - for( int i = 0; i < (int)parts.size(); ++i ){ + for ( int i = 0; i < (int)parts.size(); ++i ) { fprintf(screen, "[%f, %f] x [%f, %f] x [%f, %f]\n", parts[i]->xlo, parts[i]->xhi, parts[i]->ylo, parts[i]->yhi, parts[i]->zlo, parts[i]->zhi ); } fprintf(screen,"My params are:\n"); - for( int i = 0; i < NPARAMS; ++i ){ + for ( int i = 0; i < NPARAMS; ++i ) { fprintf(screen,"%f\n", params[i]); } } @@ -79,7 +79,7 @@ double manifold_thylakoid::g( const double *x ) int err = 0; std::size_t idx; thyla_part *p = get_thyla_part(x,&err,&idx); - if(err){ + if (err) { char msg[2048]; sprintf(msg,"Error getting thyla_part for x = (%f, %f, %f)",x[0],x[1],x[2]); error->one(FLERR,msg); @@ -101,7 +101,7 @@ void manifold_thylakoid::n( const double *x, double *n ) int err = 0; std::size_t idx; thyla_part *p = get_thyla_part(x,&err,&idx); - if(err){ + if (err) { char msg[2048]; sprintf(msg,"Error getting thyla_part for x = (%f, %f, %f)",x[0],x[1],x[2]); error->one(FLERR,msg); @@ -120,7 +120,7 @@ void manifold_thylakoid::n( const double *x, double *n ) thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_flag*/, std::size_t *idx ) { - for( std::size_t i = 0; i < parts.size(); ++i ){ + for ( std::size_t i = 0; i < parts.size(); ++i ) { thyla_part *p = parts[i]; if (is_in_domain(p,x)) { if (idx != nullptr) *idx = i; @@ -185,17 +185,17 @@ void manifold_thylakoid::init_domains() #ifndef USE_PHONY_LAMMPS char msg[2048]; - if(x1 > domain->boxhi[0]){ + if (x1 > domain->boxhi[0]) { sprintf(msg,"Expected xhi larger than current box has: %f > %f", x1, domain->boxhi[0]); error->one(FLERR,msg); } - if(y1 > domain->boxhi[1]){ + if (y1 > domain->boxhi[1]) { sprintf(msg,"Expected yhi larger than current box has: %f > %f", y1, domain->boxhi[1]); error->one(FLERR,msg); } - // if(z1 > domain->boxhi[2]){ + // if (z1 > domain->boxhi[2]) { // sprintf(msg,"Expected zhi larger than current box has: %f > %f", // z1, domain->boxhi[2]); // error->one(FLERR,msg); @@ -604,7 +604,7 @@ thyla_part *manifold_thylakoid::make_cyl_to_plane_part(double X0, double R0, dou void manifold_thylakoid::print_part_data( FILE *fp_doms, FILE *fp_coms ) { - for( std::size_t i = 0; i < parts.size(); ++i ){ + for ( std::size_t i = 0; i < parts.size(); ++i ) { thyla_part *p = parts[i]; fprintf(fp_doms, "%f %f\n", p->xlo, p->ylo); fprintf(fp_doms, "%f %f\n", p->xlo, p->yhi); diff --git a/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp b/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp index 1c6b4dd06a..c0b6871ea8 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid_shared.cpp @@ -10,7 +10,7 @@ thyla_part::thyla_part( int type, double *args, double xlo, double ylo, double z : type(type), xlo(xlo), xhi(xhi), ylo(ylo), yhi(yhi), zlo(zlo), zhi(zhi) { - switch(type){ + switch(type) { case THYLA_TYPE_PLANE: // a*(x-x0) + b*(y-y0) + c*(z-z0) = 0 params[0] = args[0]; // a params[1] = args[1]; // b @@ -40,7 +40,7 @@ thyla_part::thyla_part( int type, double *args, double xlo, double ylo, double z // The others should be 1. if ( (args[0] != 1.0) && (args[0] != 0.0) && (args[1] != 1.0) && (args[1] != 0.0) && - (args[2] != 1.0) && (args[2] != 0.0) ){ + (args[2] != 1.0) && (args[2] != 0.0) ) { err_flag = -1; } break; @@ -83,7 +83,7 @@ thyla_part::~thyla_part() double thyla_part::g(const double *x) { - switch(type){ + switch(type) { case THYLA_TYPE_PLANE:{ // a*(x-x0) + b*(y-y0) + c*(z-z0) = 0 double a = params[0]; double b = params[1]; @@ -144,7 +144,7 @@ double thyla_part::g(const double *x) void thyla_part::n( const double *x, double *n ) { - switch(type){ + switch(type) { case THYLA_TYPE_PLANE:{ // a*(x-x0) + b*(y-y0) + c*(z-z0) = 0 double a = params[0]; double b = params[1]; diff --git a/src/USER-MEAMC/meam_funcs.cpp b/src/USER-MEAMC/meam_funcs.cpp index 7f4067a1e5..7292dd64b0 100644 --- a/src/USER-MEAMC/meam_funcs.cpp +++ b/src/USER-MEAMC/meam_funcs.cpp @@ -383,7 +383,7 @@ MEAM::get_Zij2(const lattice_t latt, const double cmin, const double cmax, } // Compute screening for each first neighbor - if (latt==DIA3){ // special case for 3NN diamond structure + if (latt==DIA3) { // special case for 3NN diamond structure C = 1.0; } else { C = 4.0 / (a * a) - 1.0; diff --git a/src/USER-MEAMC/meam_setup_done.cpp b/src/USER-MEAMC/meam_setup_done.cpp index 84a11c607b..3a62bf0942 100644 --- a/src/USER-MEAMC/meam_setup_done.cpp +++ b/src/USER-MEAMC/meam_setup_done.cpp @@ -488,8 +488,8 @@ MEAM::phi_meam(double r, int a, int b) } else if (this->lattce_meam[a][b] == CH4) { phi_m = (5 * Eu - F1 - 4*F2)/4; - } else if (this->lattce_meam[a][b] == ZIG){ - if (a==b){ + } else if (this->lattce_meam[a][b] == ZIG) { + if (a==b) { phi_m = (2 * Eu - F1 - F2) / Z12; } else{ Z1 = get_Zij(this->lattce_meam[a][b]); @@ -504,7 +504,7 @@ MEAM::phi_meam(double r, int a, int b) } } else if (this->lattce_meam[a][b] == TRI) { - if (a==b){ + if (a==b) { phi_m = (3.0*Eu - 2.0*F1 - F2) / Z12; } else { Z1 = get_Zij(this->lattce_meam[a][b]); diff --git a/src/USER-MESODPD/fix_edpd_source.cpp b/src/USER-MESODPD/fix_edpd_source.cpp index 39c250141e..98a36e589a 100644 --- a/src/USER-MESODPD/fix_edpd_source.cpp +++ b/src/USER-MESODPD/fix_edpd_source.cpp @@ -37,7 +37,7 @@ FixEDPDSource::FixEDPDSource(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal fix edpd/source command"); iarg++; - if(option == 0){ + if (option == 0) { if (narg != 9 ) error->all(FLERR,"Illegal fix edpd/source command (5 args for sphere)"); center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); @@ -45,7 +45,7 @@ FixEDPDSource::FixEDPDSource(LAMMPS *lmp, int narg, char **arg) : radius = utils::numeric(FLERR,arg[iarg++],false,lmp); value = utils::numeric(FLERR,arg[iarg++],false,lmp); } - else if(option == 1){ + else if (option == 1) { if (narg != 11 ) error->all(FLERR,"Illegal fix edpd/edpd command (7 args for cuboid)"); center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); @@ -94,19 +94,19 @@ void FixEDPDSource::post_force(int /*vflag*/) for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if(option == 0){ + if (option == 0) { drx = x[i][0] - center[0]; dry = x[i][1] - center[1]; drz = x[i][2] - center[2]; rsq = drx*drx + dry*dry + drz*drz; - if(rsq < radius_sq) + if (rsq < radius_sq) edpd_flux[i] += value*edpd_cv[i]; } - else if(option == 1){ + else if (option == 1) { drx = x[i][0] - center[0]; dry = x[i][1] - center[1]; drz = x[i][2] - center[2]; - if(fabs(drx) <= 0.5*dLx && fabs(dry) <= 0.5*dLy && fabs(drz) <= 0.5*dLz) + if (fabs(drx) <= 0.5*dLx && fabs(dry) <= 0.5*dLy && fabs(drz) <= 0.5*dLz) edpd_flux[i] += value*edpd_cv[i]; } } diff --git a/src/USER-MESODPD/fix_mvv_dpd.cpp b/src/USER-MESODPD/fix_mvv_dpd.cpp index d8b36e12f4..7d8658a065 100644 --- a/src/USER-MESODPD/fix_mvv_dpd.cpp +++ b/src/USER-MESODPD/fix_mvv_dpd.cpp @@ -39,7 +39,7 @@ FixMvvDPD::FixMvvDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/dpd command"); verlet = 0.5; - if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); + if (narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); dynamic_group_allow = 1; time_integrate = 1; diff --git a/src/USER-MESODPD/fix_mvv_edpd.cpp b/src/USER-MESODPD/fix_mvv_edpd.cpp index 9cb4b86d85..200ab2564e 100644 --- a/src/USER-MESODPD/fix_mvv_edpd.cpp +++ b/src/USER-MESODPD/fix_mvv_edpd.cpp @@ -48,7 +48,7 @@ FixMvvEDPD::FixMvvEDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/edpd command"); verlet = 0.5; - if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); + if (narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); dynamic_group_allow = 1; time_integrate = 1; diff --git a/src/USER-MESODPD/fix_mvv_tdpd.cpp b/src/USER-MESODPD/fix_mvv_tdpd.cpp index 84a7fdbaf9..8819595174 100644 --- a/src/USER-MESODPD/fix_mvv_tdpd.cpp +++ b/src/USER-MESODPD/fix_mvv_tdpd.cpp @@ -44,7 +44,7 @@ FixMvvTDPD::FixMvvTDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/tdpd command"); verlet = 0.5; - if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); + if (narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); cc_species = atom->cc_species; @@ -107,7 +107,7 @@ void FixMvvTDPD::initial_integrate(int /*vflag*/) v[i][0] += 2.0 * verlet * dtfm * f[i][0]; v[i][1] += 2.0 * verlet * dtfm * f[i][1]; v[i][2] += 2.0 * verlet * dtfm * f[i][2]; - for(int k = 0; k < cc_species; k++) + for (int k = 0; k < cc_species; k++) cc[i][k] += 0.5 * dtv * cc_flux[i][k]; } } @@ -140,7 +140,7 @@ void FixMvvTDPD::final_integrate() v[i][0] = vest[i][0] + dtfm * f[i][0]; v[i][1] = vest[i][1] + dtfm * f[i][1]; v[i][2] = vest[i][2] + dtfm * f[i][2]; - for(int k = 0; k < cc_species; k++) + for (int k = 0; k < cc_species; k++) cc[i][k] += 0.5 * dtv * cc_flux[i][k]; } } diff --git a/src/USER-MESODPD/fix_tdpd_source.cpp b/src/USER-MESODPD/fix_tdpd_source.cpp index 25a8332e9f..c0669552ff 100644 --- a/src/USER-MESODPD/fix_tdpd_source.cpp +++ b/src/USER-MESODPD/fix_tdpd_source.cpp @@ -38,7 +38,7 @@ FixTDPDSource::FixTDPDSource(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal fix tdpd/source command"); iarg++; - if(option == 0){ + if (option == 0) { if (narg != 10 ) error->all(FLERR,"Illegal fix tdpd/source command (5 args for sphere)"); center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); @@ -46,7 +46,7 @@ FixTDPDSource::FixTDPDSource(LAMMPS *lmp, int narg, char **arg) : radius = utils::numeric(FLERR,arg[iarg++],false,lmp); value = utils::numeric(FLERR,arg[iarg++],false,lmp); } - else if(option == 1){ + else if (option == 1) { if (narg != 12 ) error->all(FLERR,"Illegal fix tdpd/edpd command (7 args for cuboid)"); center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); @@ -94,19 +94,19 @@ void FixTDPDSource::post_force(int /*vflag*/) for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if(option == 0){ + if (option == 0) { drx = x[i][0] - center[0]; dry = x[i][1] - center[1]; drz = x[i][2] - center[2]; rsq = drx*drx + dry*dry + drz*drz; - if(rsq < radius_sq) + if (rsq < radius_sq) cc_flux[i][cc_index-1] += value; } - else if(option == 1){ + else if (option == 1) { drx = x[i][0] - center[0]; dry = x[i][1] - center[1]; drz = x[i][2] - center[2]; - if(fabs(drx) <= 0.5*dLx && fabs(dry) <= 0.5*dLy && fabs(drz) <= 0.5*dLz) + if (fabs(drx) <= 0.5*dLx && fabs(dry) <= 0.5*dLy && fabs(drz) <= 0.5*dLz) cc_flux[i][cc_index-1] += value; } } diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index c3b4d3b1fe..f7201052ff 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -162,9 +162,9 @@ void PairEDPD::compute(int eflag, int vflag) T_pow[3] = T_pow[0]*T_pow[2]; double power_d = power[itype][jtype]; - if(power_flag){ + if (power_flag) { double factor = 1.0; - for(int k = 0; k < 4; k++) + for (int k = 0; k < 4; k++) factor += sc[itype][jtype][k]*T_pow[k]; power_d *= factor; } @@ -197,9 +197,9 @@ void PairEDPD::compute(int eflag, int vflag) randnumT = MAX(-5.0,MIN(randnum,5.0)); double kappaT = kappa[itype][jtype]; - if(kappa_flag) { + if (kappa_flag) { double factor = 1.0; - for(int k = 0; k < 4; k++) + for (int k = 0; k < 4; k++) factor += kc[itype][jtype][k]*T_pow[k]; kappaT *= factor; } @@ -350,11 +350,11 @@ void PairEDPD::coeff(int narg, char **arg) powerT[i][j]= powerT_one; cutT[i][j] = cutT_one; - if(power_flag) + if (power_flag) for (int k = 0; k < 4; k++) sc[i][j][k] = sc_one[k]; - if(kappa_flag) + if (kappa_flag) for (int k = 0; k < 4; k++) kc[i][j][k] = kc_one[k]; @@ -399,11 +399,11 @@ double PairEDPD::init_one(int i, int j) kappa[j][i] = kappa[i][j]; powerT[j][i]= powerT[i][j]; - if(power_flag) + if (power_flag) for (int k = 0; k < 4; k++) sc[j][i][k] = sc[i][j][k]; - if(kappa_flag) + if (kappa_flag) for (int k = 0; k < 4; k++) kc[j][i][k] = kc[i][j][k]; @@ -429,11 +429,11 @@ void PairEDPD::write_restart(FILE *fp) fwrite(&kappa[i][j],sizeof(double),1,fp); fwrite(&powerT[i][j],sizeof(double),1,fp); fwrite(&cutT[i][j],sizeof(double),1,fp); - if(power_flag) + if (power_flag) for (int k = 0; k < 4; k++) fwrite(&sc[i][j][k],sizeof(double),1,fp); - if(kappa_flag) + if (kappa_flag) for (int k = 0; k < 4; k++) fwrite(&kc[i][j][k],sizeof(double),1,fp); } @@ -464,11 +464,11 @@ void PairEDPD::read_restart(FILE *fp) utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,nullptr,error); utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,nullptr,error); - if(power_flag) + if (power_flag) for (int k = 0; k < 4; k++) utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,nullptr,error); - if(kappa_flag) + if (kappa_flag) for (int k = 0; k < 4; k++) utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,nullptr,error); } @@ -479,11 +479,11 @@ void PairEDPD::read_restart(FILE *fp) MPI_Bcast(&kappa[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&powerT[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cutT[i][j],1,MPI_DOUBLE,0,world); - if(power_flag) + if (power_flag) for (int k = 0; k < 4; k++) MPI_Bcast(&sc[i][j][k],1,MPI_DOUBLE,0,world); - if(kappa_flag) + if (kappa_flag) for (int k = 0; k < 4; k++) MPI_Bcast(&kc[i][j][k],1,MPI_DOUBLE,0,world); } diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 0506886861..4dc42eb56a 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -241,7 +241,7 @@ void PairMDPD::settings(int narg, char **arg) void PairMDPD::coeff(int narg, char **arg) { - if(narg != 7 ) error->all(FLERR,"Incorrect args for pair coefficients\n itype jtype A B gamma cutA cutB"); + if (narg != 7 ) error->all(FLERR,"Incorrect args for pair coefficients\n itype jtype A B gamma cutA cutB"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; @@ -254,7 +254,7 @@ void PairMDPD::coeff(int narg, char **arg) double cut_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_two = utils::numeric(FLERR,arg[6],false,lmp); - if(cut_one < cut_two) error->all(FLERR,"Incorrect args for pair coefficients\n cutA should be larger than cutB."); + if (cut_one < cut_two) error->all(FLERR,"Incorrect args for pair coefficients\n cutA should be larger than cutB."); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index 88d89a860d..a416d94a00 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -159,7 +159,7 @@ void PairTDPD::compute(int eflag, int vflag) // chemical concentration transport if (r < cutcc[itype][jtype]) { - for(int k=0; k b) + else if (a > b) return 1; else return 0; @@ -66,7 +66,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub FILE *in = fopen(potin_file,"r"); char line[1024]; - if(in == nullptr) { + if (in == nullptr) { fprintf(stderr,"@%s:%d: Error reading potin file. Can not open file \'%s\'.\n", __FILE__,__LINE__,potin_file); exit(1); @@ -80,22 +80,22 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub double r0x,r1x,drx; int nrx,i; - if(line[strspn(line," \t")] == '#') continue; + if (line[strspn(line," \t")] == '#') continue; - if(n == 0) { + if (n == 0) { metal[0] = 0; - if(sscanf(line,"%s %d %d",metal,&ipot,&mode) != 3) { + if (sscanf(line,"%s %d %d",metal,&ipot,&mode) != 3) { fprintf(stderr,"@%s:%d: Error on potin file. line = %s\n", __FILE__,__LINE__,line); exit(1); } } else { metalx[0] = 0; - if(sscanf(line,"%s %d %d",metalx,&ipotx,&modex) != 3) { + if (sscanf(line,"%s %d %d",metalx,&ipotx,&modex) != 3) { fprintf(stderr,"@%s:%d: Error on potin file. line = %s\n", __FILE__,__LINE__,line); exit(1); - } else if(strcmp(metal,metalx) != 0 || ipot != ipotx || mode != modex) { + } else if (strcmp(metal,metalx) != 0 || ipot != ipotx || mode != modex) { fprintf(stderr,"@%s:%d: Error on potin file, parameter mismatch:\n" " metal = \'%s\' ipot = %d mode = %d\n" " metalx = \'%s\' ipotx = %d modex = %d\n", @@ -108,39 +108,39 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub fgets(line,sizeof(line),in); sscanf(line,"%lf %lf %lf %lf",&zval,&ivol,&rws,&mass); - if(n >= vsize) { + if (n >= vsize) { vsize = 2*vsize; volarr = (double *) realloc(volarr,sizeof(double) * vsize); } volarr[n] = ivol; n = n + 1; - for(i = 0; i<5; i++) + for (i = 0; i<5; i++) fgets(line,sizeof(line),in); sscanf(line,"%lf %lf %lf",&r0x,&r1x,&drx); nrx = (int) ((r1x-r0x)/drx + 1.1); /* Really: 1+round((r1-r0)/dr) */ - for(i = 0; i nvol = %d, vol0 = %.6f, x0= %.6f, x1 = %.6f, dx = %.6f\n", nvol,vol0,x0,x1,dx); } @@ -214,8 +214,8 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl anorm3 = s*ss + 2.0*( p*pp + d*dd + f*ff); anorm4 = ss*ss + 2.0*(pp*pp + dd*dd + ff*ff); /* - for(i = 1; i<=lmax; i++) { - for(j = 1; j<=lmax; j++) + for (i = 1; i<=lmax; i++) { + for (j = 1; j<=lmax; j++) del0.m[i][j] = 0.0; del0[i][i] = 1.0; } @@ -237,10 +237,10 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl in = fopen(potin_file,"r"); int *tag = new int[nx]; - for(i = 0; i 1e-3) + if (fabs(volguess/ivol - 1.0) > 1e-3) printf("Wrong volume guess, i=%d volgues=%15.5e ivol=%15.5e\n", i,volguess,ivol); }*/ double ifrac = (pow(ivol/vol0,1.0/3.0) - x0)/((x1-x0)/(nx-1)); i = (int) (ifrac + 0.1); - if(fabs(i - ifrac) > 0.01) { + if (fabs(i - ifrac) > 0.01) { printf("Volume point not in table... ii=%d i=%d ifrac=%15.5e vol=%15.5e\n", ii,i,ifrac,ivol); printf("vol0 = %15.5e zval = %15.5e mass = %15.5e\n",vol0,zval,mass); exit(1); - } else if(tag[i] == 1) { + } else if (tag[i] == 1) { printf("Duplicate volume point in table.... ii=%d i=%d ifrac=%15.5e vol=%15.5e\n", ii,i,ifrac,ivol); exit(1); @@ -334,7 +334,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl fgets(line,sizeof(line),in); sscanf(line,"%lf %lf %lf %lf %lf", &vatab[i],&vbtab[i],&vctab[i],&vdtab[i],&vetab[i]); - if(ipot == 1) { + if (ipot == 1) { vatab[i] *= vdtab[i]; vctab[i] *= vctab[i]; vetab[i] *= vetab[i]; @@ -346,14 +346,14 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl sscanf(line,"%lf %lf %lf",&r0x,&r1x,&drx); nrx = (int) ((r1x-r0x)/drx + 1.1); /* Really: 1+round((r1-r0)/dr) */ - if(ii == 0) { + if (ii == 0) { r0 = r0x; r1 = r1x; dr = drx; nr = nrx; vpairtab = new double[nx*nr]; } else { /* Check that {r0,r1,dr,nr}x == {r0,r1,dr,nr} */ } - for(j = 0; j= r0rws) { + if (bscreen == 1 && rrws >= r0rws) { double arg = rrws/r0rwstab[i]; double arg1 = arg - 1.0; double arg12 = arg1*arg1; double f,dp; - if(mode <= 2) { + if (mode <= 2) { f = fgauss(arg,al); dp=2.*al*arg*arg1; } @@ -407,16 +407,16 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl double vpair_tmp = vpairtab[i*nr+j]; vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; - if(0) if(fabs(vol-ivol) < 0.01) { + if (0) if (fabs(vol-ivol) < 0.01) { static FILE *xfile = nullptr; - if(j == 0) { + if (j == 0) { xfile = fopen("mgpt5-pot.dat","w"); fprintf(xfile,"%%%% vol = %15.5e ivol = %15.5e i = %d ii = %d\n", vol,ivol,i,ii); } fprintf(xfile,"%15.5e %15.5e %15.5e %15.5e %15.5e %20.10e\n", r,vpair_tmp,fscr,v2a,v2b,flr); - if(j == nr-1) fclose(xfile); + if (j == nr-1) fclose(xfile); } @@ -426,8 +426,8 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl } fclose(in); - for(i = 0; i0; i--) { + for (int i = n-1; i>0; i--) { double q = A[i-1][2] / A[i][1]; A[i-1][1] = A[i-1][1] - q*A[i][0]; y[i-1] = y[i-1] - q*y[i]; @@ -28,7 +28,7 @@ static void trisolve(int n,double A[][3],double y[]) { /* Forward substitution */ y[0] = y[0] / A[0][1]; - for(int i = 1; i n-1) idx = n-1; + if (idx < 0) idx = 0; + if (idx > n-1) idx = n-1; xhat = xhat - idx; p = C[idx]; - if(0) { + if (0) { *y = p[0] + xhat*(p[1] + xhat*(p[2] + xhat*p[3])); *dy = p[1] + xhat*(2*p[2] + xhat*3*p[3]); diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index c056258127..b358b12857 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -51,7 +51,7 @@ using namespace LAMMPS_NS; #endif static double gettime(int x = 0) { - if(1) { + if (1) { /* struct timeval tv; gettimeofday(&tv,nullptr); @@ -93,7 +93,7 @@ PairMGPT::PairMGPT(LAMMPS *lmp) : Pair(lmp) PairMGPT::~PairMGPT() { - if(allocated) { + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutghost); @@ -107,8 +107,8 @@ static double t_make_b2 = 0.0,n_make_b2 = 0.0; template void fmatconv(intype *array) { outtype *cast = (outtype *) array; - for(int i = 0; iHz.m)) & 31) == 0 ); rij = 0.0; - for(p = 0; p<3; p++) { + for (p = 0; p<3; p++) { rrij[p] = xx[i][p] - xx[j][p]; rij = rij + rrij[p]*rrij[p]; } /* Zero all matrix elements */ - for(i = 0; i<8; i++) - for(j = 0; j<8; j++) { + for (i = 0; i<8; i++) + for (j = 0; j<8; j++) { bptr->H.m[i][j] = 0.0; bptr->Hx.m[i][j] = 0.0; bptr->Hy.m[i][j] = 0.0; @@ -140,9 +140,9 @@ void PairMGPT::make_bond(const double xx[][3],int i,int j,bond_data *bptr) { bptr->Hz.m[j][i] = 0.0; } - if(rij <= rcrit*rcrit) { + if (rij <= rcrit*rcrit) { t0 = gettime(); - if(lang == 3) { + if (lang == 3) { hamltn_5_raw(rrij[0],rrij[1],rrij[2], bptr->H.m ,bptr->Hx.m, bptr->Hy.m,bptr->Hz.m,&bptr->fl_deriv_sum); @@ -159,7 +159,7 @@ void PairMGPT::make_bond(const double xx[][3],int i,int j,bond_data *bptr) { bptr->fl_deriv_sum = 0.0; } - if(linalg.single) { + if (linalg.single) { fmatconv(&(bptr->H.m[1][0])); fmatconv(&(bptr->Hx.m[1][0])); fmatconv(&(bptr->Hy.m[1][0])); @@ -174,12 +174,12 @@ static inline double mtrace(int n,double A[8][8],double B[8][8]) { double s; t0 = gettime(); - if(n == 5) s = mtrace_5(A,B); - else if(n == 7) s = mtrace_7(A,B); + if (n == 5) s = mtrace_5(A,B); + else if (n == 7) s = mtrace_7(A,B); else { s = 0.0; - for(int i = 1; i<=n; i++) - for(int j = 1; j<=n; j++) + for (int i = 1; i<=n; i++) + for (int j = 1; j<=n; j++) s = s + A[i][j]*B[i][j]; } t1 = gettime(); @@ -192,7 +192,7 @@ static inline double mtrace(int n,double A[8][8],double B[8][8]) { void PairMGPT::make_triplet(bond_data *ij_bond,bond_data *ik_bond, triplet_data *triptr) { - if(1) { + if (1) { const trmul_fun tr_mul = linalg.tr_mul; tr_mul(&(ij_bond->H.m[1][0]), &(ik_bond->H.m[1][0]) ,&(triptr->H1H2.m[1][0]) ); tr_mul(&(ij_bond->Hx.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1xH2.m[1][0])); @@ -227,28 +227,28 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i triplet_data *tptr = 0; t0 = gettime(); - if(recompute == 0) { + if (recompute == 0) { bij = bhash->Lookup(Doublet(i,j)); bik = bhash->Lookup(Doublet(i,k)); } - if(bij == 0) { - if(recompute == 0) + if (bij == 0) { + if (recompute == 0) bij = bhash->Insert(Doublet(i,j)); else bij = &bij_work; - if(i < j) + if (i < j) make_bond(xx,i,j,bij); else make_bond(xx,j,i,bij); } - if(bik == 0) { - if(recompute == 0) + if (bik == 0) { + if (recompute == 0) bik = bhash->Insert(Doublet(i,k)); else bik = &bik_work; - if(i < k) + if (i < k) make_bond(xx,i,k,bik); else make_bond(xx,k,i,bik); @@ -257,7 +257,7 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i t_make_b += t1-t0; t0 = gettime(); - if(bij != 0 && bij != 0) { + if (bij != 0 && bij != 0) { tptr = twork; make_triplet(bij,bik,tptr); *dvir_ij_p = bij->fl_deriv_sum; @@ -290,7 +290,7 @@ double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if(0) { /* This bond doesn't change when i is perturbed */ + if (0) { /* This bond doesn't change when i is perturbed */ make_bond(xx,j,k,&Bjk); } make_bond(xx,k,i,&Bki); @@ -342,7 +342,7 @@ double PairMGPT::numderiv4(double xx[][3],int i,int j,int k,int m,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if(0) { /* Only the i coordinates changed... */ + if (0) { /* Only the i coordinates changed... */ make_bond(xx,j,k,&Bjk); make_bond(xx,k,m,&Bkm); } @@ -365,14 +365,14 @@ void PairMGPT::force_debug_3t(double xx[][3], dfj[0] = dfjx; dfj[1] = dfjy; dfj[2] = dfjz; dfk[0] = dfkx; dfk[1] = dfky; dfk[2] = dfkz; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k */ double ndfi,ndfj,ndfk; ndfi = -numderiv3t(xx,i,j,k,p); ndfj = -numderiv3t(xx,j,k,i,p); ndfk = -numderiv3t(xx,k,i,j,p); - if((fabs(dfi[p] - ndfi) > dtol && + if ((fabs(dfi[p] - ndfi) > dtol && fabs(dfi[p] - ndfi) > dtol*fabs(ndfi)) || (fabs(dfj[p] - ndfj) > dtol && fabs(dfj[p] - ndfj) > dtol*fabs(ndfj)) || @@ -398,14 +398,14 @@ void PairMGPT::force_debug_3v(double xx[][3], dfj[0] = dfjx; dfj[1] = dfjy; dfj[2] = dfjz; dfk[0] = dfkx; dfk[1] = dfky; dfk[2] = dfkz; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k */ double ndfi,ndfj,ndfk; ndfi = -numderiv3v(xx,i,j,k,p,i0); ndfj = -numderiv3v(xx,i,j,k,p,j0); ndfk = -numderiv3v(xx,i,j,k,p,k0); - if((fabs(dfi[p] - ndfi) > dtol && + if ((fabs(dfi[p] - ndfi) > dtol && fabs(dfi[p] - ndfi) > dtol*fabs(ndfi)) || (fabs(dfj[p] - ndfj) > dtol && fabs(dfj[p] - ndfj) > dtol*fabs(ndfj)) || @@ -436,14 +436,14 @@ void PairMGPT::force_debug_4(double xx[][3], const int ii0[] = {i0,j0,k0,m0},ii[] = {i,j,k,m,i,j,k}; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k,m */ double ndfi,ndfj,ndfk,ndfm; - if(1) { + if (1) { double ndf[] = {0.0,0.0,0.0,0.0}; - for(int s = 0; s<4; s++) - for(int t = 0; t<4; t++) - if(ii[s] == ii0[t]) + for (int s = 0; s<4; s++) + for (int t = 0; t<4; t++) + if (ii[s] == ii0[t]) ndf[t] = -numderiv4(xx,ii[s],ii[s+1],ii[s+2],ii[s+3],p); ndfi = ndf[0]; ndfj = ndf[1]; ndfk = ndf[2]; ndfm = ndf[3]; @@ -454,7 +454,7 @@ void PairMGPT::force_debug_4(double xx[][3], ndfm = -numderiv4(xx,m,i,j,k,p); } - if((fabs(dfi[p] - ndfi) > dtol && + if ((fabs(dfi[p] - ndfi) > dtol && fabs(dfi[p] - ndfi) > dtol*fabs(ndfi)) || (fabs(dfj[p] - ndfj) > dtol && fabs(dfj[p] - ndfj) > dtol*fabs(ndfj)) || @@ -501,7 +501,7 @@ void PairMGPT::force_debug_4(double xx[][3], &(T45->H1H2x.m[1][0]),&utr4x.d, \ &(T45->H1H2y.m[1][0]),&utr4y.d, \ &(T45->H1H2z.m[1][0]),&utr4z.d); \ - if(linalg.single) { \ + if (linalg.single) { \ trd1x = utr1x.f; trd2x = utr2x.f; trd3x = utr3x.f; trd4x = utr4x.f; \ trd1y = utr1y.f; trd2y = utr2y.f; trd3y = utr3y.f; trd4y = utr4y.f; \ trd1z = utr1z.f; trd2z = utr2z.f; trd3z = utr3z.f; trd4z = utr4z.f; \ @@ -679,7 +679,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, { double vtot = 1.0; double ntot = atom->natoms; - for(i = 0; i<3; i++) + for (i = 0; i<3; i++) vtot = vtot * (domain->boxhi[i] - domain->boxlo[i]); rhoinv = vtot / ntot; } @@ -705,47 +705,47 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, const int triclinic = domain->triclinic; double alpha[3] = {0.0,0.0,0.0}; - if(triclinic) { + if (triclinic) { double E[3][3],EX[3][3]; int cyc[] = {0,1,2,0,1}; ss = (double (*)[3]) memory->smalloc(sizeof(double [3]) * ntot, "mgpt: local reduced coordinate vector."); - for(i = 0; i<3; i++) { - for(j = 0; j<3; j++) + for (i = 0; i<3; i++) { + for (j = 0; j<3; j++) E[i][j] = 0.0; E[i][i] = domain->subhi_lamda[i] - domain->sublo_lamda[i]; domain->lamda2x(E[i],EX[i]); } - for(i = 0; i<3; i++) { + for (i = 0; i<3; i++) { int i1 = cyc[i+1],i2 = cyc[i+2]; double dot = 0.0,ns2 = 0.0; - for(j = 0; j<3; j++) { + for (j = 0; j<3; j++) { int j1 = cyc[j+1],j2 = cyc[j+2]; double cj = EX[i1][j1]*EX[i2][j2] - EX[i1][j2]*EX[i2][j1]; ns2 = ns2 + cj*cj; dot = dot + EX[i][j]*cj; } alpha[i] = E[i][i] / (dot/sqrt(ns2)); - if(comm->me == 0) { + if (comm->me == 0) { static int count = 0; - if(count < 3) + if (count < 3) printf("@@@ alpha(%d) = %15.5e\n",i+1,alpha[i]); count++; } - if(alpha[i] < 0.0) alpha[i] = -alpha[i]; + if (alpha[i] < 0.0) alpha[i] = -alpha[i]; } } else ss = xx; nneitot = 0; - for(ix = 0; ixx[ix][p]; ff[ix][p] = 0.0; } - if(triclinic) + if (triclinic) domain->x2lamda(xx[ix],ss[ix]); nneitot = nneitot + nnei[ix]; } @@ -766,22 +766,22 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, int c_p = 0, c_t = 0, c_q = 0; - if(0) - if(domain->triclinic) { - if(comm->me == 0) + if (0) + if (domain->triclinic) { + if (comm->me == 0) printf("Can not handle triclinic box yet\n"); error->all(__FILE__,__LINE__,"Can not handle triclinic cell with mgpt yet."); } /* - for(i = 0; i 0.0) { + if (w2 > 0.0) { /* Compute pair energy/force */ @@ -814,20 +814,20 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, df = df / rij * w2; - if(pair_energies == 0) de_pair = 0.0; + if (pair_energies == 0) de_pair = 0.0; e_pair = e_pair + de_pair; c_p++; - if(pair_forces == 0) df = 0.0; + if (pair_forces == 0) df = 0.0; - if(volpres_flag && pair_energies) { + if (volpres_flag && pair_energies) { double dvir; splinepot.eval_vir(rij,&dvir); volvir2 = volvir2 - dvir * w2; /* Per-atom virial contribution of volumetric energy term */ - if(vflag_atom) - for(int pp = 0; pp<3; pp++) { + if (vflag_atom) + for (int pp = 0; pp<3; pp++) { //virial[i] = virial[i] + rhoinv*e_scale*volvir2; vatom[i][pp] -= 0.5 * rhoinv*e_scale*dvir*w2; vatom[j][pp] -= 0.5 * rhoinv*e_scale*dvir*w2; @@ -847,7 +847,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fiz = fiz + df*drijz; fjz = fjz - df*drijz; - if(evflag) { + if (evflag) { //ev_tally(i,j,nloc,newton_pair,de_pair,0.0,df,-drijx,-drijy,-drijz); /* To fix stress-per-atom scaling, and sign */ ev_tally(i,j,nloc,newton_pair,de_pair,0.0,-df * e_scale,-drijx,-drijy,-drijz); @@ -861,7 +861,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } } - if(rij2 < rcut2_bond && c2_outside(ss[i],ss[j],triclinic,alpha) == 0) { + if (rij2 < rcut2_bond && c2_outside(ss[i],ss[j],triclinic,alpha) == 0) { /* Add j to short neighbor list for i. Insert j to keep list sorted. @@ -874,7 +874,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } nlist_short[p+1] = j; first[i+1] = first[i+1] + 1; - if(first[i+1] > nneitot) { + if (first[i+1] > nneitot) { printf("nneitot = %d, short list full. i=%d\n", nneitot,i); error->one(__FILE__,__LINE__,"Shit! Short list full\n"); @@ -892,7 +892,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, ntpair += nnei[i]; } - for(i = 0; i i) continue; /* Require k i) continue; /* Require k 0.0) { + if (w3 > 0.0) { triplet_defer = 0; dvir_ij = dvir_jk = dvir_ki = 0.0; - if(c_ij && c_jk) + if (c_ij && c_jk) T12 = get_triplet(xx,j,i,k,&bond_hash,&T12work,&dvir_ij,&dvir_jk); - if(c_ki && c_jk) + if (c_ki && c_jk) T23 = get_triplet(xx,k,i,j,&bond_hash,&T23work,&dvir_ki,&dvir_jk); - if(c_ij && c_ki) + if (c_ij && c_ki) T31 = get_triplet(xx,i,j,k,&bond_hash,&T31work,&dvir_ij,&dvir_ki); - if(evflag) { + if (evflag) { fsave[0][0] = fix; fsave[0][1] = fiy; fsave[0][2] = fiz; fsave[1][0] = fjx; fsave[1][1] = fjy; fsave[1][2] = fjz; fsave[2][0] = fkx; fsave[2][1] = fky; fsave[2][2] = fkz; @@ -981,10 +981,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, double xvir3t,xvir3v; xvir3t = xvir3v = 0.0; - if(T12 && T23) { + if (T12 && T23) { bond_data *bki = bond_hash.Lookup(Doublet(k,i)); - if(three_body_energies && evflag) { + if (three_body_energies && evflag) { tr0 = transtrace(T12->H1H2,bki->H); double dvir = ((dvir_ij + dvir_jk + bki->fl_deriv_sum)*splinepot.vc + splinepot.dvc)*tr0*w3/anorm3; @@ -1010,7 +1010,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, &(bki->Hy.m[1][0]),&utr3y.d, &(bki->Hz.m[1][0]),&utr3z.d); - if(linalg.single) { + if (linalg.single) { trd1x = utr1x.f; trd2x = utr2x.f; trd3x = utr3x.f; trd1y = utr1y.f; trd2y = utr2y.f; trd3y = utr3y.f; trd1z = utr1z.f; trd2z = utr2z.f; trd3z = utr3z.f; @@ -1033,20 +1033,20 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfkz = ( ( sjk)*trd2z + (-ski)*trd3z ) * (vc / anorm3); } - if(triplet_debug) + if (triplet_debug) force_debug_3t(xx,i,j,k, i,j,k, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - if(three_body_forces) + if (three_body_forces) accumulate_forces_3(w3); } - if(T12 != 0) { + if (T12 != 0) { //printf("T12 i,j,k = %d,%d,%d\n",i,j,k); mcount++; - if(three_body_energies && evflag) { + if (three_body_energies && evflag) { tr1 = transtrace(T12->H1H2,T12->H1H2); double dvir = (2.0*(dvir_ij + dvir_jk)*splinepot.vd + splinepot.dvd)*tr1*w3/anorm4; @@ -1065,7 +1065,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, &(T12->H1H2x.m[1][0]),&utr2x.d, &(T12->H1H2y.m[1][0]),&utr2y.d, &(T12->H1H2z.m[1][0]),&utr2z.d); - if(linalg.single) { + if (linalg.single) { trd1x = utr1x.f; trd2x = utr2x.f; trd1y = utr1y.f; trd2y = utr2y.f; trd1z = utr1z.f; trd2z = utr2z.f; @@ -1088,21 +1088,21 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfjz = -(dfiz + dfkz); } - if(triplet_debug) /* Compare forces to numerical derivatives */ + if (triplet_debug) /* Compare forces to numerical derivatives */ force_debug_3v(xx,i,j,k, j,i,k, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - if(three_body_forces) + if (three_body_forces) accumulate_forces_3(w3); } - if(T23 != 0) { + if (T23 != 0) { //printf("T23 i,j,k = %d,%d,%d\n",i,j,k); mcount++; - if(three_body_energies && evflag) { + if (three_body_energies && evflag) { tr2 = transtrace(T23->H1H2,T23->H1H2); double dvir = (2.0*(dvir_jk + dvir_ki)*splinepot.vd + splinepot.dvd)*tr2*w3/anorm4; @@ -1121,7 +1121,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, &(T23->H1H2x.m[1][0]),&utr2x.d, &(T23->H1H2y.m[1][0]),&utr2y.d, &(T23->H1H2z.m[1][0]),&utr2z.d); - if(linalg.single) { + if (linalg.single) { trd1x = utr1x.f; trd2x = utr2x.f; trd1y = utr1y.f; trd2y = utr2y.f; trd1z = utr1z.f; trd2z = utr2z.f; @@ -1144,21 +1144,21 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfkz = -(dfiz + dfjz); } - if(triplet_debug) /* Compare forces to numerical derivatives */ + if (triplet_debug) /* Compare forces to numerical derivatives */ force_debug_3v(xx,i,j,k, k,i,j, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - if(three_body_forces) + if (three_body_forces) accumulate_forces_3(w3); } - if(T31 != 0) { + if (T31 != 0) { //printf("T31 i,j,k = %d,%d,%d\n",i,j,k); mcount++; - if(three_body_energies && evflag) { + if (three_body_energies && evflag) { tr3 = transtrace(T31->H1H2,T31->H1H2); double dvir = (2.0*(dvir_ki + dvir_ij)*splinepot.vd + splinepot.dvd)*tr3*w3/anorm4; @@ -1177,7 +1177,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, &(T31->H1H2x.m[1][0]),&utr2x.d, &(T31->H1H2y.m[1][0]),&utr2y.d, &(T31->H1H2z.m[1][0]),&utr2z.d); - if(linalg.single) { + if (linalg.single) { trd1x = utr1x.f; trd2x = utr2x.f; trd1y = utr1y.f; trd2y = utr2y.f; trd1z = utr1z.f; trd2z = utr2z.f; @@ -1201,13 +1201,13 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } - if(triplet_debug) /* Compare forces to numerical derivatives */ + if (triplet_debug) /* Compare forces to numerical derivatives */ force_debug_3v(xx,i,j,k, i,j,k, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - if(three_body_forces) + if (three_body_forces) accumulate_forces_3(w3); } @@ -1220,10 +1220,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, //printf("xxxx %6d %6d %6d :: %20.10e\n",1,2,3,de_triplet); - if(evflag) { + if (evflag) { double drji[3],drki[3]; double fj[3] = {fjx,fjy,fjz},fk[3] = {fkx,fky,fkz}; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { drji[p] = xx[j][p] - xx[i][p]; drki[p] = xx[k][p] - xx[i][p]; /* To fix stress-per-atom scaling. */ @@ -1233,10 +1233,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, ev_tally3(i,j,k,de_triplet,0.0,fj,fk,drji,drki); - if(volpres_flag && vflag_atom) { + if (volpres_flag && vflag_atom) { //virial[i] = virial[i] - (vir3v + vir3t) * rhoinv*e_scale; double dvir = -(xvir3v + xvir3t) * rhoinv*e_scale * (1.0/3.0); - for(int pp = 0; pp<3; pp++) { + for (int pp = 0; pp<3; pp++) { vatom[i][pp] += dvir; vatom[j][pp] += dvir; vatom[k][pp] += dvir; @@ -1255,8 +1255,8 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, triplet_defer = 1; } - if(four_body_energies || four_body_forces) - if(j < i) { /* Search for quadruplet */ + if (four_body_energies || four_body_forces) + if (j < i) { /* Search for quadruplet */ tx0 = gettime(); mj = first[j]; @@ -1267,7 +1267,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, */ while(nlist_short[mj] < i && nlist_short[mk] < i) { - if(mj >= first[j+1] || mk >= first[k+1]) { + if (mj >= first[j+1] || mk >= first[k+1]) { printf("Illegal quad...\n" " j=%d first[j]=%d first[j+1]=%d mj=%d\n" " k=%d first[k]=%d first[k+1]=%d mk=%d\n", @@ -1276,7 +1276,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, error->one(__FILE__,__LINE__,"Shit, brkoen quad loop"); } - if(nlist_short[mj] == nlist_short[mk]) { + if (nlist_short[mj] == nlist_short[mk]) { /* Closed quadruplet */ m = nlist_short[mj]; c_jm = c_km = 1; @@ -1287,25 +1287,25 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, w4 = get_weight(triclinic,ss[i],ss[j],ss[k],ss[m]); - if(w4 > 0.0) { + if (w4 > 0.0) { /* Alrady know ij,jk,ki,jm,km bonds. Look for im bond. */ mi = first[i]; while(mi < first[i+1] && nlist_short[mi] < m) mi = mi + 1; - if(mi < first[i+1] && nlist_short[mi] == m) + if (mi < first[i+1] && nlist_short[mi] == m) c_im = 1; else c_im = 0; - if(c_im == 0 || c_jk == 0 || (c_jk && c_im && m < k)) { + if (c_im == 0 || c_jk == 0 || (c_jk && c_im && m < k)) { - if(triplet_defer) { + if (triplet_defer) { dvir_ij = dvir_jk = dvir_ki = 0.0; - if(c_ij && c_jk) + if (c_ij && c_jk) T12 = get_triplet(xx,j,i,k,&bond_hash,&T12work,&dvir_ij,&dvir_jk); - if(c_ki && c_jk) + if (c_ki && c_jk) T23 = get_triplet(xx,k,i,j,&bond_hash,&T23work,&dvir_ki,&dvir_jk); - if(c_ij && c_ki) + if (c_ij && c_ki) T31 = get_triplet(xx,i,j,k,&bond_hash,&T31work,&dvir_ij,&dvir_ki); triplet_defer = 0; } @@ -1314,7 +1314,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fmx = fmy = fmz = 0.0; double xvir4 = 0.0; - if(evflag) { + if (evflag) { fsave[0][0] = fix; fsave[0][1] = fiy; fsave[0][2] = fiz; fsave[1][0] = fjx; fsave[1][1] = fjy; fsave[1][2] = fjz; fsave[2][0] = fkx; fsave[2][1] = fky; fsave[2][2] = fkz; @@ -1329,15 +1329,15 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dvir_im = dvir_jm = dvir_km = 0.0; T45 = T56 = T64 = 0; - if(T12 != 0 && c_km && c_im) + if (T12 != 0 && c_km && c_im) T45 = get_triplet(xx,m,i,k,&bond_hash,&T45work,&dvir_im,&dvir_km); - if(T23 != 0 && c_im && c_jm) + if (T23 != 0 && c_im && c_jm) T56 = get_triplet(xx,m,i,j,&bond_hash,&T56work,&dvir_im,&dvir_jm); - if(T31 != 0 && c_jm && c_km) + if (T31 != 0 && c_jm && c_km) T64 = get_triplet(xx,m,j,k,&bond_hash,&T64work,&dvir_jm,&dvir_km); - if(T12 != 0 && T45 != 0) { - if(four_body_energies && evflag) { + if (T12 != 0 && T45 != 0) { + if (four_body_energies && evflag) { tr1 = transtrace(T12->H1H2,T45->H1H2); double dvir = ( (dvir_ij + dvir_jk + dvir_im + dvir_km)*splinepot.ve + splinepot.dve )*tr1*w4/anorm4; @@ -1356,17 +1356,17 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix_update_4a(z); } - if(quad_debug) /* Compare forces to numerical derivatives */ + if (quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,j,k,m, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - if(four_body_forces) + if (four_body_forces) accumulate_forces_4(w4); } - if(T23 != 0 && T56 != 0) { - if(four_body_energies && evflag) { + if (T23 != 0 && T56 != 0) { + if (four_body_energies && evflag) { tr2 = transtrace(T23->H1H2,T56->H1H2); double dvir = ( (dvir_ki + dvir_jk + dvir_im + dvir_jm)*splinepot.ve + splinepot.dve )*tr2*w4/anorm4; @@ -1385,18 +1385,18 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix_update_4b(z); } - if(quad_debug) /* Compare forces to numerical derivatives */ + if (quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,m,j,k, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - if(four_body_forces) + if (four_body_forces) accumulate_forces_4(w4); } - if(T31 != 0 && T64 != 0) { - if(four_body_energies && evflag) { + if (T31 != 0 && T64 != 0) { + if (four_body_energies && evflag) { tr3 = transtrace(T31->H1H2,T64->H1H2); double dvir = ( (dvir_ki + dvir_ij + dvir_jm + dvir_km)*splinepot.ve + splinepot.dve )*tr3*w4/anorm4; @@ -1416,29 +1416,29 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix_update_4c(z); } - if(quad_debug) /* Compare forces to numerical derivatives */ + if (quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,j,m,k, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - if(four_body_forces) + if (four_body_forces) accumulate_forces_4(w4); } double de_quad = splinepot.ve*(tr1 + tr2 + tr3)/anorm4 * e_scale * w4; e_quad = e_quad + de_quad; - if((T12 && T45) || + if ((T12 && T45) || (T23 && T56) || (T31 && T64)) { c_q++; } - if(evflag) { + if (evflag) { double drim[3],drjm[3],drkm[3]; double fi[3] = {fix,fiy,fiz}; double fj[3] = {fjx,fjy,fjz}; double fk[3] = {fkx,fky,fkz}; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { drim[p] = xx[i][p] - xx[m][p]; drjm[p] = xx[j][p] - xx[m][p]; drkm[p] = xx[k][p] - xx[m][p]; @@ -1449,10 +1449,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, ev_tally4(i,j,k,m,de_quad,fi,fj,fk,drim,drjm,drkm); - if(volpres_flag && vflag_atom) { + if (volpres_flag && vflag_atom) { //virial[i] = virial[i] - vir4 * rhoinv*e_scale; double dvir = -xvir4 * rhoinv*e_scale * (1.0/4.0); - for(int pp = 0; pp<3; pp++) { + for (int pp = 0; pp<3; pp++) { vatom[i][pp] += dvir; vatom[j][pp] += dvir; vatom[k][pp] += dvir; @@ -1474,7 +1474,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } mj = mj + 1; mk = mk + 1; - } else if(nlist_short[mj] < nlist_short[mk]) { + } else if (nlist_short[mj] < nlist_short[mk]) { mj = mj + 1; } else { mk = mk + 1; @@ -1505,15 +1505,15 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, ff[i][1] += fiy * e_scale; ff[i][2] += fiz * e_scale; - if(single_energies == 1 && i < nloc) { + if (single_energies == 1 && i < nloc) { const double evol0 = splinepot.evol0; - if(eflag_global) { + if (eflag_global) { e_single = e_single + evol0 * e_scale; eng_vdwl = eng_vdwl + evol0 * e_scale; } - if(eflag_atom) eatom[i] = eatom[i] + evol0 * e_scale; - if(volpres_flag && vflag_atom) { - for(int pp = 0; pp<3; pp++) + if (eflag_atom) eatom[i] = eatom[i] + evol0 * e_scale; + if (volpres_flag && vflag_atom) { + for (int pp = 0; pp<3; pp++) vatom[i][pp] = vatom[i][pp] - rhoinv*splinepot.devol0*e_scale; } @@ -1522,13 +1522,13 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } tx0 = gettime(); - for(i = 0; if[i][p] = atom->f[i][p] + ff[i][p]; memory->sfree(nlist_short); memory->sfree(first); - if(ss != xx) memory->sfree(ss); + if (ss != xx) memory->sfree(ss); memory->sfree(ff); memory->sfree(xx); tx1 = gettime(); @@ -1541,7 +1541,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, #ifdef TIMING_ON - if(comm->me == 0) { + if (comm->me == 0) { double tsum = (tmem+tsort+tpair+tlookup+ttriplet+tquad); double nsum = (ntmem+ntsort+ntpair+ntlookup+nttriplet+ntquad); //double adj = ((t1-t0)-tsum)/nsum; @@ -1624,7 +1624,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } #endif - if(volpres_flag) { + if (volpres_flag) { /* Include contributions to the pressure due to derivatines of the energy with respect to the potential input volume. @@ -1635,29 +1635,29 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, /* double vtot = 1.0; double ntot = atom->natoms; - for(i = 0; i<3; i++) + for (i = 0; i<3; i++) vtot = vtot * (domain->boxhi[i] - domain->boxlo[i]); double rhoinv = vtot / ntot; */ - if(single_energies) // Virial correction for self energy - for(i = 0; i<3; i++) { + if (single_energies) // Virial correction for self energy + for (i = 0; i<3; i++) { //virial[i] = virial[i] + nloc*pot_input_vol*pvol0*e_scale; virial[i] = virial[i] - nloc*rhoinv*splinepot.devol0*e_scale; } - if(pair_energies) // Virial correction for pair energy - for(i = 0; i<3; i++) + if (pair_energies) // Virial correction for pair energy + for (i = 0; i<3; i++) virial[i] = virial[i] + rhoinv*e_scale*volvir2; - if(three_body_energies) // Virial correction for three body enegries - for(i = 0; i<3; i++) { + if (three_body_energies) // Virial correction for three body enegries + for (i = 0; i<3; i++) { //virial[i] = virial[i] - pot_input_vol*(e_triplet_c*pc + (e_triplet-e_triplet_c)*pd); virial[i] = virial[i] - (vir3v + vir3t) * rhoinv*e_scale; } - if(four_body_energies) // Virial correction for four body enegries - for(i = 0; i<3; i++) { + if (four_body_energies) // Virial correction for four body enegries + for (i = 0; i<3; i++) { //virial[i] = virial[i] - pot_input_vol*e_quad*pe; virial[i] = virial[i] - vir4 * rhoinv*e_scale; } @@ -1679,66 +1679,66 @@ void PairMGPT::compute(int eflag, int vflag) //printf("newton_pair = %d, newton = %d, tag_enable = %d\n",force->newton_pair,force->newton,atom->tag_enable); - if(newton_pair == 0) { + if (newton_pair == 0) { printf("This is a problem. MGPT requires newton_pair flag to be on. Exiting...\n"); exit(1); } - if(atom->tag_enable == 0) { + if (atom->tag_enable == 0) { printf("This is a problem. MGPT requires tag_enable flag to be on. Exiting...\n"); exit(1); } compute_x(listfull->numneigh,listfull->firstneigh,&e_s,&e_p,&e_t,&e_q,evflag,newton_pair); - if(0) { // Stupid force calculation / verification + if (0) { // Stupid force calculation / verification int ii,nmax=-1; - for(ii = 0; iiinum + listfull->gnum; ii++) { + for (ii = 0; iiinum + listfull->gnum; ii++) { int i = listfull->ilist[ii]; - if(i > nmax) nmax = i; + if (i > nmax) nmax = i; } nmax++; double *ffwork = new double[3*nmax]; double *ffloc = new double[3*listfull->inum]; double *ffloc2 = new double[3*listfull->inum]; double **ffptr = new double *[nmax]; - for(ii = 0; iiinum + listfull->gnum; ii++) + for (ii = 0; iiinum + listfull->gnum; ii++) ffptr[ii] = &ffwork[3*ii]; printf("Computing boundary forces\n"); - for(ii = 0; iiinum; ii++) { + for (ii = 0; iiinum; ii++) { ffloc2[3*ii] = 0.0; ffloc2[3*ii+1] = 0.0; ffloc2[3*ii+2] = 0.0; int i = listfull->ilist[ii]; - for(int jj = 0; jjinum+listfull->gnum; jj++) { + for (int jj = 0; jjinum+listfull->gnum; jj++) { int j = listfull->ilist[jj]; - if(atom->tag[i] == atom->tag[j]) - for(int p = 0; p<3; p++) + if (atom->tag[i] == atom->tag[j]) + for (int p = 0; p<3; p++) ffloc2[3*ii+p] += atom->f[j][p]; } } printf("Starting main displacement force calculation\n"); - for(ii = 0; iiinum; ii++) { + for (ii = 0; iiinum; ii++) { int i = listfull->ilist[ii]; double **atom_f_save = atom->f; atom->f = ffptr; - for(int p = 0; p<3; p++) { + for (int p = 0; p<3; p++) { double xsave = atom->x[i][p]; const double delta = 1e-3; atom->x[i][p] = xsave + delta; - for(int jj = 0; jj<3*nmax; jj++) ffwork[jj] = 0.0; + for (int jj = 0; jj<3*nmax; jj++) ffwork[jj] = 0.0; compute_x(listfull->numneigh, listfull->firstneigh, &e_s,&e_p,&e_t,&e_q,evflag,newton_pair); double e1 = e_s + e_p + e_t + e_q; atom->x[i][p] = xsave - delta; - for(int jj = 0; jj<3*nmax; jj++) ffwork[jj] = 0.0; + for (int jj = 0; jj<3*nmax; jj++) ffwork[jj] = 0.0; compute_x(listfull->numneigh, listfull->firstneigh, &e_s,&e_p,&e_t,&e_q,evflag,newton_pair); @@ -1769,10 +1769,10 @@ void PairMGPT::compute(int eflag, int vflag) } - if(0) { + if (0) { printf("\nForces MGPT:\n"); const int iimax = (listfull->inum < 10) ? listfull->inum : 10; - for(int ii = 0; iiilist[ii]; printf("%4d = %20.10e %20.10e %20.10e\n", i,atom->f[i][0],atom->f[i][1],atom->f[i][2]); @@ -1780,7 +1780,7 @@ void PairMGPT::compute(int eflag, int vflag) printf("\n\n"); } - if(vflag_fdotr) { + if (vflag_fdotr) { //printf("##### Using virial_compute!!!\n"); virial_fdotr_compute(); } @@ -1792,8 +1792,8 @@ void PairMGPT::allocate() int n = atom->ntypes; memory->create(setflag,n+1,n+1,"pair:setflag"); - for(int i = 0; i <= n; i++) - for(int j = 0; j <= n; j++) + for (int i = 0; i <= n; i++) + for (int j = 0; j <= n; j++) setflag[i][j] = 0; memory->create(cutsq,n+1,n+1,"pair:cutsq"); @@ -1805,7 +1805,7 @@ void PairMGPT::allocate() ------------------------------------------------------------------------- */ void PairMGPT::settings(int narg, char **/*arg*/) { - if(narg != 0) error->all(__FILE__,__LINE__,"Illegal pair_style command"); + if (narg != 0) error->all(__FILE__,__LINE__,"Illegal pair_style command"); } /* ---------------------------------------------------------------------- @@ -1816,18 +1816,18 @@ void PairMGPT::coeff(int narg, char **arg) { int single_precision = 0; - if(narg < 5) + if (narg < 5) error->all(__FILE__,__LINE__, "Not enough arguments for mgpt (MGPT) pair coefficients."); - if(!allocated) allocate(); + if (!allocated) allocate(); // Make sure I,J args are * * - if(strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) + if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(__FILE__,__LINE__,"Incorrect args for pair coefficients"); double vol; - if(sscanf(arg[4], "%lg", &vol) != 1 || vol <= 0.0) + if (sscanf(arg[4], "%lg", &vol) != 1 || vol <= 0.0) error->all(__FILE__,__LINE__,"Invalid volume in mgpt (MGPT) pair coefficients."); volpres_flag = 1; @@ -1838,11 +1838,11 @@ void PairMGPT::coeff(int narg, char **arg) int iarg = 5; while (iarg < narg) { - if(strcmp(arg[iarg],"volpress") == 0) { /* Volumetric pressure flag */ + if (strcmp(arg[iarg],"volpress") == 0) { /* Volumetric pressure flag */ if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); - if(strcmp(arg[iarg+1],"yes") == 0) volpres_flag = 1; - else if(strcmp(arg[iarg+1],"no") == 0) volpres_flag = 0; + if (strcmp(arg[iarg+1],"yes") == 0) volpres_flag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) volpres_flag = 0; else { char line[1024]; sprintf(line,"(In %s:%d) Invalid value for volumetric pressure argument.\n" @@ -1852,16 +1852,16 @@ void PairMGPT::coeff(int narg, char **arg) } volpres_tag = 1; iarg += 2; - if(comm->me == 0) printf("* volpress: volpres_flag = %d [%s %s]\n",volpres_flag,arg[iarg-2],arg[iarg-1]); - } else if(strcmp(arg[iarg],"nbody") == 0) { + if (comm->me == 0) printf("* volpress: volpres_flag = %d [%s %s]\n",volpres_flag,arg[iarg-2],arg[iarg-1]); + } else if (strcmp(arg[iarg],"nbody") == 0) { if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); - if(strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { + if (strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { nbody_flag = 0; - for(int i = 0; i<4; i++) - if(strchr(arg[iarg+1],'1'+i) != nullptr) { + for (int i = 0; i<4; i++) + if (strchr(arg[iarg+1],'1'+i) != nullptr) { nbody_flag = nbody_flag + (1<me == 0) printf("Explicitly adding %d-tuple forces.\n",i+1); + if (comm->me == 0) printf("Explicitly adding %d-tuple forces.\n",i+1); } } else { char line[1024]; @@ -1874,11 +1874,11 @@ void PairMGPT::coeff(int narg, char **arg) } nbody_tag = 1; iarg += 2; - } else if(strcmp(arg[iarg],"precision") == 0) { + } else if (strcmp(arg[iarg],"precision") == 0) { if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); - if(strcmp(arg[iarg+1],"single") == 0) single_precision = 1; - else if(strcmp(arg[iarg+1],"double") == 0) single_precision = 0; + if (strcmp(arg[iarg+1],"single") == 0) single_precision = 1; + else if (strcmp(arg[iarg+1],"double") == 0) single_precision = 0; else { char line[1024]; sprintf(line,"(In %s:%d) Invalid value for precision argument.\n" @@ -1888,7 +1888,7 @@ void PairMGPT::coeff(int narg, char **arg) } precision_tag = 1; iarg += 2; - if(comm->me == 0) printf("* precision: single_flag = %d [%s %s]\n",single_precision,arg[iarg-2],arg[iarg-1]); + if (comm->me == 0) printf("* precision: single_flag = %d [%s %s]\n",single_precision,arg[iarg-2],arg[iarg-1]); } else { char line[1024]; sprintf(line,"(In %s:%d) Invalid argument. Allowed arguments are:\n" @@ -1900,10 +1900,10 @@ void PairMGPT::coeff(int narg, char **arg) } } - if(comm->me == 0) + if (comm->me == 0) printf("Volumetric pressure is %s.\n",volpres_flag ? "on" : "off"); - if(comm->me == 0) { + if (comm->me == 0) { FILE *parmin_fp = utils::open_potential(arg[2],lmp,nullptr); FILE *potin_fp = utils::open_potential(arg[3],lmp,nullptr); if (parmin_fp == nullptr || potin_fp == nullptr) { @@ -1920,14 +1920,14 @@ void PairMGPT::coeff(int narg, char **arg) /* Set up default and requested nbody forces to include */ { int nbody_default = (1<<0) + (1<<1) + (1<<2) + (1<<3); - if(splinepot.vd == 0.0 && splinepot.dvd == 0.0) + if (splinepot.vd == 0.0 && splinepot.dvd == 0.0) nbody_default -= (1<<2); // No 3-body contributions - if(splinepot.ve == 0.0 && splinepot.dve == 0.0) + if (splinepot.ve == 0.0 && splinepot.dve == 0.0) nbody_default -= (1<<3); // No 4-body contributions - if(nbody_tag == 0) nbody_flag = nbody_default; + if (nbody_tag == 0) nbody_flag = nbody_default; - if(nbody_flag != nbody_default) { + if (nbody_flag != nbody_default) { printf("Warning: nbody=%d (suggested=%d) set to disregard multibody-forces in potential.\n", nbody_flag,nbody_default); } @@ -1943,7 +1943,7 @@ void PairMGPT::coeff(int narg, char **arg) memory, and then broadcast contents of arrays. */ MPI_Bcast(&splinepot,sizeof(splinepot),MPI_BYTE,0,world); - if(comm->me != 0) { + if (comm->me != 0) { splinepot.vpair_spline = new double[splinepot.nr-1][4]; splinepot.dvpair_spline = new double[splinepot.nr-1][4]; } @@ -1954,10 +1954,10 @@ void PairMGPT::coeff(int narg, char **arg) lmax = splinepot.lmax; lang = splinepot.lang; //ipot = splinepot.ipot; - for(int i = 0; i<(int) (sizeof(ddl)/sizeof(double)); i++) + for (int i = 0; i<(int) (sizeof(ddl)/sizeof(double)); i++) ddl[i] = splinepot.ddl[i]; - for(int i = 0; i rmax) cutoff = rcrit; + if (rcrit > rmax) cutoff = rcrit; // Set LAMMPS pair interaction flags. - for(int i = 1; i <= atom->ntypes; i++) { - for(int j = 1; j <= atom->ntypes; j++) { + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = 1; j <= atom->ntypes; j++) { setflag[i][j] = 1; cutsq[i][j] = cutoff; cutghost[i][j] = cutoff; @@ -1980,12 +1980,12 @@ void PairMGPT::coeff(int narg, char **arg) } // Set atomic mass. - for(int i = 1; i <= atom->ntypes; i++) + for (int i = 1; i <= atom->ntypes; i++) atom->set_mass(FLERR,i, splinepot.mass); // Initialize linear algebra routines. linalg = mgpt_linalg(lmax,single_precision); - if(comm->me == 0) + if (comm->me == 0) printf("%s",linalg.msg); } @@ -1995,7 +1995,7 @@ void PairMGPT::coeff(int narg, char **arg) ------------------------------------------------------------------------- */ void PairMGPT::init_style() { - if(force->newton_pair == 0) + if (force->newton_pair == 0) error->all(__FILE__,__LINE__,"Pair style mgpt requires newton pair on."); // Need full neighbor list. @@ -2016,8 +2016,8 @@ void PairMGPT::init_style() ------------------------------------------------------------------------- */ void PairMGPT::init_list(int id, NeighList *ptr) { - if(id == 1) listfull = ptr; - else if(id == 2) listhalf = ptr; + if (id == 1) listfull = ptr; + else if (id == 2) listhalf = ptr; } /* ---------------------------------------------------------------------- @@ -2056,13 +2056,13 @@ void PairMGPT::fl_deriv_new(double r,double ri,double xhat,double yhat,double zh */ double rpi = 1.0/rp; - if(mode <= 4) { + if (mode <= 4) { t = pow(rp*ri,p1); s = -p1 * t * ri; t_rp_ti = p1*rpi; t_p1_ti = log(rp*ri); } else { - if(pn == 1.0) { + if (pn == 1.0) { double p1_rpi = -p1*rpi; t = exp(p1 + r*p1_rpi); s = p1_rpi * t; @@ -2107,7 +2107,7 @@ void PairMGPT::fl_deriv_new(double r,double ri,double xhat,double yhat,double zh q_al = u*u; exp_q = exp(-q); - if(mode <= 2) { + if (mode <= 2) { fl_0 = exp_q * t; fl_x = exp_q*(tx - t*qx); fl_y = exp_q*(ty - t*qy); diff --git a/src/USER-MISC/angle_gaussian.cpp b/src/USER-MISC/angle_gaussian.cpp index 554b19cfb5..66da9e792e 100644 --- a/src/USER-MISC/angle_gaussian.cpp +++ b/src/USER-MISC/angle_gaussian.cpp @@ -244,7 +244,7 @@ void AngleGaussian::write_restart(FILE *fp) { fwrite(&angle_temperature[1],sizeof(double),atom->nangletypes,fp); fwrite(&nterms[1],sizeof(int),atom->nangletypes,fp); - for(int i = 1; i <= atom->nangletypes; i++) { + for (int i = 1; i <= atom->nangletypes; i++) { fwrite(alpha[i],sizeof(double),nterms[i],fp); fwrite(width[i],sizeof(double),nterms[i],fp); fwrite(theta0[i],sizeof(double),nterms[i],fp); @@ -267,21 +267,21 @@ void AngleGaussian::read_restart(FILE *fp) MPI_Bcast(&nterms[1],atom->nangletypes,MPI_INT,0,world); // allocate - for(int i = 1; i <= atom->nangletypes; i++) { + for (int i = 1; i <= atom->nangletypes; i++) { alpha[i] = new double [nterms[i]]; width[i] = new double [nterms[i]]; theta0[i] = new double [nterms[i]]; } if (comm->me == 0) { - for(int i = 1; i <= atom->nangletypes; i++) { + for (int i = 1; i <= atom->nangletypes; i++) { utils::sfread(FLERR,alpha[i],sizeof(double),nterms[i],fp,nullptr,error); utils::sfread(FLERR,width[i],sizeof(double),nterms[i],fp,nullptr,error); utils::sfread(FLERR,theta0[i],sizeof(double),nterms[i],fp,nullptr,error); } } - for(int i = 1; i <= atom->nangletypes; i++) { + for (int i = 1; i <= atom->nangletypes; i++) { MPI_Bcast(alpha[i],nterms[i],MPI_DOUBLE,0,world); MPI_Bcast(width[i],nterms[i],MPI_DOUBLE,0,world); MPI_Bcast(theta0[i],nterms[i],MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_gaussian.cpp b/src/USER-MISC/bond_gaussian.cpp index b1e9d3d66b..42f76eda75 100644 --- a/src/USER-MISC/bond_gaussian.cpp +++ b/src/USER-MISC/bond_gaussian.cpp @@ -200,7 +200,7 @@ void BondGaussian::write_restart(FILE *fp) { fwrite(&bond_temperature[1],sizeof(double),atom->nbondtypes,fp); fwrite(&nterms[1],sizeof(int),atom->nbondtypes,fp); - for(int i = 1; i <= atom->nbondtypes; i++) { + for (int i = 1; i <= atom->nbondtypes; i++) { fwrite(alpha[i],sizeof(double),nterms[i],fp); fwrite(width[i],sizeof(double),nterms[i],fp); fwrite(r0[i],sizeof(double),nterms[i],fp); @@ -223,21 +223,21 @@ void BondGaussian::read_restart(FILE *fp) MPI_Bcast(&nterms[1],atom->nbondtypes,MPI_INT,0,world); // allocate - for(int i = 1; i <= atom->nbondtypes; i++) { + for (int i = 1; i <= atom->nbondtypes; i++) { alpha[i] = new double [nterms[i]]; width[i] = new double [nterms[i]]; r0[i] = new double [nterms[i]]; } if (comm->me == 0) { - for(int i = 1; i <= atom->nbondtypes; i++) { + for (int i = 1; i <= atom->nbondtypes; i++) { utils::sfread(FLERR,alpha[i],sizeof(double),nterms[i],fp,nullptr,error); utils::sfread(FLERR,width[i],sizeof(double),nterms[i],fp,nullptr,error); utils::sfread(FLERR,r0[i],sizeof(double),nterms[i],fp,nullptr,error); } } - for(int i = 1; i <= atom->nbondtypes; i++) { + for (int i = 1; i <= atom->nbondtypes; i++) { MPI_Bcast(alpha[i],nterms[i],MPI_DOUBLE,0,world); MPI_Bcast(width[i],nterms[i],MPI_DOUBLE,0,world); MPI_Bcast(r0[i],nterms[i],MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index 01a623b4a9..a73f401120 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -289,7 +289,7 @@ void ComputeBasalAtom::compute_peratom() } var5 = var6 = var7 = 0.0; //find standard deviations - for (j=0;j 0){ + if (Mag > 0) { BPV[i][0] = BPV[i][0]/Mag; BPV[i][1] = BPV[i][1]/Mag; BPV[i][2] = BPV[i][2]/Mag; diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index cc1b81fc97..1362da447b 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -247,7 +247,7 @@ void ComputeEntropyAtom::compute_peratom() // loop over list of all neighbors within force cutoff // initialize gofr - for(int k=0;k (nbin-1)) minbin=nbin-1; maxbin=bin + deltabin; if (maxbin > (nbin-1)) maxbin=nbin-1; - for(int k=minbin;kprd[i]; } @@ -180,7 +180,7 @@ void ComputeStressMop::init() // Warnings - if (me==0){ + if (me==0) { //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. @@ -327,7 +327,7 @@ void ComputeStressMop::compute_pairs() values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; } - else if ( ((xi[dir]pos)) || ((xi[dir]pos1)) ){ + else if ( ((xi[dir]pos)) || ((xi[dir]pos1)) ) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); @@ -359,13 +359,13 @@ void ComputeStressMop::compute_pairs() // Compute kinetic contribution to pressure // counts local particles transfers across the plane - if (which[m] == KIN || which[m] == TOTAL){ + if (which[m] == KIN || which[m] == TOTAL) { double sgn; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { // skip if I is not in group - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { itype = type[i]; @@ -402,7 +402,7 @@ void ComputeStressMop::compute_pairs() double pos_temp = pos+copysign(1.0,domain->prd_half[dir]-pos)*domain->prd[dir]; if (fabs(xi[dir]-pos)ndihedraltypes,fp); - for(int i = 1; i <= atom->ndihedraltypes; i++) { + for (int i = 1; i <= atom->ndihedraltypes; i++) { fwrite(k[i],sizeof(double),nterms[i],fp); fwrite(multiplicity[i],sizeof(int),nterms[i],fp); fwrite(shift[i],sizeof(double),nterms[i],fp); @@ -410,7 +410,7 @@ void DihedralFourier::write_data(FILE *fp) for (int i = 1; i <= atom->ndihedraltypes; i++) { fprintf(fp,"%d %d",i,nterms[i]); - for(int j = 0; j < nterms[i]; j++) + for (int j = 0; j < nterms[i]; j++) fprintf(fp," %g %d %g",k[i][j],multiplicity[i][j],shift[i][j]); fprintf(fp,"\n"); } diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index f1b01d031f..1041062530 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -307,7 +307,7 @@ void DihedralNHarmonic::coeff(int narg, char **arg) void DihedralNHarmonic::write_restart(FILE *fp) { fwrite(&nterms[1],sizeof(int),atom->ndihedraltypes,fp); - for(int i = 1; i <= atom->ndihedraltypes; i++) + for (int i = 1; i <= atom->ndihedraltypes; i++) fwrite(a[i],sizeof(double),nterms[i],fp); } @@ -325,11 +325,11 @@ void DihedralNHarmonic::read_restart(FILE *fp) MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); // allocate - for(int i = 1; i <= atom->ndihedraltypes; i++) + for (int i = 1; i <= atom->ndihedraltypes; i++) a[i] = new double [nterms[i]]; if (comm->me == 0) { - for(int i = 1; i <= atom->ndihedraltypes; i++) + for (int i = 1; i <= atom->ndihedraltypes; i++) utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,nullptr,error); } diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 2c12266d85..2f77887de9 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -479,7 +479,7 @@ void DihedralSpherical::compute(int eflag, int vflag) // d U d U d phi d U d theta1 d U d theta2 // -f = ----- = ----- * ----- + -------*------- + --------*-------- // d x d phi d x d theta1 d X d theta2 d X - for(int d=0; d < g_dim; ++d) { + for (int d=0; d < g_dim; ++d) { f1[d] = m_du_dphi*dphi_dx1[d]+m_du_dth1*dth1_dx1[d]; //note: dth2_dx1[d]=0 f2[d] = m_du_dphi*dphi_dx2[d]+m_du_dth1*dth1_dx2[d]+m_du_dth2*dth2_dx2[d]; @@ -731,7 +731,7 @@ void DihedralSpherical::write_restart(FILE *fp) { fwrite(&nterms[1],sizeof(int),atom->ndihedraltypes,fp); - for(int i = 1; i <= atom->ndihedraltypes; i++) { + for (int i = 1; i <= atom->ndihedraltypes; i++) { fwrite(Ccoeff[i],sizeof(double),nterms[i],fp); fwrite(phi_mult[i],sizeof(double),nterms[i],fp); fwrite(phi_shift[i],sizeof(double),nterms[i],fp); diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 11b5016a9a..30e6192275 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -204,7 +204,7 @@ static int cyc_spline(double const *xa, // The for loop sets up the equations we need to solve. // Later we invoke the GSL tridiagonal matrix solver to solve them. - for(int i=0; i < n; i++) { + for (int i=0; i < n; i++) { // I have to lookup xa[i+1] and xa[i-1]. This gets tricky because of // periodic boundary conditions. We handle that now. @@ -675,7 +675,7 @@ void DihedralTable::compute(int eflag, int vflag) // d U d U d phi // -f = ----- = ----- * ----- // d x d phi d x - for(int d=0; d < g_dim; ++d) { + for (int d=0; d < g_dim; ++d) { f1[d] = m_du_dphi * dphi_dx1[d]; f2[d] = m_du_dphi * dphi_dx2[d]; f3[d] = m_du_dphi * dphi_dx3[d]; diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index 4c008bed6d..ed7b3ac0d6 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -221,7 +221,7 @@ static int cyc_spline(double const *xa, // The for loop sets up the equations we need to solve. // Later we invoke the GSL tridiagonal matrix solver to solve them. - for(int i=0; i < n; i++) { + for (int i=0; i < n; i++) { // I have to lookup xa[i+1] and xa[i-1]. This gets tricky because of // periodic boundary conditions. We handle that now. diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index bbf106e68a..a9c8228871 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -491,7 +491,7 @@ void FixAveCorrelateLong::end_of_step() evaluate(); if (fp && me == 0) { - if(overwrite) fseek(fp,filepos,SEEK_SET); + if (overwrite) fseek(fp,filepos,SEEK_SET); fprintf(fp,"# Timestep: " BIGINT_FORMAT "\n", ntimestep); for (unsigned int i=0;idt*nevery); @@ -590,7 +590,7 @@ void FixAveCorrelateLong::accumulate() /* ---------------------------------------------------------------------- Add a scalar value to the autocorrelator k of pair i ------------------------------------------------------------------------- */ -void FixAveCorrelateLong::add(const int i, const double w, const int k){ +void FixAveCorrelateLong::add(const int i, const double w, const int k) { // If we exceed the correlator side, the value is discarded if (k == numcorrelators) return; if (k > kmax) kmax=k; diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 1bcf3cee21..4f1feeaa6c 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -260,14 +260,14 @@ void FixFilterCorotate::init() int i; // error if more than one filter int count = 0; - for (i = 0; i < modify->nfix; i++){ + for (i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"filter/corotate") == 0) count++; } if (count > 1) error->all(FLERR,"More than one fix filter/corotate"); // check for fix shake: count = 0; - for (i = 0; i < modify->nfix; i++){ + for (i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"shake") == 0) count++; } if (count > 1) @@ -353,7 +353,7 @@ void FixFilterCorotate::pre_neighbor() nlist = 0; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (shake_flag[i]) { if (shake_flag[i] == 2) { atom1 = atom->map(shake_atom[i][0]); @@ -682,11 +682,11 @@ void FixFilterCorotate::setup(int vflag) ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); } -void FixFilterCorotate::setup_pre_force_respa(int vflag,int ilevel){ +void FixFilterCorotate::setup_pre_force_respa(int vflag,int ilevel) { pre_force_respa(vflag,ilevel,0); } -//void FixFilterCorotate::setup_post_force_respa(int vflag,int ilevel){ +//void FixFilterCorotate::setup_post_force_respa(int vflag,int ilevel) { // post_force_respa(vflag,ilevel,0); //} @@ -944,7 +944,7 @@ void FixFilterCorotate::find_clusters() m = 0; while (m < size) { i = atom->map(buf[m]); - for (j = 0; j < npartner[i]; j++){ + for (j = 0; j < npartner[i]; j++) { if (buf[m+1] == partner_tag[i][j]) break; } partner_mask[i][j] = buf[m+2]; @@ -965,7 +965,7 @@ void FixFilterCorotate::find_clusters() // else it's an error flag = 0; - for (i = 0; i < nlocal; i++){ + for (i = 0; i < nlocal; i++) { for (j = 0; j < npartner[i]; j++) { if (partner_type[i][j] == 0) flag = 1; if (!(mask[i] & groupbit)) continue; @@ -1072,7 +1072,7 @@ void FixFilterCorotate::find_clusters() m = 0; while (m < size) { i = atom->map(buf[m]); - for (j = 0; j < npartner[i]; j++){ + for (j = 0; j < npartner[i]; j++) { if (buf[m+1] == partner_tag[i][j]) break; } partner_nshake[i][j] = buf[m+2]; @@ -1132,7 +1132,7 @@ void FixFilterCorotate::find_clusters() shake_type[i][3] = 0; if (nshake[i] == 1) { - for (j = 0; j < npartner[i]; j++){ + for (j = 0; j < npartner[i]; j++) { if (partner_shake[i][j]) break; } if (partner_nshake[i][j] == 1 && tag[i] < partner_tag[i][j]) { diff --git a/src/USER-MISC/fix_flow_gauss.cpp b/src/USER-MISC/fix_flow_gauss.cpp index 422c002158..0dabf82436 100644 --- a/src/USER-MISC/fix_flow_gauss.cpp +++ b/src/USER-MISC/fix_flow_gauss.cpp @@ -175,7 +175,7 @@ void FixFlowGauss::post_force(int /*vflag*/) f_thisProc[ii]=0.0; //add all forces on each processor - for(ii=0; iinarg) error->all(FLERR,"Did not specify C matrix for non-equilibrium GLE"); diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index a28363ff8e..cb7ca713a1 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -2754,23 +2754,23 @@ void FixNPTCauchy::CauchyStat_Step(double (&Fi)[3][3], double (&Fdot)[3][3], uv(5,1)=1; uv(5,2)=3; uv(6,1)=1; uv(6,2)=2; - for(int ii = 1;ii <= 6;ii++) { + for (int ii = 1;ii <= 6;ii++) { i=uv(ii,1); j=uv(ii,2); deltastress(ii)=setcauchy(i,j)-cauchy(i,j); - if(ii>3) deltastress(ii)=deltastress(ii)*2.0; + if (ii>3) deltastress(ii)=deltastress(ii)*2.0; fdotvec(ii)=Fdot(i,j)*deltat; } - for(int ii = 1;ii <= 6;ii++) { + for (int ii = 1;ii <= 6;ii++) { i=uv(ii,1); j=uv(ii,2); - for(int jj = 1;jj <= 6;jj++) { + for (int jj = 1;jj <= 6;jj++) { m=uv(jj,1); n=uv(jj,2); dsds(ii,jj) = Fi(i,m)*Fi(j,n) + Fi(i,n)*Fi(j,m) + Fi(j,m)*Fi(i,n) + Fi(j,n)*Fi(i,m); - for(int l = 1;l <= 3;l++) { - for(int k = 1;k <= 3;k++) { + for (int l = 1;l <= 3;l++) { + for (int k = 1;k <= 3;k++) { dsdf(ii,jj) = dsdf(ii,jj) + cauchy(k,l)* ( Fi(i,k)*Fi(j,l)*Fi(n,m) - Fi(i,m)*Fi(j,l)*Fi(n,k) - Fi(i,k)*Fi(j,m)*Fi(n,l) ); } @@ -2779,21 +2779,21 @@ void FixNPTCauchy::CauchyStat_Step(double (&Fi)[3][3], double (&Fdot)[3][3], } jac=volume/volume0; - for(int ii = 1;ii <= 6;ii++) { - for(int jj = 1;jj <= 6;jj++) { + for (int ii = 1;ii <= 6;ii++) { + for (int jj = 1;jj <= 6;jj++) { dsds(ii,jj)=dsds(ii,jj)*jac/4.0; dsdf(ii,jj)=dsdf(ii,jj)*jac; } } - for(int ii = 1;ii <= 6;ii++) { - for(int jj = 1;jj <= 6;jj++) { + for (int ii = 1;ii <= 6;ii++) { + for (int jj = 1;jj <= 6;jj++) { deltaF(ii)=deltaF(ii)+dsdf(ii,jj)*fdotvec(jj); } } - for(int ii = 1;ii <= 6;ii++) { - for(int jj = 1;jj <= 6;jj++) { + for (int ii = 1;ii <= 6;ii++) { + for (int jj = 1;jj <= 6;jj++) { deltaPK(ii)=deltaPK(ii)+alpha*dsds(ii,jj)*deltastress(jj); } deltaPK(ii)=deltaPK(ii)+alpha*deltaF(ii); diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index 2d229062de..ec0733657a 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -286,7 +286,7 @@ void FixPAFI::post_force(int /*vflag*/) } } - if (com_flag == 0){ + if (com_flag == 0) { c_v[9] += 1.0; } else { for (int i = 0; i < nlocal; i++) @@ -318,7 +318,7 @@ void FixPAFI::post_force(int /*vflag*/) results_all[4] = proj_all[5]; // dX.f force_flag = 1; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { f[i][0] -= proj_all[0] * path[i][3] + c_v_all[0]/c_v_all[9]; @@ -336,7 +336,7 @@ void FixPAFI::post_force(int /*vflag*/) } if (od_flag == 0) { - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (rmass) mass_f = sqrt(rmass[i]); else mass_f = sqrt(mass[type[i]]); @@ -351,7 +351,7 @@ void FixPAFI::post_force(int /*vflag*/) } } } else { - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (rmass) mass_f = sqrt(rmass[i]); @@ -449,7 +449,7 @@ void FixPAFI::min_post_force(int /*vflag*/) } } - if (com_flag == 0){ + if (com_flag == 0) { c_v[9] += 1.0; } else { for (int i = 0; i < nlocal; i++) @@ -482,7 +482,7 @@ void FixPAFI::min_post_force(int /*vflag*/) MPI_Bcast(results_all,5,MPI_DOUBLE,0,world); force_flag = 1; - for (int i = 0; i < nlocal; i++){ + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { f[i][0] -= proj_all[0] * path[i][3] + c_v_all[0]/c_v_all[9]; @@ -544,7 +544,7 @@ void FixPAFI::initial_integrate(int /*vflag*/) proj[1] += v[i][2] * path[i][5]; // v.n } } - if (com_flag == 0){ + if (com_flag == 0) { c_v[9] += 1.0; } else { for (int i = 0; i < nlocal; i++) @@ -566,7 +566,7 @@ void FixPAFI::initial_integrate(int /*vflag*/) MPI_Allreduce(proj,proj_all,5,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); - if (od_flag == 0){ + if (od_flag == 0) { if (rmass) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -650,7 +650,7 @@ void FixPAFI::final_integrate() proj[0] += f[i][1] * path[i][4]; // f.n proj[0] += f[i][2] * path[i][5]; // f.n } - if (com_flag == 0){ + if (com_flag == 0) { c_v[9] += 1.0; } else { for (int i = 0; i < nlocal; i++) @@ -665,7 +665,7 @@ void FixPAFI::final_integrate() MPI_Allreduce(proj,proj_all,5,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); - if (od_flag == 0){ + if (od_flag == 0) { if (rmass) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index 020799a943..5571f1cf35 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -52,34 +52,34 @@ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) nhc_nchain = 2; sp = 1.0; - for(int i=3; iuniverse_all(FLERR,"Unknown method parameter for fix pimd"); } - else if(strcmp(arg[i],"fmass")==0) + else if (strcmp(arg[i],"fmass")==0) { fmass = atof(arg[i+1]); - if(fmass<0.0 || fmass>1.0) error->universe_all(FLERR,"Invalid fmass value for fix pimd"); + if (fmass<0.0 || fmass>1.0) error->universe_all(FLERR,"Invalid fmass value for fix pimd"); } - else if(strcmp(arg[i],"sp")==0) + else if (strcmp(arg[i],"sp")==0) { sp = atof(arg[i+1]); - if(fmass<0.0) error->universe_all(FLERR,"Invalid sp value for fix pimd"); + if (fmass<0.0) error->universe_all(FLERR,"Invalid sp value for fix pimd"); } - else if(strcmp(arg[i],"temp")==0) + else if (strcmp(arg[i],"temp")==0) { nhc_temp = atof(arg[i+1]); - if(nhc_temp<0.0) error->universe_all(FLERR,"Invalid temp value for fix pimd"); + if (nhc_temp<0.0) error->universe_all(FLERR,"Invalid temp value for fix pimd"); } - else if(strcmp(arg[i],"nhc")==0) + else if (strcmp(arg[i],"nhc")==0) { nhc_nchain = atoi(arg[i+1]); - if(nhc_nchain<2) error->universe_all(FLERR,"Invalid nhc value for fix pimd"); + if (nhc_nchain<2) error->universe_all(FLERR,"Invalid nhc value for fix pimd"); } else error->universe_all(arg[i],i+1,"Unknown keyword for fix pimd"); } @@ -155,7 +155,7 @@ void FixPIMD::init() if (atom->map_style == Atom::MAP_NONE) error->all(FLERR,"Fix pimd requires an atom map, see atom_modify"); - if(universe->me==0 && screen) fprintf(screen,"Fix pimd initializing Path-Integral ...\n"); + if (universe->me==0 && screen) fprintf(screen,"Fix pimd initializing Path-Integral ...\n"); // prepare the constants @@ -190,7 +190,7 @@ void FixPIMD::init() omega_np = sqrt(np) / (hbar * beta) * sqrt(force->mvv2e); fbond = - _fbond * force->mvv2e; - if(universe->me==0) + if (universe->me==0) printf("Fix pimd -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); dtv = update->dt; @@ -200,17 +200,17 @@ void FixPIMD::init() mass = new double [atom->ntypes+1]; - if(method==CMD || method==NMPIMD) nmpimd_init(); - else for(int i=1; i<=atom->ntypes; i++) mass[i] = atom->mass[i] / np * fmass; + if (method==CMD || method==NMPIMD) nmpimd_init(); + else for (int i=1; i<=atom->ntypes; i++) mass[i] = atom->mass[i] / np * fmass; - if(!nhc_ready) nhc_init(); + if (!nhc_ready) nhc_init(); } /* ---------------------------------------------------------------------- */ void FixPIMD::setup(int vflag) { - if(universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); + if (universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); post_force(vflag); } @@ -234,12 +234,12 @@ void FixPIMD::final_integrate() void FixPIMD::post_force(int /*flag*/) { - for(int i=0; inlocal; i++) for(int j=0; j<3; j++) atom->f[i][j] /= np; + for (int i=0; inlocal; i++) for(int j=0; j<3; j++) atom->f[i][j] /= np; comm_exec(atom->x); spring_force(); - if(method==CMD || method==NMPIMD) + if (method==CMD || method==NMPIMD) { /* forward comm for the force on ghost atoms */ @@ -267,29 +267,29 @@ void FixPIMD::nhc_init() double mass0 = KT * tau * tau; int max = 3 * atom->nlocal; - for(int i=0; iiworld==0) ; else nhc_eta_mass[i][ichain] *= fmass; + if ((method==CMD || method==NMPIMD) && universe->iworld==0) ; else nhc_eta_mass[i][ichain] *= fmass; } nhc_eta_dot[i][nhc_nchain] = 0.0; - for(int ichain=1; ichainmvv2e - KT) / nhc_eta_mass[i][ichain]; } // Zero NH acceleration for CMD - if(method==CMD && universe->iworld==0) for(int i=0; iiworld==0) for (int i=0; ix; double **v = atom->v; - if(method==CMD || method==NMPIMD) + if (method==CMD || method==NMPIMD) { nmpimd_fill(atom->v); comm_exec(atom->v); @@ -313,7 +313,7 @@ void FixPIMD::nhc_update_x() nmpimd_transform(buf_beads, v, M_xp2x[universe->iworld]); } - for(int i=0; iv; double **f = atom->f; - for(int i=0; iiworld==0) return; + if (method==CMD && universe->iworld==0) return; double expfac; int nmax = 3 * atom->nlocal; @@ -350,7 +350,7 @@ void FixPIMD::nhc_update_v() double dt4 = 0.25 * update->dt; double dt8 = 0.125 * update->dt; - for(int i=0; i0; ichain--) + for (int ichain=nhc_nchain-1; ichain>0; ichain--) { expfac = exp(-dt8 * eta_dot[ichain+1]); eta_dot[ichain] *= expfac; @@ -388,14 +388,14 @@ void FixPIMD::nhc_update_v() kecurrent = force->boltz * t_current; eta_dotdot[0] = (kecurrent - KT) / nhc_eta_mass[i][0]; - for(int ichain=0; ichainiworld; - for(int i=1; i<=atom->ntypes; i++) + for (int i=1; i<=atom->ntypes; i++) { mass[i] = atom->mass[i]; - if(iworld) + if (iworld) { mass[i] *= lam[iworld]; mass[i] *= fmass; @@ -491,10 +491,10 @@ void FixPIMD::nmpimd_transform(double** src, double** des, double *vector) int n = atom->nlocal; int m = 0; - for(int i=0; ime - comm->nprocs; int rank_next = universe->me + comm->nprocs; - if(rank_last<0) rank_last += universe->nprocs; - if(rank_next>=universe->nprocs) rank_next -= universe->nprocs; + if (rank_last<0) rank_last += universe->nprocs; + if (rank_next>=universe->nprocs) rank_next -= universe->nprocs; plan_send[0] = rank_next; plan_send[1] = rank_last; plan_recv[0] = rank_last; plan_recv[1] = rank_next; @@ -579,13 +579,13 @@ void FixPIMD::comm_init() plan_recv = new int [size_plan]; mode_index = new int [size_plan]; - for(int i=0; ime + comm->nprocs * (i+1); - if(plan_send[i]>=universe->nprocs) plan_send[i] -= universe->nprocs; + if (plan_send[i]>=universe->nprocs) plan_send[i] -= universe->nprocs; plan_recv[i] = universe->me - comm->nprocs * (i+1); - if(plan_recv[i]<0) plan_recv[i] += universe->nprocs; + if (plan_recv[i]<0) plan_recv[i] += universe->nprocs; mode_index[i]=(universe->iworld+i+1)%(universe->nworlds); } @@ -594,14 +594,14 @@ void FixPIMD::comm_init() x_last = (universe->iworld-1+universe->nworlds)%(universe->nworlds); } - if(buf_beads) + if (buf_beads) { - for(int i=0; inlocal; - if(nlocal > max_nlocal) + if (nlocal > max_nlocal) { max_nlocal = nlocal+200; int size = sizeof(double) * max_nlocal * 3; buf_recv = (double*) memory->srealloc(buf_recv, size, "FixPIMD:x_recv"); - for(int i=0; isrealloc(buf_beads[i], size, "FixPIMD:x_beads[i]"); } @@ -626,7 +626,7 @@ void FixPIMD::comm_exec(double **ptr) // go over comm plans - for(int iplan = 0; iplan max_nsend) + if (nsend > max_nsend) { max_nsend = nsend+200; tag_send = (tagint*) memory->srealloc(tag_send, sizeof(tagint)*max_nsend, "FixPIMD:tag_send"); @@ -654,11 +654,11 @@ void FixPIMD::comm_exec(double **ptr) double *wrap_ptr = buf_send; int ncpy = sizeof(double)*3; - for(int i=0; imap(tag_send[i]); - if(index<0) + if (index<0) { char error_line[256]; @@ -846,7 +846,7 @@ int FixPIMD::size_restart(int /*nlocal*/) double FixPIMD::compute_vector(int n) { - if(n==0) { return spring_energy; } - if(n==1) { return t_sys; } + if (n==0) { return spring_energy; } + if (n==1) { return t_sys; } return 0.0; } diff --git a/src/USER-MISC/fix_propel_self.cpp b/src/USER-MISC/fix_propel_self.cpp index 9299f4d23b..8617fb0d3d 100644 --- a/src/USER-MISC/fix_propel_self.cpp +++ b/src/USER-MISC/fix_propel_self.cpp @@ -171,8 +171,8 @@ void FixPropelSelf::post_force_quaternion(int /* vflag */ ) // Add the active force to the atom force: - for( int i = 0; i < nlocal; ++i ){ - if( mask[i] & groupbit ){ + for ( int i = 0; i < nlocal; ++i ) { + if ( mask[i] & groupbit ) { if (filter_by_type && !apply_to_type[type[i]]) { continue; } @@ -206,8 +206,8 @@ void FixPropelSelf::post_force_velocity(int /*vflag*/) // Add the active force to the atom force: - for(int i = 0; i < nlocal; ++i) { - if( mask[i] & groupbit ){ + for (int i = 0; i < nlocal; ++i) { + if ( mask[i] & groupbit ) { if (filter_by_type && !apply_to_type[type[i]]) { continue; } diff --git a/src/USER-MISC/fix_rhok.cpp b/src/USER-MISC/fix_rhok.cpp index e63ba88b93..a84d9dae4d 100644 --- a/src/USER-MISC/fix_rhok.cpp +++ b/src/USER-MISC/fix_rhok.cpp @@ -235,9 +235,9 @@ FixRhok::compute_vector( int inI ) { if (inI == 0) return mRhoKGlobal[0]; // Real part - else if( inI == 1 ) + else if ( inI == 1 ) return mRhoKGlobal[1]; // Imagniary part - else if( inI == 2 ) + else if ( inI == 2 ) return sqrt( mRhoKGlobal[0]*mRhoKGlobal[0] + mRhoKGlobal[1]*mRhoKGlobal[1] ); else diff --git a/src/USER-MISC/fix_smd.cpp b/src/USER-MISC/fix_smd.cpp index 2d6117608a..828ceda0ed 100644 --- a/src/USER-MISC/fix_smd.cpp +++ b/src/USER-MISC/fix_smd.cpp @@ -223,7 +223,7 @@ void FixSMD::smd_tether() if (!zflag) dz = 0.0; r = sqrt(dx*dx + dy*dy + dz*dz); if (styleflag & SMD_CVEL) { - if(r > SMALL) { + if (r > SMALL) { dr = r - r0 - r_old; fx = k_smd*dx*dr/r; fy = k_smd*dy*dr/r; diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index 70398711d9..254a66f2f2 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -134,8 +134,8 @@ void FixSRP::init() char c0[20]; char c1[20]; - for(int z = 1; z < atom->ntypes; z++) { - if(z == bptype) + for (int z = 1; z < atom->ntypes; z++) { + if (z == bptype) continue; sprintf(c0, "%d", z); arg1[2] = c0; @@ -175,7 +175,7 @@ void FixSRP::setup_pre_force(int /*zz*/) memory->create(tagold,nall,"fix_srp:tagold"); memory->create(dlist,nall,"fix_srp:dlist"); - for (i = 0; i < nall; i++){ + for (i = 0; i < nall; i++) { xold[i][0] = x[i][0]; xold[i][1] = x[i][1]; xold[i][2] = x[i][2]; @@ -209,7 +209,7 @@ void FixSRP::setup_pre_force(int /*zz*/) // consider only the user defined bond type // btype of zero considers all bonds - if(btype > 0 && bondlist[n][2] != btype) + if (btype > 0 && bondlist[n][2] != btype) continue; i = bondlist[n][0]; @@ -226,7 +226,7 @@ void FixSRP::setup_pre_force(int /*zz*/) dely = xold[j][1] - xold[i][1]; delz = xold[j][2] - xold[i][2]; rsq = delx*delx + dely*dely + delz*delz; - if(rsq > rsqold) rsqold = rsq; + if (rsq > rsqold) rsqold = rsq; // make one particle for each bond // i is local @@ -255,7 +255,7 @@ void FixSRP::setup_pre_force(int /*zz*/) int nadd_all = 0, ndel_all = 0; MPI_Allreduce(&ndel,&ndel_all,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&nadd,&nadd_all,1,MPI_INT,MPI_SUM,world); - if(comm->me == 0){ + if (comm->me == 0) { sprintf(str, "Removed/inserted %d/%d bond particles.", ndel_all,nadd_all); error->message(FLERR,str); } @@ -285,7 +285,7 @@ void FixSRP::setup_pre_force(int /*zz*/) cutghostmin = comm->cutghost[2]/length2; // stop if cutghost is insufficient - if (cutneighmax_srp > cutghostmin){ + if (cutneighmax_srp > cutghostmin) { sprintf(str, "Communication cutoff too small for fix srp. " "Need %f, current %f.", cutneighmax_srp, cutghostmin); error->all(FLERR,str); @@ -327,14 +327,14 @@ void FixSRP::setup_pre_force(int /*zz*/) // zero all forces - for(i = 0; i < nall; i++) + for (i = 0; i < nall; i++) atom->f[i][0] = atom->f[i][1] = atom->f[i][2] = 0.0; // do not include bond particles in thermo output // remove them from all groups. set their velocity to zero. - for(i=0; i< nlocal; i++) - if(atom->type[i] == bptype) { + for (i=0; i< nlocal; i++) + if (atom->type[i] == bptype) { atom->mask[i] = 0; atom->v[i][0] = atom->v[i][1] = atom->v[i][2] = 0.0; } @@ -355,15 +355,15 @@ void FixSRP::pre_exchange() int i,j; int nlocal = atom->nlocal; - for(int ii = 0; ii < nlocal; ii++){ - if(atom->type[ii] != bptype) continue; + for (int ii = 0; ii < nlocal; ii++) { + if (atom->type[ii] != bptype) continue; i = atom->map(static_cast(array[ii][0])); - if(i < 0) error->all(FLERR,"Fix SRP failed to map atom"); + if (i < 0) error->all(FLERR,"Fix SRP failed to map atom"); i = domain->closest_image(ii,i); j = atom->map(static_cast(array[ii][1])); - if(j < 0) error->all(FLERR,"Fix SRP failed to map atom"); + if (j < 0) error->all(FLERR,"Fix SRP failed to map atom"); j = domain->closest_image(ii,j); // position of bond particle ii @@ -462,7 +462,7 @@ int FixSRP::unpack_border(int n, int first, double *buf) int m = 0; last = first + n; - for (i = first; i < last; i++){ + for (i = first; i < last; i++) { array[i][0] = buf[m++]; array[i][1] = buf[m++]; } @@ -484,8 +484,8 @@ void FixSRP::post_run() int* dlist; memory->create(dlist,nlocal,"fix_srp:dlist"); - for (int i = 0; i < nlocal; i++){ - if(atom->type[i] == bptype) + for (int i = 0; i < nlocal; i++) { + if (atom->type[i] == bptype) dlist[i] = 1; else dlist[i] = 0; @@ -574,7 +574,7 @@ void FixSRP::unpack_restart(int nlocal, int nth) // unpack the Nth first values this way because other fixes pack them int m = 0; - for (int i = 0; i < nth; i++){ + for (int i = 0; i < nth; i++) { m += static_cast (extra[nlocal][m]); } diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 88219a66cb..3a87dfa96d 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -380,7 +380,7 @@ double FixTISpring::switch_func(double t) double FixTISpring::dswitch_func(double t) { - if(sf == 1) return 1.0/t_switch; + if (sf == 1) return 1.0/t_switch; double t2 = t*t; double t4 = t2*t2; diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index e6aa062b39..a776e7e1da 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -290,8 +290,8 @@ void FixTTMMod::post_force(int /*vflag*/) double vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; if (vsq > v_0_sq) gamma1 *= (gamma_p + gamma_s)/gamma_p; gamma2 = gfactor2[type[i]] * tsqrt; - if (ixnode >= surface_l){ - if (ixnode < surface_r){ + if (ixnode >= surface_l) { + if (ixnode < surface_r) { flangevin[i][0] = gamma1*v[i][0] + gamma2*(random->uniform()-0.5); flangevin[i][1] = gamma1*v[i][1] + gamma2*(random->uniform()-0.5); flangevin[i][2] = gamma1*v[i][2] + gamma2*(random->uniform()-0.5); @@ -320,8 +320,8 @@ void FixTTMMod::post_force(int /*vflag*/) double diff_x = (x_at - x_surf)*(x_at - x_surf); diff_x = pow(diff_x,0.5); double len_factor = diff_x/(diff_x+free_path); - if (movsur == 1){ - if (x_at >= x_surf){ + if (movsur == 1) { + if (x_at >= x_surf) { flangevin[i][0] -= pres_factor/ionic_density*((C_ir*T_ir*free_path/(diff_x+free_path)/(diff_x+free_path)) + (len_factor/dx)*(C_ir*T_ir-C_i*T_i)); flangevin[i][1] -= pres_factor/ionic_density/dy*(C_iu*T_iu-C_i*T_i); @@ -337,8 +337,8 @@ void FixTTMMod::post_force(int /*vflag*/) f[i][2] += flangevin[i][2]; } } - if (movsur == 1){ - if (ixnode < surface_l){ + if (movsur == 1) { + if (ixnode < surface_l) { t_surface_l = ixnode; } } @@ -629,12 +629,12 @@ void FixTTMMod::end_of_step() int *mask = atom->mask; int nlocal = atom->nlocal; - if (movsur == 1){ + if (movsur == 1) { for (int ixnode = 0; ixnode < nxnodes; ixnode++) for (int iynode = 0; iynode < nynodes; iynode++) - for (int iznode = 0; iznode < nznodes; iznode++){ + for (int iznode = 0; iznode < nznodes; iznode++) { double TTT = T_electron[ixnode][iynode][iznode]; - if (TTT > 0){ + if (TTT > 0) { if (ixnode < t_surface_l) t_surface_l = ixnode; } @@ -659,7 +659,7 @@ void FixTTMMod::end_of_step() while (ixnode < 0) ixnode += nxnodes; while (iynode < 0) iynode += nynodes; while (iznode < 0) iznode += nznodes; - if (ixnode >= t_surface_l){ + if (ixnode >= t_surface_l) { if (ixnode < surface_r) net_energy_transfer[ixnode][iynode][iznode] += (flangevin[i][0]*v[i][0] + flangevin[i][1]*v[i][1] + @@ -748,7 +748,7 @@ void FixTTMMod::end_of_step() double ixnode_d = double(ixnode); double surface_d = double(t_surface_l); mult_factor = 0.0; - if (duration < width){ + if (duration < width) { if (ixnode >= t_surface_l) mult_factor = (intensity/(dx*skin_layer_d))*exp((-1.0)*(ixnode_d - surface_d)/skin_layer_d); } if (ixnode < t_surface_l) net_energy_transfer_all[ixnode][iynode][iznode] = 0.0; @@ -862,7 +862,7 @@ void FixTTMMod::end_of_step() if (nsum_all[ixnode][iynode][iznode] > 0) { T_a = sum_mass_vsq_all[ixnode][iynode][iznode]/ (3.0*force->boltz*nsum_all[ixnode][iynode][iznode]/force->mvv2e); - if (movsur == 1){ + if (movsur == 1) { if (T_electron[ixnode][iynode][iznode]==0.0) T_electron[ixnode][iynode][iznode] = electron_temperature_min; } } diff --git a/src/USER-MISC/fix_wall_ees.cpp b/src/USER-MISC/fix_wall_ees.cpp index 554d8870a0..e8e307224f 100644 --- a/src/USER-MISC/fix_wall_ees.cpp +++ b/src/USER-MISC/fix_wall_ees.cpp @@ -122,8 +122,8 @@ void FixWallEES::wall_particle(int m, int which, double coord) double* shape = bonus[ellipsoid[i]].shape;; MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); MathExtra::transpose_matvec(A,nhat,tempvec); - for(int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for(int k = 0; k<3 ; k++) sigman2 += tempvec[k]*tempvec[k]; + for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; + for (int k = 0; k<3 ; k++) sigman2 += tempvec[k]*tempvec[k]; sigman = sqrt(sigman2); if (delta <= sigman) { @@ -149,7 +149,7 @@ void FixWallEES::wall_particle(int m, int which, double coord) double Lz[3][3] = {{0,-1,0},{1,0,0},{0,0,0}}; - for(int k = 0; k<3; k++) SAn[k] = tempvec[k]; + for (int k = 0; k<3; k++) SAn[k] = tempvec[k]; sigman3 = sigman2 * sigman; sigman4 = sigman2 * sigman2; @@ -189,21 +189,21 @@ void FixWallEES::wall_particle(int m, int which, double coord) MathExtra::matvec(Lx,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k<3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; that[0] = MathExtra::dot3(SAn,tempvec2); MathExtra::matvec(Ly,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k<3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; that[1] = MathExtra::dot3(SAn,tempvec2); MathExtra::matvec(Lz,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; that[2] = MathExtra::dot3(SAn,tempvec2); - for(int j = 0; j<3 ; j++) + for (int j = 0; j<3 ; j++) tor[i][j] += twall * that[j]; } diff --git a/src/USER-MISC/fix_wall_region_ees.cpp b/src/USER-MISC/fix_wall_region_ees.cpp index f88ec3f0b2..ab475ffb9b 100644 --- a/src/USER-MISC/fix_wall_region_ees.cpp +++ b/src/USER-MISC/fix_wall_region_ees.cpp @@ -190,14 +190,14 @@ void FixWallRegionEES::post_force(int /*vflag*/) double* shape = bonus[ellipsoid[i]].shape;; MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); - for(int which = 0 ; which < 3; which ++){//me + for (int which = 0 ; which < 3; which ++) {//me nhat[which]=1; nhat[(which+1)%3] = 0 ; nhat[(which+2)%3] = 0 ; sn2 = 0 ; MathExtra::transpose_matvec(A,nhat,tempvec); - for(int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for(int k = 0; k<3 ; k++) sn2 += tempvec[k]*tempvec[k]; + for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; + for (int k = 0; k<3 ; k++) sn2 += tempvec[k]*tempvec[k]; sn = sqrt(sn2); tooclose[which] = sn; } @@ -206,13 +206,13 @@ void FixWallRegionEES::post_force(int /*vflag*/) for (m = 0; m < n; m++) { - if (region->contact[m].delx != 0 && region->contact[m].r <= tooclose[0]){ + if (region->contact[m].delx != 0 && region->contact[m].r <= tooclose[0]) { onflag = 1; continue; - } else if (region->contact[m].dely != 0 && region->contact[m].r <= tooclose[1]){ + } else if (region->contact[m].dely != 0 && region->contact[m].r <= tooclose[1]) { onflag = 1; continue; - } else if (region->contact[m].delz !=0 && region->contact[m].r <= tooclose[2]){ + } else if (region->contact[m].delz !=0 && region->contact[m].r <= tooclose[2]) { onflag = 1; continue; } else rinv = 1.0/region->contact[m].r; @@ -323,9 +323,9 @@ void FixWallRegionEES::ees(int m, int i) sigman2 = 0.0; MathExtra::transpose_matvec(A,nhat,tempvec); - for(int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for(int k = 0; k<3; k++) sigman2 += tempvec[k]*tempvec[k]; - for(int k = 0; k<3; k++) SAn[k] = tempvec[k]; + for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; + for (int k = 0; k<3; k++) sigman2 += tempvec[k]*tempvec[k]; + for (int k = 0; k<3; k++) SAn[k] = tempvec[k]; sigman = sqrt(sigman2); delta = fabs(region->contact[m].r); @@ -362,19 +362,19 @@ void FixWallRegionEES::ees(int m, int i) MathExtra::matvec(Lx,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k<3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; that[0] = MathExtra::dot3(SAn,tempvec2); MathExtra::matvec(Ly,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k<3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; that[1] = MathExtra::dot3(SAn,tempvec2); MathExtra::matvec(Lz,nhat,tempvec); MathExtra::transpose_matvec(A,tempvec,tempvec2); - for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; + for (int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; that[2] = MathExtra::dot3(SAn,tempvec2); - for(int j = 0; j<3 ; j++) + for (int j = 0; j<3 ; j++) torque[j] = twall * that[j]; } diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index afb457d9e4..c6cd44871e 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -200,7 +200,7 @@ void PairAGNI::compute(int eflag, int vflag) double ky = 0.0; double kz = 0.0; - for(int k = 0; k < iparam.numeta; ++k) { + for (int k = 0; k < iparam.numeta; ++k) { const double xu = iparam.xU[k][j]; kx += square(Vx[k] - xu); ky += square(Vy[k] - xu); diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index 49c483ca1f..dceed1fc57 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -630,7 +630,7 @@ double PairE3B::init_one(int i, int j) bool PairE3B::checkKeyword(const char *thiskey,const char *test,const int nVal, const int nRem) { if (strcmp(thiskey,test) == 0) { - if(nRemall(FLERR,str); diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 9d36db7041..6aedc863a8 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -365,14 +365,14 @@ void PairEDIPMulti::edip_fc(double r, Param *param, double &f, double &fdr) double x; double v1, v2; - if(r < c + 1E-6) + if (r < c + 1E-6) { f=1.0; fdr=0.0; return; } - if(r > a - 1E-6) + if (r > a - 1E-6) { f=0.0; fdr=0.0; @@ -394,7 +394,7 @@ void PairEDIPMulti::edip_fcut2(double r, Param *param, double &f, double &fdr) double a = param->cutoffA; double v1; - if(r > a - 1E-6) + if (r > a - 1E-6) { f=0.0; fdr=0.0; @@ -466,7 +466,7 @@ void PairEDIPMulti::edip_fcut3(double r, Param *param, double &f, double &fdr) double a = param->cutoffA; double v1; - if(r > a - 1E-6) + if (r > a - 1E-6) { f=0.0; fdr=0.0; diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index f3718834fa..58d9f39dcb 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -782,19 +782,19 @@ void PairILPGrapheneHBN::calc_normal() i = ilist[ii]; // Initialize the arrays - for (id = 0; id < 3; id++){ + for (id = 0; id < 3; id++) { pv12[id] = 0.0; pv31[id] = 0.0; pv23[id] = 0.0; n1[id] = 0.0; dni[id] = 0.0; normal[i][id] = 0.0; - for (ip = 0; ip < 3; ip++){ + for (ip = 0; ip < 3; ip++) { vet[ip][id] = 0.0; dnn[ip][id] = 0.0; dpvdri[ip][id] = 0.0; dnormdri[ip][id][i] = 0.0; - for (m = 0; m < 3; m++){ + for (m = 0; m < 3; m++) { dpv12[ip][id][m] = 0.0; dpv31[ip][id][m] = 0.0; dpv23[ip][id][m] = 0.0; @@ -828,10 +828,10 @@ void PairILPGrapheneHBN::calc_normal() normal[i][0] = 0.0; normal[i][1] = 0.0; normal[i][2] = 1.0; - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = 0.0; - for (m = 0; m < 3; m++){ + for (m = 0; m < 3; m++) { dnormal[id][ip][m][i] = 0.0; } } @@ -877,8 +877,8 @@ void PairILPGrapheneHBN::calc_normal() // derivatives respect to the third neighbor, atom n // derivatives of pv12 to rn is zero - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv12[id][ip][2] = 0.0; } } @@ -899,15 +899,15 @@ void PairILPGrapheneHBN::calc_normal() dni[1] = (n1[0]*dpvdri[0][1] + n1[1]*dpvdri[1][1] + n1[2]*dpvdri[2][1])/nn; dni[2] = (n1[0]*dpvdri[0][2] + n1[1]*dpvdri[1][2] + n1[2]*dpvdri[2][2])/nn; // derivatives of unit vector ni respect to ri, the result is 3x3 matrix - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = dpvdri[id][ip]/nn - n1[id]*dni[ip]/nn2; } } // derivatives of non-normalized normal vector, dn1:3x3x3 array - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ - for (m = 0; m < 3; m++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) { dn1[id][ip][m] = dpv12[id][ip][m]; } } @@ -915,16 +915,16 @@ void PairILPGrapheneHBN::calc_normal() // derivatives of nn, dnn:3x3 vector // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 // r[id][m]: the id's component of atom m - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { dnn[id][m] = (n1[0]*dn1[0][id][m] + n1[1]*dn1[1][id][m] + n1[2]*dn1[2][id][m])/nn; } } // dnormal[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormal[id][ip][m][i] = dn1[id][ip][m]/nn - n1[id]*dnn[ip][m]/nn2; } } @@ -932,7 +932,7 @@ void PairILPGrapheneHBN::calc_normal() } //############################################################################################## - else if(cont == 3) { + else if (cont == 3) { pv12[0] = vet[0][1]*vet[1][2] - vet[1][1]*vet[0][2]; pv12[1] = vet[0][2]*vet[1][0] - vet[1][2]*vet[0][0]; pv12[2] = vet[0][0]*vet[1][1] - vet[1][0]*vet[0][1]; @@ -958,8 +958,8 @@ void PairILPGrapheneHBN::calc_normal() dpv12[2][2][1] = 0.0; // derivatives respect to the third neighbor, atom n - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv12[id][ip][2] = 0.0; } } @@ -988,8 +988,8 @@ void PairILPGrapheneHBN::calc_normal() dpv31[2][1][2] = -vet[0][0]; dpv31[2][2][2] = 0.0; // derivatives respect to the second neighbor, atom l - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv31[id][ip][1] = 0.0; } } @@ -998,8 +998,8 @@ void PairILPGrapheneHBN::calc_normal() pv23[1] = vet[1][2]*vet[2][0] - vet[2][2]*vet[1][0]; pv23[2] = vet[1][0]*vet[2][1] - vet[2][0]*vet[1][1]; // derivatives respect to the second neighbor, atom k - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv23[id][ip][0] = 0.0; } } @@ -1039,16 +1039,16 @@ void PairILPGrapheneHBN::calc_normal() normal[i][2] = n1[2]/nn; // for the central atoms, dnormdri is always zero - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = 0.0; } } // derivatives of non-normalized normal vector, dn1:3x3x3 array - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ - for (m = 0; m < 3; m++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) { dn1[id][ip][m] = (dpv12[id][ip][m] + dpv23[id][ip][m] + dpv31[id][ip][m])/cont; } } @@ -1056,16 +1056,16 @@ void PairILPGrapheneHBN::calc_normal() // derivatives of nn, dnn:3x3 vector // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 // r[id][m]: the id's component of atom m - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { dnn[id][m] = (n1[0]*dn1[0][id][m] + n1[1]*dn1[1][id][m] + n1[2]*dn1[2][id][m])/nn; } } // dnormal[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormal[id][ip][m][i] = dn1[id][ip][m]/nn - n1[id]*dnn[ip][m]/nn2; } } diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index 93bfa8414f..d18d372b8b 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -787,19 +787,19 @@ void PairKolmogorovCrespiFull::calc_normal() i = ilist[ii]; // Initialize the arrays - for (id = 0; id < 3; id++){ + for (id = 0; id < 3; id++) { pv12[id] = 0.0; pv31[id] = 0.0; pv23[id] = 0.0; n1[id] = 0.0; dni[id] = 0.0; normal[i][id] = 0.0; - for (ip = 0; ip < 3; ip++){ + for (ip = 0; ip < 3; ip++) { vet[ip][id] = 0.0; dnn[ip][id] = 0.0; dpvdri[ip][id] = 0.0; dnormdri[ip][id][i] = 0.0; - for (m = 0; m < 3; m++){ + for (m = 0; m < 3; m++) { dpv12[ip][id][m] = 0.0; dpv31[ip][id][m] = 0.0; dpv23[ip][id][m] = 0.0; @@ -834,10 +834,10 @@ void PairKolmogorovCrespiFull::calc_normal() normal[i][1] = 0.0; normal[i][2] = 1.0; // derivatives of normal vector is zero - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = 0.0; - for (m = 0; m < 3; m++){ + for (m = 0; m < 3; m++) { dnormal[id][ip][m][i] = 0.0; } } @@ -881,8 +881,8 @@ void PairKolmogorovCrespiFull::calc_normal() dpv12[2][2][1] = 0.0; // derivatives respect to the third neighbor, atom n - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv12[id][ip][2] = 0.0; } } @@ -903,16 +903,16 @@ void PairKolmogorovCrespiFull::calc_normal() dni[1] = (n1[0]*dpvdri[0][1] + n1[1]*dpvdri[1][1] + n1[2]*dpvdri[2][1])/nn; dni[2] = (n1[0]*dpvdri[0][2] + n1[1]*dpvdri[1][2] + n1[2]*dpvdri[2][2])/nn; // derivatives of unit vector ni respect to ri, the result is 3x3 matrix - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = dpvdri[id][ip]/nn - n1[id]*dni[ip]/nn2; } } // derivatives of non-normalized normal vector, dn1:3x3x3 array - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ - for (m = 0; m < 3; m++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) { dn1[id][ip][m] = dpv12[id][ip][m]; } } @@ -920,16 +920,16 @@ void PairKolmogorovCrespiFull::calc_normal() // derivatives of nn, dnn:3x3 vector // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 // r[id][m]: the id's component of atom m - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { dnn[id][m] = (n1[0]*dn1[0][id][m] + n1[1]*dn1[1][id][m] + n1[2]*dn1[2][id][m])/nn; } } // dnormal[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormal[id][ip][m][i] = dn1[id][ip][m]/nn - n1[id]*dnn[ip][m]/nn2; } } @@ -937,7 +937,7 @@ void PairKolmogorovCrespiFull::calc_normal() } //############################################################################################## - else if(cont == 3) { + else if (cont == 3) { // for the atoms at the edge who has only two neighbor atoms pv12[0] = vet[0][1]*vet[1][2] - vet[1][1]*vet[0][2]; pv12[1] = vet[0][2]*vet[1][0] - vet[1][2]*vet[0][0]; @@ -964,8 +964,8 @@ void PairKolmogorovCrespiFull::calc_normal() dpv12[2][2][1] = 0.0; // derivatives respect to the third neighbor, atom n - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv12[id][ip][2] = 0.0; } } @@ -997,8 +997,8 @@ void PairKolmogorovCrespiFull::calc_normal() dpv31[2][2][2] = 0.0; // derivatives respect to the second neighbor, atom l - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv31[id][ip][1] = 0.0; } } @@ -1007,8 +1007,8 @@ void PairKolmogorovCrespiFull::calc_normal() pv23[1] = vet[1][2]*vet[2][0] - vet[2][2]*vet[1][0]; pv23[2] = vet[1][0]*vet[2][1] - vet[2][0]*vet[1][1]; // derivatives respect to the second neighbor, atom k - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv23[id][ip][0] = 0.0; } } @@ -1048,16 +1048,16 @@ void PairKolmogorovCrespiFull::calc_normal() normal[i][2] = n1[2]/nn; // for the central atoms, dnormdri is always zero - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormdri[id][ip][i] = 0.0; } } // end of derivatives of normals respect to atom i // derivatives of non-normalized normal vector, dn1:3x3x3 array - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ - for (m = 0; m < 3; m++){ + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) { dn1[id][ip][m] = (dpv12[id][ip][m] + dpv23[id][ip][m] + dpv31[id][ip][m])/cont; } } @@ -1065,16 +1065,16 @@ void PairKolmogorovCrespiFull::calc_normal() // derivatives of nn, dnn:3x3 vector // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 // r[id][m]: the id's component of atom m - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { dnn[id][m] = (n1[0]*dn1[0][id][m] + n1[1]*dn1[1][id][m] + n1[2]*dn1[2][id][m])/nn; } } // dnormal[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 - for (m = 0; m < 3; m++){ - for (id = 0; id < 3; id++){ - for (ip = 0; ip < 3; ip++){ + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dnormal[id][ip][m][i] = dn1[id][ip][m]/nn - n1[id]*dnn[ip][m]/nn2; } } diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 85c154e103..1bea688be5 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -162,7 +162,7 @@ void PairKolmogorovCrespiZ::compute(int eflag, int vflag) evdwl = -p.A*p.z06/r6+ exp1*sumCff - offset[itype][jtype]; } - if (evflag){ + if (evflag) { ev_tally_xyz(i,j,nlocal,newton_pair,evdwl,0, fsum,fsum,fpair,delx,dely,delz); } @@ -427,7 +427,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) params[nparams].z06 = pow(params[nparams].z0,6); nparams++; - if(nparams >= pow(atom->ntypes,3)) break; + if (nparams >= pow(atom->ntypes,3)) break; } memory->destroy(elem2param); memory->create(elem2param,nelements,nelements,"pair:elem2param"); diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index 4a85ecc60d..a600f5b761 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -158,7 +158,7 @@ void PairLebedevaZ::compute(int eflag, int vflag) evdwl = Ulm - offset[itype][jtype]; } - if (evflag){ + if (evflag) { ev_tally_xyz(i,j,nlocal,newton_pair,evdwl,0, -fxy,-fxy,-fz,delx,dely,delz); } @@ -421,7 +421,7 @@ void PairLebedevaZ::read_file(char *filename) params[nparams].z06 = pow(params[nparams].z0,6); nparams++; - if(nparams >= pow(atom->ntypes,3)) break; + if (nparams >= pow(atom->ntypes,3)) break; } memory->destroy(elem2param); memory->create(elem2param,nelements,nelements,"pair:elem2param"); diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index e16892c446..3da1fcbed2 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -182,7 +182,7 @@ void PairLocalDensity::compute(int eflag, int vflag) } } else { - for (k = 0; k < nLD; k++){ + for (k = 0; k < nLD; k++) { for (i = 0; i < nlocal; i++) { localrho[k][i] = 0.0; fp[k][i] = 0.0; @@ -710,7 +710,7 @@ void PairLocalDensity::parse_file(char *filename) { memory->create(a, nLD, atom->ntypes+1 , "pairLD:a"); memory->create(b, nLD, atom->ntypes+1, "pairLD:b"); if (me == 0) { - for (n = 1; n <= atom->ntypes; n++){ + for (n = 1; n <= atom->ntypes; n++) { for (k = 0; k < nLD; k++) { a[k][n] = 0; b[k][n] = 0; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index e6071ff592..57981e8922 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -87,7 +87,7 @@ PairMEAMSpline::~PairMEAMSpline() delete[] twoBodyInfo; memory->destroy(Uprime_values); - if(allocated) { + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -124,15 +124,15 @@ void PairMEAMSpline::compute(int eflag, int vflag) // Determine the maximum number of neighbors a single atom has int newMaxNeighbors = 0; - for(int ii = 0; ii < listfull->inum; ii++) { + for (int ii = 0; ii < listfull->inum; ii++) { int jnum = listfull->numneigh[listfull->ilist[ii]]; - if(jnum > newMaxNeighbors) + if (jnum > newMaxNeighbors) newMaxNeighbors = jnum; } // Allocate array for temporary bond info - if(newMaxNeighbors > maxNeighbors) { + if (newMaxNeighbors > maxNeighbors) { maxNeighbors = newMaxNeighbors; delete[] twoBodyInfo; twoBodyInfo = new MEAM2Body[maxNeighbors]; @@ -141,7 +141,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) // Sum three-body contributions to charge density and // the embedding energy - for(int ii = 0; ii < listfull->inum; ii++) { + for (int ii = 0; ii < listfull->inum; ii++) { int i = listfull->ilist[ii]; int numBonds = 0; @@ -151,7 +151,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) const int ntypes = atom->ntypes; const int itype = atom->type[i]; - for(int jj = 0; jj < listfull->numneigh[i]; jj++) { + for (int jj = 0; jj < listfull->numneigh[i]; jj++) { int j = listfull->firstneigh[i][jj]; j &= NEIGHMASK; @@ -160,7 +160,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) double jdelz = x[j][2] - x[i][2]; double rij_sq = jdelx*jdelx + jdely*jdely + jdelz*jdelz; - if(rij_sq < cutoff*cutoff) { + if (rij_sq < cutoff*cutoff) { double rij = sqrt(rij_sq); double partial_sum = 0; const int jtype = atom->type[j]; @@ -172,7 +172,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) nextTwoBodyInfo->del[1] = jdely / rij; nextTwoBodyInfo->del[2] = jdelz / rij; - for(int kk = 0; kk < numBonds; kk++) { + for (int kk = 0; kk < numBonds; kk++) { const MEAM2Body& bondk = twoBodyInfo[kk]; double cos_theta = (nextTwoBodyInfo->del[0]*bondk.del[0] + nextTwoBodyInfo->del[1]*bondk.del[1] + @@ -194,16 +194,16 @@ void PairMEAMSpline::compute(int eflag, int vflag) - zero_atom_energies[i_to_potl(itype)]; Uprime_values[i] = Uprime_i; - if(eflag) { - if(eflag_global) + if (eflag) { + if (eflag_global) eng_vdwl += embeddingEnergy; - if(eflag_atom) + if (eflag_atom) eatom[i] += embeddingEnergy; } // Compute three-body contributions to force double forces_i[3] = {0, 0, 0}; - for(int jj = 0; jj < numBonds; jj++) { + for (int jj = 0; jj < numBonds; jj++) { const MEAM2Body bondj = twoBodyInfo[jj]; double rij = bondj.r; int j = bondj.tag; @@ -215,7 +215,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) const int jtype = atom->type[j]; MEAM2Body const* bondk = twoBodyInfo; - for(int kk = 0; kk < jj; kk++, ++bondk) { + for (int kk = 0; kk < jj; kk++, ++bondk) { double rik = bondk->r; double cos_theta = (bondj.del[0]*bondk->del[0] + @@ -256,7 +256,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) forces[k][1] += fk[1]; forces[k][2] += fk[2]; - if(evflag) { + if (evflag) { double delta_ij[3]; double delta_ik[3]; delta_ij[0] = bondj.del[0] * rij; @@ -287,11 +287,11 @@ void PairMEAMSpline::compute(int eflag, int vflag) comm->forward_comm_pair(this); // Compute two-body pair interactions - for(int ii = 0; ii < listhalf->inum; ii++) { + for (int ii = 0; ii < listhalf->inum; ii++) { int i = listhalf->ilist[ii]; const int itype = atom->type[i]; - for(int jj = 0; jj < listhalf->numneigh[i]; jj++) { + for (int jj = 0; jj < listhalf->numneigh[i]; jj++) { int j = listhalf->firstneigh[i][jj]; j &= NEIGHMASK; @@ -301,7 +301,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) jdel[2] = x[j][2] - x[i][2]; double rij_sq = jdel[0]*jdel[0] + jdel[1]*jdel[1] + jdel[2]*jdel[2]; - if(rij_sq < cutoff*cutoff) { + if (rij_sq < cutoff*cutoff) { double rij = sqrt(rij_sq); const int jtype = atom->type[j]; @@ -330,7 +330,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) } } - if(vflag_fdotr) + if (vflag_fdotr) virial_fdotr_compute(); } @@ -375,7 +375,7 @@ void PairMEAMSpline::allocate() void PairMEAMSpline::settings(int narg, char **/*arg*/) { - if(narg != 0) error->all(FLERR,"Illegal pair_style command"); + if (narg != 0) error->all(FLERR,"Illegal pair_style command"); } /* ---------------------------------------------------------------------- @@ -457,9 +457,9 @@ void PairMEAMSpline::read_file(const char* filename) { int nmultichoose2; // = (n+1)*n/2; - if(comm->me == 0) { + if (comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == nullptr) { + if (fp == nullptr) { char str[1024]; snprintf(str,128,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -568,18 +568,18 @@ void PairMEAMSpline::read_file(const char* filename) // Determine maximum cutoff radius of all relevant spline functions. cutoff = 0.0; for (int i = 0; i < nmultichoose2; i++) - if(phis[i].cutoff() > cutoff) + if (phis[i].cutoff() > cutoff) cutoff = phis[i].cutoff(); for (int i = 0; i < nelements; i++) - if(rhos[i].cutoff() > cutoff) + if (rhos[i].cutoff() > cutoff) cutoff = rhos[i].cutoff(); for (int i = 0; i < nelements; i++) - if(fs[i].cutoff() > cutoff) + if (fs[i].cutoff() > cutoff) cutoff = fs[i].cutoff(); // Set LAMMPS pair interaction flags. - for(int i = 1; i <= atom->ntypes; i++) { - for(int j = 1; j <= atom->ntypes; j++) { + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = 1; j <= atom->ntypes; j++) { // setflag[i][j] = 1; cutsq[i][j] = cutoff; } @@ -592,7 +592,7 @@ void PairMEAMSpline::read_file(const char* filename) ------------------------------------------------------------------------- */ void PairMEAMSpline::init_style() { - if(force->newton_pair == 0) + if (force->newton_pair == 0) error->all(FLERR,"Pair style meam/spline requires newton pair on"); // Need both full and half neighbor list. @@ -613,8 +613,8 @@ void PairMEAMSpline::init_style() ------------------------------------------------------------------------- */ void PairMEAMSpline::init_list(int id, NeighList *ptr) { - if(id == 1) listfull = ptr; - else if(id == 2) listhalf = ptr; + if (id == 1) listfull = ptr; + else if (id == 2) listhalf = ptr; } /* ---------------------------------------------------------------------- @@ -679,7 +679,7 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, // Parse number of spline knots. utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); - if(n < 2) + if (n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. @@ -693,10 +693,10 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. - for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); } setKnot(i, x, y); @@ -718,36 +718,36 @@ void PairMEAMSpline::SplineFunction::prepareSpline(Error* error) double* 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++) { + for (int i = 1; i <= N-2; i++) { double sig = (X[i]-X[i-1]) / (X[i+1]-X[i-1]); double p = sig * Y2[i-1] + 2.0; Y2[i] = (sig - 1.0) / p; u[i] = (Y[i+1]-Y[i]) / (X[i+1]-X[i]) - (Y[i]-Y[i-1])/(X[i]-X[i-1]); u[i] = (6.0 * u[i]/(X[i+1]-X[i-1]) - sig*u[i-1])/p; - if(fabs(h*i+xmin - X[i]) > 1e-8) + if (fabs(h*i+xmin - X[i]) > 1e-8) isGridSpline = false; } double qn = 0.5; double un = (3.0/(X[N-1]-X[N-2])) * (derivN - (Y[N-1]-Y[N-2])/(X[N-1]-X[N-2])); Y2[N-1] = (un - qn*u[N-2]) / (qn * Y2[N-2] + 1.0); - for(int k = N-2; k >= 0; k--) { + for (int k = N-2; k >= 0; k--) { Y2[k] = Y2[k] * Y2[k+1] + u[k]; } delete[] u; #if !SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES - if(!isGridSpline) + if (!isGridSpline) error->one(FLERR,"Support for MEAM potentials with non-uniform cubic splines has not been enabled in the MEAM potential code. Set SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES in pair_spline_meam.h to 1 to enable it"); #endif // Shift the spline to X=0 to speed up interpolation. - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { Xs[i] = X[i] - xmin; #if !SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES - if(i < N-1) Ydelta[i] = (Y[i+1]-Y[i])/h; + if (i < N-1) Ydelta[i] = (Y[i+1]-Y[i])/h; Y2[i] /= h*6.0; #endif } @@ -768,7 +768,7 @@ void PairMEAMSpline::SplineFunction::communicate(MPI_Comm& world, int me) MPI_Bcast(&h, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&hsq, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&inv_h, 1, MPI_DOUBLE, 0, world); - if(me != 0) { + if (me != 0) { X = new double[N]; Xs = new double[N]; Y = new double[N]; @@ -790,18 +790,18 @@ void PairMEAMSpline::SplineFunction::writeGnuplot(const char* filename, { FILE* fp = fopen(filename, "w"); fprintf(fp, "#!/usr/bin/env gnuplot\n"); - if(title) fprintf(fp, "set title \"%s\"\n", title); + if (title) fprintf(fp, "set title \"%s\"\n", title); double tmin = X[0] - (X[N-1] - X[0]) * 0.05; double tmax = X[N-1] + (X[N-1] - X[0]) * 0.05; double delta = (tmax - tmin) / (N*200); fprintf(fp, "set xrange [%f:%f]\n", tmin, tmax); fprintf(fp, "plot '-' with lines notitle, '-' with points notitle pt 3 lc 3\n"); - for(double x = tmin; x <= tmax+1e-8; x += delta) { + for (double x = tmin; x <= tmax+1e-8; x += delta) { double y = eval(x); fprintf(fp, "%f %f\n", x, y); } fprintf(fp, "e\n"); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { fprintf(fp, "%f %f\n", X[i], Y[i]); } fprintf(fp, "e\n"); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 17511e90b8..09f5fa436d 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -74,7 +74,7 @@ PairMEAMSWSpline::~PairMEAMSWSpline() memory->destroy(Uprime_values); //memory->destroy(ESWprime_values); - if(allocated) { + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); delete [] map; @@ -112,14 +112,14 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) // Determine the maximum number of neighbors a single atom has int newMaxNeighbors = 0; - for(int ii = 0; ii < inum_full; ii++) { + for (int ii = 0; ii < inum_full; ii++) { int jnum = numneigh_full[ilist_full[ii]]; - if(jnum > newMaxNeighbors) newMaxNeighbors = jnum; + if (jnum > newMaxNeighbors) newMaxNeighbors = jnum; } // Allocate array for temporary bond info - if(newMaxNeighbors > maxNeighbors) { + if (newMaxNeighbors > maxNeighbors) { maxNeighbors = newMaxNeighbors; delete[] twoBodyInfo; twoBodyInfo = new MEAM2Body[maxNeighbors]; @@ -128,7 +128,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) // Sum three-body contributions to charge density and // compute embedding energies - for(int ii = 0; ii < inum_full; ii++) { + for (int ii = 0; ii < inum_full; ii++) { int i = ilist_full[ii]; double xtmp = x[i][0]; double ytmp = x[i][1]; @@ -140,7 +140,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) int numBonds = 0; MEAM2Body* nextTwoBodyInfo = twoBodyInfo; - for(int jj = 0; jj < jnum; jj++) { + for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; @@ -149,7 +149,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) double jdelz = x[j][2] - ztmp; double rij_sq = jdelx*jdelx + jdely*jdely + jdelz*jdelz; - if(rij_sq < cutforcesq) { + if (rij_sq < cutforcesq) { double rij = sqrt(rij_sq); double partial_sum = 0; double partial_sum2 = 0; @@ -162,7 +162,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) nextTwoBodyInfo->del[1] = jdely / rij; nextTwoBodyInfo->del[2] = jdelz / rij; - for(int kk = 0; kk < numBonds; kk++) { + for (int kk = 0; kk < numBonds; kk++) { const MEAM2Body& bondk = twoBodyInfo[kk]; double cos_theta = (nextTwoBodyInfo->del[0]*bondk.del[0] + nextTwoBodyInfo->del[1]*bondk.del[1] + @@ -188,16 +188,16 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) double ESWprime_i = 1.0; Uprime_values[i] = Uprime_i; // ESWprime_values[i] = ESWprime_i; - if(eflag) { - if(eflag_global) eng_vdwl += embeddingEnergy + SWEnergy; - if(eflag_atom) eatom[i] += embeddingEnergy + SWEnergy; + if (eflag) { + if (eflag_global) eng_vdwl += embeddingEnergy + SWEnergy; + if (eflag_atom) eatom[i] += embeddingEnergy + SWEnergy; } double forces_i[3] = {0, 0, 0}; // Compute three-body contributions to force - for(int jj = 0; jj < numBonds; jj++) { + for (int jj = 0; jj < numBonds; jj++) { const MEAM2Body bondj = twoBodyInfo[jj]; double rij = bondj.r; int j = bondj.tag; @@ -210,7 +210,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) double forces_j[3] = {0, 0, 0}; MEAM2Body const* bondk = twoBodyInfo; - for(int kk = 0; kk < jj; kk++, ++bondk) { + for (int kk = 0; kk < jj; kk++, ++bondk) { double rik = bondk->r; double cos_theta = (bondj.del[0]*bondk->del[0] + @@ -268,7 +268,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) forces[k][1] += fk[1]; forces[k][2] += fk[2]; - if(evflag) { + if (evflag) { double delta_ij[3]; double delta_ik[3]; delta_ij[0] = bondj.del[0] * rij; @@ -305,7 +305,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) // Compute two-body pair interactions - for(int ii = 0; ii < inum_half; ii++) { + for (int ii = 0; ii < inum_half; ii++) { int i = ilist_half[ii]; double xtmp = x[i][0]; double ytmp = x[i][1]; @@ -313,7 +313,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) int* jlist = firstneigh_half[i]; int jnum = numneigh_half[i]; - for(int jj = 0; jj < jnum; jj++) { + for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; @@ -323,7 +323,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) jdel[2] = x[j][2] - ztmp; double rij_sq = jdel[0]*jdel[0] + jdel[1]*jdel[1] + jdel[2]*jdel[2]; - if(rij_sq < cutforcesq) { + if (rij_sq < cutforcesq) { double rij = sqrt(rij_sq); double rho_prime; @@ -350,7 +350,7 @@ void PairMEAMSWSpline::compute(int eflag, int vflag) } } - if(vflag_fdotr) virial_fdotr_compute(); + if (vflag_fdotr) virial_fdotr_compute(); } /* ---------------------------------------------------------------------- */ @@ -372,7 +372,7 @@ void PairMEAMSWSpline::allocate() void PairMEAMSWSpline::settings(int narg, char **/*arg*/) { - if(narg != 0) error->all(FLERR,"Illegal pair_style command"); + if (narg != 0) error->all(FLERR,"Illegal pair_style command"); } /* ---------------------------------------------------------------------- @@ -460,9 +460,9 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) void PairMEAMSWSpline::read_file(const char* filename) { - if(comm->me == 0) { + if (comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == nullptr) { + if (fp == nullptr) { char str[1024]; snprintf(str,1024,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -498,14 +498,14 @@ void PairMEAMSWSpline::read_file(const char* filename) // Determine maximum cutoff radius of all relevant spline functions. cutoff = 0.0; - if(phi.cutoff() > cutoff) cutoff = phi.cutoff(); - if(rho.cutoff() > cutoff) cutoff = rho.cutoff(); - if(f.cutoff() > cutoff) cutoff = f.cutoff(); - if(F.cutoff() > cutoff) cutoff = F.cutoff(); + if (phi.cutoff() > cutoff) cutoff = phi.cutoff(); + if (rho.cutoff() > cutoff) cutoff = rho.cutoff(); + if (f.cutoff() > cutoff) cutoff = f.cutoff(); + if (F.cutoff() > cutoff) cutoff = F.cutoff(); // Set LAMMPS pair interaction flags. - for(int i = 1; i <= atom->ntypes; i++) { - for(int j = 1; j <= atom->ntypes; j++) { + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = 1; j <= atom->ntypes; j++) { setflag[i][j] = 1; cutsq[i][j] = cutoff; } @@ -525,7 +525,7 @@ void PairMEAMSWSpline::read_file(const char* filename) ------------------------------------------------------------------------- */ void PairMEAMSWSpline::init_style() { - if(force->newton_pair == 0) + if (force->newton_pair == 0) error->all(FLERR,"Pair style meam/sw/spline requires newton pair on"); // Need both full and half neighbor list. @@ -543,8 +543,8 @@ void PairMEAMSWSpline::init_style() ------------------------------------------------------------------------- */ void PairMEAMSWSpline::init_list(int id, NeighList *ptr) { - if(id == 1) listfull = ptr; - else if(id == 2) listhalf = ptr; + if (id == 1) listfull = ptr; + else if (id == 2) listhalf = ptr; } /* ---------------------------------------------------------------------- @@ -604,7 +604,7 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error) // Parse number of spline knots. utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); - if(n < 2) + if (n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. @@ -617,10 +617,10 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error) utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. - for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); } setKnot(i, x, y); @@ -642,36 +642,36 @@ void PairMEAMSWSpline::SplineFunction::prepareSpline(Error* error) double* 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++) { + for (int i = 1; i <= N-2; i++) { double sig = (X[i]-X[i-1]) / (X[i+1]-X[i-1]); double p = sig * Y2[i-1] + 2.0; Y2[i] = (sig - 1.0) / p; u[i] = (Y[i+1]-Y[i]) / (X[i+1]-X[i]) - (Y[i]-Y[i-1])/(X[i]-X[i-1]); u[i] = (6.0 * u[i]/(X[i+1]-X[i-1]) - sig*u[i-1])/p; - if(fabs(h*i+xmin - X[i]) > 1e-8) + if (fabs(h*i+xmin - X[i]) > 1e-8) isGridSpline = false; } double qn = 0.5; double un = (3.0/(X[N-1]-X[N-2])) * (derivN - (Y[N-1]-Y[N-2])/(X[N-1]-X[N-2])); Y2[N-1] = (un - qn*u[N-2]) / (qn * Y2[N-2] + 1.0); - for(int k = N-2; k >= 0; k--) { + for (int k = N-2; k >= 0; k--) { Y2[k] = Y2[k] * Y2[k+1] + u[k]; } delete[] u; #if !SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES - if(!isGridSpline) + if (!isGridSpline) error->one(FLERR,"Support for MEAM potentials with non-uniform cubic splines has not been enabled in the MEAM potential code. Set SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES in pair_spline_meam.h to 1 to enable it"); #endif // Shift the spline to X=0 to speed up interpolation. - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { Xs[i] = X[i] - xmin; #if !SPLINE_MEAM_SUPPORT_NON_GRID_SPLINES - if(i < N-1) Ydelta[i] = (Y[i+1]-Y[i])/h; + if (i < N-1) Ydelta[i] = (Y[i+1]-Y[i])/h; Y2[i] /= h*6.0; #endif } @@ -692,7 +692,7 @@ void PairMEAMSWSpline::SplineFunction::communicate(MPI_Comm& world, int me) MPI_Bcast(&h, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&hsq, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&inv_h, 1, MPI_DOUBLE, 0, world); - if(me != 0) { + if (me != 0) { X = new double[N]; Xs = new double[N]; Y = new double[N]; @@ -713,18 +713,18 @@ void PairMEAMSWSpline::SplineFunction::writeGnuplot(const char* filename, const { FILE* fp = fopen(filename, "w"); fprintf(fp, "#!/usr/bin/env gnuplot\n"); - if(title) fprintf(fp, "set title \"%s\"\n", title); + if (title) fprintf(fp, "set title \"%s\"\n", title); double tmin = X[0] - (X[N-1] - X[0]) * 0.05; double tmax = X[N-1] + (X[N-1] - X[0]) * 0.05; double delta = (tmax - tmin) / (N*200); fprintf(fp, "set xrange [%f:%f]\n", tmin, tmax); fprintf(fp, "plot '-' with lines notitle, '-' with points notitle pt 3 lc 3\n"); - for(double x = tmin; x <= tmax+1e-8; x += delta) { + for (double x = tmin; x <= tmax+1e-8; x += delta) { double y = eval(x); fprintf(fp, "%f %f\n", x, y); } fprintf(fp, "e\n"); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { fprintf(fp, "%f %f\n", X[i], Y[i]); } fprintf(fp, "e\n"); diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index 2dd8a675ab..d32d56f5b7 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -174,9 +174,9 @@ void PairSRP::compute(int eflag, int vflag) // mapping global to local for atoms inside bond particles // exclude 1-2 neighs if requested - if (neighbor->ago == 0){ + if (neighbor->ago == 0) { remapBonds(nall); - if(exclude) onetwoexclude(ilist, inum, jlist, numneigh, firstneigh); + if (exclude) onetwoexclude(ilist, inum, jlist, numneigh, firstneigh); } // this pair style only used with hybrid @@ -185,7 +185,7 @@ void PairSRP::compute(int eflag, int vflag) // each neigh j is type bptype // using midpoint distance option - if(midpoint){ + if (midpoint) { for (ii = 0; ii < inum; ii++) { @@ -215,7 +215,7 @@ void PairSRP::compute(int eflag, int vflag) dz = 0.5*(x[i0][2] - x[i1][2] + x[j0][2] - x[j1][2]); dijsq = dx*dx + dy*dy + dz*dz; - if (dijsq < cutsq[bptype][bptype]){ + if (dijsq < cutsq[bptype][bptype]) { dij = sqrt(dijsq); if (dij < SMALL) @@ -248,11 +248,11 @@ void PairSRP::compute(int eflag, int vflag) // ************************************************* // - if (eflag){ + if (eflag) { evdwl = 0.5 * a0[bptype][bptype] * cut[bptype][bptype] * wd * wd; } - if (evflag){ + if (evflag) { ev_tally(i0,i1,nlocal,1,0.5*evdwl,0.0,fpair,dx,dy,dz); ev_tally(j0,j1,nlocal,1,0.5*evdwl,0.0,fpair,dx,dy,dz); } @@ -289,7 +289,7 @@ void PairSRP::compute(int eflag, int vflag) getMinDist(x, dx, dy, dz, ti, tj, i0, j0, i1, j1); dijsq = dx*dx + dy*dy + dz*dz; - if (dijsq < cutsq[bptype][bptype]){ + if (dijsq < cutsq[bptype][bptype]) { dij = sqrt(dijsq); @@ -333,11 +333,11 @@ void PairSRP::compute(int eflag, int vflag) // ************************************************* // - if (eflag){ + if (eflag) { evdwl = 0.5 * a0[bptype][bptype] * cut[bptype][bptype] * wd * wd; } - if (evflag){ + if (evflag) { ev_tally(i0,i1,nlocal,1,0.5*evdwl,0.0,0.5*fpair,dx,dy,dz); ev_tally(j0,j1,nlocal,1,0.5*evdwl,0.0,0.5*fpair,dx,dy,dz); } @@ -394,7 +394,7 @@ void PairSRP::settings(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal pair srp command"); if (strcmp(arg[iarg+1],"yes") == 0) exclude = 1; - if (strcmp(arg[iarg+1],"no") == 0){ + if (strcmp(arg[iarg+1],"no") == 0) { if (min) error->all(FLERR,"Illegal exclude option in pair srp command"); exclude = 0; } @@ -552,8 +552,8 @@ inline void PairSRP::getMinDist(double** &x, double &dx, double &dy, double &dz, // handle case of parallel lines // reduce to midpt distance - if (fabs(denom) < SMALL){ - if(denom < 0) denom = -BIG; + if (fabs(denom) < SMALL) { + if (denom < 0) denom = -BIG; else denom = BIG; } @@ -586,7 +586,7 @@ map global id of atoms in stored by each bond particle ------------------------------------------------------- */ inline void PairSRP::remapBonds(int &nall) { - if(nall > maxcount){ + if (nall > maxcount) { memory->grow(segment, nall, 2, "pair:segment"); maxcount = nall; } @@ -600,7 +600,7 @@ inline void PairSRP::remapBonds(int &nall) srp = f_srp->array_atom; for (int i = 0; i < nall; i++) { - if(atom->type[i] == bptype){ + if (atom->type[i] == bptype) { // tmp is local id // tmp == -1 is ok tmp = atom->map((int)srp[i][0]); @@ -643,7 +643,7 @@ inline void PairSRP::onetwoexclude(int* &ilist, int &inum, int* &jlist, int* &nu j1 = segment[j][1]; // check for a 1-2 neigh - if(i0 == i1 || i0 == j1 || i1 == j0 || j0 == j1){ + if (i0 == i1 || i0 == j1 || i1 == j0 || j0 == j1) { j |= ONETWOBIT; jlist[jj] = j; } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index c4e2d2c993..9eae918128 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -953,7 +953,7 @@ void PairTersoffTable::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/USER-OMP/dihedral_table_omp.cpp b/src/USER-OMP/dihedral_table_omp.cpp index 158f350b6d..6d6acc27e6 100644 --- a/src/USER-OMP/dihedral_table_omp.cpp +++ b/src/USER-OMP/dihedral_table_omp.cpp @@ -344,7 +344,7 @@ void DihedralTableOMP::eval(int nfrom, int nto, ThrData * const thr) // d U d U d phi // -f = ----- = ----- * ----- // d x d phi d x - for(int d=0; d < g_dim; ++d) { + for (int d=0; d < g_dim; ++d) { f1[d] = m_du_dphi * dphi_dx1[d]; f2[d] = m_du_dphi * dphi_dx2[d]; f3[d] = m_du_dphi * dphi_dx3[d]; diff --git a/src/USER-OMP/fix_nve_sphere_omp.cpp b/src/USER-OMP/fix_nve_sphere_omp.cpp index aba966b71d..5e66d0f2c7 100644 --- a/src/USER-OMP/fix_nve_sphere_omp.cpp +++ b/src/USER-OMP/fix_nve_sphere_omp.cpp @@ -126,7 +126,7 @@ void FixNVESphereOMP::initial_integrate(int /* vflag */) // Q = I + vx + vx^2 * (1-c)/s^2 const double s2 = a[0]*a[0] + a[1]*a[1]; - if (s2 != 0.0){ // i.e. the vectors are not parallel + if (s2 != 0.0) { // i.e. the vectors are not parallel const double scale = (1.0 - a[2])/s2; Q[0][0] = 1.0 - scale*a[0]*a[0]; Q[0][1] = -scale*a[0]*a[1]; Q[0][2] = -a[0]; diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index a0fb934bf8..957c49abe6 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -135,7 +135,7 @@ void FixQEQCombOMP::post_force(int /* vflag */) } comm->forward_comm_fix(this); - if(comb) enegtot = comb->yasu_char(qf,igroup); + if (comb) enegtot = comb->yasu_char(qf,igroup); enegtot /= ngroup; enegchk = enegmax = 0.0; diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index 0582133d6c..393503badb 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -137,7 +137,7 @@ void PairAGNIOMP::eval(int iifrom, int iito, ThrData * const thr) double ky = 0.0; double kz = 0.0; - for(int k = 0; k < iparam.numeta; ++k) { + for (int k = 0; k < iparam.numeta; ++k) { const double xu = iparam.xU[k][j]; kx += square(Vx[k] - xu); ky += square(Vy[k] - xu); diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index b7405a2605..2841c5e840 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -79,20 +79,20 @@ void PairBrownianOMP::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (int j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index d7aef4b8b9..d02d13a74e 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -79,20 +79,20 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (int j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index e535a3529e..045db5d402 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -242,7 +242,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) jtype = map[type[j]]; iparam_ij = elem2param[itype][jtype][jtype]; - if(params[iparam_ij].hfocor > 0.0 ) { + if (params[iparam_ij].hfocor > 0.0 ) { delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index 81bd6474d0..37cc1aa6f1 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -116,7 +116,7 @@ void PairEAMAlloyOMP::read_file(char *filename) Setfl *file = setfl; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(PairEAM::lmp, filename, "eam/alloy", unit_convert_flag); diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index c7cd02ba4b..41a2a2eeba 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -116,7 +116,7 @@ void PairEAMFSOMP::read_file(char *filename) Fs *file = fs; // read potential file - if(comm->me == 0) { + if (comm->me == 0) { PotentialFileReader reader(PairEAM::lmp, filename, "eam/fs", unit_convert_flag); diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index ab84b374cb..33968f1710 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -146,7 +146,7 @@ void PairLJCutTholeLongOMP::eval(int iifrom, int iito, ThrData * const thr) jnum = numneigh[i]; fxtmp=fytmp=fztmp=0.; - if (drudetype[type[i]] != NOPOL_TYPE){ + if (drudetype[type[i]] != NOPOL_TYPE) { di = atom->map(drudeid[i]); if (di < 0) error->all(FLERR, "Drude partner not found"); di_closest = domain->closest_image(i, di); @@ -202,9 +202,9 @@ void PairLJCutTholeLongOMP::eval(int iifrom, int iito, ThrData * const thr) } if (drudetype[type[i]] != NOPOL_TYPE && - drudetype[type[j]] != NOPOL_TYPE){ - if (j != di_closest){ - if (drudetype[type[j]] == CORE_TYPE){ + drudetype[type[j]] != NOPOL_TYPE) { + if (j != di_closest) { + if (drudetype[type[j]] == CORE_TYPE) { dj = atom->map(drudeid[j]); dqj = -q[dj]; } else dqj = qj; @@ -246,7 +246,7 @@ void PairLJCutTholeLongOMP::eval(int iifrom, int iito, ThrData * const thr) } if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; if (drudetype[type[i]] != NOPOL_TYPE && - drudetype[type[j]] != NOPOL_TYPE && j != di_closest){ + drudetype[type[j]] != NOPOL_TYPE && j != di_closest) { ecoul += factor_e * dcoul; } } else ecoul = 0.0; diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index f2c8799415..7c258fb94c 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -718,7 +718,7 @@ void PairLJLongCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) if (rsq < cut_ljsqi[typej]) { // lj if (ORDER6) { // long-range lj - if(!LJTABLE || rsq <= tabinnerdispsq) { //series real space + if (!LJTABLE || rsq <= tabinnerdispsq) { //series real space double rn = r2inv*r2inv*r2inv; double x2 = g2*rsq, a2 = 1.0/x2; x2 = a2*exp(-x2)*lj4i[typej]; diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index d78bda9b42..4291850820 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -65,20 +65,20 @@ void PairLubricateOMP::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (int j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index 10738be70a..4226c96e1b 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -65,20 +65,20 @@ void PairLubricatePolyOMP::compute(int eflag, int vflag) double dims[3], wallcoord; if (flagVF) // Flag for volume fraction corrections - if (flagdeform || flagwall == 2){ // Possible changes in volume fraction + if (flagdeform || flagwall == 2) { // Possible changes in volume fraction if (flagdeform && !flagwall) for (int j = 0; j < 3; j++) dims[j] = domain->prd[j]; - else if (flagwall == 2 || (flagdeform && flagwall == 1)){ + else if (flagwall == 2 || (flagdeform && flagwall == 1)) { double wallhi[3], walllo[3]; - for (int j = 0; j < 3; j++){ + for (int j = 0; j < 3; j++) { wallhi[j] = domain->prd[j]; walllo[j] = 0; } - for (int m = 0; m < wallfix->nwall; m++){ + for (int m = 0; m < wallfix->nwall; m++) { int dim = wallfix->wallwhich[m] / 2; int side = wallfix->wallwhich[m] % 2; - if (wallfix->xstyle[m] == VARIABLE){ + if (wallfix->xstyle[m] == VARIABLE) { wallcoord = input->variable->compute_equal(wallfix->xindex[m]); } else wallcoord = wallfix->coord0[m]; diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index 500a3d17c7..bb8ab8af7c 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -93,9 +93,9 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) // Determine the maximum number of neighbors a single atom has. int myMaxNeighbors = 0; - for(int ii = iifrom; ii < iito; ii++) { + for (int ii = iifrom; ii < iito; ii++) { int jnum = numneigh_full[ilist_full[ii]]; - if(jnum > myMaxNeighbors) myMaxNeighbors = jnum; + if (jnum > myMaxNeighbors) myMaxNeighbors = jnum; } // Allocate array for temporary bond info. @@ -113,7 +113,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) const double cutforcesq = cutoff*cutoff; // Sum three-body contributions to charge density and compute embedding energies. - for(int ii = iifrom; ii < iito; ii++) { + for (int ii = iifrom; ii < iito; ii++) { const int i = ilist_full[ii]; const double xtmp = x[i][0]; @@ -125,7 +125,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) int numBonds = 0; MEAM2Body* nextTwoBodyInfo = myTwoBodyInfo; - for(int jj = 0; jj < jnum; jj++) { + for (int jj = 0; jj < jnum; jj++) { const int j = jlist[jj] & NEIGHMASK; const double jdelx = x[j][0] - xtmp; @@ -145,7 +145,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) nextTwoBodyInfo->del[1] = jdely / rij; nextTwoBodyInfo->del[2] = jdelz / rij; - for(int kk = 0; kk < numBonds; kk++) { + for (int kk = 0; kk < numBonds; kk++) { const MEAM2Body& bondk = myTwoBodyInfo[kk]; double cos_theta = (nextTwoBodyInfo->del[0]*bondk.del[0] + nextTwoBodyInfo->del[1]*bondk.del[1] + @@ -173,7 +173,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) double forces_i[3] = {0.0, 0.0, 0.0}; // Compute three-body contributions to force. - for(int jj = 0; jj < numBonds; jj++) { + for (int jj = 0; jj < numBonds; jj++) { const MEAM2Body bondj = myTwoBodyInfo[jj]; const double rij = bondj.r; const int j = bondj.tag; @@ -185,7 +185,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) double forces_j[3] = {0.0, 0.0, 0.0}; MEAM2Body const* bondk = myTwoBodyInfo; - for(int kk = 0; kk < jj; kk++, ++bondk) { + for (int kk = 0; kk < jj; kk++, ++bondk) { const double rik = bondk->r; const double cos_theta = (bondj.del[0]*bondk->del[0] @@ -226,7 +226,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) forces[k][1] += fk[1]; forces[k][2] += fk[2]; - if(EVFLAG) { + if (EVFLAG) { double delta_ij[3]; double delta_ik[3]; delta_ij[0] = bondj.del[0] * rij; @@ -277,7 +277,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) const int* const * const firstneigh_half = listhalf->firstneigh; // Compute two-body pair interactions. - for(int ii = iifrom; ii < iito; ii++) { + for (int ii = iifrom; ii < iito; ii++) { const int i = ilist_half[ii]; const double xtmp = x[i][0]; const double ytmp = x[i][1]; @@ -286,7 +286,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) const int jnum = numneigh_half[i]; const int itype = atom->type[i]; - for(int jj = 0; jj < jnum; jj++) { + for (int jj = 0; jj < jnum; jj++) { const int j = jlist[jj] & NEIGHMASK; double jdel[3]; @@ -295,7 +295,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) jdel[2] = x[j][2] - ztmp; double rij_sq = jdel[0]*jdel[0] + jdel[1]*jdel[1] + jdel[2]*jdel[2]; - if(rij_sq < cutforcesq) { + if (rij_sq < cutforcesq) { double rij = sqrt(rij_sq); const int jtype = atom->type[j]; diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 459113bfb8..b717f87d0f 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -241,7 +241,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) #if defined(_OPENMP) #pragma omp parallel for schedule(static) #endif - for(int k = 0; k < system->N; ++k) { + for (int k = 0; k < system->N; ++k) { num_bonds[k] = system->my_atoms[k].num_bonds; num_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -293,7 +293,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) // populate tmpid and tmpbo arrays for fix reax/c/species - if(fixspecies_flag) { + if (fixspecies_flag) { if (system->N > nmax) { memory->destroy(tmpid); memory->destroy(tmpbo); @@ -365,7 +365,7 @@ void PairReaxCOMP::init_style( ) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - for( int i = 0; i < LIST_N; ++i ) + for ( int i = 0; i < LIST_N; ++i ) lists[i].allocated = 0; if (fix_reax == nullptr) { @@ -424,7 +424,7 @@ void PairReaxCOMP::setup( ) write_reax_atoms(); int num_nbrs = estimate_reax_lists(); - if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + if (!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, lists+FAR_NBRS)) error->all(FLERR,"Pair reax/c problem in far neighbor list"); @@ -433,7 +433,7 @@ void PairReaxCOMP::setup( ) InitializeOMP( system, control, data, workspace, &lists, out_control, mpi_data, world ); - for( int k = 0; k < system->N; ++k ) { + for ( int k = 0; k < system->N; ++k ) { num_bonds[k] = system->my_atoms[k].num_bonds; num_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -446,7 +446,7 @@ void PairReaxCOMP::setup( ) // reset the bond list info for new atoms - for(int k = oldN; k < system->N; ++k) + for (int k = oldN; k < system->N; ++k) Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS ); // estimate far neighbor list size @@ -472,7 +472,7 @@ void PairReaxCOMP::write_reax_atoms() #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for( int i = 0; i < system->N; ++i ){ + for ( int i = 0; i < system->N; ++i ) { system->my_atoms[i].orig_id = atom->tag[i]; system->my_atoms[i].type = map[atom->type[i]]; system->my_atoms[i].x[0] = atom->x[i][0]; @@ -596,7 +596,7 @@ void PairReaxCOMP::read_reax_forces(int /* vflag */) #if defined(_OPENMP) #pragma omp parallel for schedule(static) default(shared) #endif - for( int i = 0; i < system->N; ++i ) { + for ( int i = 0; i < system->N; ++i ) { system->my_atoms[i].f[0] = workspace->f[i][0]; system->my_atoms[i].f[1] = workspace->f[i][1]; system->my_atoms[i].f[2] = workspace->f[i][2]; @@ -622,7 +622,7 @@ void PairReaxCOMP::FindBond() bond_data *bo_ij; nj = 0; - for( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { + for ( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { bo_ij = &( lists->select.bond_list[pj] ); j = bo_ij->nbr; if (j < i) continue; diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index d721565d99..44d7994c9e 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -190,7 +190,7 @@ void PairTersoffZBLOMP::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index 6253df7fe7..ec93d9478d 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -164,7 +164,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, } // forces on k: i neighbor - for( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) { + for ( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; @@ -194,7 +194,7 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj, } // forces on k: j neighbor - for( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) { + for ( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; @@ -274,7 +274,7 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, * forces related to atom i * * first neighbors of atom i * ************************************/ - for( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) { + for ( pk = Start_Index(i, bonds); pk < End_Index(i, bonds); ++pk ) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; @@ -307,7 +307,7 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, /* force */ rvec_Add(workspace->forceReduction[reductionOffset+i],temp ); - for( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) { + for ( pk = Start_Index(j, bonds); pk < End_Index(j, bonds); ++pk ) { nbr_k = &(bonds->select.bond_list[pk]); k = nbr_k->nbr; @@ -463,7 +463,7 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data #endif for (i = 0; i < system->N; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[type_i]); workspace->Deltap[i] = workspace->total_bond_order[i] - sbp_i->valency; workspace->Deltap_boc[i] = @@ -483,7 +483,7 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data #endif for (i = 0; i < system->N; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[type_i]); val_i = sbp_i->valency; Deltap_i = workspace->Deltap[i]; @@ -494,7 +494,7 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data for (pj = start_i; pj < end_i; ++pj) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; bo_ij = &( bonds->select.bond_list[pj].bo_data ); if (i < j || workspace->bond_mark[j] > 3) { @@ -652,14 +652,14 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data #endif for (i = 0; i < system->N; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; start_i = Start_Index(i, bonds); end_i = End_Index(i, bonds); for (pj = start_i; pj < end_i; ++pj) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; if (i < j || workspace->bond_mark[j] > 3) { // Computed in previous for-loop @@ -692,9 +692,9 @@ void BOOMP( reax_system *system, control_params * /* control */, simulation_data #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for(j = 0; j < system->N; ++j ) { + for (j = 0; j < system->N; ++j ) { type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; sbp_j = &(system->reax_param.sbp[ type_j ]); workspace->Delta[j] = workspace->total_bond_order[j] - sbp_j->valency; diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp index 413d50d0f9..30d50a4e70 100644 --- a/src/USER-OMP/reaxc_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_bonds_omp.cpp @@ -174,7 +174,7 @@ void BondsOMP( reax_system *system, control_params * /* control */, } } } - } // for(i) + } // for (i) } // omp diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index 849c239ed0..68ab6f933d 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -92,7 +92,7 @@ void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control, #endif /* Implement all force calls as function pointers */ - for( i = 0; i < NUM_INTRS; i++ ) { + for ( i = 0; i < NUM_INTRS; i++ ) { (Interaction_Functions[i])( system, control, data, workspace, lists, out_control ); } @@ -199,7 +199,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, // Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists ); // } - if(control->virial == 0) { + if (control->virial == 0) { #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) @@ -225,7 +225,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, Add_dBond_to_Forces_NPTOMP(system, i, pj, data, workspace, lists ); } - } // if(virial == 0) + } // if (virial == 0) pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, 0, 1, thr); @@ -284,7 +284,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for(int i = 0; i < N; ++i ) { + for (int i = 0; i < N; ++i ) { system->my_atoms[i].num_bonds = MAX(Num_Entries(i,bonds)*2, MIN_BONDS); if (i < N-1) @@ -308,7 +308,7 @@ void Validate_ListsOMP(reax_system *system, storage * /*workspace*/, reax_list * #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for(int i = 0; i < n; ++i ) { + for (int i = 0; i < n; ++i ) { Hindex = system->my_atoms[i].Hindex; if (Hindex > -1) { system->my_atoms[i].num_hbonds = @@ -395,7 +395,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, start_i = Start_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs); - for( pj = start_i; pj < end_i; ++pj ) { + for ( pj = start_i; pj < end_i; ++pj ) { nbr_pj = &( far_nbrs->select.far_nbr_list[pj] ); if (nbr_pj->d <= cutoff) { int j = nbr_pj->nbr; @@ -445,7 +445,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, BO = BO_s + BO_pi + BO_pi2; // End top portion of BOp() - if(BO >= bo_cut) { + if (BO >= bo_cut) { int btop_j; // Update indices in critical section @@ -478,12 +478,12 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, btop_i++; num_bonds++; - } // if(BO>=bo_cut) + } // if (BO>=bo_cut) - } // if(cutoff) + } // if (cutoff) - } // for(pj) - } // for(i) + } // for (pj) + } // for (i) // Need to wait for all indices and tmp arrays accumulated. #if defined(_OPENMP) @@ -493,8 +493,8 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, #if defined(_OPENMP) #pragma omp for schedule(dynamic,50) #endif - for(int i=0; iN; i++) - for(int t=0; tN; i++) + for (int t=0; tN + i; workspace->dDeltap_self[i][0] += tmp_ddelta[indx][0]; workspace->dDeltap_self[i][1] += tmp_ddelta[indx][1]; @@ -529,7 +529,7 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, j = nbr_pj->nbr; atom_j = &(system->my_atoms[j]); type_j = atom_j->type; - if(type_j < 0) continue; + if (type_j < 0) continue; sbp_j = &(system->reax_param.sbp[type_j]); jhb = sbp_j->p_hbond; @@ -537,30 +537,30 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, int iflag = 0; int jflag = 0; - if(ihb==1 && jhb==2) iflag = 1; - else if(jn && ihb == 2 && jhb == 1) jflag = 1; + if (ihb==1 && jhb==2) iflag = 1; + else if (jn && ihb == 2 && jhb == 1) jflag = 1; - if(iflag || jflag) { - if(iflag) { + if (iflag || jflag) { + if (iflag) { ihb_top = End_Index(atom_i->Hindex, hbonds); Set_End_Index(atom_i->Hindex, ihb_top+1, hbonds); - } else if(jflag) { + } else if (jflag) { jhb_top = End_Index(atom_j->Hindex, hbonds); Set_End_Index(atom_j->Hindex, jhb_top+1, hbonds); } - if(iflag) { + if (iflag) { hbonds->select.hbond_list[ihb_top].nbr = j; hbonds->select.hbond_list[ihb_top].scl = 1; hbonds->select.hbond_list[ihb_top].ptr = nbr_pj; - } else if(jflag) { + } else if (jflag) { hbonds->select.hbond_list[jhb_top].nbr = i; hbonds->select.hbond_list[jhb_top].scl = -1; hbonds->select.hbond_list[jhb_top].ptr = nbr_pj; } num_hbonds++; - } // if(iflag || jflag) + } // if (iflag || jflag) } } @@ -569,13 +569,13 @@ void Init_Forces_noQEq_OMP( reax_system *system, control_params *control, } // omp critical } - } // if(control->hbond > 0) + } // if (control->hbond > 0) // Zero buffers for others to use as intended. #if defined(_OPENMP) #pragma omp for schedule(guided) #endif - for(int i=0; imy_atoms[j].Hindex, hbonds ); hb_end_j = End_Index( system->my_atoms[j].Hindex, hbonds ); - if(type_j < 0) continue; + if (type_j < 0) continue; top = 0; for( pi = start_j; pi < end_j; ++pi ) { pbond_ij = &( bond_list[pi] ); i = pbond_ij->nbr; type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; bo_ij = &(pbond_ij->bo_data); - if( system->reax_param.sbp[type_i].p_hbond == 2 && + if ( system->reax_param.sbp[type_i].p_hbond == 2 && bo_ij->BO >= HB_THRESHOLD ) hblist[top++] = pi; } @@ -140,7 +140,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, /* set k's varibles */ k = hbond_list[pk].nbr; type_k = system->my_atoms[k].type; - if(type_k < 0) continue; + if (type_k < 0) continue; nbr_jk = hbond_list[pk].ptr; r_jk = nbr_jk->d; rvec_Scale( dvec_jk, hbond_list[pk].scl, nbr_jk->dvec ); @@ -153,7 +153,7 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control, if (system->my_atoms[i].orig_id != system->my_atoms[k].orig_id) { bo_ij = &(pbond_ij->bo_data); type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; hbp = &(system->reax_param.hbp[ type_i ][ type_j ][ type_k ]); ++num_hb_intrs; diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index af982443cb..1312953180 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -68,26 +68,26 @@ int Init_ListsOMP(reax_system *system, control_params *control, if (control->hbond_cut > 0) { /* init H indexes */ total_hbonds = 0; - for(i = 0; i < system->n; ++i) { + for (i = 0; i < system->n; ++i) { system->my_atoms[i].num_hbonds = hb_top[i]; total_hbonds += hb_top[i]; } total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if(!Make_List(system->Hcap, total_hbonds, TYP_HBOND, + if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS)) { error->one(FLERR, "Not enough space for hbonds list. Terminating!"); } } total_bonds = 0; - for(i = 0; i < system->N; ++i) { + for (i = 0; i < system->N; ++i) { system->my_atoms[i].num_bonds = bond_top[i]; total_bonds += bond_top[i]; } bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - if(!Make_List(system->total_cap, bond_cap, TYP_BOND, + if (!Make_List(system->total_cap, bond_cap, TYP_BOND, *lists+BONDS)) { error->one(FLERR, "Not enough space for bonds list. Terminating!\n"); } @@ -101,8 +101,8 @@ int Init_ListsOMP(reax_system *system, control_params *control, /* 3bodies list */ cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if(!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, - *lists+THREE_BODIES)){ + if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, + *lists+THREE_BODIES)) { error->one(FLERR, "Problem in initializing angles list. Terminating!"); } diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp index 86ba98631a..52ef7048d6 100644 --- a/src/USER-OMP/reaxc_multi_body_omp.cpp +++ b/src/USER-OMP/reaxc_multi_body_omp.cpp @@ -106,7 +106,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, #endif for ( i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[ type_i ]); /* lone-pair Energy */ @@ -120,7 +120,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, numbonds ++; /* calculate the energy */ - if(numbonds > 0) + if (numbonds > 0) total_Elp += e_lp = p_lp2 * workspace->Delta_lp[i] * inv_expvd2; @@ -128,7 +128,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, 75 * p_lp2 * workspace->Delta_lp[i] * expvd2 * SQR(inv_expvd2); CElp = dElp * workspace->dDelta_lp[i]; - if(numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term + if (numbonds > 0) workspace->CdDelta[i] += CElp; // lp - 1st term /* tally into per-atom energy */ if (system->pair_ptr->evflag) @@ -140,7 +140,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; if (!strcmp( system->reax_param.sbp[type_j].name, "C" )) { twbp = &( system->reax_param.tbp[type_i][type_j]); @@ -171,7 +171,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, #endif for (i = 0; i < system->n; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; sbp_i = &(system->reax_param.sbp[ type_i ]); /* over-coordination energy */ @@ -184,7 +184,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { j = bonds->select.bond_list[pj].nbr; type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; bo_ij = &(bonds->select.bond_list[pj].bo_data); twbp = &(system->reax_param.tbp[ type_i ][ type_j ]); @@ -230,7 +230,7 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) numbonds ++; - if(numbonds > 0) total_Eun += e_un = + if (numbonds > 0) total_Eun += e_un = -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; CEunder1 = inv_exp_ovun2n * @@ -244,14 +244,14 @@ void Atom_EnergyOMP( reax_system *system, control_params * /* control */, /* tally into per-atom energy */ if (system->pair_ptr->evflag) { eng_tmp = e_ov; - if(numbonds > 0) eng_tmp+= e_un; + if (numbonds > 0) eng_tmp+= e_un; pair_reax_ptr->ev_tally_thr_proxy(system->pair_ptr, i, i, system->n, 1, eng_tmp, 0.0, 0.0, 0.0, 0.0, 0.0, thr); } /* forces */ workspace->CdDelta[i] += CEover3; // OvCoor - 2nd term - if(numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term + if (numbonds > 0) workspace->CdDelta[i] += CEunder3; // UnCoor - 1st term for (pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj) { pbond = &(bonds->select.bond_list[pj]); diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index 301dbe8479..ce463c39ff 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -97,7 +97,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, #pragma omp for schedule(guided) #endif for( i = 0; i < natoms; ++i ) { - if(system->my_atoms[i].type < 0) continue; + if (system->my_atoms[i].type < 0) continue; start_i = Start_Index(i, far_nbrs); end_i = End_Index(i, far_nbrs); orig_i = system->my_atoms[i].orig_id; @@ -108,8 +108,8 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, orig_j = system->my_atoms[j].orig_id; flag = 0; - if(nbr_pj->d <= control->nonb_cut) { - if(j < natoms) flag = 1; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; else if (orig_i < orig_j) flag = 1; else if (orig_i == orig_j) { if (nbr_pj->dvec[2] > SMALL) flag = 1; @@ -145,7 +145,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, dTap += workspace->Tap[1]/r_ij; /*vdWaals Calculations*/ - if(system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) { // shielding powr_vdW1 = pow(r_ij, p_vdW1); powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); @@ -174,7 +174,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control, Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - if(system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) { // innner wall e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); total_EvdW += Tap * e_core; @@ -293,7 +293,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro #endif for (i = 0; i < natoms; ++i) { type_i = system->my_atoms[i].type; - if(type_i < 0) continue; + if (type_i < 0) continue; start_i = Start_Index(i,far_nbrs); end_i = End_Index(i,far_nbrs); orig_i = system->my_atoms[i].orig_id; @@ -302,12 +302,12 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro nbr_pj = &(far_nbrs->select.far_nbr_list[pj]); j = nbr_pj->nbr; type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; orig_j = system->my_atoms[j].orig_id; flag = 0; - if(nbr_pj->d <= control->nonb_cut) { - if(j < natoms) flag = 1; + if (nbr_pj->d <= control->nonb_cut) { + if (j < natoms) flag = 1; else if (orig_i < orig_j) flag = 1; else if (orig_i == orig_j) { if (nbr_pj->dvec[2] > SMALL) flag = 1; diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index 2b9afae341..79fa9e0f47 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -202,7 +202,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, //tan_ijk_i = 1. / tan( theta_ijk ); if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) tan_ijk_i = cos_ijk / MIN_SINE; - else if( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) + else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) tan_ijk_i = cos_ijk / -MIN_SINE; else tan_ijk_i = cos_ijk / sin_ijk; @@ -241,7 +241,7 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control, //tan_jkl_i = 1. / tan( theta_jkl ); if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) tan_jkl_i = cos_jkl / MIN_SINE; - else if( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) + else if ( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) tan_jkl_i = cos_jkl / -MIN_SINE; else tan_jkl_i = cos_jkl /sin_jkl; diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index c42b97958f..8b6f1e7617 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -177,7 +177,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, pair_reax_ptr = static_cast(system->pair_ptr); class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); - // Run through a minimal for(jnum_intrs / nthreads; @@ -187,7 +187,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, for (j = 0; j < system->N; ++j) { type_j = system->my_atoms[j].type; _my_offset[j] = 0; - if(type_j < 0) continue; + if (type_j < 0) continue; start_j = Start_Index(j, bonds); end_j = End_Index(j, bonds); @@ -220,7 +220,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, ++my_offset; break; } - } // for(pk) + } // for (pk) /* and this is the second for loop mentioned above */ for (pk = pi+1; pk < end_j; ++pk) { @@ -233,14 +233,14 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, p_ijk->thb = k; ++my_offset; // add this to the list of 3-body interactions - } // for(pk) - } // if() + } // for (pk) + } // if () Set_End_Index(pi, my_offset, thb_intrs ); - } // for(pi) + } // for (pi) // Confirm that thb_intrs->num_intrs / nthreads is enough to hold all angles from a single atom - if(my_offset >= (tid+1)*per_thread) { + if (my_offset >= (tid+1)*per_thread) { char errmsg[512]; snprintf( errmsg, 512, "step%d-ran out of space on angle_list for atom %i:\n" " nthreads= %d, tid=%d, my_offset=%d, per_thread=%d\n" @@ -251,7 +251,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, // Number of angles owned by this atom _my_offset[j] = my_offset - tid * per_thread; - } // for(j) + } // for (j) // Wait for all threads to finish counting angles #if defined(_OPENMP) && !defined(__NVCC__) @@ -266,7 +266,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, int current_count = 0; int m = _my_offset[0]; _my_offset[0] = current_count; - for(j=1; jN; j++) { + for (j=1; jN; j++) { current_count+= m; m = _my_offset[j]; _my_offset[j] = current_count; @@ -286,10 +286,10 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, #endif for (j = 0; j < system->N; ++j) { // Ray: the first one with system->N type_j = system->my_atoms[j].type; - if(type_j < 0) continue; + if (type_j < 0) continue; // Skip if no angles for this atom - if(_my_offset[j] == _my_offset[j+1]) continue; + if (_my_offset[j] == _my_offset[j+1]) continue; start_j = Start_Index(j, bonds); end_j = End_Index(j, bonds); @@ -373,7 +373,7 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, ++num_thb_intrs; break; } - } // for(pk) + } // for (pk) /* and this is the second for loop mentioned above */ @@ -587,15 +587,15 @@ void Valence_AnglesOMP( reax_system *system, control_params *control, system->pair_ptr->v_tally3( i, j, k, fi_tmp, fk_tmp, delij, delkj); } - } // if(p_val1>0.001) - } // for(cnt) - } // if(j0) - } // for(pk) - } // if(BOA_ij>0) + } // if (p_val1>0.001) + } // for (cnt) + } // if (j0) + } // for (pk) + } // if (BOA_ij>0) Set_End_Index(pi, my_offset, thb_intrs ); - } // for(pi) - } // for(j) + } // for (pi) + } // for (j) } // end omp parallel data->my_en.e_ang = total_Eang; diff --git a/src/USER-PHONON/dynamical_matrix.cpp b/src/USER-PHONON/dynamical_matrix.cpp index b9c42b45d0..798b50fdf7 100644 --- a/src/USER-PHONON/dynamical_matrix.cpp +++ b/src/USER-PHONON/dynamical_matrix.cpp @@ -266,29 +266,29 @@ void DynamicalMatrix::calculateMatrix() update->nsteps = 0; int prog = 0; - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); if (gm[i-1] < 0) continue; - for (int alpha=0; alpha<3; alpha++){ + for (int alpha=0; alpha<3; alpha++) { displace_atom(local_idx, alpha, 1); update_force(); - for (bigint j=1; j<=natoms; j++){ + for (bigint j=1; j<=natoms; j++) { local_jdx = atom->map(j); if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal - && gm[j-1] >= 0){ - for (int beta=0; beta<3; beta++){ + && gm[j-1] >= 0) { + for (int beta=0; beta<3; beta++) { dynmat[alpha][gm[j-1]*3+beta] -= f[local_jdx][beta]; } } } displace_atom(local_idx,alpha,-2); update_force(); - for (bigint j=1; j<=natoms; j++){ + for (bigint j=1; j<=natoms; j++) { local_jdx = atom->map(j); if (local_idx >= 0 && local_jdx >= 0 && local_jdx < nlocal - && gm[j-1] >= 0){ - for (int beta=0; beta<3; beta++){ + && gm[j-1] >= 0) { + for (int beta=0; beta<3; beta++) { if (atom->rmass_flag == 1) imass = sqrt(m[local_idx] * m[local_jdx]); else @@ -369,7 +369,7 @@ void DynamicalMatrix::displace_atom(int local_idx, int direction, int magnitude) x[local_idx][direction] += del*magnitude; - while (sametag[j] >= 0){ + while (sametag[j] >= 0) { j = sametag[j]; x[j][direction] += del*magnitude; } @@ -524,7 +524,7 @@ void DynamicalMatrix::create_groupmap() bigint *temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) gid += 1; // gid at the end of loop is final_Gid @@ -534,21 +534,21 @@ void DynamicalMatrix::create_groupmap() gid = 0; //create a map between global atom id and group atom id for each proc - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); - if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit){ + if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) { sub_groupmap[gid] = i; gid += 1; } } //populate arrays for Allgatherv - for (int i=0; inprocs; i++){ + for (int i=0; inprocs; i++) { recv[i] = 0; } recv[comm->me] = gid; MPI_Allreduce(recv,displs,comm->nprocs,MPI_INT,MPI_SUM,world); - for (int i=0; inprocs; i++){ + for (int i=0; inprocs; i++) { recv[i]=displs[i]; if (i>0) displs[i] = displs[i-1]+recv[i-1]; else displs[i] = 0; @@ -560,7 +560,7 @@ void DynamicalMatrix::create_groupmap() //populate member groupmap based on temp groupmap bigint j = 0; - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { // flag groupmap contents that are in temp_groupmap if (j < gcount && i == temp_groupmap[j]) groupmap[i-1] = j++; diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index a4915d6930..013b18948a 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -92,13 +92,13 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) nasr = 20; // other command line options - while (iarg < narg){ - if (strcmp(arg[iarg],"sysdim") == 0){ + while (iarg < narg) { + if (strcmp(arg[iarg],"sysdim") == 0) { if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); sdim = utils::inumeric(FLERR, arg[iarg],false,lmp); if (sdim < 1) error->all(FLERR,"Illegal fix phonon command: sysdim should not be less than 1."); - } else if (strcmp(arg[iarg],"nasr") == 0){ + } else if (strcmp(arg[iarg],"nasr") == 0) { if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); nasr = utils::inumeric(FLERR, arg[iarg],false,lmp); @@ -139,7 +139,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // here the parallization is done on the x direction only nxlo = 0; int *nx_loc = new int [nprocs]; - for (int i = 0; i < nprocs; ++i){ + for (int i = 0; i < nprocs; ++i) { nx_loc[i] = nx / nprocs; if (i < nx%nprocs) ++nx_loc[i]; } @@ -182,7 +182,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) else memory->create(Phi_all,1,1,"fix_phonon:Phi_all"); // output some information on the system to log file - if (me == 0){ + if (me == 0) { flog = fopen(logfile, "w"); if (flog == nullptr) { char str[MAXLINE]; @@ -205,7 +205,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fprintf(flog,"%d %d %d %d\n", nx, ny, nz, nucell); fprintf(flog,"# l1 l2 l3 k atom_id\n"); int ix, iy, iz, iu; - for (idx = 0; idx < ngroup; ++idx){ + for (idx = 0; idx < ngroup; ++idx) { itag = surf2tag[idx]; iu = idx%nucell; iz = (idx/nucell)%nz; @@ -341,8 +341,8 @@ void FixPhonon::end_of_step() // evaluate R(r) on local proc nfind = 0; - for (i = 0; i < nlocal; ++i){ - if (mask[i] & groupbit){ + for (i = 0; i < nlocal; ++i) { + if (mask[i] & groupbit) { itag = tag[i]; idx = tag2surf[itag]; @@ -361,8 +361,8 @@ void FixPhonon::end_of_step() for (i = 1; i < nprocs; ++i) displs[i] = displs[i-1] + recvcnts[i-1]; MPI_Gatherv(RIloc[0],nfind,MPI_DOUBLE,RIall[0],recvcnts,displs,MPI_DOUBLE,0,world); - if (me == 0){ - for (i = 0; i < ngroup; ++i){ + if (me == 0) { + for (i = 0; i < ngroup; ++i) { idx = static_cast(RIall[i][sysdim]); for (idim = 0; idim < sysdim; ++idim) Rsort[idx][idim] = RIall[i][idim]; } @@ -374,9 +374,9 @@ void FixPhonon::end_of_step() for (idim = 0; idim < fft_dim; ++idim) Rsum[idx][idim] += Rnow[idx][idim]; // FFT R(r) to get R(q) - for (idim = 0; idim < fft_dim; ++idim){ + for (idim = 0; idim < fft_dim; ++idim) { int m = 0; - for (idx = 0; idx < mynpt; ++idx){ + for (idx = 0; idx < mynpt; ++idx) { fft_data[m++] = static_cast(Rnow[idx][idim]); fft_data[m++] = static_cast(0.); } @@ -384,25 +384,25 @@ void FixPhonon::end_of_step() fft->compute(fft_data, fft_data, -1); m = 0; - for (idq = 0; idq < mynq; ++idq){ + for (idq = 0; idq < mynq; ++idq) { Rqnow[idq][idim] = std::complex(static_cast(fft_data[m]), static_cast(fft_data[m+1])); m += 2; } } // to get sum(R(q).R(q)*) - for (idq = 0; idq < mynq; ++idq){ + for (idq = 0; idq < mynq; ++idq) { ndim = 0; for (idim = 0; idim < fft_dim; ++idim) for (jdim = 0; jdim < fft_dim; ++jdim) Rqsum[idq][ndim++] += Rqnow[idq][idim] * std::conj(Rqnow[idq][jdim]); } // get basis info - if (fft_dim > sysdim){ + if (fft_dim > sysdim) { double dist2orig[3]; - for (idx = 0; idx < mynpt; ++idx){ + for (idx = 0; idx < mynpt; ++idx) { ndim = sysdim; - for (i = 1; i < nucell; ++i){ + for (i = 1; i < nucell; ++i) { for (idim = 0; idim < sysdim; ++idim) dist2orig[idim] = Rnow[idx][ndim++] - Rnow[idx][idim]; domain->minimum_image(dist2orig); for (idim = 0; idim < sysdim; ++idim) basis[i][idim] += dist2orig[idim]; @@ -477,9 +477,9 @@ void FixPhonon::getmass() type_all = new double[nucell]; for (int i = 0; i < nucell; ++i) mass_one[i] = type_one[i] = 0.; - if (rmass){ - for (int i = 0; i < nlocal; ++i){ - if (mask[i] & groupbit){ + if (rmass) { + for (int i = 0; i < nlocal; ++i) { + if (mask[i] & groupbit) { itag = tag[i]; idx = tag2surf[itag]; int iu = idx%nucell; @@ -488,8 +488,8 @@ void FixPhonon::getmass() } } } else { - for (int i = 0; i < nlocal; ++i){ - if (mask[i] & groupbit){ + for (int i = 0; i < nlocal; ++i) { + if (mask[i] & groupbit) { itag = tag[i]; idx = tag2surf[itag]; int iu = idx%nucell; @@ -506,7 +506,7 @@ void FixPhonon::getmass() basetype = new int[nucell]; double inv_total = 1./double(ntotal); - for (int i = 0; i < nucell; ++i){ + for (int i = 0; i < nucell; ++i) { mass_all[i] *= inv_total; M_inv_sqrt[i] = sqrt(1./mass_all[i]); @@ -528,7 +528,7 @@ void FixPhonon::readmap() int info = 0; // auto-generate mapfile for "cluster" (gamma only system) - if (strcmp(mapfile, "GAMMA") == 0){ + if (strcmp(mapfile, "GAMMA") == 0) { nx = ny = nz = ntotal = 1; nucell = ngroup; @@ -538,7 +538,7 @@ void FixPhonon::readmap() // get atom IDs on local proc int nfind = 0; - for (int i = 0; i < atom->nlocal; ++i){ + for (int i = 0; i < atom->nlocal; ++i) { if (atom->mask[i] & groupbit) tag_loc[nfind++] = atom->tag[i]; } @@ -549,7 +549,7 @@ void FixPhonon::readmap() for (int i = 1; i < nprocs; ++i) displs[i] = displs[i-1] + recvcnts[i-1]; MPI_Allgatherv(tag_loc,nfind,MPI_LMP_TAGINT,tag_all,recvcnts,displs,MPI_LMP_TAGINT,world); - for (int i = 0; i < ngroup; ++i){ + for (int i = 0; i < ngroup; ++i) { itag = tag_all[i]; tag2surf[itag] = i; surf2tag[i] = itag; @@ -563,7 +563,7 @@ void FixPhonon::readmap() // read from map file for others char line[MAXLINE]; FILE *fp = fopen(mapfile, "r"); - if (fp == nullptr){ + if (fp == nullptr) { sprintf(line,"Cannot open input map file %s", mapfile); error->all(FLERR,line); } @@ -584,7 +584,7 @@ void FixPhonon::readmap() int ix, iy, iz, iu; // the remaining lines carry the mapping info - for (int i = 0; i < ngroup; ++i){ + for (int i = 0; i < ngroup; ++i) { if (fgets(line,MAXLINE,fp) == nullptr) {info = 1; break;} ix = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); iy = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); @@ -614,7 +614,7 @@ void FixPhonon::readmap() int nlocal = atom->nlocal; for (int i = 0; i < nlocal; ++i) { - if (mask[i] & groupbit){ + if (mask[i] & groupbit) { itag = tag[i]; idx = tag2surf[itag]; if (itag != surf2tag[idx]) @@ -643,9 +643,9 @@ void FixPhonon::postprocess( ) for (idim = 0; idim < fft_dim; ++idim) Rnow[idx][idim] = Rsum[idx][idim] * inv_neval; // to get q - for (idim = 0; idim < fft_dim; ++idim){ + for (idim = 0; idim < fft_dim; ++idim) { int m = 0; - for (idx = 0; idx < mynpt; ++idx){ + for (idx = 0; idx < mynpt; ++idx) { fft_data[m++] = static_cast(Rnow[idx][idim]); fft_data[m++] = static_cast(0.); } @@ -653,14 +653,14 @@ void FixPhonon::postprocess( ) fft->compute(fft_data,fft_data,-1); m = 0; - for (idq = 0; idq < mynq; ++idq){ + for (idq = 0; idq < mynq; ++idq) { Rqnow[idq][idim] = std::complex(static_cast(fft_data[m]), static_cast(fft_data[m+1])); m += 2; } } // to get G(q) = - q.q - for (idq = 0; idq < mynq; ++idq){ + for (idq = 0; idq < mynq; ++idq) { ndim = 0; for (idim = 0; idim < fft_dim; ++idim) for (jdim = 0; jdim < fft_dim; ++jdim) Phi_q[idq][ndim++] -= Rqnow[idq][idim] * std::conj(Rqnow[idq][jdim]); @@ -672,13 +672,13 @@ void FixPhonon::postprocess( ) double TempFac = inv_neval * inv_nTemp; double NormFac = TempFac * double(ntotal); - for (idim = 0; idim < sysdim; ++idim){ + for (idim = 0; idim < sysdim; ++idim) { kbtsqrt[idim] = sqrt(TempSum[idim] * NormFac); TempAve += TempSum[idim] * TempFac; } TempAve /= sysdim*boltz; - for (idq = 0; idq < mynq; ++idq){ + for (idq = 0; idq < mynq; ++idq) { GaussJordan(fft_dim, Phi_q[idq]); ndim =0; for (idim = 0; idim < fft_dim; ++idim) @@ -695,7 +695,7 @@ void FixPhonon::postprocess( ) double *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 + if (me == 0) { // output dynamic matrix by root // get basis info for (idim = 0; idim < sysdim; ++idim) basis_root[idim] = 0.; @@ -748,18 +748,18 @@ void FixPhonon::postprocess( ) EnforceASR(); // to get D = 1/M x Phi - for (idq = 0; idq < ntotal; ++idq){ + for (idq = 0; idq < ntotal; ++idq) { ndim =0; for (idim = 0; idim < fft_dim; ++idim) for (jdim = 0; jdim < fft_dim; ++jdim) Phi_all[idq][ndim++] *= M_inv_sqrt[idim/sysdim]*M_inv_sqrt[jdim/sysdim]; } idq =0; - for (int ix = 0; ix < nx; ++ix){ + for (int ix = 0; ix < nx; ++ix) { double qx = double(ix)/double(nx); - for (int iy = 0; iy < ny; ++iy){ + for (int iy = 0; iy < ny; ++iy) { double qy = double(iy)/double(ny); - for (int iz = 0; iz < nz; ++iz){ + for (int iz = 0; iz < nz; ++iz) { double qz = double(iz)/double(nz); fprintf(flog,"%lg %lg %lg", qx, qy, qz); for (idim = 0; idim < fft_dim2; ++idim) @@ -794,15 +794,15 @@ void FixPhonon::GaussJordan(int n, std::complex *Mat) ipiv = new int[n]; for (i = 0; i < n; ++i) ipiv[i] = 0; - for (i = 0; i < n; ++i){ + for (i = 0; i < n; ++i) { big = 0.; - for (j = 0; j < n; ++j){ - if (ipiv[j] != 1){ - for (k = 0; k < n; ++k){ - if (ipiv[k] == 0){ + for (j = 0; j < n; ++j) { + if (ipiv[j] != 1) { + for (k = 0; k < n; ++k) { + if (ipiv[k] == 0) { idr = j*n+k; nmjk = norm(Mat[idr]); - if (nmjk >= big){ + if (nmjk >= big) { big = nmjk; irow = j; icol = k; @@ -812,8 +812,8 @@ void FixPhonon::GaussJordan(int n, std::complex *Mat) } } ipiv[icol] += 1; - if (irow != icol){ - for (l = 0; l < n; ++l){ + if (irow != icol) { + for (l = 0; l < n; ++l) { idr = irow*n+l; idc = icol*n+l; dum = Mat[idr]; @@ -830,8 +830,8 @@ void FixPhonon::GaussJordan(int n, std::complex *Mat) Mat[idr] = std::complex(1.,0.); idr = icol*n; for (l = 0; l < n; ++l) Mat[idr+l] *= pivinv; - for (ll = 0; ll < n; ++ll){ - if (ll != icol){ + for (ll = 0; ll < n; ++ll) { + if (ll != icol) { idc = ll*n + icol; dum = Mat[idc]; Mat[idc] = 0.; @@ -841,11 +841,11 @@ void FixPhonon::GaussJordan(int n, std::complex *Mat) } } - for (l = n-1; l >= 0; --l){ + for (l = n-1; l >= 0; --l) { int rl = indxr[l]; int cl = indxc[l]; - if (rl != cl){ - for (k = 0; k < n; ++k){ + if (rl != cl) { + for (k = 0; k < n; ++k) { idr = k*n + rl; idc = k*n + cl; dum = Mat[idr]; @@ -867,18 +867,18 @@ void FixPhonon::EnforceASR() { if (nasr < 1) return; - for (int iit = 0; iit < nasr; ++iit){ + for (int iit = 0; iit < nasr; ++iit) { // simple ASR; the resultant matrix might not be symmetric for (int a = 0; a < sysdim; ++a) - for (int b = 0; b < sysdim; ++b){ - for (int k = 0; k < nucell; ++k){ + for (int b = 0; b < sysdim; ++b) { + for (int k = 0; k < nucell; ++k) { double sum = 0.; - for (int kp = 0; kp < nucell; ++kp){ + for (int kp = 0; kp < nucell; ++kp) { int idx = (k*sysdim+a)*fft_dim + kp*sysdim + b; sum += std::real(Phi_all[0][idx]); } sum /= double(nucell); - for (int kp = 0; kp < nucell; ++kp){ + for (int kp = 0; kp < nucell; ++kp) { int idx = (k*sysdim+a)*fft_dim + kp*sysdim + b; Phi_all[0][idx] -= sum; } @@ -887,10 +887,10 @@ void FixPhonon::EnforceASR() // symmetrize for (int k = 0; k < nucell; ++k) - for (int kp = k; kp < nucell; ++kp){ + for (int kp = k; kp < nucell; ++kp) { double csum = 0.; for (int a = 0; a < sysdim; ++a) - for (int b = 0; b < sysdim; ++b){ + for (int b = 0; b < sysdim; ++b) { int idx = (k*sysdim+a)*fft_dim + kp*sysdim + b; int jdx = (kp*sysdim+b)*fft_dim + k*sysdim + a; csum = (std::real(Phi_all[0][idx])+std::real(Phi_all[0][jdx]))*0.5; @@ -902,15 +902,15 @@ void FixPhonon::EnforceASR() // symmetric ASR for (int a = 0; a < sysdim; ++a) - for (int b = 0; b < sysdim; ++b){ - for (int k = 0; k < nucell; ++k){ + for (int b = 0; b < sysdim; ++b) { + for (int k = 0; k < nucell; ++k) { double sum = 0.; - for (int kp = 0; kp < nucell; ++kp){ + for (int kp = 0; kp < nucell; ++kp) { int idx = (k*sysdim+a)*fft_dim + kp*sysdim + b; sum += std::real(Phi_all[0][idx]); } sum /= double(nucell-k); - for (int kp = k; kp < nucell; ++kp){ + for (int kp = k; kp < nucell; ++kp) { int idx = (k*sysdim+a)*fft_dim + kp*sysdim + b; int jdx = (kp*sysdim+b)*fft_dim + k*sysdim + a; Phi_all[0][idx] -= sum; diff --git a/src/USER-PHONON/third_order.cpp b/src/USER-PHONON/third_order.cpp index 32ced74cad..875490d643 100644 --- a/src/USER-PHONON/third_order.cpp +++ b/src/USER-PHONON/third_order.cpp @@ -254,18 +254,18 @@ void ThirdOrder::calculateMatrix() update->nsteps = 0; int prog = 0; - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); - for (int alpha=0; alpha<3; alpha++){ - for (bigint j=1; j<=natoms; j++){ + for (int alpha=0; alpha<3; alpha++) { + for (bigint j=1; j<=natoms; j++) { local_jdx = atom->map(j); - for (int beta=0; beta<3; beta++){ + for (int beta=0; beta<3; beta++) { displace_atom(local_idx, alpha, 1); displace_atom(local_jdx, beta, 1); update_force(); - for (bigint k=1; k<=natoms; k++){ + for (bigint k=1; k<=natoms; k++) { local_kdx = atom->map(k); - for (int gamma=0; gamma<3; gamma++){ + for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 && local_kdx < nlocal) { @@ -275,9 +275,9 @@ void ThirdOrder::calculateMatrix() } displace_atom(local_jdx, beta, -2); update_force(); - for (bigint k=1; k<=natoms; k++){ + for (bigint k=1; k<=natoms; k++) { local_kdx = atom->map(k); - for (int gamma=0; gamma<3; gamma++){ + for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 && local_kdx < nlocal) { @@ -289,9 +289,9 @@ void ThirdOrder::calculateMatrix() displace_atom(local_idx,alpha,-2); displace_atom(local_jdx, beta, 1); update_force(); - for (bigint k=1; k<=natoms; k++){ + for (bigint k=1; k<=natoms; k++) { local_kdx = atom->map(k); - for (int gamma=0; gamma<3; gamma++){ + for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 && local_kdx < nlocal) { @@ -301,9 +301,9 @@ void ThirdOrder::calculateMatrix() } displace_atom(local_jdx, beta, -2); update_force(); - for (bigint k=1; k<=natoms; k++){ + for (bigint k=1; k<=natoms; k++) { local_kdx = atom->map(k); - for (int gamma=0; gamma<3; gamma++){ + for (int gamma=0; gamma<3; gamma++) { if (local_idx >= 0 && local_jdx >= 0 && local_kdx >= 0 && gm[i-1] >= 0 && gm[j-1] >= 0 && gm[k-1] >= 0 && local_kdx < nlocal) { @@ -315,7 +315,7 @@ void ThirdOrder::calculateMatrix() displace_atom(local_jdx, beta, 1); displace_atom(local_idx, alpha, 1); MPI_Reduce(dynmat,fdynmat,3*dynlen,MPI_DOUBLE,MPI_SUM,0,world); - if (me == 0){ + if (me == 0) { writeMatrix(fdynmat, gm[i-1], alpha, gm[j-1], beta); } memset(&dynmat[0],0,dynlen*sizeof(double)); @@ -351,7 +351,7 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) double norm; if (!binaryflag && fp) { clearerr(fp); - for (int k = 0; k < gcount; k++){ + for (int k = 0; k < gcount; k++) { norm = square(dynmat[k*3])+ square(dynmat[k*3+1])+ square(dynmat[k*3+2]); @@ -364,7 +364,7 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); } - } else if (binaryflag && fp){ + } else if (binaryflag && fp) { clearerr(fp); fwrite(&dynmat[0], sizeof(double), dynlen, fp); } @@ -386,7 +386,7 @@ void ThirdOrder::displace_atom(int local_idx, int direction, int magnitude) x[local_idx][direction] += del*magnitude; - while (sametag[j] >= 0){ + while (sametag[j] >= 0) { j = sametag[j]; x[j][direction] += del*magnitude; } @@ -518,7 +518,7 @@ void ThirdOrder::create_groupmap() bigint *temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); if ((local_idx >= 0) && (local_idx < nlocal) && mask[local_idx] & groupbit) gid += 1; // gid at the end of loop is final_Gid @@ -528,22 +528,22 @@ void ThirdOrder::create_groupmap() gid = 0; //create a map between global atom id and group atom id for each proc - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { local_idx = atom->map(i); if ((local_idx >= 0) && (local_idx < nlocal) - && (mask[local_idx] & groupbit)){ + && (mask[local_idx] & groupbit)) { sub_groupmap[gid] = i; gid += 1; } } //populate arrays for Allgatherv - for (int i=0; inprocs; i++){ + for (int i=0; inprocs; i++) { recv[i] = 0; } recv[comm->me] = gid; MPI_Allreduce(recv,displs,comm->nprocs,MPI_INT,MPI_SUM,world); - for (int i=0; inprocs; i++){ + for (int i=0; inprocs; i++) { recv[i]=displs[i]; if (i>0) displs[i] = displs[i-1]+recv[i-1]; else displs[i] = 0; @@ -556,7 +556,7 @@ void ThirdOrder::create_groupmap() //populate member groupmap based on temp groupmap bigint j = 0; - for (bigint i=1; i<=natoms; i++){ + for (bigint i=1; i<=natoms; i++) { // flag groupmap contents that are in temp_groupmap if (j < gcount && i == temp_groupmap[j]) groupmap[i-1] = j++; diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 1fc19a7724..e2246adcd9 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -118,7 +118,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // LAMMPS units wrt kj/mol - nm - ps // Set up units - if(strcmp(update->unit_style,"lj") == 0) { + if (strcmp(update->unit_style,"lj") == 0) { // LAMMPS units lj p->cmd("setNaturalUnits"); } else { @@ -486,7 +486,7 @@ void FixPlumed::post_force(int /* vflag */) // do the real calculation: p->cmd("performCalc"); - if(plumedStopCondition) timer->force_timeout(); + if (plumedStopCondition) timer->force_timeout(); // retransform virial to lammps representation and assign it to this // fix's virial. If the energy is biased, Plumed is giving back the full diff --git a/src/USER-PTM/ptm_voronoi_cell.cpp b/src/USER-PTM/ptm_voronoi_cell.cpp index 60ef4cf87b..5b29706b82 100644 --- a/src/USER-PTM/ptm_voronoi_cell.cpp +++ b/src/USER-PTM/ptm_voronoi_cell.cpp @@ -76,13 +76,13 @@ voronoicell_base::voronoicell_base() : ds2(new int[current_delete2_size]), stacke2(ds2+current_delete_size), current_marginal(init_marginal), marg(new int[current_marginal]) { int i; - for(i=0;i<3;i++) { + for (i=0;i<3;i++) { mem[i]=init_n_vertices;mec[i]=0; mep[i]=new int[init_n_vertices*((i<<1)+1)]; } mem[3]=init_3_vertices;mec[3]=0; mep[3]=new int[init_3_vertices*7]; - for(i=4;i=0;i--) if(mem[i]>0) delete [] mep[i]; + for (int i=current_vertex_order-1;i>=0;i--) if (mem[i]>0) delete [] mep[i]; delete [] marg; delete [] ds2;delete [] ds; delete [] mep;delete [] mec; @@ -104,7 +104,7 @@ voronoicell_base::~voronoicell_base() { template void voronoicell_base::check_memory_for_copy(vc_class &vc,voronoicell_base* vb) { while(current_vertex_ordercurrent_vertex_order) add_memory_vorder(vc); - for(int i=0;imec[i]) add_memory(vc,i,ds2); + for (int i=0;imec[i]) add_memory(vc,i,ds2); while(current_verticesp) add_memory_vertices(vc); } @@ -122,7 +122,7 @@ void voronoicell_base::check_memory_for_copy(vc_class &vc,voronoicell_base* vb) template void voronoicell_base::add_memory(vc_class &vc,int i,int *stackp2) { int s=(i<<1)+1; - if(mem[i]==0) { + if (mem[i]==0) { vc.n_allocate(i,init_n_vertices); mep[i]=new int[init_n_vertices*s]; mem[i]=init_n_vertices; @@ -132,7 +132,7 @@ void voronoicell_base::add_memory(vc_class &vc,int i,int *stackp2) { } else { int j=0,k,*l; mem[i]<<=1; - if(mem[i]>max_n_vertices) voro_fatal_error("Point memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); + if (mem[i]>max_n_vertices) voro_fatal_error("Point memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Order %d vertex memory scaled up to %d\n",i,mem[i]); #endif @@ -141,25 +141,25 @@ void voronoicell_base::add_memory(vc_class &vc,int i,int *stackp2) { vc.n_allocate_aux1(i); while(j=0) { + if (k>=0) { ed[k]=l+j; vc.n_set_to_aux1_offset(k,m); } else { int *dsp; - for(dsp=ds2;dsp=3 fputs("Relocated dangling pointer",stderr); #endif } - for(k=0;kmax_vertices) voro_fatal_error("Vertex memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); + if (i>max_vertices) voro_fatal_error("Vertex memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Vertex memory scaled up to %d\n",i); #endif double *ppts; pp=new int*[i]; - for(j=0;j void voronoicell_base::add_memory_vorder(vc_class &vc) { int i=(current_vertex_order<<1),j,*p1,**p2; - if(i>max_vertex_order) voro_fatal_error("Vertex order memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); + if (i>max_vertex_order) voro_fatal_error("Vertex order memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Vertex order memory scaled up to %d\n",i); #endif p1=new int[i]; - for(j=0;jmax_delete_size) voro_fatal_error("Delete stack 1 memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); + if (current_delete_size>max_delete_size) voro_fatal_error("Delete stack 1 memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Delete stack 1 memory scaled up to %d\n",current_delete_size); #endif @@ -244,7 +244,7 @@ void voronoicell_base::add_memory_ds(int *&stackp) { * routine causes a fatal error. */ void voronoicell_base::add_memory_ds2(int *&stackp2) { current_delete2_size<<=1; - if(current_delete2_size>max_delete2_size) voro_fatal_error("Delete stack 2 memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); + if (current_delete2_size>max_delete2_size) voro_fatal_error("Delete stack 2 memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Delete stack 2 memory scaled up to %d\n",current_delete2_size); #endif @@ -259,7 +259,7 @@ void voronoicell_base::add_memory_ds2(int *&stackp2) { * \param[in] (ymin,ymax) the minimum and maximum y coordinates. * \param[in] (zmin,zmax) the minimum and maximum z coordinates. */ void voronoicell_base::init_base(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax) { - for(int i=0;i inline void voronoicell_base::add_to_stack(vc_class &vc,int lp,int *&stackp2) { (void)vc; - for(int *k(ds2);k=p) throw true; + if (++count>=p) throw true; u=l;up=lp; - for(us=0;us=p) throw true; + if (++count>=p) throw true; u=q;up=qp; - for(us=0;us=current_vertex_order) add_memory_vorder(vc); - if(mec[nu[p]]==mem[nu[p]]) add_memory(vc,nu[p],stackp2); + if (mec[nu[p]]==mem[nu[p]]) add_memory(vc,nu[p],stackp2); vc.n_set_pointer(p,nu[p]); ed[p]=mep[nu[p]]+((nu[p]<<1)+1)*mec[nu[p]]++; ed[p][nu[p]<<1]=p; @@ -609,7 +609,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // If i reaches zero, then we have a point in // the plane all of whose edges are outside // the cutting space, so we just exit - if(i==0) return true; + if (i==0) return true; lp=ed[up][i]; lw=m_test(lp,l); } @@ -631,7 +631,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // the remaining one is on the plane. For that case we // have to reduce the edge count by one to prevent // doubling up. - if(i==j&&qw==0) { + if (i==j&&qw==0) { double_edge=true; nu[p]=nu[up]; } else { @@ -642,7 +642,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // already k=1; while(nu[p]>=current_vertex_order) add_memory_vorder(vc); - if(mec[nu[p]]==mem[nu[p]]) add_memory(vc,nu[p],stackp2); + if (mec[nu[p]]==mem[nu[p]]) add_memory(vc,nu[p],stackp2); // Copy the edges of the original vertex into the new // one. Delete the edges of the original vertex, and @@ -676,13 +676,13 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq } qs=j; } - if(!double_edge) { + if (!double_edge) { vc.n_copy(p,k,up,qs); vc.n_set(p,0,p_id); } else vc.n_copy(p,0,up,qs); // Add this point to the auxiliary delete stack - if(stackp2==stacke2) add_memory_ds2(stackp2); + if (stackp2==stacke2) add_memory_ds2(stackp2); *(stackp2++)=up; // Look at the edges on either side of the group that was @@ -702,7 +702,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // points lp and up. Create a new vertex between them which // lies on the cutting plane. Since u and l differ by at least // the tolerance, this division should never screw up. - if(stackp==stacke) add_memory_ds(stackp); + if (stackp==stacke) add_memory_ds(stackp); *(stackp++)=up; r=u/(u-l);l=1-r; pts[3*p]=pts[3*lp]*r+pts[3*up]*l; @@ -712,7 +712,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // This point will always have three edges. Connect one of them // to lp. nu[p]=3; - if(mec[3]==mem[3]) add_memory(vc,3,stackp2); + if (mec[3]==mem[3]) add_memory(vc,3,stackp2); vc.n_set_pointer(p,3); vc.n_set(p,0,p_id); vc.n_copy(p,1,up,us); @@ -742,30 +742,30 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq lp=ed[qp][qs]; lw=m_test(lp,l); - if(lw==1) { + if (lw==1) { // The point is still in the cutting space. Just add it // to the delete stack and keep moving. qs=cycle_up(ed[qp][nu[qp]+qs],lp); qp=lp; q=l; - if(stackp==stacke) add_memory_ds(stackp); + if (stackp==stacke) add_memory_ds(stackp); *(stackp++)=qp; - } else if(lw==-1) { + } else if (lw==-1) { // The point is outside of the cutting space, so we've // found an intersected edge. Introduce a regular point // at the point of intersection. Connect it to the // point we just tested. Also connect it to the previous // new point in the facet we're constructing. - if(p==current_vertices) add_memory_vertices(vc); + if (p==current_vertices) add_memory_vertices(vc); r=q/(q-l);l=1-r; pts[3*p]=pts[3*lp]*r+pts[3*qp]*l; pts[3*p+1]=pts[3*lp+1]*r+pts[3*qp+1]*l; pts[3*p+2]=pts[3*lp+2]*r+pts[3*qp+2]*l; nu[p]=3; - if(mec[3]==mem[3]) add_memory(vc,3,stackp2); + if (mec[3]==mem[3]) add_memory(vc,3,stackp2); ls=ed[qp][qs+nu[qp]]; vc.n_set_pointer(p,3); vc.n_set(p,0,p_id); @@ -791,7 +791,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // We're going to introduce a new point right here, but // first we need to figure out the number of edges it // has. - if(p==current_vertices) add_memory_vertices(vc); + if (p==current_vertices) add_memory_vertices(vc); // If the previous vertex detected a double edge, our // new vertex will have one less edge. @@ -816,15 +816,15 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // need to figure out whether we're in a case where we // might be creating a duplicate edge. j=-ed[qp][nu[qp]<<1]; - if(qp==up&&qs==us) { + if (qp==up&&qs==us) { // If we're heading into the final part of the // new facet, then we never worry about the // duplicate edge calculation. new_double_edge=false; - if(j>0) k+=nu[j]; + if (j>0) k+=nu[j]; } else { - if(j>0) { + if (j>0) { // This vertex was visited before, so // count those vertices to the ones we @@ -836,16 +836,16 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // going to move to next is also a // marginal point, so test for that // first. - if(lw==0) { + if (lw==0) { // Now see whether this marginal point // has been visited before. i=-ed[lp][nu[lp]<<1]; - if(i>0) { + if (i>0) { // Now see if the last edge of that other // marginal point actually ends up here. - if(ed[i][nu[i]-1]==j) { + if (ed[i][nu[i]-1]==j) { new_double_edge=true; k-=1; } else new_double_edge=false; @@ -857,7 +857,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // case when that's the way into the end // of the facet, because that way always creates // an edge. - if(j==rp&&lp==up&&ed[qp][nu[qp]+qs]==us) { + if (j==rp&&lp==up&&ed[qp][nu[qp]+qs]==us) { new_double_edge=true; k-=1; } else new_double_edge=false; @@ -868,7 +868,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // The vertex hasn't been visited // before, but let's see if it's // marginal - if(lw==0) { + if (lw==0) { // If it is, we need to check // for the case that it's a @@ -876,7 +876,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // heading right back to where // we came from i=-ed[lp][nu[lp]<<1]; - if(i==cp) { + if (i==cp) { new_double_edge=true; k-=1; } else new_double_edge=false; @@ -888,16 +888,16 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // we are forming. Add memory for it if it doesn't exist // already. while(k>=current_vertex_order) add_memory_vorder(vc); - if(mec[k]==mem[k]) add_memory(vc,k,stackp2); + if (mec[k]==mem[k]) add_memory(vc,k,stackp2); // Now create a new vertex with order k, or augment // the existing one - if(j>0) { + if (j>0) { // If we're augmenting a vertex but we don't // actually need any more edges, just skip this // routine to avoid memory confusion - if(nu[j]!=k) { + if (nu[j]!=k) { // Allocate memory and copy the edges // of the previous instance into it vc.n_set_aux1(k); @@ -915,8 +915,8 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // fewer vertices from the memory // structure edd=mep[nu[j]]+((nu[j]<<1)+1)*--mec[nu[j]]; - if(edd!=ed[j]) { - for(lw=0;lw<=(nu[j]<<1);lw++) ed[j][lw]=edd[lw]; + if (edd!=ed[j]) { + for (lw=0;lw<=(nu[j]<<1);lw++) ed[j][lw]=edd[lw]; vc.n_set_aux2_copy(j,nu[j]); vc.n_copy_pointer(edd[nu[j]<<1],j); ed[edd[nu[j]<<1]]=ed[j]; @@ -930,7 +930,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq vc.n_set_pointer(p,k); ed[p]=mep[k]+((k<<1)+1)*mec[k]++; ed[p][k<<1]=p; - if(stackp2==stacke2) add_memory_ds2(stackp2); + if (stackp2==stacke2) add_memory_ds2(stackp2); *(stackp2++)=qp; pts[3*p]=pts[3*qp]; pts[3*p+1]=pts[3*qp+1]; @@ -944,7 +944,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq // Unless the previous case was a double edge, connect // the first available edge of the new vertex to the // last one in the facet - if(!double_edge) { + if (!double_edge) { ed[j][i]=cp; ed[j][nu[j]+i]=cs; vc.n_set(j,i,p_id); @@ -988,7 +988,7 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq dsp=ds; while(dsp0) voro_fatal_error("Zero order vertex formed",VOROPP_INTERNAL_ERROR); + if (*mec>0) voro_fatal_error("Zero order vertex formed",VOROPP_INTERNAL_ERROR); // Collapse any order 2 vertices and exit return collapse_order2(vc); @@ -1080,14 +1080,14 @@ bool voronoicell_base::nplane(vc_class &vc,double x,double y,double z,double rsq * was successful. */ template inline bool voronoicell_base::collapse_order2(vc_class &vc) { - if(!collapse_order1(vc)) return false; + if (!collapse_order1(vc)) return false; int a,b,i,j,k,l; while(mec[2]>0) { // Pick a order 2 vertex and read in its edges i=--mec[2]; j=mep[2][5*i];k=mep[2][5*i+1]; - if(j==k) { + if (j==k) { #if VOROPP_VERBOSE >=1 fputs("Order two vertex joins itself",stderr); #endif @@ -1095,33 +1095,33 @@ inline bool voronoicell_base::collapse_order2(vc_class &vc) { } // Scan the edges of j to see if joins k - for(l=0;l=1 - if(i<1) { + if (i<1) { fputs("Zero order vertex formed\n",stderr); return false; } #endif - if(mec[i]==mem[i]) add_memory(vc,i,ds2); + if (mec[i]==mem[i]) add_memory(vc,i,ds2); vc.n_set_aux1(i); - for(l=0;l &v) { v.clear(); int i,j,k,l,m,n; double ux,uy,uz,vx,vy,vz,wx,wy,wz; - for(i=1;i=0) { + if (k>=0) { area=0; ed[i][j]=-1-k; l=cycle_up(ed[i][nu[i]+j],k); @@ -1261,8 +1261,8 @@ void voronoicell_base::face_areas(std::vector &v) { * internal error if it encounters a positive edge. */ inline void voronoicell_base::reset_edges() { int i,j; - for(i=0;i=0) voro_fatal_error("Edge reset routine found a previously untested edge",VOROPP_INTERNAL_ERROR); + for (i=0;i=0) voro_fatal_error("Edge reset routine found a previously untested edge",VOROPP_INTERNAL_ERROR); ed[i][j]=-1-ed[i][j]; } } @@ -1282,9 +1282,9 @@ inline int voronoicell_base::m_test(int n,double &ans) { ans=*(pp++)*px; ans+=*(pp++)*py; ans+=*pp*pz-prsq; - if(ans<-tolerance2) { + if (ans<-tolerance2) { return -1; - } else if(ans>tolerance2) { + } else if (ans>tolerance2) { return 1; } return check_marginal(n,ans); @@ -1304,16 +1304,16 @@ inline int voronoicell_base::m_test(int n,double &ans) { * plane, or 0 if the point is within the plane. */ int voronoicell_base::check_marginal(int n,double &ans) { int i; - for(i=0;imax_marginal) + if (current_marginal>max_marginal) voro_fatal_error("Marginal case buffer allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR); #if VOROPP_VERBOSE >=2 fprintf(stderr,"Marginal cases buffer scaled up to %d\n",i); #endif int *pmarg=new int[current_marginal]; - for(int j=0;j=0) { + if (k>=0) { ed[i][j]=-1-k; q=ne[i][j]; l=cycle_up(ed[i][nu[i]+j],k); do { m=ed[k][l]; ed[k][l]=-1-m; - if(ne[k][l]!=q) fprintf(stderr,"Facet error at (%d,%d)=%d, started from (%d,%d)=%d\n",k,l,ne[k][l],i,j,q); + if (ne[k][l]!=q) fprintf(stderr,"Facet error at (%d,%d)=%d, started from (%d,%d)=%d\n",k,l,ne[k][l],i,j,q); l=cycle_up(ed[k][nu[k]+l],m); k=m; } while (k!=i); @@ -1371,15 +1371,15 @@ voronoicell_neighbor::voronoicell_neighbor() { int i; mne=new int*[current_vertex_order]; ne=new int*[current_vertices]; - for(i=0;i<3;i++) mne[i]=new int[init_n_vertices*i]; + for (i=0;i<3;i++) mne[i]=new int[init_n_vertices*i]; mne[3]=new int[init_3_vertices*3]; - for(i=4;i=0;i--) if(mem[i]>0) delete [] mne[i]; + for (int i=current_vertex_order-1;i>=0;i--) if (mem[i]>0) delete [] mne[i]; delete [] mne; delete [] ne; } @@ -1388,9 +1388,9 @@ voronoicell_neighbor::~voronoicell_neighbor() { void voronoicell_neighbor::neighbors(std::vector &v) { v.clear(); int i,j,k,l,m; - for(i=1;i=0) { + if (k>=0) { v.push_back(ne[i][j]); ed[i][j]=-1-k; l=cycle_up(ed[i][nu[i]+j],k); @@ -1409,9 +1409,9 @@ void voronoicell_neighbor::neighbors(std::vector &v) { * \return The number of faces. */ int voronoicell_base::number_of_faces() { int i,j,k,l,m,s=0; - for(i=1;i=0) { + if (k>=0) { s++; ed[i][j]=-1-k; l=cycle_up(ed[i][nu[i]+j],k); @@ -1435,7 +1435,7 @@ int voronoicell_base::number_of_faces() { void voronoicell_base::vertices(double x,double y,double z,std::vector &v) { v.resize(3*p); double *ptsp=pts; - for(int i=0;i<3*p;i+=3) { + for (int i=0;i<3*p;i+=3) { v[i]=x+*(ptsp++)*0.5; v[i+1]=y+*(ptsp++)*0.5; v[i+2]=z+*(ptsp++)*0.5; @@ -1448,9 +1448,9 @@ void voronoicell_base::vertices(double x,double y,double z,std::vector & void voronoicell_base::face_vertices(std::vector &v) { int i,j,k,l,m,vp(0),vn; v.clear(); - for(i=1;i=0) { + if (k>=0) { v.push_back(0); v.push_back(i); ed[i][j]=-1-k; diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 26a4716704..82dd76a1b5 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -526,7 +526,7 @@ void FixQBMSST::initial_integrate(int /*vflag*/) // load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H for (int k = 0; k < 2*N_f; k++) { double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 - if(k == N_f) { + if (k == N_f) { omega_H[k]=sqrt(force->boltz * t_current); } else { double energy_k= force->hplanck * fabs(f_k); diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index 16e01faa54..31f0808ca7 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -201,7 +201,7 @@ void FixQTB::init() // load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H for (int k = 0; k < 2*N_f; k++) { double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 - if(k == N_f) { + if (k == N_f) { omega_H[k]=sqrt(force->boltz * t_target); } else { double energy_k= force->hplanck * fabs(f_k); diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 0cbc71e564..3ca19285f6 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -162,17 +162,17 @@ void PairQUIP::compute(int eflag, int vflag) iquip = 0; for (ii = 0; ii < ntotal; ii++) { - for( jj = 0; jj < 3; jj++ ) { + for ( jj = 0; jj < 3; jj++ ) { f[ii][jj] += quip_force[iquip]; iquip++; } } - if(eflag_global) { + if (eflag_global) { eng_vdwl = quip_energy; } - if(eflag_atom) { + if (eflag_atom) { for (ii = 0; ii < ntotal; ii++) { eatom[ii] = quip_local_e[ii]; } @@ -187,9 +187,9 @@ void PairQUIP::compute(int eflag, int vflag) virial[5] = (quip_virial[5] + quip_virial[7])*0.5; } - if(vflag_atom) { + if (vflag_atom) { int iatom = 0; - for(ii = 0; ii < ntotal; ii++) { + for (ii = 0; ii < ntotal; ii++) { vatom[ii][0] += quip_local_virial[iatom+0]; vatom[ii][1] += quip_local_virial[iatom+4]; vatom[ii][2] += quip_local_virial[iatom+8]; diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 2bfc7714be..e5413c6af7 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -3400,7 +3400,7 @@ void FixBondReact::ReadConstraints(char *line, int myrxn) } else if (ptr = strstr(line,"||")) { strcat(constraintstr[myrxn],"||"); *ptr = '\0'; - } else if (i+1 < nconstraints[myrxn]){ + } else if (i+1 < nconstraints[myrxn]) { strcat(constraintstr[myrxn],"&&"); } if (ptr = strchr(line,')')) diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 6db17d4d61..abe6f26081 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -811,16 +811,16 @@ int FixQEqReax::pack_forward_comm(int n, int *list, double *buf, int m; if (pack_flag == 1) - for(m = 0; m < n; m++) buf[m] = d[list[m]]; + for (m = 0; m < n; m++) buf[m] = d[list[m]]; else if (pack_flag == 2) - for(m = 0; m < n; m++) buf[m] = s[list[m]]; + for (m = 0; m < n; m++) buf[m] = s[list[m]]; else if (pack_flag == 3) - for(m = 0; m < n; m++) buf[m] = t[list[m]]; + for (m = 0; m < n; m++) buf[m] = t[list[m]]; else if (pack_flag == 4) - for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; + for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; else if (pack_flag == 5) { m = 0; - for(int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { int j = 2 * list[i]; buf[m++] = d[j ]; buf[m++] = d[j+1]; @@ -837,17 +837,17 @@ void FixQEqReax::unpack_forward_comm(int n, int first, double *buf) int i, m; if (pack_flag == 1) - for(m = 0, i = first; m < n; m++, i++) d[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) d[i] = buf[m]; else if (pack_flag == 2) - for(m = 0, i = first; m < n; m++, i++) s[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) s[i] = buf[m]; else if (pack_flag == 3) - for(m = 0, i = first; m < n; m++, i++) t[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) t[i] = buf[m]; else if (pack_flag == 4) - for(m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; + for (m = 0, i = first; m < n; m++, i++) atom->q[i] = buf[m]; else if (pack_flag == 5) { int last = first + n; m = 0; - for(i = first; i < last; i++) { + for (i = first; i < last; i++) { int j = 2 * i; d[j ] = buf[m++]; d[j+1] = buf[m++]; @@ -863,7 +863,7 @@ int FixQEqReax::pack_reverse_comm(int n, int first, double *buf) if (pack_flag == 5) { m = 0; int last = first + n; - for(i = first; i < last; i++) { + for (i = first; i < last; i++) { int indxI = 2 * i; buf[m++] = q[indxI ]; buf[m++] = q[indxI+1]; @@ -881,7 +881,7 @@ void FixQEqReax::unpack_reverse_comm(int n, int *list, double *buf) { if (pack_flag == 5) { int m = 0; - for(int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { int indxI = 2 * list[i]; q[indxI ] += buf[m++]; q[indxI+1] += buf[m++]; diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 91f7f52ccc..fa115e343e 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -262,7 +262,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, double cutof3 = reaxc->control->bg_cut; MPI_Request irequest, irequest2; - if (me == 0 ){ + if (me == 0 ) { fprintf(fp,"# Timestep " BIGINT_FORMAT " \n",ntimestep); fprintf(fp,"# \n"); fprintf(fp,"# Number of particles %d \n",natoms); @@ -315,7 +315,7 @@ void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, MPI_Isend(&buf[0],nbuf_local,MPI_DOUBLE,0,0,world,&irequest2); MPI_Wait(&irequest2,MPI_STATUS_IGNORE); } - if(me ==0) fprintf(fp,"# \n"); + if (me ==0) fprintf(fp,"# \n"); } diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index d3507bdf85..1fb6eb9005 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -420,7 +420,7 @@ void PairReaxC::init_style( ) error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an " "increased neighbor list skin."); - for( int i = 0; i < LIST_N; ++i ) + for ( int i = 0; i < LIST_N; ++i ) if (lists[i].allocated != 1) lists[i].allocated = 0; @@ -470,7 +470,7 @@ void PairReaxC::setup( ) int num_nbrs = estimate_reax_lists(); if (num_nbrs < 0) error->all(FLERR,"Too many neighbors for pair style reax/c"); - if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, + if (!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR, lists+FAR_NBRS)) error->all(FLERR,"Pair reax/c problem in far neighbor list"); (lists+FAR_NBRS)->error_ptr=error; @@ -478,7 +478,7 @@ void PairReaxC::setup( ) write_reax_lists(); Initialize( system, control, data, workspace, &lists, out_control, mpi_data, world ); - for( int k = 0; k < system->N; ++k ) { + for ( int k = 0; k < system->N; ++k ) { num_bonds[k] = system->my_atoms[k].num_bonds; num_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -491,7 +491,7 @@ void PairReaxC::setup( ) // reset the bond list info for new atoms - for(int k = oldN; k < system->N; ++k) + for (int k = oldN; k < system->N; ++k) Set_End_Index( k, Start_Index( k, lists+BONDS ), lists+BONDS ); // check if I need to shrink/extend my data-structs @@ -560,7 +560,7 @@ void PairReaxC::compute(int eflag, int vflag) Compute_Forces(system,control,data,workspace,&lists,out_control,mpi_data); read_reax_forces(vflag); - for(int k = 0; k < system->N; ++k) { + for (int k = 0; k < system->N; ++k) { num_bonds[k] = system->my_atoms[k].num_bonds; num_hbonds[k] = system->my_atoms[k].num_hbonds; } @@ -616,7 +616,7 @@ void PairReaxC::compute(int eflag, int vflag) // populate tmpid and tmpbo arrays for fix reax/c/species int i, j; - if(fixspecies_flag) { + if (fixspecies_flag) { if (system->N > nmax) { memory->destroy(tmpid); memory->destroy(tmpbo); @@ -645,7 +645,7 @@ void PairReaxC::write_reax_atoms() if (system->N > system->total_cap) error->all(FLERR,"Too many ghost atoms"); - for( int i = 0; i < system->N; ++i ){ + for ( int i = 0; i < system->N; ++i ) { system->my_atoms[i].orig_id = atom->tag[i]; system->my_atoms[i].type = map[atom->type[i]]; system->my_atoms[i].x[0] = atom->x[i][0]; @@ -703,13 +703,13 @@ int PairReaxC::estimate_reax_lists() int numall = list->inum + list->gnum; - for( itr_i = 0; itr_i < numall; ++itr_i ){ + for ( itr_i = 0; itr_i < numall; ++itr_i ) { i = ilist[itr_i]; marked[i] = 1; ++num_marked; jlist = firstneigh[i]; - for( itr_j = 0; itr_j < numneigh[i]; ++itr_j ){ + for ( itr_j = 0; itr_j < numneigh[i]; ++itr_j ) { j = jlist[itr_j]; j &= NEIGHMASK; get_distance( x[j], x[i], &d_sqr, &dvec ); @@ -751,7 +751,7 @@ int PairReaxC::write_reax_lists() int numall = list->inum + list->gnum; - for( itr_i = 0; itr_i < numall; ++itr_i ){ + for ( itr_i = 0; itr_i < numall; ++itr_i ) { i = ilist[itr_i]; jlist = firstneigh[i]; Set_Start_Index( i, num_nbrs, far_nbrs ); @@ -761,7 +761,7 @@ int PairReaxC::write_reax_lists() else cutoff_sqr = control->bond_cut*control->bond_cut; - for( itr_j = 0; itr_j < numneigh[i]; ++itr_j ){ + for ( itr_j = 0; itr_j < numneigh[i]; ++itr_j ) { j = jlist[itr_j]; j &= NEIGHMASK; get_distance( x[j], x[i], &d_sqr, &dvec ); @@ -784,7 +784,7 @@ int PairReaxC::write_reax_lists() void PairReaxC::read_reax_forces(int /*vflag*/) { - for( int i = 0; i < system->N; ++i ) { + for ( int i = 0; i < system->N; ++i ) { system->my_atoms[i].f[0] = workspace->f[i][0]; system->my_atoms[i].f[1] = workspace->f[i][1]; system->my_atoms[i].f[2] = workspace->f[i][2]; @@ -846,7 +846,7 @@ double PairReaxC::memory_usage() bytes += lists->num_intrs * sizeof(far_neighbor_data); bytes += lists->num_intrs * sizeof(hbond_data); - if(fixspecies_flag) + if (fixspecies_flag) bytes += 2 * nmax * MAXSPECBOND * sizeof(double); return bytes; @@ -864,7 +864,7 @@ void PairReaxC::FindBond() for (i = 0; i < system->n; i++) { nj = 0; - for( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { + for ( pj = Start_Index(i, lists); pj < End_Index(i, lists); ++pj ) { bo_ij = &( lists->select.bond_list[pj] ); j = bo_ij->nbr; if (j < i) continue; diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 8e7c8b2b23..f017eae41e 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -322,7 +322,7 @@ static void Reallocate_Neighbor_List( reax_list *far_nbrs, int n, int num_intrs ) { Delete_List( far_nbrs); - if(!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs )){ + if (!Make_List( n, num_intrs, TYP_FAR_NEIGHBOR, far_nbrs )) { far_nbrs->error_ptr->one(FLERR,"Problem in initializing far neighbors list"); } } @@ -361,7 +361,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, *total_bonds = 0; *est_3body = 0; - for( i = 0; i < system->N; ++i ){ + for( i = 0; i < system->N; ++i ) { *est_3body += SQR(system->my_atoms[i].num_bonds); *total_bonds += system->my_atoms[i].num_bonds; } @@ -374,7 +374,7 @@ static int Reallocate_Bonds_List( reax_system *system, reax_list *bonds, #endif Delete_List( bonds); - if(!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds)) { + if (!Make_List(system->total_cap, *total_bonds, TYP_BOND, bonds)) { bonds->error_ptr->one(FLERR, "Not enough space for bonds list"); } @@ -410,13 +410,13 @@ void ReAllocate( reax_system *system, control_params *control, realloc = &(workspace->realloc); - if( system->n >= DANGER_ZONE * system->local_cap || + if ( system->n >= DANGER_ZONE * system->local_cap || (0 && system->n <= LOOSE_ZONE * system->local_cap) ) { system->local_cap = MAX( (int)(system->n * safezone), mincap ); } int Nflag = 0; - if( system->N >= DANGER_ZONE * system->total_cap || + if ( system->N >= DANGER_ZONE * system->total_cap || (0 && system->N <= LOOSE_ZONE * system->total_cap) ) { Nflag = 1; system->total_cap = MAX( (int)(system->N * safezone), mincap ); @@ -466,7 +466,7 @@ void ReAllocate( reax_system *system, control_params *control, /* hydrogen bonds list */ if (control->hbond_cut > 0) { Hflag = 0; - if( system->numH >= DANGER_ZONE * system->Hcap || + if ( system->numH >= DANGER_ZONE * system->Hcap || (0 && system->numH <= LOOSE_ZONE * system->Hcap) ) { Hflag = 1; system->Hcap = int(MAX( system->numH * saferzone, mincap )); @@ -496,7 +496,7 @@ void ReAllocate( reax_system *system, control_params *control, realloc->num_3body = (int)(MAX(realloc->num_3body*safezone, MIN_3BODIES)); - if( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, + if ( !Make_List( num_bonds, realloc->num_3body, TYP_THREE_BODY, (*lists)+THREE_BODIES ) ) { system->error_ptr->one(FLERR, "Problem in initializing angles list"); } diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index afa6c0ba5e..a9985d79f3 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -558,7 +558,7 @@ void BO( reax_system *system, control_params * /*control*/, simulation_data * /* } p_lp1 = system->reax_param.gp.l[15]; - for( j = 0; j < system->N; ++j ){ + for( j = 0; j < system->N; ++j ) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; sbp_j = &(system->reax_param.sbp[ type_j ]); diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index dd5b8ad89e..91dc38d56d 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -104,7 +104,7 @@ void Bonds( reax_system *system, control_params * /*control*/, /* Stabilisation terminal triple bond */ if (bo_ij->BO >= 1.00) { - if( gp37 == 2 || + if ( gp37 == 2 || (sbp_i->mass == 12.0000 && sbp_j->mass == 15.9990) || (sbp_j->mass == 12.0000 && sbp_i->mass == 15.9990) ) { exphu = exp( -gp7 * SQR(bo_ij->BO - 2.50) ); diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index b805e46bf9..ab183bdaa4 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -134,7 +134,7 @@ char Read_Control_File( char *control_file, control_params* control, ival = atoi(tmp[1]); control->nsteps = ival; } - else if( strcmp(tmp[0], "dt") == 0) { + else if ( strcmp(tmp[0], "dt") == 0) { val = atof(tmp[1]); control->dt = val * 1.e-3; // convert dt from fs to ps! } diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 5181415a9f..13e01c3a53 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -303,7 +303,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Equate vval3 to valf for first-row elements (25/10/2004) */ for( i = 0; i < reax->num_atom_types; i++ ) - if( reax->sbp[i].mass < 21 && + if ( reax->sbp[i].mass < 21 && reax->sbp[i].valency_val != reax->sbp[i].valency_boc ) { if (me == 0) { char errmsg[256]; diff --git a/src/USER-REAXC/reaxc_forces.cpp b/src/USER-REAXC/reaxc_forces.cpp index 2ebffed25e..3cc66b7530 100644 --- a/src/USER-REAXC/reaxc_forces.cpp +++ b/src/USER-REAXC/reaxc_forces.cpp @@ -155,7 +155,7 @@ void Validate_Lists( reax_system *system, storage * /*workspace*/, reax_list **l (int)(MAX(Num_Entries(Hindex, hbonds)*saferzone, system->minhbonds)); //if( Num_Entries(i, hbonds) >= - //(Start_Index(i+1,hbonds)-Start_Index(i,hbonds))*0.90/*DANGER_ZONE*/){ + //(Start_Index(i+1,hbonds)-Start_Index(i,hbonds))*0.90/*DANGER_ZONE*/) { // workspace->realloc.hbonds = 1; if (Hindex < numH-1) @@ -367,7 +367,7 @@ void Estimate_Storages( reax_system *system, control_params *control, j = nbr_pj->nbr; atom_j = &(system->my_atoms[j]); - if(nbr_pj->d <= cutoff) { + if (nbr_pj->d <= cutoff) { type_j = system->my_atoms[j].type; if (type_j < 0) continue; r_ij = nbr_pj->d; @@ -384,7 +384,7 @@ void Estimate_Storages( reax_system *system, control_params *control, jhb = sbp_j->p_hbond; if (ihb == 1 && jhb == 2) ++hb_top[i]; - else if( j < system->n && ihb == 2 && jhb == 1 ) + else if ( j < system->n && ihb == 2 && jhb == 1 ) ++hb_top[j]; } } diff --git a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp index 780b5f04a4..680f069bab 100644 --- a/src/USER-REAXC/reaxc_hydrogen_bonds.cpp +++ b/src/USER-REAXC/reaxc_hydrogen_bonds.cpp @@ -80,7 +80,7 @@ void Hydrogen_Bonds( reax_system *system, control_params *control, if (type_i < 0) continue; bo_ij = &(pbond_ij->bo_data); - if( system->reax_param.sbp[type_i].p_hbond == 2 && + if ( system->reax_param.sbp[type_i].p_hbond == 2 && bo_ij->BO >= HB_THRESHOLD ) hblist[top++] = pi; } diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index e651f272ac..e7d46fa742 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -58,7 +58,7 @@ int Init_System(reax_system *system, control_params *control, char * /*msg*/) /* estimate numH and Hcap */ system->numH = 0; if (control->hbond_cut > 0) - for(i = 0; i < system->n; ++i) { + for (i = 0; i < system->n; ++i) { atom = &(system->my_atoms[i]); if (system->reax_param.sbp[ atom->type ].p_hbond == 1 && atom->type >= 0) atom->Hindex = system->numH++; @@ -101,7 +101,7 @@ void Init_Taper(control_params *control, storage *workspace) if (swb < 0) { error->all(FLERR,"Negative upper Taper-radius cutoff"); } - else if(swb < 5 && control->me == 0) { + else if (swb < 5 && control->me == 0) { char errmsg[256]; snprintf(errmsg, 256, "Very low Taper-radius cutoff: %f", swb); error->warning(FLERR, errmsg); @@ -178,13 +178,13 @@ int Init_Lists(reax_system *system, control_params *control, if (control->hbond_cut > 0) { /* init H indexes */ total_hbonds = 0; - for(i = 0; i < system->n; ++i) { + for (i = 0; i < system->n; ++i) { system->my_atoms[i].num_hbonds = hb_top[i]; total_hbonds += hb_top[i]; } total_hbonds = (int)(MAX(total_hbonds*saferzone,mincap*system->minhbonds)); - if(!Make_List(system->Hcap, total_hbonds, TYP_HBOND, + if (!Make_List(system->Hcap, total_hbonds, TYP_HBOND, *lists+HBONDS)) error->one(FLERR, "Not enough space for hbonds list."); @@ -192,13 +192,13 @@ int Init_Lists(reax_system *system, control_params *control, } total_bonds = 0; - for(i = 0; i < system->N; ++i) { + for (i = 0; i < system->N; ++i) { system->my_atoms[i].num_bonds = bond_top[i]; total_bonds += bond_top[i]; } bond_cap = (int)(MAX(total_bonds*safezone, mincap*MIN_BONDS)); - if(!Make_List(system->total_cap, bond_cap, TYP_BOND, + if (!Make_List(system->total_cap, bond_cap, TYP_BOND, *lists+BONDS)) error->one(FLERR, "Not enough space for bonds list."); @@ -206,7 +206,7 @@ int Init_Lists(reax_system *system, control_params *control, /* 3bodies list */ cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES)); - if(!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, + if (!Make_List(bond_cap, cap_3body, TYP_THREE_BODY, *lists+THREE_BODIES)) error->one(FLERR,"Problem in initializing angles list."); diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index 3e1c00307d..6ac64a17bc 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -61,7 +61,7 @@ int Init_Output_Files( reax_system *system, control_params *control, } /* init pressure file */ - if( control->ensemble == NPT || + if ( control->ensemble == NPT || control->ensemble == iNPT || control->ensemble == sNPT ) { sprintf( temp, "%s.prs", control->sim_name ); @@ -109,15 +109,15 @@ void Output_Results( reax_system *system, control_params *control, output_controls *out_control, mpi_datatypes *mpi_data ) { - if((out_control->energy_update_freq > 0 && + if ((out_control->energy_update_freq > 0 && data->step%out_control->energy_update_freq == 0) || (out_control->write_steps > 0 && - data->step%out_control->write_steps == 0)){ + data->step%out_control->write_steps == 0)) { /* update system-wide energies */ Compute_System_Energy( system, data, mpi_data->world ); /* output energies */ - if( system->my_rank == MASTER_NODE && + if ( system->my_rank == MASTER_NODE && out_control->energy_update_freq > 0 && data->step % out_control->energy_update_freq == 0 ) { @@ -141,7 +141,7 @@ void Output_Results( reax_system *system, control_params *control, } /* write current frame */ - if( out_control->write_steps > 0 && + if ( out_control->write_steps > 0 && (data->step-data->prev_steps) % out_control->write_steps == 0 ) { Append_Frame( system, control, data, lists, out_control, mpi_data ); } diff --git a/src/USER-REAXC/reaxc_lookup.cpp b/src/USER-REAXC/reaxc_lookup.cpp index e39412ace6..980e6e0fb6 100644 --- a/src/USER-REAXC/reaxc_lookup.cpp +++ b/src/USER-REAXC/reaxc_lookup.cpp @@ -31,20 +31,20 @@ #include "reaxc_tool_box.h" void Tridiagonal_Solve( const double *a, const double *b, - double *c, double *d, double *x, unsigned int n){ + double *c, double *d, double *x, unsigned int n) { int i; double id; c[0] /= b[0]; /* Division by zero risk. */ d[0] /= b[0]; /* Division by zero would imply a singular matrix. */ - for(i = 1; i < (int)n; i++){ + for (i = 1; i < (int)n; i++) { id = (b[i] - c[i-1] * a[i]); /* Division by zero risk. */ c[i] /= id; /* Last value calculated is redundant. */ d[i] = (d[i] - d[i-1] * a[i])/id; } x[n - 1] = d[n - 1]; - for(i = n - 2; i >= 0; i--) + for (i = n - 2; i >= 0; i--) x[i] = d[i] - c[i] * x[i + 1]; } @@ -64,26 +64,26 @@ void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const d /* build the linear system */ a[0] = a[1] = a[n-1] = 0; - for( i = 2; i < (int)n-1; ++i ) + for ( i = 2; i < (int)n-1; ++i ) a[i] = h[i-1]; b[0] = b[n-1] = 0; - for( i = 1; i < (int)n-1; ++i ) + for ( i = 1; i < (int)n-1; ++i ) b[i] = 2 * (h[i-1] + h[i]); c[0] = c[n-2] = c[n-1] = 0; - for( i = 1; i < (int)n-2; ++i ) + for ( i = 1; i < (int)n-2; ++i ) c[i] = h[i]; d[0] = d[n-1] = 0; - for( i = 1; i < (int)n-1; ++i ) + for ( i = 1; i < (int)n-1; ++i ) d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); v[0] = 0; v[n-1] = 0; Tridiagonal_Solve( &(a[1]), &(b[1]), &(c[1]), &(d[1]), &(v[1]), n-2 ); - for( i = 1; i < (int)n; ++i ){ + for ( i = 1; i < (int)n; ++i ) { coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); coef[i-1].c = v[i]/2; coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; @@ -114,25 +114,25 @@ void Complete_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const /* build the linear system */ a[0] = 0; - for( i = 1; i < (int)n; ++i ) + for ( i = 1; i < (int)n; ++i ) a[i] = h[i-1]; b[0] = 2*h[0]; - for( i = 1; i < (int)n; ++i ) + for ( i = 1; i < (int)n; ++i ) b[i] = 2 * (h[i-1] + h[i]); c[n-1] = 0; - for( i = 0; i < (int)n-1; ++i ) + for ( i = 0; i < (int)n-1; ++i ) c[i] = h[i]; d[0] = 6 * (f[1]-f[0])/h[0] - 6 * v0; d[n-1] = 6 * vlast - 6 * (f[n-1]-f[n-2]/h[n-2]); - for( i = 1; i < (int)n-1; ++i ) + for ( i = 1; i < (int)n-1; ++i ) d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]); Tridiagonal_Solve( &(a[0]), &(b[0]), &(c[0]), &(d[0]), &(v[0]), n ); - for( i = 1; i < (int)n; ++i ){ + for ( i = 1; i < (int)n; ++i ) { coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]); coef[i-1].c = v[i]/2; coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6; @@ -181,21 +181,21 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, LR = (LR_lookup_table**) scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table*), "lookup:LR"); - for( i = 0; i < num_atom_types; ++i ) + for ( i = 0; i < num_atom_types; ++i ) LR[i] = (LR_lookup_table*) scalloc(system->error_ptr, num_atom_types, sizeof(LR_lookup_table), "lookup:LR[i]"); - for( i = 0; i < REAX_MAX_ATOM_TYPES; ++i ) + for ( i = 0; i < REAX_MAX_ATOM_TYPES; ++i ) existing_types[i] = 0; - for( i = 0; i < system->n; ++i ) + for ( i = 0; i < system->n; ++i ) existing_types[ system->my_atoms[i].type ] = 1; MPI_Allreduce( existing_types, aggregated, REAX_MAX_ATOM_TYPES, MPI_INT, MPI_SUM, mpi_data->world ); - for( i = 0; i < num_atom_types; ++i ) { + for ( i = 0; i < num_atom_types; ++i ) { if (aggregated[i]) { - for( j = i; j < num_atom_types; ++j ) { + for ( j = i; j < num_atom_types; ++j ) { if (aggregated[j]) { LR[i][j].xmin = 0; LR[i][j].xmax = control->nonb_cut; @@ -216,7 +216,7 @@ int Init_Lookup_Tables( reax_system *system, control_params *control, smalloc(system->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef), "lookup:LR[i,j].CEclmb"); - for( r = 1; r <= control->tabulate; ++r ) { + for ( r = 1; r <= control->tabulate; ++r ) { LR_vdW_Coulomb( system, workspace, control, i, j, r * dr, &(LR[i][j].y[r]) ); h[r] = LR[i][j].dx; fh[r] = LR[i][j].y[r].H; @@ -277,8 +277,8 @@ void Deallocate_Lookup_Tables( reax_system *system ) ntypes = system->reax_param.num_atom_types; - for( i = 0; i < ntypes; ++i ) { - for( j = i; j < ntypes; ++j ) + for ( i = 0; i < ntypes; ++i ) { + for ( j = i; j < ntypes; ++j ) if (LR[i][j].n) { sfree(system->error_ptr, LR[i][j].y, "LR[i,j].y" ); sfree(system->error_ptr, LR[i][j].H, "LR[i,j].H" ); diff --git a/src/USER-REAXC/reaxc_nonbonded.cpp b/src/USER-REAXC/reaxc_nonbonded.cpp index ccb8f0fed0..7c3350fd40 100644 --- a/src/USER-REAXC/reaxc_nonbonded.cpp +++ b/src/USER-REAXC/reaxc_nonbonded.cpp @@ -75,7 +75,7 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, orig_j = system->my_atoms[j].orig_id; flag = 0; - if(nbr_pj->d <= control->nonb_cut) { + if (nbr_pj->d <= control->nonb_cut) { if (j < natoms) flag = 1; else if (orig_i < orig_j) flag = 1; else if (orig_i == orig_j) { @@ -110,7 +110,7 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, dTap += workspace->Tap[1]/r_ij; /*vdWaals Calculations*/ - if(system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) { // shielding powr_vdW1 = pow(r_ij, p_vdW1); powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); @@ -139,7 +139,7 @@ void vdW_Coulomb_Energy( reax_system *system, control_params *control, Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - if(system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) { // inner wall e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); data->my_en.e_vdW += Tap * e_core; @@ -243,7 +243,7 @@ void Tabulated_vdW_Coulomb_Energy( reax_system *system,control_params *control, orig_j = system->my_atoms[j].orig_id; flag = 0; - if(nbr_pj->d <= control->nonb_cut) { + if (nbr_pj->d <= control->nonb_cut) { if (j < natoms) flag = 1; else if (orig_i < orig_j) flag = 1; else if (orig_i == orig_j) { @@ -372,7 +372,7 @@ void LR_vdW_Coulomb( reax_system *system, storage *workspace, dTap += workspace->Tap[1]/r_ij; /*vdWaals Calculations*/ - if(system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==1 || system->reax_param.gp.vdw_type==3) { // shielding powr_vdW1 = pow(r_ij, p_vdW1); powgi_vdW1 = pow( 1.0 / twbp->gamma_w, p_vdW1); @@ -397,7 +397,7 @@ void LR_vdW_Coulomb( reax_system *system, storage *workspace, Tap * twbp->D * (twbp->alpha / twbp->r_vdW) * (exp1 - exp2) / r_ij; } - if(system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) + if (system->reax_param.gp.vdw_type==2 || system->reax_param.gp.vdw_type==3) { // inner wall e_core = twbp->ecore * exp(twbp->acore * (1.0-(r_ij/twbp->rcore))); lr->e_vdW += Tap * e_core; diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index 380fbf4a02..c49b095b20 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -85,9 +85,9 @@ double Calculate_Omega( rvec dvec_ij, double r_ij, if (arg < -1.0) arg = -1.0; if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) sin_ijk = MIN_SINE; - else if( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) sin_ijk = -MIN_SINE; + else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) sin_ijk = -MIN_SINE; if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) sin_jkl = MIN_SINE; - else if( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) sin_jkl = -MIN_SINE; + else if ( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) sin_jkl = -MIN_SINE; // dcos_omega_di rvec_ScaledSum( dcos_omega_di, (htra-arg*hnra)/r_ij, dvec_ij, -1., dvec_li ); @@ -230,7 +230,7 @@ void Torsion_Angles( reax_system *system, control_params *control, //tan_ijk_i = 1. / tan( theta_ijk ); if (sin_ijk >= 0 && sin_ijk <= MIN_SINE) tan_ijk_i = cos_ijk / MIN_SINE; - else if( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) + else if ( sin_ijk <= 0 && sin_ijk >= -MIN_SINE ) tan_ijk_i = cos_ijk / -MIN_SINE; else tan_ijk_i = cos_ijk / sin_ijk; @@ -249,9 +249,9 @@ void Torsion_Angles( reax_system *system, control_params *control, fbp = &(system->reax_param.fbp[type_i][type_j] [type_k][type_l].prm[0]); - if( i != l && fbh->cnt && + if ( i != l && fbh->cnt && bo_kl->BO > control->thb_cut/*0*/ && - bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/ ){ + bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/ ) { ++num_frb_intrs; r_kl = pbond_kl->d; BOA_kl = bo_kl->BO - control->thb_cut; @@ -262,7 +262,7 @@ void Torsion_Angles( reax_system *system, control_params *control, //tan_jkl_i = 1. / tan( theta_jkl ); if (sin_jkl >= 0 && sin_jkl <= MIN_SINE) tan_jkl_i = cos_jkl / MIN_SINE; - else if( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) + else if ( sin_jkl <= 0 && sin_jkl >= -MIN_SINE ) tan_jkl_i = cos_jkl / -MIN_SINE; else tan_jkl_i = cos_jkl /sin_jkl; diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index b71d883c7d..2d56722aba 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -578,7 +578,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, for( i=0; i < system->n; ++i ) for( pj = Start_Index(i, bonds); pj < End_Index(i, bonds); ++pj ) { j = bonds->select.bond_list[pj].nbr; - if( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && bonds->select.bond_list[pj].bo_data.BO >= control->bg_cut ) ++my_bonds; } @@ -605,7 +605,7 @@ int Write_Bonds(reax_system *system, control_params *control, reax_list *bonds, bo_ij = &( bonds->select.bond_list[pj] ); j = bo_ij->nbr; - if( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && + if ( system->my_atoms[i].orig_id <= system->my_atoms[j].orig_id && bo_ij->bo_data.BO >= control->bg_cut ) { switch( out_control->bond_info ) { case OPT_BOND_BASIC: @@ -678,7 +678,7 @@ int Write_Angles( reax_system *system, control_params *control, k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - if( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + if ( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && bo_jk->bo_data.BO >= control->bg_cut ) // physical j&k bond ++my_angles; } @@ -711,7 +711,7 @@ int Write_Angles( reax_system *system, control_params *control, k = angle_ijk->thb; bo_jk = &(bonds->select.bond_list[ angle_ijk->pthb ]); - if( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && + if ( system->my_atoms[i].orig_id < system->my_atoms[k].orig_id && bo_jk->bo_data.BO >= control->bg_cut ) { // physical j&k bond sprintf( out_control->line, ANGLE_BASIC, system->my_atoms[i].orig_id, system->my_atoms[j].orig_id, diff --git a/src/USER-REAXC/reaxc_valence_angles.cpp b/src/USER-REAXC/reaxc_valence_angles.cpp index 14c57773c7..b545fa93a9 100644 --- a/src/USER-REAXC/reaxc_valence_angles.cpp +++ b/src/USER-REAXC/reaxc_valence_angles.cpp @@ -176,7 +176,7 @@ void Valence_Angles( reax_system *system, control_params *control, BOA_ij = bo_ij->BO - control->thb_cut; - if( BOA_ij/*bo_ij->BO*/ > 0.0 && + if ( BOA_ij/*bo_ij->BO*/ > 0.0 && ( j < system->n || pbond_ij->nbr < system->n ) ) { i = pbond_ij->nbr; type_i = system->my_atoms[i].type; diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index 9cc7c408c1..ab28589f20 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -226,7 +226,7 @@ void Scafacos::compute(int eflag, int vflag) memcpy(xpbc,&x[0][0],3*nlocal*sizeof(double)); - if (domain->xperiodic || domain -> yperiodic || domain -> zperiodic){ + if (domain->xperiodic || domain -> yperiodic || domain -> zperiodic) { int j = 0; for (int i = 0; i < nlocal; i++) { domain->remap(&xpbc[j]); @@ -321,7 +321,7 @@ int Scafacos::modify_param(int narg, char **arg) else error->all(FLERR, "Illegal kspace_modify command (tolerance argument)"); // check if method is compatatible to chosen tolerance type - if( + if ( ( strcmp(method,"fmm") == 0 && ( diff --git a/src/USER-SMD/compute_smd_triangle_vertices.cpp b/src/USER-SMD/compute_smd_triangle_vertices.cpp index 9f2f11ebdf..f621029a47 100644 --- a/src/USER-SMD/compute_smd_triangle_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_vertices.cpp @@ -95,7 +95,7 @@ void ComputeSMDTriangleVertices::compute_peratom() { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if ((mask[i] & groupbit) && (mol[i] >= 65535) ){ + if ((mask[i] & groupbit) && (mol[i] >= 65535) ) { outputVector[i][0] = smd_data_9[i][0]; outputVector[i][1] = smd_data_9[i][1]; outputVector[i][2] = smd_data_9[i][2]; diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index 208be69acc..bf9fcdc1e7 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -679,7 +679,7 @@ void PairTlsph::ComputeForces(int eflag, int vflag) { } // end loop over jj neighbors of i // avoid division by zero and overflow - if ((shepardWeight != 0.0) && (fabs(hourglass_error[i]) < 1.0e300)){ + if ((shepardWeight != 0.0) && (fabs(hourglass_error[i]) < 1.0e300)) { hourglass_error[i] /= shepardWeight; } diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index aedf90da07..5f416955cf 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -501,7 +501,7 @@ void PairSMTBQ::read_file(char *file) params[i].chi = atof(words[2]) ; params[i].dj = atof(words[3]) ; - if(strcmp(params[i].nom,"O")!=0){ + if (strcmp(params[i].nom,"O")!=0) { params[i].R = atof(words[4]) ; if (verbose) printf(" %s %f %f %f %f\n",words[0],params[i].ne,params[i].chi, params[i].dj,params[i].R); @@ -511,7 +511,7 @@ void PairSMTBQ::read_file(char *file) // Line 4bis - Coordinance et rayon pour Ox - if(strcmp(params[i].nom,"O")==0){ + if (strcmp(params[i].nom,"O")==0) { fgets( ptr, MAXLINE, fp); Tokenize ( ptr, &words ); @@ -543,7 +543,7 @@ void PairSMTBQ::read_file(char *file) ===================================================================== */ m = 0; maxintsm = 0; // - for (k=0 ; k<=maxintparam ; k++){intparams[k].intsm = 0;} + for (k=0 ; k<=maxintparam ; k++) {intparams[k].intsm = 0;} // --------------------------------- for (k = 0; k < maxintparam; k++) { // --------------------------------- @@ -597,7 +597,7 @@ void PairSMTBQ::read_file(char *file) intparams[m].intsm = maxintsm; if (strcmp(intparams[m].mode,"oxide") != 0 && - strcmp(intparams[m].mode,"metal") != 0){ + strcmp(intparams[m].mode,"metal") != 0) { error->all(FLERR,"needs mode to second moment interaction : oxide or metal"); } // if (strcmp(intparams[m].mode,"oxide") == 0) @@ -1400,8 +1400,8 @@ void PairSMTBQ::tabqeq() rcoupe = cutmax ; double cang ; - for (i = 0; i < n ; i++){ - for (j = i; j < n ; j++){ + for (i = 0; i < n ; i++) { + for (j = i; j < n ; j++) { rc = cutmax; if (verbose) printf ("cutmax %f\n",cutmax); m = coultype[i][j] ; @@ -1457,11 +1457,11 @@ void PairSMTBQ::tabqeq() // Make the table fafbOxOxSurf rc = cutmax; - if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ - if(strcmp(params[i].nom,"O")==0) { + if (strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0) { + if (strcmp(params[i].nom,"O")==0) { ra = ROxSurf; za = (2.0*params[i].ne + 1.0)/(4.0*ra);} - if(strcmp(params[j].nom,"O")==0) { + if (strcmp(params[j].nom,"O")==0) { rb = ROxSurf; zb = (2.0*params[j].ne + 1.0)/(4.0*rb); } @@ -1501,7 +1501,7 @@ void PairSMTBQ::tabqeq() if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} - if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ + if (strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0) { fafbOxOxSurf[k] = potqn[k] - dij ; if (k == 1) fafbOxOxSurf[0] = fafbOxOxSurf[k] ; @@ -1520,11 +1520,11 @@ void PairSMTBQ::tabqeq() // Makes the table fafbOxOxBB rc = cutmax; - if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ - if(strcmp(params[i].nom,"O")==0) { + if (strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0) { + if (strcmp(params[i].nom,"O")==0) { ra = ROxBB; za = (2.0*params[i].ne + 1.0)/(4.0*ra);} - if(strcmp(params[j].nom,"O")==0) { + if (strcmp(params[j].nom,"O")==0) { rb = ROxBB; zb = (2.0*params[j].ne + 1.0)/(4.0*rb); } @@ -1565,7 +1565,7 @@ void PairSMTBQ::tabqeq() if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} - if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ + if (strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0) { fafbOxOxBB[k] = potqn[k] - dij ; if (k == 1) fafbOxOxBB[0] = fafbOxOxBB[k] ; dfafbOxOxBB[k] = dpotqn[k] - ddij/r ; } @@ -1638,9 +1638,9 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, fforce = - qi*qj*(t1 + (t2 - t1)*xi/2.0) ; - if(strcmp(params[itype].nom,"O")==0 || strcmp(params[jtype].nom,"O")==0){ + if (strcmp(params[itype].nom,"O")==0 || strcmp(params[jtype].nom,"O")==0) { - if(strcmp(params[itype].nom,"O")==0 && strcmp(params[jtype].nom,"O")==0){ + if (strcmp(params[itype].nom,"O")==0 && strcmp(params[jtype].nom,"O")==0) { // between two oxygens t1 = fafbOxOxSurf[l] + (fafbOxOxSurf[l+1] - fafbOxOxSurf[l])*xi; @@ -1680,7 +1680,7 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, t2 = fafbTiOxBB[l+1] + (fafbTiOxBB[l+2] - fafbTiOxBB[l+1])*(xi-1.0); engBB = qi*qj*(t1 + (t2 - t1)*xi/2.0); - if(strcmp(params[jtype].nom,"O")==0) //the atom j is an oxygen + if (strcmp(params[jtype].nom,"O")==0) //the atom j is an oxygen { iIntfCoup2=jIntfCoup2; iCoord=jCoord; } @@ -1758,9 +1758,9 @@ void PairSMTBQ::pot_ES (int i, int j, double rsq, double &eng) engBulk=eng; - if(itype==0 || jtype==0){ + if (itype==0 || jtype==0) { - if(itype==0 && jtype==0){ // between two oxygens + if (itype==0 && jtype==0) { // between two oxygens t1 = fafbOxOxSurf[l] + (fafbOxOxSurf[l+1] - fafbOxOxSurf[l])*xi; t2 = fafbOxOxSurf[l+1] + (fafbOxOxSurf[l+2] - fafbOxOxSurf[l+1])*(xi-1.0); @@ -2062,7 +2062,7 @@ void PairSMTBQ::attractive(Intparam *intparam, double rsq, // if (i < 10) printf ("i %d, iq %f sbcov %f \n",i,iq,sbcov[i]); if (sqrt(r)(nQEqall[gp]); enegmax[gp] = enegmaxall[gp]; } @@ -2758,7 +2758,7 @@ void PairSMTBQ::Charge() // Statistique (ecart type) // ------------------------ for (i=0; i(nQEqcall[i]) ; TransfAll[i+2*cluster] /= static_cast(nQEqaall[i]) ;} sigmaa[i] = sigmac[i] = 0.0; @@ -2788,7 +2788,7 @@ void PairSMTBQ::Charge() - if (me == 0 && strcmp(Bavard,"false") != 0){ + if (me == 0 && strcmp(Bavard,"false") != 0) { for (gp = 0; gp < nteam+1; gp++) { printf (" -------------- Groupe %d -----------------\n",gp); printf (" qtotc %f(+- %f) qtota %f(+- %f)\n", @@ -3632,7 +3632,7 @@ void PairSMTBQ::CheckEnergyVSForce() drL=0.0001; iiiMax=int((cutmax-1.2)/drL); - for (iii=1; iii< iiiMax ; iii++){ + for (iii=1; iii< iiiMax ; iii++) { r=1.2+drL*iii; rsq=r*r; evdwlCoul = 0.0 ; fpairCoul = 0.0; @@ -3732,7 +3732,7 @@ void PairSMTBQ::CheckEnergyVSForce() drL=0.0001; iiiMax=int((cutmax-1.2)/drL); - for (iii=1; iii< iiiMax ; iii++){ + for (iii=1; iii< iiiMax ; iii++) { r=1.2+drL*iii; rsq=r*r; evdwlCoul = 0.0 ; fpairCoul = 0.0; diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index d4a7e80602..7cc0f95d80 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -100,7 +100,7 @@ void ComputePEMolTally::pair_tally_callback(int i, int j, int nlocal, int newton const tagint * const molid = atom->molecule; if ( ((mask[i] & groupbit) && (mask[j] & groupbit2)) - || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ){ + || ((mask[i] & groupbit2) && (mask[j] & groupbit)) ) { evdwl *= 0.5; ecoul *= 0.5; if (newton || i < nlocal) { diff --git a/src/USER-UEF/dump_cfg_uef.cpp b/src/USER-UEF/dump_cfg_uef.cpp index 4b1c8cc2c6..3f39bb5700 100644 --- a/src/USER-UEF/dump_cfg_uef.cpp +++ b/src/USER-UEF/dump_cfg_uef.cpp @@ -72,7 +72,7 @@ void DumpCFGUef::write_header(bigint n) // rot goes from "lab frame" to "upper triangular frame" // it's transpose takes the simulation box to the flow frame for (int i=0;i<3;i++) - for(int j=i+1;j<3;j++) + for (int j=i+1;j<3;j++) { double t=rot[i][j]; rot[i][j]=rot[j][i]; diff --git a/src/USER-UEF/uef_utils.cpp b/src/USER-UEF/uef_utils.cpp index 5fc92618b3..4febbbb577 100644 --- a/src/USER-UEF/uef_utils.cpp +++ b/src/USER-UEF/uef_utils.cpp @@ -277,9 +277,9 @@ void rotation_matrix(double q[3][3], double r[3][3], const double m[3][3]) // this makes r have positive diagonals // q*m = r <==> (-q)*m = (-r) will hold row-wise - if (r[0][0] < 0){ neg_row(q,0); neg_row(r,0); } - if (r[1][1] < 0){ neg_row(q,1); neg_row(r,1); } - if (r[2][2] < 0){ neg_row(q,2); neg_row(r,2); } + if (r[0][0] < 0) { neg_row(q,0); neg_row(r,0); } + if (r[1][1] < 0) { neg_row(q,1); neg_row(r,1); } + if (r[2][2] < 0) { neg_row(q,2); neg_row(r,2); } } /* ---------------------------------------------------------------------- diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index 98b8e0bb35..a2bf1fb4bf 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -1188,7 +1188,7 @@ void DumpVTK::write_domain_vtk() vtkSmartPointer gwriter = vtkSmartPointer::New(); - if(label) gwriter->SetHeader(label); + if (label) gwriter->SetHeader(label); else gwriter->SetHeader("Generated by LAMMPS"); if (binary) gwriter->SetFileTypeToBinary(); @@ -1212,7 +1212,7 @@ void DumpVTK::write_domain_vtk_triclinic() vtkSmartPointer gwriter = vtkSmartPointer::New(); - if(label) gwriter->SetHeader(label); + if (label) gwriter->SetHeader(label); else gwriter->SetHeader("Generated by LAMMPS"); if (binary) gwriter->SetFileTypeToBinary(); @@ -1305,7 +1305,7 @@ void DumpVTK::write_vtk(int n, double *mybuf) vtkSmartPointer writer = vtkSmartPointer::New(); #endif - if(label) writer->SetHeader(label); + if (label) writer->SetHeader(label); else writer->SetHeader("Generated by LAMMPS"); if (binary) writer->SetFileTypeToBinary(); @@ -1890,7 +1890,7 @@ void DumpVTK::identify_vectors() int num_vector3_starts = sizeof(vector3_starts) / sizeof(int); for (int v3s = 0; v3s < num_vector3_starts; v3s++) { - if(name.count(vector3_starts[v3s] ) && + if (name.count(vector3_starts[v3s] ) && name.count(vector3_starts[v3s]+1) && name.count(vector3_starts[v3s]+2) ) { @@ -1906,12 +1906,12 @@ void DumpVTK::identify_vectors() if (it->first < ATTRIBUTES) // neither fix nor compute continue; - if(argindex[it->first] == 0) // single value + if (argindex[it->first] == 0) // single value continue; // assume components are grouped together and in correct order - if(name.count(it->first + 1) && name.count(it->first + 2) ) { // more attributes? - if(it->second.compare(0,it->second.length()-3,name[it->first + 1],0,it->second.length()-3) == 0 && // same attributes? + if (name.count(it->first + 1) && name.count(it->first + 2) ) { // more attributes? + if (it->second.compare(0,it->second.length()-3,name[it->first + 1],0,it->second.length()-3) == 0 && // same attributes? it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0 ) { it->second.erase(it->second.length()-1); diff --git a/src/atom.cpp b/src/atom.cpp index 7b15b731c7..daead53a83 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1884,7 +1884,7 @@ void Atom::add_molecule(int narg, char **arg) int Atom::find_molecule(char *id) { - if(id == nullptr) return -1; + if (id == nullptr) return -1; int imol; for (imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; @@ -2330,7 +2330,7 @@ void Atom::update_callback(int ifix) int Atom::find_custom(const char *name, int &flag) { - if(name == nullptr) return -1; + if (name == nullptr) return -1; for (int i = 0; i < nivector; i++) if (iname[i] && strcmp(iname[i],name) == 0) { diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index b4e03c6e57..6fa8ef7c37 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -201,7 +201,7 @@ void CommTiled::setup() cutghost[1] = cut * length1; length2 = h_inv[2]; cutghost[2] = cut * length2; - if (mode == Comm::MULTI){ + if (mode == Comm::MULTI) { for (i = 1; i <= ntypes; i++) { cutghostmulti[i][0] *= length0; cutghostmulti[i][1] *= length1; diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index b59d4d894d..aae935815c 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -260,8 +260,8 @@ inline void ComputeHexOrderAtom::calc_qn_complex(double delx, double dely, doubl inline void ComputeHexOrderAtom::calc_qn_trig(double delx, double dely, double &u, double &v) { double ntheta; - if(fabs(delx) <= MY_EPSILON) { - if(dely > 0.0) ntheta = ndegree * MY_PI / 2.0; + if (fabs(delx) <= MY_EPSILON) { + if (dely > 0.0) ntheta = ndegree * MY_PI / 2.0; else ntheta = ndegree * 3.0 * MY_PI / 2.0; } else ntheta = ndegree * atan(dely / delx); u = cos(ntheta); diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index b334654e82..b4f9662468 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -440,16 +440,16 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { qnm_r[il][m] = 0.0; qnm_i[il][m] = 0.0; } } - for(int ineigh = 0; ineigh < ncount; ineigh++) { + for (int ineigh = 0; ineigh < ncount; ineigh++) { const double * const r = rlist[ineigh]; double rmag = dist(r); - if(rmag <= MY_EPSILON) { + if (rmag <= MY_EPSILON) { return; } @@ -457,7 +457,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, double expphi_r = r[0]; double expphi_i = r[1]; double rxymag = sqrt(expphi_r*expphi_r+expphi_i*expphi_i); - if(rxymag <= MY_EPSILON) { + if (rxymag <= MY_EPSILON) { expphi_r = 1.0; expphi_i = 0.0; } else { @@ -476,14 +476,14 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, qnm_r[il][l] += polar_prefactor(l, 0, costheta); double expphim_r = expphi_r; double expphim_i = expphi_i; - for(int m = 1; m <= +l; m++) { + for (int m = 1; m <= +l; m++) { double prefactor = polar_prefactor(l, m, costheta); double ylm_r = prefactor * expphim_r; double ylm_i = prefactor * expphim_i; qnm_r[il][m+l] += ylm_r; qnm_i[il][m+l] += ylm_i; - if(m & 1) { + if (m & 1) { qnm_r[il][-m+l] -= ylm_r; qnm_i[il][-m+l] += ylm_i; } else { @@ -504,7 +504,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, double facn = 1.0 / ncount; for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { qnm_r[il][m] *= facn; qnm_i[il][m] *= facn; } @@ -518,7 +518,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, int l = qlist[il]; double qnormfac = sqrt(MY_4PI/(2*l+1)); double qm_sum = 0.0; - for(int m = 0; m < 2*l+1; m++) + for (int m = 0; m < 2*l+1; m++) qm_sum += qnm_r[il][m]*qnm_r[il][m] + qnm_i[il][m]*qnm_i[il][m]; qn[jj++] = qnormfac * sqrt(qm_sum); } @@ -530,8 +530,8 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, for (int il = 0; il < nqlist; il++) { int l = qlist[il]; double wlsum = 0.0; - for(int m1 = 0; m1 < 2*l+1; m1++) { - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { int m = m1 + m2 - l; double qm1qm2_r = qnm_r[il][m1]*qnm_r[il][m2] - qnm_i[il][m1]*qnm_i[il][m2]; double qm1qm2_i = qnm_r[il][m1]*qnm_i[il][m2] + qnm_i[il][m1]*qnm_r[il][m2]; @@ -550,8 +550,8 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, for (int il = 0; il < nqlist; il++) { int l = qlist[il]; double wlsum = 0.0; - for(int m1 = 0; m1 < 2*l+1; m1++) { - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { int m = m1 + m2 - l; double qm1qm2_r = qnm_r[il][m1]*qnm_r[il][m2] - qnm_i[il][m1]*qnm_i[il][m2]; double qm1qm2_i = qnm_r[il][m1]*qnm_i[il][m2] + qnm_i[il][m1]*qnm_r[il][m2]; @@ -575,14 +575,14 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, int il = iqlcomp; int l = qlcomp; if (qn[il] < QEPSILON) - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { qn[jj++] = 0.0; qn[jj++] = 0.0; } else { double qnormfac = sqrt(MY_4PI/(2*l+1)); double qnfac = qnormfac/qn[il]; - for(int m = 0; m < 2*l+1; m++) { + for (int m = 0; m < 2*l+1; m++) { qn[jj++] = qnm_r[il][m] * qnfac; qn[jj++] = qnm_i[il][m] * qnfac; } @@ -663,8 +663,8 @@ void ComputeOrientOrderAtom::init_clebsch_gordan() idxcg_count = 0; for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m1 = 0; m1 < 2*l+1; m1++) - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) + for (int m1 = 0; m1 < 2*l+1; m1++) + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) idxcg_count++; } idxcg_max = idxcg_count; @@ -673,9 +673,9 @@ void ComputeOrientOrderAtom::init_clebsch_gordan() idxcg_count = 0; for (int il = 0; il < nqlist; il++) { int l = qlist[il]; - for(int m1 = 0; m1 < 2*l+1; m1++) { + for (int m1 = 0; m1 < 2*l+1; m1++) { aa2 = m1 - l; - for(int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { + for (int m2 = MAX(0,l-m1); m2 < MIN(2*l+1,3*l-m1+1); m2++) { bb2 = m2 - l; m = aa2 + bb2 + l; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 93a9e68a16..16e2ade2af 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -70,7 +70,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) if (iarg+3 > narg) error->all(FLERR,"Illegal fix adapt command"); nadapt++; iarg += 3; - } else if (strcmp(arg[iarg],"bond") == 0 ){ + } else if (strcmp(arg[iarg],"bond") == 0 ) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix adapt command"); nadapt++; iarg += 5; @@ -110,7 +110,7 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) nadapt++; iarg += 6; - } else if (strcmp(arg[iarg],"bond") == 0 ){ + } else if (strcmp(arg[iarg],"bond") == 0 ) { if (iarg+5 > narg) error->all(FLERR, "Illegal fix adapt command"); adapt[nadapt].which = BOND; int n = strlen(arg[iarg+1]) + 1; @@ -395,7 +395,7 @@ void FixAdapt::init() } delete [] pstyle; - } else if (ad->which == BOND){ + } else if (ad->which == BOND) { ad->bond = nullptr; anybond = 1; @@ -463,10 +463,10 @@ void FixAdapt::init() for (i = ad->ilo; i <= ad->ihi; i++) for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) ad->array_orig[i][j] = ad->array[i][j]; - } else if (ad->which == PAIR && ad->pdim == 0){ + } else if (ad->which == PAIR && ad->pdim == 0) { ad->scalar_orig = *ad->scalar; - } else if (ad->which == BOND && ad->bdim == 1){ + } else if (ad->which == BOND && ad->bdim == 1) { for (i = ad->ilo; i <= ad->ihi; ++i ) ad->vector_orig[i] = ad->vector[i]; } @@ -565,7 +565,7 @@ void FixAdapt::change_settings() // set bond type array values: } else if (ad->which == BOND) { - if (ad->bdim == 1){ + if (ad->bdim == 1) { if (scaleflag) for (i = ad->ilo; i <= ad->ihi; ++i ) ad->vector[i] = value*ad->vector_orig[i]; diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 1a638db742..61a36819b0 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -138,7 +138,7 @@ void FixAveHistoWeight::end_of_step() if (which[i] == X) { weights = &atom->x[0][j]; stride = 3; - } else if (which[i] == V){ + } else if (which[i] == V) { weights = &atom->v[0][j]; stride = 3; bin_atoms(&atom->v[0][j],3); diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index d4edc0d7f2..4aec94fc32 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -362,7 +362,7 @@ rfix(nullptr), irregular(nullptr), set(nullptr) FixDeform::~FixDeform() { - if(set) { + if (set) { for (int i = 0; i < 6; i++) { delete [] set[i].hstr; delete [] set[i].hratestr; diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index b4f6bc987d..674cda4529 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -779,11 +779,11 @@ void FixNH::setup(int /*vflag*/) // if it was read in from a restart file, leave it be if (t0 == 0.0) { - if(p_temp_flag) { + if (p_temp_flag) { t0 = p_temp; } else { t0 = temperature->compute_scalar(); - if(t0 < EPSILON) + if (t0 < EPSILON) error->all(FLERR, "Current temperature too close to zero, consider using ptemp setting"); } } diff --git a/src/fix_nh_sphere.cpp b/src/fix_nh_sphere.cpp index bd599d6731..4e7fb24039 100644 --- a/src/fix_nh_sphere.cpp +++ b/src/fix_nh_sphere.cpp @@ -45,7 +45,7 @@ FixNHSphere::FixNHSphere(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"disc") == 0){ + if (strcmp(arg[iarg],"disc") == 0) { inertia = 0.5; if (domain->dimension != 2) error->all(FLERR, @@ -127,7 +127,7 @@ void FixNHSphere::nve_x() double **omega = atom->omega; int *mask = atom->mask; int nlocal = atom->nlocal; - if (dlm_flag == 0){ + if (dlm_flag == 0) { // d_mu/dt = omega cross mu // renormalize mu to dipole length double msq,scale,g[3]; @@ -174,7 +174,7 @@ void FixNHSphere::nve_x() // Q = I + vx + vx^2 * (1-c)/s^2 s2 = a[0]*a[0] + a[1]*a[1]; - if (s2 != 0.0){ // i.e. the vectors are not parallel + if (s2 != 0.0) { // i.e. the vectors are not parallel scale = (1.0 - a[2])/s2; Q[0][0] = 1.0 - scale*a[0]*a[0]; Q[0][1] = -scale*a[0]*a[1]; Q[0][2] = -a[0]; diff --git a/src/fix_nve_sphere.cpp b/src/fix_nve_sphere.cpp index 44a08638bf..cad821176b 100644 --- a/src/fix_nve_sphere.cpp +++ b/src/fix_nve_sphere.cpp @@ -187,7 +187,7 @@ void FixNVESphere::initial_integrate(int /*vflag*/) // Q = I + vx + vx^2 * (1-c)/s^2 s2 = a[0]*a[0] + a[1]*a[1]; - if (s2 != 0.0){ // i.e. the vectors are not parallel + if (s2 != 0.0) { // i.e. the vectors are not parallel scale = (1.0 - a[2])/s2; Q[0][0] = 1.0 - scale*a[0]*a[0]; diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index 674c436e9d..eedf24c387 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -105,7 +105,7 @@ double FixTempCSVR::sumnoises(int nn) { the system so it samples the canonical ensemble ---------------------------------------------------------------------- */ -double FixTempCSVR::resamplekin(double ekin_old, double ekin_new){ +double FixTempCSVR::resamplekin(double ekin_old, double ekin_new) { const double tdof = temperature->dof; const double c1 = exp(-update->dt/t_period); const double c2 = (1.0-c1)*ekin_new/ekin_old/tdof; diff --git a/src/hashlittle.cpp b/src/hashlittle.cpp index 5a8869bfea..a76e36050f 100644 --- a/src/hashlittle.cpp +++ b/src/hashlittle.cpp @@ -327,13 +327,13 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) h = 0; for (p = (uint32_t *)key, bytes=num_bytes; bytes >= (uint32_t) sizeof(uint32_t); - bytes-=sizeof(uint32_t), p++){ + bytes-=sizeof(uint32_t), p++) { h = (h^(*p))*MAXINT_DIV_PHI; } /* Then take care of the remaining bytes, if any */ rest = 0; - for (byteptr = (char *)p; bytes > 0; bytes--, byteptr++){ + for (byteptr = (char *)p; bytes > 0; bytes--, byteptr++) { rest = (rest<<8) | (*byteptr); } diff --git a/src/info.cpp b/src/info.cpp index 085e4e65ea..5202610f9a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -654,20 +654,20 @@ void Info::available_styles(FILE * out, int flags) fputs("\nStyles information:\n",out); - if(flags & ATOM_STYLES) atom_styles(out); - if(flags & INTEGRATE_STYLES) integrate_styles(out); - if(flags & MINIMIZE_STYLES) minimize_styles(out); - if(flags & PAIR_STYLES) pair_styles(out); - if(flags & BOND_STYLES) bond_styles(out); - if(flags & ANGLE_STYLES) angle_styles(out); - if(flags & DIHEDRAL_STYLES) dihedral_styles(out); - if(flags & IMPROPER_STYLES) improper_styles(out); - if(flags & KSPACE_STYLES) kspace_styles(out); - if(flags & FIX_STYLES) fix_styles(out); - if(flags & COMPUTE_STYLES) compute_styles(out); - if(flags & REGION_STYLES) region_styles(out); - if(flags & DUMP_STYLES) dump_styles(out); - if(flags & COMMAND_STYLES) command_styles(out); + if (flags & ATOM_STYLES) atom_styles(out); + if (flags & INTEGRATE_STYLES) integrate_styles(out); + if (flags & MINIMIZE_STYLES) minimize_styles(out); + if (flags & PAIR_STYLES) pair_styles(out); + if (flags & BOND_STYLES) bond_styles(out); + if (flags & ANGLE_STYLES) angle_styles(out); + if (flags & DIHEDRAL_STYLES) dihedral_styles(out); + if (flags & IMPROPER_STYLES) improper_styles(out); + if (flags & KSPACE_STYLES) kspace_styles(out); + if (flags & FIX_STYLES) fix_styles(out); + if (flags & COMPUTE_STYLES) compute_styles(out); + if (flags & REGION_STYLES) region_styles(out); + if (flags & DUMP_STYLES) dump_styles(out); + if (flags & COMMAND_STYLES) command_styles(out); } void Info::atom_styles(FILE *out) @@ -935,31 +935,31 @@ bool Info::has_style(const std::string &category, const std::string &name) { if ( category == "atom" ) { return find_style(lmp, atom->avec_map, name, false); - } else if( category == "integrate" ) { + } else if ( category == "integrate" ) { return find_style(lmp, update->integrate_map, name, true); - } else if( category == "minimize" ) { + } else if ( category == "minimize" ) { return find_style(lmp, update->minimize_map, name, true); - } else if( category == "pair" ) { + } else if ( category == "pair" ) { return find_style(lmp, force->pair_map, name, true); - } else if( category == "bond" ) { + } else if ( category == "bond" ) { return find_style(lmp, force->bond_map, name, true); - } else if( category == "angle" ) { + } else if ( category == "angle" ) { return find_style(lmp, force->angle_map, name, true); - } else if( category == "dihedral" ) { + } else if ( category == "dihedral" ) { return find_style(lmp, force->dihedral_map, name, true); - } else if( category == "improper" ) { + } else if ( category == "improper" ) { return find_style(lmp, force->improper_map, name, true); - } else if( category == "kspace" ) { + } else if ( category == "kspace" ) { return find_style(lmp, force->kspace_map, name, true); - } else if( category == "fix" ) { + } else if ( category == "fix" ) { return find_style(lmp, modify->fix_map, name, true); - } else if( category == "compute" ) { + } else if ( category == "compute" ) { return find_style(lmp, modify->compute_map, name, true); - } else if( category == "region" ) { + } else if ( category == "region" ) { return find_style(lmp, domain->region_map, name, false); - } else if( category == "dump" ) { + } else if ( category == "dump" ) { return find_style(lmp, output->dump_map, name, false); - } else if( category == "command" ) { + } else if ( category == "command" ) { return find_style(lmp, input->command_map, name, false); } return false; @@ -969,31 +969,31 @@ std::vector Info::get_available_styles(const std::string &category) { if ( category == "atom" ) { return get_style_names(atom->avec_map); - } else if( category == "integrate" ) { + } else if ( category == "integrate" ) { return get_style_names(update->integrate_map); - } else if( category == "minimize" ) { + } else if ( category == "minimize" ) { return get_style_names(update->minimize_map); - } else if( category == "pair" ) { + } else if ( category == "pair" ) { return get_style_names(force->pair_map); - } else if( category == "bond" ) { + } else if ( category == "bond" ) { return get_style_names(force->bond_map); - } else if( category == "angle" ) { + } else if ( category == "angle" ) { return get_style_names(force->angle_map); - } else if( category == "dihedral" ) { + } else if ( category == "dihedral" ) { return get_style_names(force->dihedral_map); - } else if( category == "improper" ) { + } else if ( category == "improper" ) { return get_style_names(force->improper_map); - } else if( category == "kspace" ) { + } else if ( category == "kspace" ) { return get_style_names(force->kspace_map); - } else if( category == "fix" ) { + } else if ( category == "fix" ) { return get_style_names(modify->fix_map); - } else if( category == "compute" ) { + } else if ( category == "compute" ) { return get_style_names(modify->compute_map); - } else if( category == "region" ) { + } else if ( category == "region" ) { return get_style_names(domain->region_map); - } else if( category == "dump" ) { + } else if ( category == "dump" ) { return get_style_names(output->dump_map); - } else if( category == "command" ) { + } else if ( category == "command" ) { return get_style_names(input->command_map); } return std::vector(); @@ -1005,7 +1005,7 @@ static std::vector get_style_names(std::map std::vector names; names.reserve(styles->size()); - for(auto const& kv : *styles) { + for (auto const& kv : *styles) { // skip "secret" styles if (isupper(kv.first[0])) continue; names.push_back(kv.first); @@ -1049,7 +1049,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 (typename std::map::iterator it = styles->begin(); it != styles->end(); ++it) { const std::string &style_name = it->first; // skip "secret" styles @@ -1121,8 +1121,8 @@ bool Info::has_exceptions() { } bool Info::has_package(const char * package_name) { - for(int i = 0; LAMMPS::installed_packages[i] != nullptr; ++i) { - if(strcmp(package_name, LAMMPS::installed_packages[i]) == 0) { + for (int i = 0; LAMMPS::installed_packages[i] != nullptr; ++i) { + if (strcmp(package_name, LAMMPS::installed_packages[i]) == 0) { return true; } } diff --git a/src/library.cpp b/src/library.cpp index 17ca454b3c..00a922f98b 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -2444,7 +2444,7 @@ void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *d int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if(vptr == nullptr) { + if (vptr == nullptr) { if (lmp->comm->me == 0) lmp->error->warning(FLERR, "lammps_scatter_atoms: unknown property name"); @@ -2561,7 +2561,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, } void *vptr = lmp->atom->extract(name); - if(vptr == nullptr) { + if (vptr == nullptr) { if (lmp->comm->me == 0) lmp->error->warning(FLERR, "lammps_scatter_atoms_subset: unknown property name"); @@ -2722,7 +2722,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) return; } - if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; else vptr = (void *) lmp->modify->fix[fcid]->array_atom; } @@ -2751,7 +2751,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) lmp->modify->compute[fcid]->compute_peratom(); - if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom; @@ -2775,7 +2775,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) lmp->error->warning(FLERR,"lammps_gather: property/atom has count=1"); return; } - if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid]; } @@ -2942,7 +2942,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d return; } - if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; else vptr = (void *) lmp->modify->fix[fcid]->array_atom; } @@ -2971,7 +2971,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) lmp->modify->compute[fcid]->compute_peratom(); - if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom; @@ -2998,7 +2998,7 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d "property/atom has count=1"); return; } - if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid]; } @@ -3183,7 +3183,7 @@ void lammps_gather_subset(void *handle, char *name, return; } - if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; else vptr = (void *) lmp->modify->fix[fcid]->array_atom; } @@ -3212,7 +3212,7 @@ void lammps_gather_subset(void *handle, char *name, if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) lmp->modify->compute[fcid]->compute_peratom(); - if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom; @@ -3239,7 +3239,7 @@ void lammps_gather_subset(void *handle, char *name, "property/atom has count=1"); return; } - if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid]; } @@ -3414,7 +3414,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) return; } - if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; else vptr = (void *) lmp->modify->fix[fcid]->array_atom; } @@ -3443,7 +3443,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) lmp->modify->compute[fcid]->compute_peratom(); - if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom; @@ -3467,12 +3467,12 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) lmp->error->warning(FLERR,"lammps_scatter: property/atom has count=1"); return; } - if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid]; } - if(vptr == nullptr) { + if (vptr == nullptr) { if (lmp->comm->me == 0) lmp->error->warning(FLERR,"lammps_scatter: unknown property name"); return; @@ -3612,7 +3612,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count, return; } - if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; else vptr = (void *) lmp->modify->fix[fcid]->array_atom; } @@ -3641,7 +3641,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count, if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) lmp->modify->compute[fcid]->compute_peratom(); - if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + if (count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; else vptr = (void *) lmp->modify->compute[fcid]->array_atom; } @@ -3666,11 +3666,11 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count, "property/atom has count=1"); return; } - if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + if (ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; else vptr = (void *) lmp->atom->dvector[fcid]; } - if(vptr == nullptr) { + if (vptr == nullptr) { if (lmp->comm->me == 0) lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: " "unknown property name"); @@ -4025,7 +4025,7 @@ int lammps_neighlist_num_elements(void *handle, int idx) { LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; - if(idx < 0 || idx >= neighbor->nlist) { + if (idx < 0 || idx >= neighbor->nlist) { return -1; } @@ -4053,13 +4053,13 @@ void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *numneigh = 0; *neighbors = nullptr; - if(idx < 0 || idx >= neighbor->nlist) { + if (idx < 0 || idx >= neighbor->nlist) { return; } NeighList * list = neighbor->lists[idx]; - if(element < 0 || element >= list->inum) { + if (element < 0 || element >= list->inum) { return; } @@ -4645,7 +4645,7 @@ void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr c Fix *fix = lmp->modify->fix[ifix]; - if (strcmp("external",fix->style) != 0){ + if (strcmp("external",fix->style) != 0) { char str[128]; snprintf(str, 128, "Fix '%s' is not of style external!", id); lmp->error->all(FLERR,str); @@ -4819,7 +4819,7 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size) { Error *error = lmp->error; buffer[0] = buffer[buf_size-1] = '\0'; - if(!error->get_last_error().empty()) { + if (!error->get_last_error().empty()) { int error_type = error->get_last_error_type(); strncpy(buffer, error->get_last_error().c_str(), buf_size-1); error->set_last_error("", ERROR_NONE); diff --git a/src/modify.cpp b/src/modify.cpp index 2d0c23d125..f3ebb03c38 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1329,7 +1329,7 @@ void Modify::delete_compute(const std::string &id) int Modify::find_compute(const std::string &id) { - if(id.empty()) return -1; + if (id.empty()) return -1; for (int icompute = 0; icompute < ncompute; icompute++) if (id == compute[icompute]->id) return icompute; return -1; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 7761aae721..a76bf78c24 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -720,11 +720,11 @@ int Neighbor::init_pair() lists[i]->index = i; lists[i]->requestor = requests[i]->requestor; - if(requests[i]->pair) { + if (requests[i]->pair) { lists[i]->requestor_type = NeighList::PAIR; - } else if(requests[i]->fix) { + } else if (requests[i]->fix) { lists[i]->requestor_type = NeighList::FIX; - } else if(requests[i]->compute) { + } else if (requests[i]->compute) { lists[i]->requestor_type = NeighList::COMPUTE; } diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 7c4061d22d..01fc0adac3 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -113,10 +113,10 @@ void PairCoulStreitz::settings(int narg, char **arg) cut_coul = utils::numeric(FLERR,arg[0],false,lmp); - if (strcmp(arg[1],"wolf") == 0){ + if (strcmp(arg[1],"wolf") == 0) { kspacetype = 1; g_wolf = utils::numeric(FLERR,arg[2],false,lmp); - } else if (strcmp(arg[1],"ewald") == 0){ + } else if (strcmp(arg[1],"ewald") == 0) { ewaldflag = pppmflag = 1; kspacetype = 2; } else { @@ -297,7 +297,7 @@ void PairCoulStreitz::read_file(char *file) MPI_Bcast(&nparams, 1, MPI_INT, 0, world); MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); - if(comm->me != 0) { + if (comm->me != 0) { params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); } diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index d41902c10d..2ad8bbb764 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -58,7 +58,7 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp, try { reader = open_potential(filename); - if(!reader) { + if (!reader) { error->one(FLERR, fmt::format("cannot open {} potential file {}", potential_name, filename)); } } catch (FileReaderException &e) { diff --git a/src/reader_native.cpp b/src/reader_native.cpp index 9fe57198fd..a185f5ab3a 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -169,7 +169,7 @@ bigint ReaderNative::read_header(double box[3][3], int &boxinfo, int &triclinic, labels[tokens.next()] = nwords++; } - if(nwords == 0) { + if (nwords == 0) { return 1; } diff --git a/src/region.cpp b/src/region.cpp index cd0464e10e..2fe2d88cef 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -496,7 +496,7 @@ void Region::set_velocity() prev[3] = theta; } - if (varshape){ + if (varshape) { set_velocity_shape(); } } @@ -514,12 +514,12 @@ void Region::velocity_contact(double *vwall, double *x, int ic) vwall[0] = vwall[1] = vwall[2] = 0.0; - if (moveflag){ + if (moveflag) { vwall[0] = v[0]; vwall[1] = v[1]; vwall[2] = v[2]; } - if (rotateflag){ + if (rotateflag) { xc[0] = x[0] - contact[ic].delx; xc[1] = x[1] - contact[ic].dely; xc[2] = x[2] - contact[ic].delz; diff --git a/src/region_block.cpp b/src/region_block.cpp index 385fcdd90a..4e433f424a 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -320,7 +320,7 @@ int RegBlock::surface_exterior(double *x, double cutoff) else zp = x[2]; } else { mindist = BIG; - for (int i = 0; i < 6; i++){ + for (int i = 0; i < 6; i++) { if (open_faces[i]) continue; dist = find_closest_point(i,x,xc,yc,zc); if (dist < mindist) { @@ -361,7 +361,7 @@ double RegBlock::find_closest_point(int i, double *x, // check if point projects inside of face - if (inside_face(xproj, i)){ + if (inside_face(xproj, i)) { d2 = d2min = dot*dot; xc = xproj[0] + corners[i][0][0]; yc = xproj[1] + corners[i][0][1]; diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 72d315c16e..de3f8b254b 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -508,7 +508,7 @@ int RegCone::surface_exterior(double *x, double cutoff) distsq = BIG; - if (!open_faces[2]){ + if (!open_faces[2]) { point_on_line_segment(corner1,corner2,x,xp); distsq = closest(x,xp,nearest,distsq); crad = -2.0*(radiuslo + (nearest[1]-lo)*(radiushi-radiuslo)/(hi-lo)); @@ -573,7 +573,7 @@ int RegCone::surface_exterior(double *x, double cutoff) distsq = BIG; - if (!open_faces[2]){ + if (!open_faces[2]) { point_on_line_segment(corner1,corner2,x,xp); distsq = closest(x,xp,nearest,distsq); crad = -2.0*(radiuslo + (nearest[2]-lo)*(radiushi-radiuslo)/(hi-lo)); diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 306026cd7e..9e94a53046 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -520,7 +520,7 @@ int RegCylinder::surface_exterior(double *x, double cutoff) else d2 = dr2 + dx*dx; if (d2 < d2prev) { xp = hi; - if (r < radius){ + if (r < radius) { yp = x[1]; zp = x[2]; } @@ -572,7 +572,7 @@ int RegCylinder::surface_exterior(double *x, double cutoff) dr = r - radius; dr2 = dr*dr; - if (!open_faces[2]){ + if (!open_faces[2]) { xp = c1 + del1*radius/r; zp = c2 + del2*radius/r; if (x[1] < lo) { diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index beb8bb42b1..fb2b6239b1 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -313,7 +313,7 @@ void RegIntersect::write_restart(FILE *fp) fwrite(style, 1, sizestyle, fp); fwrite(&nregion,sizeof(int),1,fp); - for (int ilist = 0; ilist < nregion; ilist++){ + for (int ilist = 0; ilist < nregion; ilist++) { domain->regions[list[ilist]]->write_restart(fp); } } diff --git a/src/region_prism.cpp b/src/region_prism.cpp index 3ee45a4255..51c67c706c 100644 --- a/src/region_prism.cpp +++ b/src/region_prism.cpp @@ -393,7 +393,7 @@ void RegPrism::find_nearest(double *x, double &xp, double &yp, double &zp) xproj[0] = x[0] - dot*face[iface][0]; xproj[1] = x[1] - dot*face[iface][1]; xproj[2] = x[2] - dot*face[iface][2]; - if (inside_tri(xproj,corners[i],corners[j],corners[k],face[iface])){ + if (inside_tri(xproj,corners[i],corners[j],corners[k],face[iface])) { distsq = closest(x,xproj,nearest,distsq); } else { diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index b254933531..37ebcd07fb 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -24,8 +24,8 @@ using namespace LAMMPS_NS; -TokenizerException::TokenizerException(const std::string &msg, const std::string &token){ - if(token.empty()) { +TokenizerException::TokenizerException(const std::string &msg, const std::string &token) { + if (token.empty()) { message = msg; } else { message = fmt::format("{}: '{}'", msg, token); @@ -83,12 +83,12 @@ bool Tokenizer::contains(const std::string &str) const { * * \param n number of tokens to skip over */ void Tokenizer::skip(int n) { - for(int i = 0; i < n; ++i) { - if(!has_next()) throw TokenizerException("No more tokens", ""); + for (int i = 0; i < n; ++i) { + if (!has_next()) throw TokenizerException("No more tokens", ""); size_t end = text.find_first_of(separators, start); - if(end == std::string::npos) { + if (end == std::string::npos) { start = end; } else { start = text.find_first_not_of(separators, end+1); @@ -107,11 +107,11 @@ bool Tokenizer::has_next() const { * * \return string with the next token */ std::string Tokenizer::next() { - if(!has_next()) throw TokenizerException("No more tokens", ""); + if (!has_next()) throw TokenizerException("No more tokens", ""); size_t end = text.find_first_of(separators, start); - if(end == std::string::npos) { + if (end == std::string::npos) { std::string token = text.substr(start); start = end; return token; @@ -210,7 +210,7 @@ std::string ValueTokenizer::next_string() { int ValueTokenizer::next_int() { if (has_next()) { std::string current = tokens.next(); - if(!utils::is_integer(current)) { + if (!utils::is_integer(current)) { throw InvalidIntegerException(current); } int value = atoi(current.c_str()); @@ -225,7 +225,7 @@ int ValueTokenizer::next_int() { bigint ValueTokenizer::next_bigint() { if (has_next()) { std::string current = tokens.next(); - if(!utils::is_integer(current)) { + if (!utils::is_integer(current)) { throw InvalidIntegerException(current); } bigint value = ATOBIGINT(current.c_str()); @@ -240,7 +240,7 @@ bigint ValueTokenizer::next_bigint() { tagint ValueTokenizer::next_tagint() { if (has_next()) { std::string current = tokens.next(); - if(!utils::is_integer(current)) { + if (!utils::is_integer(current)) { throw InvalidIntegerException(current); } tagint value = ATOTAGINT(current.c_str()); @@ -255,7 +255,7 @@ tagint ValueTokenizer::next_tagint() { double ValueTokenizer::next_double() { if (has_next()) { std::string current = tokens.next(); - if(!utils::is_double(current)) { + if (!utils::is_double(current)) { throw InvalidFloatException(current); } double value = atof(current.c_str()); diff --git a/src/update.cpp b/src/update.cpp index a8a698a7f3..d52e5a742f 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -324,7 +324,7 @@ void Update::create_integrate(int narg, char **arg, int trysuffix) int sflag; - if(narg-1 > 0) { + if (narg-1 > 0) { new_integrate(arg[0],narg-1,&arg[1],trysuffix,sflag); } else { new_integrate(arg[0],0,nullptr,trysuffix,sflag); diff --git a/src/utils.cpp b/src/utils.cpp index 8bd36a8065..64283aa9c5 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -618,7 +618,7 @@ size_t utils::count_words(const std::string &text, const std::string &separators size_t end = text.find_first_of(separators, start); ++count; - if(end == std::string::npos) { + if (end == std::string::npos) { return count; } else { start = text.find_first_not_of(separators, end + 1); @@ -806,7 +806,7 @@ std::string utils::path_join(const std::string &a, const std::string &b) { bool utils::file_is_readable(const std::string &path) { FILE * fp = fopen(path.c_str(), "r"); - if(fp) { + if (fp) { fclose(fp); return true; } @@ -828,13 +828,13 @@ std::string utils::get_potential_file_path(const std::string &path) { std::string filepath = path; std::string filename = utils::path_basename(path); - if(utils::file_is_readable(filepath)) { + if (utils::file_is_readable(filepath)) { return filepath; } else { // try the environment variable directory const char *var = getenv("LAMMPS_POTENTIALS"); - if (var != nullptr){ + if (var != nullptr) { Tokenizer dirs(var,OS_PATH_VAR_SEP); while (dirs.has_next()) { @@ -935,12 +935,12 @@ FILE *utils::open_potential(const std::string &name, LAMMPS *lmp, std::string filepath = get_potential_file_path(name); - if(!filepath.empty()) { + if (!filepath.empty()) { std::string unit_style = lmp->update->unit_style; std::string date = get_potential_date(filepath, "potential"); std::string units = get_potential_units(filepath, "potential"); - if(!date.empty() && (me == 0)) { + if (!date.empty() && (me == 0)) { logmesg(lmp, fmt::format("Reading potential file {} " "with DATE: {}\n", name, date)); } diff --git a/src/variable.cpp b/src/variable.cpp index c339700787..bd5fc6cf8c 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -2755,7 +2755,7 @@ double Variable::collapse_tree(Tree *tree) ivalue3-ivalue1+1 < ivalue2 ) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) tree->value = ivalue1; - //else if (update->ntimestep <= ivalue3){ + //else if (update->ntimestep <= ivalue3) { else { tree->value = ivalue1; double logsp = ivalue1; @@ -3664,7 +3664,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; if (update->ntimestep < ivalue1) value = ivalue1; - //else if (update->ntimestep <= ivalue3){ + //else if (update->ntimestep <= ivalue3) { else { value = ivalue1; double logsp = ivalue1;