diff --git a/src/dihedral.cpp b/src/dihedral.cpp index 14b59d2542..a6e66ac9cf 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -33,6 +33,7 @@ Dihedral::Dihedral(LAMMPS *_lmp) : Pointers(_lmp) { energy = 0.0; writedata = 0; + reinitflag = 1; allocated = 0; suffix_flag = Suffix::NONE; @@ -428,3 +429,15 @@ double Dihedral::memory_usage() bytes += (double) comm->nthreads * maxcvatom * 9 * sizeof(double); return bytes; } + +/* ----------------------------------------------------------------------- + reset all type-based dihedral params via init() +-------------------------------------------------------------------------- */ + +void Dihedral::reinit() +{ + if (!reinitflag) + error->all(FLERR, "Fix adapt interface to this dihedral style not supported"); + + init(); +} diff --git a/src/dihedral.h b/src/dihedral.h index 03a5690a49..7ca3379e44 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -37,6 +37,9 @@ class Dihedral : protected Pointers { // CENTROID_AVAIL = different and implemented // CENTROID_NOTAVAIL = different, not yet implemented + int reinitflag; // 0 if not compatible with fix adapt + // extract() method may still need to be added + // KOKKOS host/device flag and data masks ExecutionSpace execution_space; @@ -62,6 +65,8 @@ class Dihedral : protected Pointers { du = 0.0; du2 = 0.0; } + virtual void *extract(const char *, int &) { return nullptr; } + void reinit(); protected: int suffix_flag; // suffix compatibility flag diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 3671391f5d..6210009170 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -326,6 +326,14 @@ void DihedralHybrid::init_style() if (styles[m]) styles[m]->init_style(); } +/* ---------------------------------------------------------------------- */ + +int DihedralHybrid::check_itype(int itype, char *substyle) +{ + if (strcmp(keywords[map[itype]], substyle) == 0) return 1; + return 0; +} + /* ---------------------------------------------------------------------- proc 0 writes to restart file ------------------------------------------------------------------------- */ diff --git a/src/dihedral_hybrid.h b/src/dihedral_hybrid.h index debc8a9d8d..4dcadcb67a 100644 --- a/src/dihedral_hybrid.h +++ b/src/dihedral_hybrid.h @@ -40,6 +40,8 @@ class DihedralHybrid : public Dihedral { void read_restart(FILE *) override; double memory_usage() override; + int check_itype(int, char *); + protected: int *map; // which style each dihedral type points to