diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 22a4531eec..57bd7eb9cb 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -153,6 +153,12 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) options(narg-iarg,&arg[iarg]); + // setup dimflags used by other classes to check for volume-change conflicts + + for (int i = 0; i < 6; i++) + if (set[i].style == NONE) dimflag[i] = 0; + else dimflag[i] = 1; + // check periodicity if ((set[0].style && domain->xperiodic == 0) || diff --git a/src/fix_deform.h b/src/fix_deform.h index f34bad600e..201aafd322 100644 --- a/src/fix_deform.h +++ b/src/fix_deform.h @@ -20,7 +20,8 @@ namespace LAMMPS_NS { class FixDeform : public Fix { public: - int remapflag; + int remapflag; // whether x,v are remapped across PBC + int dimflag[6]; // which dims are deformed FixDeform(class LAMMPS *, int, char **); ~FixDeform(); diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index d3ff39ed12..2fe14a4c44 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -24,6 +24,7 @@ #include "comm.h" #include "domain.h" #include "modify.h" +#include "fix_deform.h" #include "compute.h" #include "kspace.h" #include "update.h" @@ -232,6 +233,14 @@ void FixNPH::init() if (atom->mass == NULL) error->all("Cannot use fix nph without per-type mass defined"); + for (int i = 0; i < modify->nfix; i++) + if (strcmp(modify->fix[i]->style,"deform") == 0) { + int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || + (p_flag[2] && dimflag[2])) + error->all("Cannot use fix npt and fix deform on same dimension"); + } + // set temperature and pressure ptrs // set ptemperature only if pressure's id_pre[0] is not id_temp diff --git a/src/fix_npt.cpp b/src/fix_npt.cpp index a0dd52261b..391d957637 100644 --- a/src/fix_npt.cpp +++ b/src/fix_npt.cpp @@ -23,6 +23,7 @@ #include "force.h" #include "comm.h" #include "modify.h" +#include "fix_deform.h" #include "compute.h" #include "kspace.h" #include "update.h" @@ -242,6 +243,14 @@ void FixNPT::init() if (atom->mass == NULL) error->all("Cannot use fix npt without per-type mass defined"); + for (int i = 0; i < modify->nfix; i++) + if (strcmp(modify->fix[i]->style,"deform") == 0) { + int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || + (p_flag[2] && dimflag[2])) + error->all("Cannot use fix npt and fix deform on same dimension"); + } + // set temperature and pressure ptrs // set ptemperature only if pressure's id_pre[0] is not id_temp