From 287ac442f66de3c1015cfcc03d2b3d5dbb16fc02 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Mon, 20 Dec 2010 15:45:23 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5415 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_setforce.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index ce972a0c67..d32c8145f2 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -165,6 +165,21 @@ void FixSetForce::init() if (strcmp(update->integrate_style,"respa") == 0) nlevels_respa = ((Respa *) update->integrate)->nlevels; + + // cannot use non-zero forces for a minimization since no energy is integrated + // use fix addforce instead + + int flag = 0; + if (update->whichflag == 2) { + if (xstyle == EQUAL || xstyle == ATOM) flag = 1; + if (ystyle == EQUAL || ystyle == ATOM) flag = 1; + if (zstyle == EQUAL || zstyle == ATOM) flag = 1; + if (xstyle == CONSTANT && xvalue != 0.0) flag = 1; + if (ystyle == CONSTANT && yvalue != 0.0) flag = 1; + if (zstyle == CONSTANT && zvalue != 0.0) flag = 1; + } + if (flag) + error->all("Cannot use non-zero forces in an energy minimization"); } /* ---------------------------------------------------------------------- */