diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index af78ea4f2a..c085d2b6a2 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -94,6 +94,7 @@ PPPMGPU::PPPMGPU(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) { if (narg != 1) error->all(FLERR,"Illegal kspace_style pppm/gpu command"); + triclinic_support = 0; density_brick_gpu = vd_brick = NULL; kspace_split = false; im_real_space = false; diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index f98595992f..57b0d98046 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -99,7 +99,8 @@ void Ewald::init() domain->boundary[2][0] != 1 || domain->boundary[2][1] != 1) error->all(FLERR,"Incorrect boundaries with slab Ewald"); if (domain->triclinic) - error->all(FLERR,"Cannot (yet) use Ewald with triclinic box and slab correction"); + error->all(FLERR,"Cannot (yet) use Ewald with triclinic box " + "and slab correction"); } // extract short-range Coulombic cutoff from pair style diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 40bc87f042..0313bfab00 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -142,7 +142,9 @@ void MSM::init() if (order%2 != 0) error->all(FLERR,"MSM order must be 4, 6, 8, or 10"); - if (sizeof(FFT_SCALAR) != 8) error->all(FLERR,"Cannot (yet) use single precision with MSM (remove -DFFT_SINGLE from Makefile and recompile)"); + if (sizeof(FFT_SCALAR) != 8) + error->all(FLERR,"Cannot (yet) use single precision with MSM " + "(remove -DFFT_SINGLE from Makefile and recompile)"); pair_check(); diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 878e3d1045..151b7ef91d 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -48,10 +48,10 @@ MSMCG::MSMCG(LAMMPS *lmp, int narg, char **arg) : MSM(lmp, narg, arg) if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal kspace_style msm/cg command"); - if (narg == 2) - smallq = atof(arg[1]); - else - smallq = SMALLQ; + triclinic_support = 0; + + if (narg == 2) smallq = atof(arg[1]); + else smallq = SMALLQ; num_charged = -1; is_charged = NULL; @@ -66,7 +66,6 @@ MSMCG::~MSMCG() memory->destroy(is_charged); } - /* ---------------------------------------------------------------------- compute the MSM long-range force, energy, virial ------------------------------------------------------------------------- */ @@ -289,7 +288,6 @@ void MSMCG::compute(int eflag, int vflag) } - /* ---------------------------------------------------------------------- find center grid pt for each of my particles check that full stencil for the particle will fit in my 3d brick diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 53f373ac12..c92bfc7dc6 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -172,9 +172,11 @@ void PPPM::init() // error check if (domain->triclinic && differentiation_flag == 1) - error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and 'kspace_modify diff ad'"); + error->all(FLERR,"Cannot (yet) use PPPM with triclinic box " + "and kspace_modify diff a'"); if (domain->triclinic && slabflag) - error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and slab correction"); + error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and " + "slab correction"); if (domain->dimension == 2) error->all(FLERR, "Cannot use PPPM with 2d simulation"); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 93d93c48c3..014d2678e8 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -53,10 +53,10 @@ PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal kspace_style pppm/cg command"); - if (narg == 2) - smallq = atof(arg[1]); - else - smallq = SMALLQ; + triclinic_support = 0; + + if (narg == 2) smallq = atof(arg[1]); + else smallq = SMALLQ; num_charged = -1; is_charged = NULL; @@ -78,7 +78,6 @@ PPPMCG::~PPPMCG() void PPPMCG::compute(int eflag, int vflag) { - // set energy/virial flags // invoke allocate_peratom() if needed for first time diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 95dfb76a9a..aa7dcc6b0c 100755 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -68,6 +68,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/disp command"); + triclinic_support = 0; pppmflag = dispersionflag = 1; accuracy_relative = atof(arg[0]); @@ -203,8 +204,7 @@ void PPPMDisp::init() if (logfile) fprintf(logfile,"PPPMDisp initialization ...\n"); } - if (domain->triclinic) - error->all(FLERR,"Cannot (yet) use PPPMDisp with triclinic box"); + triclinic_check(); if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMDisp with 2d simulation"); @@ -227,8 +227,6 @@ void PPPMDisp::init() deallocate_peratom(); peratom_allocate_flag = 0; - - // set scale scale = 1.0; diff --git a/src/KSPACE/pppm_disp_tip4p.cpp b/src/KSPACE/pppm_disp_tip4p.cpp index 4a93013ae0..1de82c867e 100755 --- a/src/KSPACE/pppm_disp_tip4p.cpp +++ b/src/KSPACE/pppm_disp_tip4p.cpp @@ -44,6 +44,7 @@ using namespace MathConst; PPPMDispTIP4P::PPPMDispTIP4P(LAMMPS *lmp, int narg, char **arg) : PPPMDisp(lmp, narg, arg) { + triclinic_support = 0; tip4pflag = 1; } diff --git a/src/KSPACE/pppm_old.cpp b/src/KSPACE/pppm_old.cpp index 0b7f2d45e3..f050c734c9 100644 --- a/src/KSPACE/pppm_old.cpp +++ b/src/KSPACE/pppm_old.cpp @@ -60,6 +60,7 @@ PPPMOld::PPPMOld(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command"); + triclinic_support = 0; pppmflag = 1; group_group_enable = 1; @@ -123,8 +124,7 @@ void PPPMOld::init() // error check - if (domain->triclinic) - error->all(FLERR,"Cannot (yet) use PPPM with triclinic box"); + triclinic_check(); if (domain->dimension == 2) error->all(FLERR, "Cannot use PPPM with 2d simulation"); diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index dd2f3da0cc..772c156a1e 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -42,6 +42,7 @@ using namespace MathConst; PPPMTIP4P::PPPMTIP4P(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) { + triclinic_support = 0; tip4pflag = 1; } diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index ec79dadf34..2052582c48 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -109,6 +109,8 @@ PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : #ifndef FFT_CUFFT error->all(FLERR,"Using kspace_style pppm/cuda without cufft is not possible. Compile with cufft=1 to include cufft. Aborting."); #endif + + triclinic_support = 0; accuracy_relative = atof(arg[0]); nfactors = 3; @@ -209,8 +211,7 @@ void PPPMCuda::init() // error check - if (domain->triclinic) - error->all(FLERR,"Cannot (yet) use PPPMCuda with triclinic box"); + triclinic_check(); if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMCuda with 2d simulation"); if (!atom->q_flag) error->all(FLERR,"Kspace style requires atom attribute q"); diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index 93b61af186..07881bf895 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -37,6 +37,7 @@ using namespace MathConst; EwaldOMP::EwaldOMP(LAMMPS *lmp, int narg, char **arg) : Ewald(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index bc78414af6..1c3369be76 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -49,10 +49,10 @@ MSMCGOMP::MSMCGOMP(LAMMPS *lmp, int narg, char **arg) : MSMOMP(lmp, narg, arg) if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal kspace_style msm/cg/omp command"); - if (narg == 2) - smallq = atof(arg[1]); - else - smallq = SMALLQ; + triclinic_support = 0; + + if (narg == 2) smallq = atof(arg[1]); + else smallq = SMALLQ; num_charged = -1; is_charged = NULL; @@ -67,7 +67,6 @@ MSMCGOMP::~MSMCGOMP() memory->destroy(is_charged); } - /* ---------------------------------------------------------------------- compute the MSM long-range force, energy, virial ------------------------------------------------------------------------- */ diff --git a/src/USER-OMP/msm_omp.cpp b/src/USER-OMP/msm_omp.cpp index 18e2086a3b..04b6ae6e46 100755 --- a/src/USER-OMP/msm_omp.cpp +++ b/src/USER-OMP/msm_omp.cpp @@ -38,6 +38,7 @@ using namespace LAMMPS_NS; MSMOMP::MSMOMP(LAMMPS *lmp, int narg, char **arg) : MSM(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/pppm_cg_omp.cpp b/src/USER-OMP/pppm_cg_omp.cpp index d5ebf21e14..48e319b468 100644 --- a/src/USER-OMP/pppm_cg_omp.cpp +++ b/src/USER-OMP/pppm_cg_omp.cpp @@ -49,6 +49,7 @@ using namespace MathSpecial; PPPMCGOMP::PPPMCGOMP(LAMMPS *lmp, int narg, char **arg) : PPPMCG(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/pppm_disp_omp.cpp b/src/USER-OMP/pppm_disp_omp.cpp index 7a60ad57f2..7871cde401 100644 --- a/src/USER-OMP/pppm_disp_omp.cpp +++ b/src/USER-OMP/pppm_disp_omp.cpp @@ -46,6 +46,7 @@ using namespace MathConst; PPPMDispOMP::PPPMDispOMP(LAMMPS *lmp, int narg, char **arg) : PPPMDisp(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/pppm_disp_tip4p_omp.cpp b/src/USER-OMP/pppm_disp_tip4p_omp.cpp index 9532a2d61b..557b36e426 100644 --- a/src/USER-OMP/pppm_disp_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_disp_tip4p_omp.cpp @@ -47,6 +47,7 @@ using namespace MathSpecial; PPPMDispTIP4POMP::PPPMDispTIP4POMP(LAMMPS *lmp, int narg, char **arg) : PPPMDispTIP4P(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; tip4pflag = 1; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/pppm_omp.cpp b/src/USER-OMP/pppm_omp.cpp index d0c9d99689..bcda74e92a 100644 --- a/src/USER-OMP/pppm_omp.cpp +++ b/src/USER-OMP/pppm_omp.cpp @@ -47,6 +47,7 @@ using namespace MathSpecial; PPPMOMP::PPPMOMP(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/USER-OMP/pppm_tip4p_omp.cpp b/src/USER-OMP/pppm_tip4p_omp.cpp index 9679474ae4..f11d44d753 100644 --- a/src/USER-OMP/pppm_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_tip4p_omp.cpp @@ -48,6 +48,7 @@ using namespace MathSpecial; PPPMTIP4POMP::PPPMTIP4POMP(LAMMPS *lmp, int narg, char **arg) : PPPMTIP4P(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { + triclinic_support = 0; suffix_flag |= Suffix::OMP; } diff --git a/src/kspace.cpp b/src/kspace.cpp index a4aeb07576..f7db79568c 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -33,6 +33,7 @@ KSpace::KSpace(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) energy = 0.0; virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0; + triclinic_support = 1; ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = 0; compute_flag = 1; group_group_enable = 0; @@ -128,6 +129,14 @@ KSpace::~KSpace() /* ---------------------------------------------------------------------- */ +void KSpace::triclinic_check() +{ + if (domain->triclinic && triclinic_support != 1) + error->all(FLERR,"KSpace style does not yet support triclinic geometries"); +} + +/* ---------------------------------------------------------------------- */ + void KSpace::compute_dummy(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); diff --git a/src/kspace.h b/src/kspace.h index e27cd7297a..63446b8c44 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -30,12 +30,13 @@ class KSpace : protected Pointers { friend class ThrOMP; friend class FixOMP; public: - double energy; // accumulated energy + double energy; // accumulated energies double energy_1,energy_6; - double virial[6]; // accumlated virial - double *eatom,**vatom; // accumulated per-atom energy/virial - double e2group; // accumulated group-group energy - double f2group[3]; // accumulated group-group force + double virial[6]; // accumlated virial + double *eatom,**vatom; // accumulated per-atom energy/virial + double e2group; // accumulated group-group energy + double f2group[3]; // accumulated group-group force + int triclinic_support; // 1 if supports triclinic geometries int ewaldflag; // 1 if a Ewald solver int pppmflag; // 1 if a PPPM solver @@ -58,6 +59,7 @@ class KSpace : protected Pointers { KSpace(class LAMMPS *, int, char **); virtual ~KSpace(); + void triclinic_check(); void modify_params(int, char **); void *extract(const char *); void compute_dummy(int, int);