Commit 9090fd02 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

propagate the kspace change to a the first few kspace styles

parent 7deb1df2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ using namespace MathConst;

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

Ewald::Ewald(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp),
  kxvecs(NULL), kyvecs(NULL), kzvecs(NULL), ug(NULL), eg(NULL), vg(NULL),
  ek(NULL), sfacrl(NULL), sfacim(NULL), sfacrl_all(NULL), sfacim_all(NULL),
  cs(NULL), sn(NULL), sfacrl_A(NULL), sfacim_A(NULL), sfacrl_A_all(NULL),
@@ -49,12 +49,10 @@ Ewald::Ewald(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
{
  group_allocate_flag = 0;
  kmax_created = 0;
  if (narg != 1) error->all(FLERR,"Illegal kspace_style ewald command");

  ewaldflag = 1;
  group_group_enable = 1;

  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
  accuracy_relative = 0.0;

  kmax = 0;
  kxvecs = kyvecs = kzvecs = NULL;
@@ -69,6 +67,13 @@ Ewald::Ewald(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
  kcount = 0;
}

void Ewald::settings(int narg, char **arg)
{
  if (narg != 1) error->all(FLERR,"Illegal kspace_style ewald command");

  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}  

/* ----------------------------------------------------------------------
   free all memory
------------------------------------------------------------------------- */
+2 −1
Original line number Diff line number Diff line
@@ -26,10 +26,11 @@ namespace LAMMPS_NS {

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

+8 −4
Original line number Diff line number Diff line
@@ -43,14 +43,11 @@ using namespace MathSpecial;

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

EwaldDisp::EwaldDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
EwaldDisp::EwaldDisp(LAMMPS *lmp) : KSpace(lmp),
  kenergy(NULL), kvirial(NULL), energy_self_peratom(NULL), virial_self_peratom(NULL),
  ekr_local(NULL), hvec(NULL), kvec(NULL), B(NULL), cek_local(NULL), cek_global(NULL)
{
  if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command");

  ewaldflag = dispersionflag = dipoleflag = 1;
  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));

  memset(function, 0, EWALD_NFUNCS*sizeof(int));
  kenergy = kvirial = NULL;
@@ -68,6 +65,13 @@ EwaldDisp::EwaldDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
  M2 = 0;
}

void EwaldDisp::settings(int narg, char **arg)
{
  if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command");
  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}


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

EwaldDisp::~EwaldDisp()
+2 −1
Original line number Diff line number Diff line
@@ -36,10 +36,11 @@ typedef struct kvector { long x, y, z; } kvector;

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

+9 −5
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM};
enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */

MSM::MSM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
MSM::MSM(LAMMPS *lmp) : KSpace(lmp),
  factors(NULL), delxinv(NULL), delyinv(NULL), delzinv(NULL), nx_msm(NULL),
  ny_msm(NULL), nz_msm(NULL), nxlo_in(NULL), nylo_in(NULL), nzlo_in(NULL),
  nxhi_in(NULL), nyhi_in(NULL), nzhi_in(NULL), nxlo_out(NULL), nylo_out(NULL),
@@ -58,12 +58,8 @@ MSM::MSM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
  phi1d(NULL), dphi1d(NULL), procneigh_levels(NULL), cg(NULL), cg_peratom(NULL),
  cg_all(NULL), cg_peratom_all(NULL), part2grid(NULL), boxlo(NULL)
{
  if (narg < 1) error->all(FLERR,"Illegal kspace_style msm command");

  msmflag = 1;

  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));

  nfactors = 1;
  factors = new int[nfactors];
  factors[0] = 2;
@@ -115,6 +111,14 @@ MSM::MSM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
  order = 10;
}


void MSM::settings(int narg, char **arg)
{
  if (narg < 1) error->all(FLERR,"Illegal kspace_style msm command");
  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}


/* ----------------------------------------------------------------------
   free all memory
------------------------------------------------------------------------- */
Loading