Unverified Commit 5e183ecb authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

simplify in MANYBODY and MC package

parent 7de4655e
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "memory.h"
#include "error.h"
#include "utils.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;
using namespace FixConst;
@@ -64,11 +65,9 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/comb command");
      if (me == 0) {
        fp = fopen(arg[iarg+1],"w");
        if (fp == NULL) {
          char str[128];
          snprintf(str,128,"Cannot open fix qeq/comb file %s",arg[iarg+1]);
          error->one(FLERR,str);
        }
        if (fp == NULL)
          error->one(FLERR,std::string("Cannot open fix qeq/comb file ")
                     + arg[iarg+1]);
      }
      iarg += 2;
    } else error->all(FLERR,"Illegal fix qeq/comb command");
@@ -191,8 +190,7 @@ void FixQEQComb::post_force(int /*vflag*/)
  // charge-equilibration loop

  if (me == 0 && fp)
    fprintf(fp,"Charge equilibration on step " BIGINT_FORMAT "\n",
            update->ntimestep);
    fmt::print(fp,"Charge equilibration on step {}\n", update->ntimestep);

  heatpq = 0.05;
  qmass  = 0.016;
@@ -253,8 +251,8 @@ void FixQEQComb::post_force(int /*vflag*/)
    if (enegchk <= precision && enegmax <= 100.0*precision) break;

    if (me == 0 && fp)
      fprintf(fp,"  iteration: %d, enegtot %.6g, "
              "enegmax %.6g, fq deviation: %.6g\n",
      fmt::print(fp,"  iteration: {}, enegtot {:.6g}, "
                 "enegmax {:.6g}, fq deviation: {:.6g}\n",
                 iloop,enegtot,enegmax,enegchk);

    for (ii = 0; ii < inum; ii++) {
@@ -266,9 +264,9 @@ void FixQEQComb::post_force(int /*vflag*/)

  if (me == 0 && fp) {
    if (iloop == loopmax)
      fprintf(fp,"Charges did not converge in %d iterations\n",iloop);
      fmt::print(fp,"Charges did not converge in {} iterations\n",iloop);
    else
      fprintf(fp,"Charges converged in %d iterations to %.10f tolerance\n",
      fmt::print(fp,"Charges converged in {} iterations to {:.10f} tolerance\n",
                 iloop,enegchk);
  }
}
+4 −6
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
#include "utils.h"
#include "tokenizer.h"
#include "potential_file_reader.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;

@@ -689,12 +690,9 @@ void PairBOP::init_style()

  // check that user sets comm->cutghostuser to 3x the max BOP cutoff

  if (comm->cutghostuser < 3.0*cutmax - EPSILON) {
    char str[128];
    sprintf(str,"Pair style bop requires comm ghost cutoff "
            "at least 3x larger than %g",cutmax);
    error->all(FLERR,str);
  }
  if (comm->cutghostuser < 3.0*cutmax - EPSILON)
    error->all(FLERR,fmt::format("Pair style bop requires comm ghost cutoff "
                                 "at least 3x larger than {}",cutmax));

  // need a full neighbor list and neighbors of ghosts

+8 −6
Original line number Diff line number Diff line
@@ -493,15 +493,17 @@ void PairComb::coeff(int narg, char **arg)

  // generate streitz-mintmire direct 1/r energy look-up table

  if (comm->me == 0 && screen) fprintf(screen,"Pair COMB:\n");
  if (comm->me == 0 && screen)
    fprintf(screen,"  generating Coulomb integral lookup table ...\n");
    fputs("Pair COMB:\n"
          "  generating Coulomb integral lookup table ...\n",screen);
  sm_table();

  if (cor_flag && comm->me == 0 && screen)
    fprintf(screen,"  will apply over-coordination correction ...\n");
  if (!cor_flag&& comm->me == 0 && screen)
    fprintf(screen,"  will not apply over-coordination correction ...\n");
  if (comm->me == 0 && screen) {
    if (cor_flag)
      fputs("  will apply over-coordination correction ...\n",screen);
    else
      fputs("  will not apply over-coordination correction ...\n",screen);
  }

  // clear setflag since coeff() called once with I,J = * *

+10 −13
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "utils.h"
#include "tokenizer.h"
#include "potential_file_reader.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;
using namespace MathConst;
@@ -165,17 +166,13 @@ void PairComb3::settings(int narg, char **arg)

  if (narg != 1) error->all(FLERR,"Illegal pair_style command");

  if (strcmp(arg[0],"polar_on") == 0) {
    pol_flag = 1;
    if (comm->me == 0 && screen) fprintf(screen,
                    "   PairComb3: polarization is on \n");
  } else if (strcmp(arg[0],"polar_off") == 0) {
    pol_flag = 0;
    if (comm->me == 0 && screen) fprintf(screen,
                    "   PairComb3: polarization is off \n");
  } else {
    error->all(FLERR,"Illegal pair_style command");
  }
  if (strcmp(arg[0],"polar_on") == 0) pol_flag = 1;
  else if (strcmp(arg[0],"polar_off") == 0) pol_flag = 0;
  else error->all(FLERR,"Illegal pair_style command");

  if (comm->me == 0 && screen)
    fmt::print(screen,"   PairComb3: polarization is {} \n",
               pol_flag ? "on" : "off");
}

/* ----------------------------------------------------------------------
@@ -210,8 +207,8 @@ void PairComb3::coeff(int narg, char **arg)
  nelements = 0;
  for (i = 3; i < narg; i++) {
    if ((strcmp(arg[i],"C") == 0) && (cflag == 0)) {
      if (comm->me == 0 && screen) fprintf(screen,
      " PairComb3: Found C: reading additional library file\n");
      if (comm->me == 0 && screen)
        fputs(" PairComb3: Found C: reading additional library file\n",screen);
    read_lib();
    cflag = 1;
    }
+4 −6
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "update.h"
#include "random_mars.h"
#include "utils.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;

@@ -283,12 +284,9 @@ void PairDSMC::init_style()
  celly = (domain->boxhi[1] - domain->boxlo[1])/ncellsy;
  cellz = (domain->boxhi[2] - domain->boxlo[2])/ncellsz;

  if (comm->me == 0) {
    if (screen) fprintf(screen,"DSMC cell size = %g x %g x %g\n",
                        cellx,celly,cellz);
    if (logfile) fprintf(logfile,"DSMC cell size = %g x %g x %g\n",
                         cellx,celly,cellz);
  }
  if (comm->me == 0)
    utils::logmesg(lmp,fmt::format("DSMC cell size = {} x {} x {}\n",
                                   cellx,celly,cellz));

  total_ncells = ncellsx*ncellsy*ncellsz;
  vol = cellx*celly*cellz;