modifications in dihedral & dihedral_hybrid

This commit is contained in:
Evangelos Voyiatzis
2025-04-04 17:00:52 +02:00
committed by GitHub
parent ccd6eeb8af
commit 54d7f46151
4 changed files with 28 additions and 0 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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
------------------------------------------------------------------------- */

View File

@ -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