Unverified Commit 1d38f2d7 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1165 from akohlmey/refactor-kspace-base-class

Refactor kspace base class to have a settings() method
parents 4a5c14f6 db32373b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
# Point dipoles in a 2d box

units		lj
atom_style  full	
atom_style  charge	

read_data data.NaCl

@@ -29,7 +29,7 @@ pair_coeff * *
#fix		2 all scafacos p3m tolerance field 0.001

kspace_style    scafacos p3m 0.001
kspace_style    scafacos tolerance field 
#kspace_style    scafacos tolerance field 

timestep	0.005
thermo          10
+1 −3
Original line number Diff line number Diff line
@@ -89,10 +89,8 @@ void PPPM_GPU_API(forces)(double **f);

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

PPPMGPU::PPPMGPU(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg)
PPPMGPU::PPPMGPU(LAMMPS *lmp) : PPPM(lmp)
{
  if (narg != 1) error->all(FLERR,"Illegal kspace_style pppm/gpu command");

  triclinic_support = 0;
  density_brick_gpu = vd_brick = NULL;
  kspace_split = false;
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ namespace LAMMPS_NS {

class PPPMGPU : public PPPM {
 public:
  PPPMGPU(class LAMMPS *, int, char **);
  PPPMGPU(class LAMMPS *);
  virtual ~PPPMGPU();
  void init();
  void setup();
+8 −5
Original line number Diff line number Diff line
@@ -64,10 +64,8 @@ enum{FORWARD_IK,FORWARD_IK_PERATOM};
/* ---------------------------------------------------------------------- */

template<class DeviceType>
PPPMKokkos<DeviceType>::PPPMKokkos(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg)
PPPMKokkos<DeviceType>::PPPMKokkos(LAMMPS *lmp) : PPPM(lmp)
{
  if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command");

  atomKK = (AtomKokkos *) atom;
  execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
  datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK;
@@ -77,8 +75,6 @@ PPPMKokkos<DeviceType>::PPPMKokkos(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp
  group_group_enable = 0;
  triclinic_support = 0;

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

  nfactors = 3;
  //factors = new int[nfactors];
  factors[0] = 2;
@@ -148,6 +144,13 @@ PPPMKokkos<DeviceType>::PPPMKokkos(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp
  k_flag = DAT::tdual_int_scalar("PPPM:flag");
}

template<class DeviceType>
void PPPMKokkos<DeviceType>::settings(int narg, char **arg)
{
  if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/kk command");
  accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}

/* ----------------------------------------------------------------------
   free all memory
------------------------------------------------------------------------- */
+2 −1
Original line number Diff line number Diff line
@@ -92,11 +92,12 @@ class PPPMKokkos : public PPPM, public KokkosBase {
  typedef DeviceType device_type;
  typedef ArrayTypes<DeviceType> AT;

  PPPMKokkos(class LAMMPS *, int, char **);
  PPPMKokkos(class LAMMPS *);
  virtual ~PPPMKokkos();
  virtual void init();
  virtual void setup();
  void setup_grid();
  virtual void settings(int, char **);
  virtual void compute(int, int);
  virtual int timing_1d(int, double &);
  virtual int timing_3d(int, double &);
Loading