From 08edd193e20400d8686471d4bc713e4b6aee6eff Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 21 Oct 2023 06:28:35 -0400 Subject: [PATCH] programming style updates --- src/atom.cpp | 5 +---- src/update.cpp | 10 +++------- src/update.h | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index c4521a244e..c22556ff9d 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -89,7 +89,7 @@ are updated by the AtomVec class as needed. * * \param _lmp pointer to the base LAMMPS class */ -Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp) +Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp), atom_style(nullptr), avec(nullptr), avec_map(nullptr) { natoms = 0; nlocal = nghost = nmax = 0; @@ -272,9 +272,6 @@ Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp) unique_tags = nullptr; reset_image_flag[0] = reset_image_flag[1] = reset_image_flag[2] = false; - atom_style = nullptr; - avec = nullptr; - avec_map = new AtomVecCreatorMap(); #define ATOM_CLASS diff --git a/src/update.cpp b/src/update.cpp index 1704e7c439..13ff7c872a 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -46,7 +46,9 @@ template static Min *minimize_creator(LAMMPS *lmp) /* ---------------------------------------------------------------------- */ -Update::Update(LAMMPS *lmp) : Pointers(lmp) +Update::Update(LAMMPS *lmp) : + Pointers(lmp), unit_style(nullptr), integrate(nullptr), integrate_style(nullptr), + minimize(nullptr), minimize_style(nullptr), integrate_map(nullptr), minimize_map(nullptr) { char *str; @@ -67,14 +69,8 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) dt_default = 1; dt = 0.0; - unit_style = nullptr; set_units("lj"); - integrate_style = nullptr; - integrate = nullptr; - minimize_style = nullptr; - minimize = nullptr; - integrate_map = new IntegrateCreatorMap(); #define INTEGRATE_CLASS diff --git a/src/update.h b/src/update.h index 7ed61ba296..3848eb3a1e 100644 --- a/src/update.h +++ b/src/update.h @@ -22,6 +22,17 @@ namespace LAMMPS_NS { class Update : protected Pointers { public: + Update(class LAMMPS *); + ~Update() override; + void init(); + void set_units(const char *); + void create_integrate(int, char **, int); + void create_minimize(int, char **, int); + void reset_timestep(int, char **); + void reset_timestep(bigint, bool); + void update_time(); + double memory_usage(); + double dt; // timestep double etol, ftol; // minimizer tolerances on energy/force bigint ntimestep; // current step (dynamics or min iterations) @@ -58,17 +69,6 @@ class Update : protected Pointers { IntegrateCreatorMap *integrate_map; MinimizeCreatorMap *minimize_map; - Update(class LAMMPS *); - ~Update() override; - void init(); - void set_units(const char *); - void create_integrate(int, char **, int); - void create_minimize(int, char **, int); - void reset_timestep(int, char **); - void reset_timestep(bigint, bool); - void update_time(); - double memory_usage(); - private: void new_integrate(char *, int, char **, int, int &); void new_minimize(char *, int, char **, int, int &);