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

simplify pppm init output

parent 385d239b
Loading
Loading
Loading
Loading
+20 −36
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "pppm.h"
#include <mpi.h>
#include <cstring>
#include <string>
#include <cmath>
#include "atom.h"
#include "comm.h"
@@ -35,6 +36,8 @@
#include "remap_wrap.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
#include "fmt/format.h"

#include "math_const.h"
#include "math_special.h"
@@ -185,10 +188,7 @@ PPPM::~PPPM()

void PPPM::init()
{
  if (me == 0) {
    if (screen) fprintf(screen,"PPPM initialization ...\n");
    if (logfile) fprintf(logfile,"PPPM initialization ...\n");
  }
  if (me == 0) utils::logmesg(lmp,"PPPM initialization ...\n");

  // error check

@@ -203,13 +203,14 @@ void PPPM::init()
  if (domain->triclinic && slabflag)
    error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and "
               "slab correction");
  if (domain->dimension == 2) error->all(FLERR,
                                         "Cannot use PPPM with 2d simulation");
  if (domain->dimension == 2)
    error->all(FLERR,"Cannot use PPPM with 2d simulation");
  if (comm->style != 0)
    error->universe_all(FLERR,"PPPM can only currently be used with "
                        "comm_style brick");

  if (!atom->q_flag) error->all(FLERR,"Kspace style requires atom attribute q");
  if (!atom->q_flag)
    error->all(FLERR,"Kspace style requires atom attribute q");

  if (slabflag == 0 && domain->nonperiodic > 0)
    error->all(FLERR,"Cannot use non-periodic boundaries with PPPM");
@@ -246,10 +247,7 @@ void PPPM::init()
  qdist = 0.0;

  if (tip4pflag) {
    if (me == 0) {
      if (screen) fprintf(screen,"  extracting TIP4P info from pair style\n");
      if (logfile) fprintf(logfile,"  extracting TIP4P info from pair style\n");
    }
    if (me == 0) utils::logmesg(lmp,"  extracting TIP4P info from pair style\n");

    double *p_qdist = (double *) force->pair->extract("qdist",itmp);
    int *p_typeO = (int *) force->pair->extract("typeO",itmp);
@@ -351,31 +349,17 @@ void PPPM::init()
  MPI_Allreduce(&nfft_both,&nfft_both_max,1,MPI_INT,MPI_MAX,world);

  if (me == 0) {

    if (screen) {
      fprintf(screen,"  G vector (1/distance) = %g\n",g_ewald);
      fprintf(screen,"  grid = %d %d %d\n",nx_pppm,ny_pppm,nz_pppm);
      fprintf(screen,"  stencil order = %d\n",order);
      fprintf(screen,"  estimated absolute RMS force accuracy = %g\n",
    std::string mesg = fmt::format("  G vector (1/distance) = {}\n",g_ewald);
    mesg += fmt::format("  grid = {} {} {}\n",nx_pppm,ny_pppm,nz_pppm);
    mesg += fmt::format("  stencil order = {}\n",order);
    mesg += fmt::format("  estimated absolute RMS force accuracy = {}\n",
                       estimated_accuracy);
      fprintf(screen,"  estimated relative force accuracy = %g\n",
    mesg += fmt::format("  estimated relative force accuracy = {}\n",
                       estimated_accuracy/two_charge_force);
      fprintf(screen,"  using " LMP_FFT_PREC " precision " LMP_FFT_LIB "\n");
      fprintf(screen,"  3d grid and FFT values/proc = %d %d\n",
    mesg += "  using " LMP_FFT_PREC " precision " LMP_FFT_LIB "\n";
    mesg += fmt::format("  3d grid and FFT values/proc = {} {}\n",
                       ngrid_max,nfft_both_max);
    }
    if (logfile) {
      fprintf(logfile,"  G vector (1/distance) = %g\n",g_ewald);
      fprintf(logfile,"  grid = %d %d %d\n",nx_pppm,ny_pppm,nz_pppm);
      fprintf(logfile,"  stencil order = %d\n",order);
      fprintf(logfile,"  estimated absolute RMS force accuracy = %g\n",
              estimated_accuracy);
      fprintf(logfile,"  estimated relative force accuracy = %g\n",
              estimated_accuracy/two_charge_force);
      fprintf(logfile,"  using " LMP_FFT_PREC " precision " LMP_FFT_LIB "\n");
      fprintf(logfile,"  3d grid and FFT values/proc = %d %d\n",
              ngrid_max,nfft_both_max);
    }
    utils::logmesg(lmp,mesg);
  }

  // allocate K-space dependent memory