From d5f8f36442bfc14ba49c4090f465f87afc65a24e Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Thu, 15 Dec 2016 15:48:09 -0700 Subject: [PATCH] Change to fix_property_atom to allow virtual override of grow_arrays() function --- src/fix_property_atom.cpp | 3 ++- src/fix_property_atom.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index b83aadc95d..002260d8f0 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -134,7 +134,6 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : // register with Atom class nmax_old = 0; - grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); if (border) atom->add_callback(2); @@ -190,6 +189,8 @@ int FixPropertyAtom::setmask() void FixPropertyAtom::init() { + grow_arrays(atom->nmax); + // error if atom style has changed since fix was defined // don't allow this b/c user could change to style that defines molecule,q diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index 77a41f393a..d923d76cac 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class FixPropertyAtom : public Fix { public: FixPropertyAtom(class LAMMPS *, int, char **); - ~FixPropertyAtom(); + virtual ~FixPropertyAtom(); int setmask(); void init(); @@ -38,7 +38,7 @@ class FixPropertyAtom : public Fix { void write_data_section_keyword(int, FILE *); void write_data_section(int, FILE *, int, double **, int); - void grow_arrays(int); + virtual void grow_arrays(int); void copy_arrays(int, int, int); int pack_border(int, int *, double *); int unpack_border(int, int, double *); @@ -50,7 +50,7 @@ class FixPropertyAtom : public Fix { int maxsize_restart(); double memory_usage(); - private: + protected: int nvalue,border; int molecule_flag,q_flag,rmass_flag; int *style,*index;