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
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->slabflag = old_slabflag;
force->kspace->slab_volfactor = old_slab_volfactor;

View File

@ -111,6 +111,7 @@ MSM::MSM(LAMMPS *lmp) : KSpace(lmp),
order = 10;
}
/* ---------------------------------------------------------------------- */
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]));
}
/* ----------------------------------------------------------------------
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)
{
triclinic_support = 0;
num_charged = -1;
}
/* ---------------------------------------------------------------------- */
void MSMCG::settings(int narg, char **arg)
{
if ((narg < 1) || (narg > 2))
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]));
else smallq = SMALLQ;
num_charged = -1;
}
/* ----------------------------------------------------------------------

View File

@ -26,8 +26,9 @@ namespace LAMMPS_NS {
class MSMCG : public MSM {
public:
MSMCG(class LAMMPS *, int, char **);
MSMCG(class LAMMPS *);
virtual ~MSMCG();
virtual void settings(int, char **);
virtual void compute(int, int);
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),
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),
@ -78,14 +78,10 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg),
peratom_allocate_flag = 0;
group_allocate_flag = 0;
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command");
pppmflag = 1;
group_group_enable = 1;
triclinic = domain->triclinic;
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 3;
factors = new int[nfactors];
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;
}
/* ---------------------------------------------------------------------- */
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
------------------------------------------------------------------------- */

View File

@ -37,8 +37,9 @@ namespace LAMMPS_NS {
class PPPM : public KSpace {
public:
PPPM(class LAMMPS *, int, char **);
PPPM(class LAMMPS *);
virtual ~PPPM();
virtual void settings(int, char **);
virtual void init();
virtual void setup();
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)
{
num_charged = -1;
group_group_enable = 1;
}
/* ---------------------------------------------------------------------- */
void PPPMCG::settings(int narg, char **arg)
{
if ((narg < 1) || (narg > 2))
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]));
else smallq = SMALLQ;
num_charged = -1;
group_group_enable = 1;
}
/* ----------------------------------------------------------------------

View File

@ -26,8 +26,9 @@ namespace LAMMPS_NS {
class PPPMCG : public PPPM {
public:
PPPMCG(class LAMMPS *, int, char **);
PPPMCG(class LAMMPS *);
virtual ~PPPMCG();
virtual void settings(int, char **);
virtual void compute(int, int);
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),
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),
@ -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),
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;
pppmflag = dispersionflag = 1;
accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 3;
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));
}
/* ---------------------------------------------------------------------- */
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
------------------------------------------------------------------------- */

View File

@ -41,11 +41,12 @@ namespace LAMMPS_NS {
class PPPMDisp : public KSpace {
public:
PPPMDisp(class LAMMPS *, int, char **);
PPPMDisp(class LAMMPS *);
virtual ~PPPMDisp();
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 &);

View File

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

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PPPMDispTIP4P : public PPPMDisp {
public:
PPPMDispTIP4P(class LAMMPS *, int, char **);
PPPMDispTIP4P(class LAMMPS *);
virtual ~PPPMDispTIP4P () {};
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) :
PPPM(lmp, narg, arg),
PPPMStagger::PPPMStagger(LAMMPS *lmp) :
PPPM(lmp),
gf_b2(NULL)
{
if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/stagger command");
stagger_flag = 1;
group_group_enable = 0;

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class EwaldOMP : public Ewald, public ThrOMP {
public:
EwaldOMP(class LAMMPS *, int, char **);
EwaldOMP(class LAMMPS *);
virtual ~EwaldOMP() { };
virtual void allocate();
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)
{
triclinic_support = 0;
num_charged = -1;
}
/* ---------------------------------------------------------------------- */
void MSMCGOMP::settings(int narg, char **arg)
{
if ((narg < 1) || (narg > 2))
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]));
else smallq = SMALLQ;
num_charged = -1;
}
/* ----------------------------------------------------------------------

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class MSMOMP : public MSM, public ThrOMP {
public:
MSMOMP(class LAMMPS *, int, char **);
MSMOMP(class LAMMPS *);
virtual ~MSMOMP () {};
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.
*/
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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