kspace refactor compiles for KSPACE and USER-OMP

This commit is contained in:
Axel Kohlmeyer 2018-10-19 15:11:37 -04:00
parent 9090fd0255
commit 2f52eee6bf
32 changed files with 92 additions and 60 deletions

View File

@ -273,7 +273,8 @@ void FixTuneKspace::update_kspace_style(char *new_kspace_style,
// delete old kspace style and create new one // delete old kspace style and create new one
force->create_kspace(narg,arg,1); force->create_kspace(arg[0],1);
force->kspace->settings(narg-1,&arg[1]);
force->kspace->differentiation_flag = old_differentiation_flag; force->kspace->differentiation_flag = old_differentiation_flag;
force->kspace->slabflag = old_slabflag; force->kspace->slabflag = old_slabflag;
force->kspace->slab_volfactor = old_slab_volfactor; force->kspace->slab_volfactor = old_slab_volfactor;

View File

@ -111,6 +111,7 @@ MSM::MSM(LAMMPS *lmp) : KSpace(lmp),
order = 10; order = 10;
} }
/* ---------------------------------------------------------------------- */
void MSM::settings(int narg, char **arg) void MSM::settings(int narg, char **arg)
{ {
@ -118,7 +119,6 @@ void MSM::settings(int narg, char **arg)
accuracy_relative = fabs(force->numeric(FLERR,arg[0])); accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free all memory free all memory
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -42,18 +42,27 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
MSMCG::MSMCG(LAMMPS *lmp, int narg, char **arg) : MSM(lmp, narg, arg), MSMCG::MSMCG(LAMMPS *lmp) : MSM(lmp),
is_charged(NULL) is_charged(NULL)
{
triclinic_support = 0;
num_charged = -1;
}
/* ---------------------------------------------------------------------- */
void MSMCG::settings(int narg, char **arg)
{ {
if ((narg < 1) || (narg > 2)) if ((narg < 1) || (narg > 2))
error->all(FLERR,"Illegal kspace_style msm/cg command"); error->all(FLERR,"Illegal kspace_style msm/cg command");
triclinic_support = 0; // first argument is processed in parent class
MSM::settings(narg,arg);
if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -26,8 +26,9 @@ namespace LAMMPS_NS {
class MSMCG : public MSM { class MSMCG : public MSM {
public: public:
MSMCG(class LAMMPS *, int, char **); MSMCG(class LAMMPS *);
virtual ~MSMCG(); virtual ~MSMCG();
virtual void settings(int, char **);
virtual void compute(int, int); virtual void compute(int, int);
virtual double memory_usage(); virtual double memory_usage();

View File

@ -64,7 +64,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg), PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp),
factors(NULL), density_brick(NULL), vdx_brick(NULL), vdy_brick(NULL), vdz_brick(NULL), factors(NULL), density_brick(NULL), vdx_brick(NULL), vdy_brick(NULL), vdz_brick(NULL),
u_brick(NULL), v0_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), u_brick(NULL), v0_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL),
v4_brick(NULL), v5_brick(NULL), greensfn(NULL), vg(NULL), fkx(NULL), fky(NULL), v4_brick(NULL), v5_brick(NULL), greensfn(NULL), vg(NULL), fkx(NULL), fky(NULL),
@ -78,14 +78,10 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
peratom_allocate_flag = 0; peratom_allocate_flag = 0;
group_allocate_flag = 0; group_allocate_flag = 0;
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command");
pppmflag = 1; pppmflag = 1;
group_group_enable = 1; group_group_enable = 1;
triclinic = domain->triclinic; triclinic = domain->triclinic;
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 3; nfactors = 3;
factors = new int[nfactors]; factors = new int[nfactors];
factors[0] = 2; factors[0] = 2;
@ -161,6 +157,14 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
acons[7][6] = 4887769399.0 / 37838389248.0; acons[7][6] = 4887769399.0 / 37838389248.0;
} }
/* ---------------------------------------------------------------------- */
void PPPM::settings(int narg, char **arg)
{
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command");
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free all memory free all memory
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -37,8 +37,9 @@ namespace LAMMPS_NS {
class PPPM : public KSpace { class PPPM : public KSpace {
public: public:
PPPM(class LAMMPS *, int, char **); PPPM(class LAMMPS *);
virtual ~PPPM(); virtual ~PPPM();
virtual void settings(int, char **);
virtual void init(); virtual void init();
virtual void setup(); virtual void setup();
void setup_grid(); void setup_grid();

View File

@ -48,17 +48,26 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg), PPPMCG::PPPMCG(LAMMPS *lmp) : PPPM(lmp),
is_charged(NULL) is_charged(NULL)
{
num_charged = -1;
group_group_enable = 1;
}
/* ---------------------------------------------------------------------- */
void PPPMCG::settings(int narg, char **arg)
{ {
if ((narg < 1) || (narg > 2)) if ((narg < 1) || (narg > 2))
error->all(FLERR,"Illegal kspace_style pppm/cg command"); error->all(FLERR,"Illegal kspace_style pppm/cg command");
// first argument is processed in parent class
PPPM::settings(narg,arg);
if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1;
group_group_enable = 1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -26,8 +26,9 @@ namespace LAMMPS_NS {
class PPPMCG : public PPPM { class PPPMCG : public PPPM {
public: public:
PPPMCG(class LAMMPS *, int, char **); PPPMCG(class LAMMPS *);
virtual ~PPPMCG(); virtual ~PPPMCG();
virtual void settings(int, char **);
virtual void compute(int, int); virtual void compute(int, int);
virtual double memory_usage(); virtual double memory_usage();

View File

@ -63,7 +63,7 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg), PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp),
factors(NULL), csumi(NULL), cii(NULL), B(NULL), density_brick(NULL), vdx_brick(NULL), factors(NULL), csumi(NULL), cii(NULL), B(NULL), density_brick(NULL), vdx_brick(NULL),
vdy_brick(NULL), vdz_brick(NULL), density_fft(NULL), u_brick(NULL), v0_brick(NULL), vdy_brick(NULL), vdz_brick(NULL), density_fft(NULL), u_brick(NULL), v0_brick(NULL),
v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), v4_brick(NULL), v5_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), v4_brick(NULL), v5_brick(NULL),
@ -106,11 +106,8 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
fft2_6(NULL), remap(NULL), remap_6(NULL), cg(NULL), cg_peratom(NULL), cg_6(NULL), fft2_6(NULL), remap(NULL), remap_6(NULL), cg(NULL), cg_peratom(NULL), cg_6(NULL),
cg_peratom_6(NULL), part2grid(NULL), part2grid_6(NULL), boxlo(NULL) cg_peratom_6(NULL), part2grid(NULL), part2grid_6(NULL), boxlo(NULL)
{ {
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/disp command");
triclinic_support = 0; triclinic_support = 0;
pppmflag = dispersionflag = 1; pppmflag = dispersionflag = 1;
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 3; nfactors = 3;
factors = new int[nfactors]; factors = new int[nfactors];
@ -225,6 +222,14 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
memset(function, 0, EWALD_FUNCS*sizeof(int)); memset(function, 0, EWALD_FUNCS*sizeof(int));
} }
/* ---------------------------------------------------------------------- */
void PPPMDisp::settings(int narg, char **arg)
{
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/disp command");
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free all memory free all memory
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -41,11 +41,12 @@ namespace LAMMPS_NS {
class PPPMDisp : public KSpace { class PPPMDisp : public KSpace {
public: public:
PPPMDisp(class LAMMPS *, int, char **); PPPMDisp(class LAMMPS *);
virtual ~PPPMDisp(); virtual ~PPPMDisp();
virtual void init(); virtual void init();
virtual void setup(); virtual void setup();
void setup_grid(); void setup_grid();
virtual void settings(int, char **);
virtual void compute(int, int); virtual void compute(int, int);
virtual int timing_1d(int, double &); virtual int timing_1d(int, double &);
virtual int timing_3d(int, double &); virtual int timing_3d(int, double &);

View File

@ -41,8 +41,7 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMDispTIP4P::PPPMDispTIP4P(LAMMPS *lmp, int narg, char **arg) : PPPMDispTIP4P::PPPMDispTIP4P(LAMMPS *lmp) : PPPMDisp(lmp)
PPPMDisp(lmp, narg, arg)
{ {
triclinic_support = 0; triclinic_support = 0;
tip4pflag = 1; tip4pflag = 1;

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PPPMDispTIP4P : public PPPMDisp { class PPPMDispTIP4P : public PPPMDisp {
public: public:
PPPMDispTIP4P(class LAMMPS *, int, char **); PPPMDispTIP4P(class LAMMPS *);
virtual ~PPPMDispTIP4P () {}; virtual ~PPPMDispTIP4P () {};
void init(); void init();

View File

@ -51,11 +51,10 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMStagger::PPPMStagger(LAMMPS *lmp, int narg, char **arg) : PPPMStagger::PPPMStagger(LAMMPS *lmp) :
PPPM(lmp, narg, arg), PPPM(lmp),
gf_b2(NULL) gf_b2(NULL)
{ {
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/stagger command");
stagger_flag = 1; stagger_flag = 1;
group_group_enable = 0; group_group_enable = 0;

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PPPMStagger : public PPPM { class PPPMStagger : public PPPM {
public: public:
PPPMStagger(class LAMMPS *, int, char **); PPPMStagger(class LAMMPS *);
virtual ~PPPMStagger(); virtual ~PPPMStagger();
virtual void init(); virtual void init();
virtual void compute(int, int); virtual void compute(int, int);

View File

@ -39,8 +39,7 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMTIP4P::PPPMTIP4P(LAMMPS *lmp, int narg, char **arg) : PPPMTIP4P::PPPMTIP4P(LAMMPS *lmp) : PPPM(lmp)
PPPM(lmp, narg, arg)
{ {
triclinic_support = 1; triclinic_support = 1;
tip4pflag = 1; tip4pflag = 1;

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PPPMTIP4P : public PPPM { class PPPMTIP4P : public PPPM {
public: public:
PPPMTIP4P(class LAMMPS *, int, char **); PPPMTIP4P(class LAMMPS *);
virtual ~PPPMTIP4P () {}; virtual ~PPPMTIP4P () {};
void init(); void init();

View File

@ -34,8 +34,7 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
EwaldOMP::EwaldOMP(LAMMPS *lmp, int narg, char **arg) EwaldOMP::EwaldOMP(LAMMPS *lmp) : Ewald(lmp), ThrOMP(lmp, THR_KSPACE)
: Ewald(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class EwaldOMP : public Ewald, public ThrOMP { class EwaldOMP : public Ewald, public ThrOMP {
public: public:
EwaldOMP(class LAMMPS *, int, char **); EwaldOMP(class LAMMPS *);
virtual ~EwaldOMP() { }; virtual ~EwaldOMP() { };
virtual void allocate(); virtual void allocate();
virtual void compute(int, int); virtual void compute(int, int);

View File

@ -44,18 +44,25 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
MSMCGOMP::MSMCGOMP(LAMMPS *lmp, int narg, char **arg) : MSMOMP(lmp, narg, arg), MSMCGOMP::MSMCGOMP(LAMMPS *lmp) : MSMOMP(lmp),
is_charged(NULL) is_charged(NULL)
{
triclinic_support = 0;
num_charged = -1;
}
/* ---------------------------------------------------------------------- */
void MSMCGOMP::settings(int narg, char **arg)
{ {
if ((narg < 1) || (narg > 2)) if ((narg < 1) || (narg > 2))
error->all(FLERR,"Illegal kspace_style msm/cg/omp command"); error->all(FLERR,"Illegal kspace_style msm/cg/omp command");
triclinic_support = 0; MSMOMP::settings(narg,arg);
if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -26,8 +26,9 @@ namespace LAMMPS_NS {
class MSMCGOMP : public MSMOMP { class MSMCGOMP : public MSMOMP {
public: public:
MSMCGOMP(class LAMMPS *, int, char **); MSMCGOMP(class LAMMPS *);
virtual ~MSMCGOMP(); virtual ~MSMCGOMP();
virtual void settings(int, char **);
virtual void compute(int, int); virtual void compute(int, int);
virtual double memory_usage(); virtual double memory_usage();

View File

@ -35,8 +35,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
MSMOMP::MSMOMP(LAMMPS *lmp, int narg, char **arg) : MSMOMP::MSMOMP(LAMMPS *lmp) : MSM(lmp), ThrOMP(lmp, THR_KSPACE)
MSM(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class MSMOMP : public MSM, public ThrOMP { class MSMOMP : public MSM, public ThrOMP {
public: public:
MSMOMP(class LAMMPS *, int, char **); MSMOMP(class LAMMPS *);
virtual ~MSMOMP () {}; virtual ~MSMOMP () {};
protected: protected:
@ -51,4 +51,4 @@ E: Must use 'kspace_modify pressure/scalar no' with kspace_style msm/omp
The kspace scalar pressure option is not compatible with kspace_style msm/omp. The kspace scalar pressure option is not compatible with kspace_style msm/omp.
*/ */

View File

@ -46,8 +46,7 @@ using namespace MathSpecial;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMCGOMP::PPPMCGOMP(LAMMPS *lmp, int narg, char **arg) : PPPMCGOMP::PPPMCGOMP(LAMMPS *lmp) : PPPMCG(lmp), ThrOMP(lmp, THR_KSPACE)
PPPMCG(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PPPMCGOMP : public PPPMCG, public ThrOMP { class PPPMCGOMP : public PPPMCG, public ThrOMP {
public: public:
PPPMCGOMP(class LAMMPS *, int, char **); PPPMCGOMP(class LAMMPS *);
virtual ~PPPMCGOMP (); virtual ~PPPMCGOMP ();
virtual void compute(int, int); virtual void compute(int, int);

View File

@ -43,8 +43,7 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMDispOMP::PPPMDispOMP(LAMMPS *lmp, int narg, char **arg) : PPPMDispOMP::PPPMDispOMP(LAMMPS *lmp) : PPPMDisp(lmp), ThrOMP(lmp, THR_KSPACE)
PPPMDisp(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PPPMDispOMP : public PPPMDisp, public ThrOMP { class PPPMDispOMP : public PPPMDisp, public ThrOMP {
public: public:
PPPMDispOMP(class LAMMPS *, int, char **); PPPMDispOMP(class LAMMPS *);
virtual ~PPPMDispOMP (); virtual ~PPPMDispOMP ();
virtual void compute(int, int); virtual void compute(int, int);

View File

@ -43,8 +43,8 @@ using namespace MathSpecial;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMDispTIP4POMP::PPPMDispTIP4POMP(LAMMPS *lmp, int narg, char **arg) : PPPMDispTIP4POMP::PPPMDispTIP4POMP(LAMMPS *lmp) :
PPPMDispTIP4P(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) PPPMDispTIP4P(lmp), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
tip4pflag = 1; tip4pflag = 1;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP { class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP {
public: public:
PPPMDispTIP4POMP(class LAMMPS *, int, char **); PPPMDispTIP4POMP(class LAMMPS *);
virtual ~PPPMDispTIP4POMP (); virtual ~PPPMDispTIP4POMP ();
protected: protected:

View File

@ -43,8 +43,7 @@ using namespace MathSpecial;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMOMP::PPPMOMP(LAMMPS *lmp, int narg, char **arg) : PPPMOMP::PPPMOMP(LAMMPS *lmp) : PPPM(lmp), ThrOMP(lmp, THR_KSPACE)
PPPM(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 0; triclinic_support = 0;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PPPMOMP : public PPPM, public ThrOMP { class PPPMOMP : public PPPM, public ThrOMP {
public: public:
PPPMOMP(class LAMMPS *, int, char **); PPPMOMP(class LAMMPS *);
virtual ~PPPMOMP (); virtual ~PPPMOMP ();
virtual void compute(int, int); virtual void compute(int, int);

View File

@ -44,8 +44,8 @@ using namespace MathSpecial;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PPPMTIP4POMP::PPPMTIP4POMP(LAMMPS *lmp, int narg, char **arg) : PPPMTIP4POMP::PPPMTIP4POMP(LAMMPS *lmp) :
PPPMTIP4P(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) PPPMTIP4P(lmp), ThrOMP(lmp, THR_KSPACE)
{ {
triclinic_support = 1; triclinic_support = 1;
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PPPMTIP4POMP : public PPPMTIP4P, public ThrOMP { class PPPMTIP4POMP : public PPPMTIP4P, public ThrOMP {
public: public:
PPPMTIP4POMP(class LAMMPS *, int, char **); PPPMTIP4POMP(class LAMMPS *);
virtual ~PPPMTIP4POMP (); virtual ~PPPMTIP4POMP ();
virtual void compute(int, int); virtual void compute(int, int);