Commit 3a4bef35 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

refactor kspace style in USER-SCAFACOS and fix uninitialized handle bug

parent da841384
Loading
Loading
Loading
Loading
+22 −25
Original line number Diff line number Diff line
@@ -36,7 +36,21 @@ using namespace LAMMPS_NS;

/* ---------------------------------------------------------------------- */

Scafacos::Scafacos(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
Scafacos::Scafacos(LAMMPS *lmp) : KSpace(lmp)
{
  me = comm->me;
  initialized = 0;

  maxatom = 0;
  xpbc = NULL;
  epot = NULL;
  efield = NULL;
  fcs = NULL;
}

/* ---------------------------------------------------------------------- */

void Scafacos::settings(int narg, char **arg)
{
  if (narg != 2) error->all(FLERR,"Illegal scafacos command");

@@ -48,35 +62,18 @@ Scafacos::Scafacos(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
  // optional ScaFaCoS library setting defaults
  // choose the correct default tolerance type for chosen method
  // throw an error if a not yet supported solver is chosen
  if (strcmp(method,"fmm") == 0)
  {
  if (strcmp(method,"fmm") == 0) {
    tolerance_type = FCS_TOLERANCE_TYPE_ENERGY;
    fmm_tuning_flag = 0;
  }
  else if (strcmp(method,"p3m") == 0 || 
  } else if (strcmp(method,"p3m") == 0 || 
             strcmp(method,"p2nfft") == 0 || 
           strcmp(method,"ewald") == 0)
  {
             strcmp(method,"ewald") == 0) {
    tolerance_type = FCS_TOLERANCE_TYPE_FIELD;    
  }
  else if (strcmp(method,"direct") == 0)
  {
    // direct summation has no tolerance type
  }
  else
  {
  } else if (strcmp(method,"direct") == 0) {
    ; // direct summation has no tolerance type
  } else {
    error->all(FLERR,"Unsupported ScaFaCoS method");
  }

  // initializations

  me = comm->me;
  initialized = 0;

  maxatom = 0;
  xpbc = NULL;
  epot = NULL;
  efield = NULL;
}

/* ---------------------------------------------------------------------- */
+2 −1
Original line number Diff line number Diff line
@@ -27,10 +27,11 @@ namespace LAMMPS_NS {

class Scafacos : public KSpace {
 public:
  Scafacos(class LAMMPS *, int, char **);
  Scafacos(class LAMMPS *);
  ~Scafacos();
  void init();
  void setup() {}
  void settings(int, char **);
  void compute(int, int);
  int modify_param(int, char **);
  double memory_usage();