diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index eba7348f21..3c1a46a7fd 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -47,6 +47,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 1; extvector = 1; + energy_global_flag = 1; dynamic_group_allow = 1; respa_level_support = 1; ilevel_respa = 0; @@ -97,7 +98,6 @@ int FixAddTorque::setmask() { int mask = 0; mask |= POST_FORCE; - mask |= THERMO_ENERGY; mask |= POST_FORCE_RESPA; mask |= MIN_POST_FORCE; return mask; diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index 061d5f4559..b882a19e91 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -46,20 +46,17 @@ enum {NO_FLIP, FLIP_RESCALE, FLIP_HARD, FLIP_SOFT}; /* syntax for fix_ffl: * fix nfix id-group ffl tau Tstart Tstop seed [flip_type] - * * */ /* ---------------------------------------------------------------------- */ - -FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) { - - +FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +{ if (narg < 7) error->all(FLERR,"Illegal fix ffl command. Expecting: fix " " ffl "); + ecouple_flag = 1; restart_peratom = 1; time_integrate = 1; scalar_flag = 1; @@ -121,7 +118,6 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : energy = 0.0; } - /* --- Frees up memory used by temporaries and buffers ------------------ */ FixFFL::~FixFFL() { @@ -139,14 +135,10 @@ FixFFL::~FixFFL() { int FixFFL::setmask() { int mask = 0; - mask |= INITIAL_INTEGRATE; mask |= FINAL_INTEGRATE; mask |= INITIAL_INTEGRATE_RESPA; mask |= FINAL_INTEGRATE_RESPA; - mask |= THERMO_ENERGY; - - return mask; } @@ -181,12 +173,8 @@ void FixFFL::init_ffl() { c1 = exp ( - gamma * 0.5 * dtv ); c2 = sqrt( (1.0 - c1*c1)* kT ); //without the mass term - - } - - /* ---------------------------------------------------------------------- */ void FixFFL::setup(int vflag) { @@ -199,6 +187,8 @@ void FixFFL::setup(int vflag) { } } +/* ---------------------------------------------------------------------- */ + void FixFFL::ffl_integrate() { double **v = atom->v; double *rmass = atom->rmass, smi, ismi; @@ -287,9 +277,10 @@ void FixFFL::ffl_integrate() { } energy += deltae*0.5*force->mvv2e; - } +/* ---------------------------------------------------------------------- */ + void FixFFL::initial_integrate(int /* vflag */) { double dtfm; @@ -333,6 +324,8 @@ void FixFFL::initial_integrate(int /* vflag */) { } } +/* ---------------------------------------------------------------------- */ + void FixFFL::final_integrate() { double dtfm; @@ -381,6 +374,7 @@ void FixFFL::final_integrate() { } } + /* ---------------------------------------------------------------------- */ void FixFFL::initial_integrate_respa(int vflag, int ilevel, int /* iloop */) { @@ -398,6 +392,8 @@ void FixFFL::initial_integrate_respa(int vflag, int ilevel, int /* iloop */) { } } +/* ---------------------------------------------------------------------- */ + void FixFFL::final_integrate_respa(int ilevel, int /* iloop */) { dtv = step_respa[ilevel]; @@ -407,6 +403,7 @@ void FixFFL::final_integrate_respa(int ilevel, int /* iloop */) { if (ilevel==nlevels_respa-1) ffl_integrate(); } +/* ---------------------------------------------------------------------- */ double FixFFL::compute_scalar() { @@ -429,7 +426,6 @@ void *FixFFL::extract(const char *str, int &dim) { return nullptr; } - /* ---------------------------------------------------------------------- Called when a change to the target temperature is requested mid-run ------------------------------------------------------------------------- */ @@ -459,7 +455,6 @@ double FixFFL::memory_usage() { return bytes; } - /* ---------------------------------------------------------------------- allocate local atom-based arrays ------------------------------------------------------------------------- */ diff --git a/src/USER-MISC/fix_flow_gauss.cpp b/src/USER-MISC/fix_flow_gauss.cpp index b1b4174352..f785545fa5 100644 --- a/src/USER-MISC/fix_flow_gauss.cpp +++ b/src/USER-MISC/fix_flow_gauss.cpp @@ -46,6 +46,8 @@ static const char cite_flow_gauss[] = "pages = {189--207}\n" "}\n\n"; +/* ---------------------------------------------------------------------- */ + FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { @@ -61,6 +63,7 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; extvector = 1; size_vector = 3; + energy_global_flag = 1; global_freq = 1; //data available every timestep respa_level_support = 1; //default respa level=outermost level is set in init() @@ -109,7 +112,6 @@ int FixFlowGauss::setmask() { int mask = 0; mask |= POST_FORCE; - mask |= THERMO_ENERGY; mask |= POST_FORCE_RESPA; return mask; } @@ -154,6 +156,7 @@ void FixFlowGauss::setup(int vflag) /* ---------------------------------------------------------------------- this is where Gaussian dynamics constraint is applied ------------------------------------------------------------------------- */ + void FixFlowGauss::post_force(int /*vflag*/) { double **f = atom->f; @@ -218,9 +221,10 @@ void FixFlowGauss::post_force(int /*vflag*/) MPI_Allreduce(&peAdded,&pe_tmp,1,MPI_DOUBLE,MPI_SUM,world); pe_tot += pe_tmp; } - } +/* ---------------------------------------------------------------------- */ + void FixFlowGauss::post_force_respa(int vflag, int ilevel, int /*iloop*/) { if (ilevel == ilevel_respa) post_force(vflag); @@ -230,6 +234,7 @@ void FixFlowGauss::post_force_respa(int vflag, int ilevel, int /*iloop*/) negative of work done by this fix This is only computed if requested, either with fix_modify energy yes, or with the energy keyword. Otherwise returns 0. ------------------------------------------------------------------------- */ + double FixFlowGauss::compute_scalar() { return -pe_tot*dt; diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index e091c3d80e..2bf6a65395 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -30,7 +30,6 @@ #include "memory.h" #include "error.h" - using namespace LAMMPS_NS; using namespace FixConst; @@ -186,6 +185,8 @@ void MatrixExp(int n, const double* M, double* EM, int j=8, int k=8) } } +/* ---------------------------------------------------------------------- */ + FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { @@ -193,6 +194,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix gle command. Expecting: fix " " gle "); + ecouple_flag = 1; restart_peratom = 1; time_integrate = 1; @@ -395,9 +397,6 @@ int FixGLE::setmask() mask |= FINAL_INTEGRATE; mask |= INITIAL_INTEGRATE_RESPA; mask |= FINAL_INTEGRATE_RESPA; - mask |= THERMO_ENERGY; - - return mask; } @@ -499,7 +498,6 @@ void FixGLE::init_gles() return; } - /* ---------------------------------------------------------------------- */ void FixGLE::setup(int vflag) @@ -513,6 +511,8 @@ void FixGLE::setup(int vflag) } } +/* ---------------------------------------------------------------------- */ + void FixGLE::gle_integrate() { double **v = atom->v; diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index cb7ca713a1..5d51114262 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -61,6 +61,7 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix npt/cauchy command"); dynamic_group_allow = 1; + ecouple_flag = 1; time_integrate = 1; scalar_flag = 1; vector_flag = 1; @@ -686,7 +687,6 @@ int FixNPTCauchy::setmask() int mask = 0; mask |= INITIAL_INTEGRATE; mask |= FINAL_INTEGRATE; - mask |= THERMO_ENERGY; mask |= INITIAL_INTEGRATE_RESPA; mask |= FINAL_INTEGRATE_RESPA; if (pre_exchange_flag) mask |= PRE_EXCHANGE; diff --git a/src/USER-MISC/fix_rhok.cpp b/src/USER-MISC/fix_rhok.cpp index 416adc2165..f546b9a814 100644 --- a/src/USER-MISC/fix_rhok.cpp +++ b/src/USER-MISC/fix_rhok.cpp @@ -48,21 +48,19 @@ static const char cite_fix_rhok[] = FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv ) : Fix( inLMP, inArgc, inArgv ) { - if (lmp->citeme) lmp->citeme->add(cite_fix_rhok); // Check arguments - if (inArgc != 8) - error->all(FLERR,"Illegal fix rhoKUmbrella command" ); + if (inArgc != 8) error->all(FLERR,"Illegal fix rhoKUmbrella command" ); // Set up fix flags scalar_flag = 1; // have compute_scalar vector_flag = 1; // have compute_vector... size_vector = 3; // ...with this many components global_freq = 1; // whose value can be computed at every timestep - thermo_energy = 1; // this fix changes system's potential energy extscalar = 0; // but the deltaPE might not scale with # of atoms extvector = 0; // neither do the components of the vector + energy_global_flag = 1; // Parse fix options int n[3]; @@ -79,29 +77,22 @@ FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv ) mRhoK0 = utils::numeric(FLERR,inArgv[7],false,lmp); } -// Methods that this fix implements -// -------------------------------- +/* ---------------------------------------------------------------------- */ // Tells LAMMPS where this fix should act -int -FixRhok::setmask() +int FixRhok::setmask() { int mask = 0; - - // This fix modifies forces... mask |= POST_FORCE; mask |= POST_FORCE_RESPA; mask |= MIN_POST_FORCE; - - // ...and potential energies - mask |= THERMO_ENERGY; - return mask; } +/* ---------------------------------------------------------------------- */ + // Initializes the fix at the beginning of a run -void -FixRhok::init() +void FixRhok::init() { // RESPA boilerplate if (strcmp( update->integrate_style, "respa" ) == 0) @@ -121,9 +112,10 @@ FixRhok::init() mSqrtNThis = sqrt( mNThis ); } +/* ---------------------------------------------------------------------- */ + // Initial application of the fix to a system (when doing MD) -void -FixRhok::setup( int inVFlag ) +void FixRhok::setup( int inVFlag ) { if (strcmp( update->integrate_style, "verlet" ) == 0) post_force( inVFlag ); @@ -135,16 +127,20 @@ FixRhok::setup( int inVFlag ) } } +/* ---------------------------------------------------------------------- */ + // Initial application of the fix to a system (when doing minimization) -void -FixRhok::min_setup( int inVFlag ) + +void FixRhok::min_setup( int inVFlag ) { post_force( inVFlag ); } +/* ---------------------------------------------------------------------- */ + // Modify the forces calculated in the main force loop of ordinary MD -void -FixRhok::post_force( int /*inVFlag*/ ) + +void FixRhok::post_force( int /*inVFlag*/ ) { double **x = atom->x; double **f = atom->f; @@ -204,24 +200,27 @@ FixRhok::post_force( int /*inVFlag*/ ) } } +/* ---------------------------------------------------------------------- */ + // Forces in RESPA loop -void -FixRhok::post_force_respa( int inVFlag, int inILevel, int /*inILoop*/ ) +void FixRhok::post_force_respa( int inVFlag, int inILevel, int /*inILoop*/ ) { if (inILevel == mNLevelsRESPA - 1) post_force( inVFlag ); } +/* ---------------------------------------------------------------------- */ + // Forces in minimization loop -void -FixRhok::min_post_force( int inVFlag ) +void FixRhok::min_post_force( int inVFlag ) { post_force( inVFlag ); } +/* ---------------------------------------------------------------------- */ + // Compute the change in the potential energy induced by this fix -double -FixRhok::compute_scalar() +double FixRhok::compute_scalar() { double rhoK = sqrt( mRhoKGlobal[0]*mRhoKGlobal[0] + mRhoKGlobal[1]*mRhoKGlobal[1] ); @@ -229,9 +228,10 @@ FixRhok::compute_scalar() return 0.5 * mKappa * (rhoK - mRhoK0) * (rhoK - mRhoK0); } +/* ---------------------------------------------------------------------- */ + // Compute the ith component of the vector -double -FixRhok::compute_vector( int inI ) +double FixRhok::compute_vector( int inI ) { if (inI == 0) return mRhoKGlobal[0]; // Real part diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 5aac36a47b..9e6c1ce296 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -64,7 +64,8 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 1; extvector = 1; - + energy_global_flag = 1; + // disallow resetting the time step, while this fix is defined time_depend = 1; @@ -133,7 +134,6 @@ int FixTISpring::setmask() mask |= POST_FORCE; mask |= POST_FORCE_RESPA; mask |= MIN_POST_FORCE; - mask |= THERMO_ENERGY; return mask; } diff --git a/src/USER-MISC/fix_wall_region_ees.cpp b/src/USER-MISC/fix_wall_region_ees.cpp index ab475ffb9b..7fe3ab24a3 100644 --- a/src/USER-MISC/fix_wall_region_ees.cpp +++ b/src/USER-MISC/fix_wall_region_ees.cpp @@ -38,13 +38,15 @@ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 7) error->all(FLERR,"Illegal fix wall/region/ees command"); + scalar_flag = 1; vector_flag = 1; size_vector = 3; global_freq = 1; extscalar = 1; extvector = 1; - + energy_global_flag = 1; + // parse args iregion = domain->find_region(arg[3]); @@ -77,7 +79,6 @@ int FixWallRegionEES::setmask() { int mask = 0; mask |= POST_FORCE; - mask |= THERMO_ENERGY; mask |= POST_FORCE_RESPA; mask |= MIN_POST_FORCE; return mask; diff --git a/src/fix.h b/src/fix.h index c4c9267e54..c8db215255 100644 --- a/src/fix.h +++ b/src/fix.h @@ -273,19 +273,18 @@ namespace FixConst { FINAL_INTEGRATE = 1<<8, END_OF_STEP = 1<<9, POST_RUN = 1<<10, - //THERMO_ENERGY = 1<<11, // remove when done with refactoring - INITIAL_INTEGRATE_RESPA = 1<<12, - POST_INTEGRATE_RESPA = 1<<13, - PRE_FORCE_RESPA = 1<<14, - POST_FORCE_RESPA = 1<<15, - FINAL_INTEGRATE_RESPA = 1<<16, - MIN_PRE_EXCHANGE = 1<<17, - MIN_PRE_NEIGHBOR = 1<<18, - MIN_POST_NEIGHBOR = 1<<19, - MIN_PRE_FORCE = 1<<20, - MIN_PRE_REVERSE = 1<<21, - MIN_POST_FORCE = 1<<22, - MIN_ENERGY = 1<<23 + INITIAL_INTEGRATE_RESPA = 1<<11, + POST_INTEGRATE_RESPA = 1<<12, + PRE_FORCE_RESPA = 1<<13, + POST_FORCE_RESPA = 1<<14, + FINAL_INTEGRATE_RESPA = 1<<15, + MIN_PRE_EXCHANGE = 1<<16, + MIN_PRE_NEIGHBOR = 1<<17, + MIN_POST_NEIGHBOR = 1<<18, + MIN_PRE_FORCE = 1<<19, + MIN_PRE_REVERSE = 1<<20, + MIN_POST_FORCE = 1<<21, + MIN_ENERGY = 1<<22 }; }