From 4314ef01f60b4ec91eef1a028fc856dbece6b668 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 26 Apr 2016 18:32:11 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14876 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_momentum.cpp | 18 ++++++++++++++---- src/fix_momentum.h | 1 + src/kspace.cpp | 9 +++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index b8ca3c2c01..aa0f5fd76e 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -64,10 +64,13 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : zflag < 0 || zflag > 1) error->all(FLERR,"Illegal fix momentum command"); - // cannot have 0 atoms in group - - if (group->count(igroup) == 0) - error->all(FLERR,"Fix momentum group has no atoms"); + dynamic_group_allow = 1; + if (group->dynamic[igroup]) { + dynamic = 1; + } else { + if (group->count(igroup) == 0) + error->all(FLERR,"Fix momentum group has no atoms"); + } } /* ---------------------------------------------------------------------- */ @@ -96,6 +99,13 @@ void FixMomentum::end_of_step() double ekin_old,ekin_new; ekin_old = ekin_new = 0.0; + if (dynamic) + masstotal = group->mass(igroup); + + // do nothing is group is empty, i.e. mass is zero; + + if (masstotal == 0.0) return; + // compute kinetic energy before momentum removal, if needed if (rescale) { diff --git a/src/fix_momentum.h b/src/fix_momentum.h index 08e0fd1a38..ffe33880e0 100644 --- a/src/fix_momentum.h +++ b/src/fix_momentum.h @@ -34,6 +34,7 @@ class FixMomentum : public Fix { private: int linear,angular,rescale; int xflag,yflag,zflag; + int dynamic; double masstotal; }; diff --git a/src/kspace.cpp b/src/kspace.cpp index 8724ca2559..d943b02c78 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -307,6 +307,15 @@ double KSpace::estimate_table_accuracy(double q2_over_sqrt, double spr) { double table_accuracy = 0.0; int nctb = force->pair->ncoultablebits; + if (comm->me == 0) { + char str[128]; + if (nctb) + sprintf(str,"Using %d-bit tables for long-range coulomb",nctb); + else + sprintf(str,"Using polynomial approximation for long-range coulomb"); + error->warning(FLERR,str); + } + if (nctb) { double empirical_precision[17]; empirical_precision[6] = 6.99E-03;