From a9906d1023567d35435d5c654a7c8d571b899c9a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 10 Oct 2014 14:46:01 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12631 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/USER-FEP/fix_adapt_fep.cpp | 13 ++++++++----- src/fix_adapt.cpp | 13 +++++++++++++ src/fix_nh.cpp | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 794278efdc..8cda1b6916 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -188,6 +188,8 @@ FixAdaptFEP::~FixAdaptFEP() } delete [] adapt; + if (force->kspace) force->kspace->qsum_update_flag = 0; + // check nfix in case all fixes have already been deleted if (id_fix_diam && modify->nfix) modify->delete_fix(id_fix_diam); @@ -289,7 +291,9 @@ void FixAdaptFEP::init() if (adapt[i].which == ATOM) error->all(FLERR,"Cannot use dynamic group with fix adapt/fep atom"); - // when using kspace, we need to recompute some additional parameters in kspace->setup() + // when using kspace, we need to recompute + // some additional parameters in kspace->setup() + if (force->kspace) force->kspace->qsum_update_flag = 1; // setup and error checks @@ -506,13 +510,13 @@ void FixAdaptFEP::change_settings() if (anypair) force->pair->reinit(); - if (force->kspace) - force->kspace->setup(); + // re-setup KSpace if using it, since charges may have changed + if (force->kspace) force->kspace->setup(); } /* ---------------------------------------------------------------------- - restore pair,kspace.atom parameters to original values + restore pair,kspace,atom parameters to original values ------------------------------------------------------------------------- */ void FixAdaptFEP::restore_settings() @@ -561,6 +565,5 @@ void FixAdaptFEP::restore_settings() } if (anypair) force->pair->reinit(); - if (force->kspace) force->kspace->setup(); } diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 246d828e7d..35632610a0 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -174,6 +174,8 @@ FixAdapt::~FixAdapt() } delete [] adapt; + if (chgflag && force->kspace) force->kspace->qsum_update_flag = 0; + // check nfix in case all fixes have already been deleted if (id_fix_diam && modify->nfix) modify->delete_fix(id_fix_diam); @@ -349,6 +351,11 @@ void FixAdapt::init() } } + // when adapting charge and using kspace, + // need to recompute additional params in kspace->setup() + + if (chgflag && force->kspace) force->kspace->qsum_update_flag = 1; + // fixes that store initial per-atom values if (id_fix_diam) { @@ -475,6 +482,11 @@ void FixAdapt::change_settings() // and also offset and tail corrections if (anypair) force->pair->reinit(); + + // re-setup KSpace if it exists and adapting charges + // since charges have changed + + if (chgflag && force->kspace) force->kspace->setup(); } /* ---------------------------------------------------------------------- @@ -527,4 +539,5 @@ void FixAdapt::restore_settings() } if (anypair) force->pair->reinit(); + if (chgflag && force->kspace) force->kspace->setup(); } diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 795bd3ee5b..f7a8d22a30 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -24,6 +24,7 @@ #include "force.h" #include "group.h" #include "comm.h" +#include "neighbor.h" #include "irregular.h" #include "modify.h" #include "fix_deform.h"