From 5a0bd3bdb3f99407f19bfe6d3085d9dfc97347ae Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 27 Apr 2010 14:33:02 +0000 Subject: [PATCH 1/6] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4050 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/fix_efield.html | 10 +++++----- doc/fix_efield.txt | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/fix_efield.html b/doc/fix_efield.html index 7b79762560..0f8dda17cf 100644 --- a/doc/fix_efield.html +++ b/doc/fix_efield.html @@ -31,11 +31,11 @@ fix kick external-field efield 0.0 0.0 v_oscillate external electric field being applied to the system.

Any of the 3 quantities defining the E-field components can be -specified as an equal-style or atom-style variable, namely -ex, ey, ez. If the value is a variable, it should be specified -as v_ID, where ID is the variable ID. In this case, the variable will -be evaluated each timestep, and its value used to determine the -E-field component. +specified as an equal-style or atom-style variable, +namely ex, ey, ez. If the value is a variable, it should be +specified as v_ID, where ID is the variable ID. In this case, the +variable will be evaluated each timestep, and its value used to +determine the E-field component.

Equal-style variables can specify formulas with various mathematical functions, and include thermo_style command diff --git a/doc/fix_efield.txt b/doc/fix_efield.txt index d62757f415..3cb4801cb1 100644 --- a/doc/fix_efield.txt +++ b/doc/fix_efield.txt @@ -28,11 +28,11 @@ Add a force F = qE to each charged atom in the group due to an external electric field being applied to the system. Any of the 3 quantities defining the E-field components can be -specified as an equal-style or atom-style "variable"_variable, namely -{ex}, {ey}, {ez}. If the value is a variable, it should be specified -as v_ID, where ID is the variable ID. In this case, the variable will -be evaluated each timestep, and its value used to determine the -E-field component. +specified as an equal-style or atom-style "variable"_variable.html, +namely {ex}, {ey}, {ez}. If the value is a variable, it should be +specified as v_ID, where ID is the variable ID. In this case, the +variable will be evaluated each timestep, and its value used to +determine the E-field component. Equal-style variables can specify formulas with various mathematical functions, and include "thermo_style"_thermo_style.html command From e2840e300d0307a31c142a2613c8087be896af39 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 27 Apr 2010 15:38:10 +0000 Subject: [PATCH 2/6] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4051 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_box_relax.cpp | 5 +++++ src/fix_box_relax.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index a50f6a0bd8..7f1794cfd1 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -24,6 +24,7 @@ #include "update.h" #include "comm.h" #include "force.h" +#include "kspace.h" #include "modify.h" #include "compute.h" #include "error.h" @@ -318,6 +319,9 @@ void FixBoxRelax::init() pv2e = 1.0 / force->nktv2p; + if (force->kspace) kspace_flag = 1; + else kspace_flag = 0; + // detect if any rigid fixes exist so rigid bodies move when box is remapped // rfix[] = indices to each fix rigid @@ -528,6 +532,7 @@ void FixBoxRelax::min_step(double alpha, double *hextra) } } remap(); + if (kspace_flag) force->kspace->setup(); } /* ---------------------------------------------------------------------- diff --git a/src/fix_box_relax.h b/src/fix_box_relax.h index 33230131ff..590412e9e1 100644 --- a/src/fix_box_relax.h +++ b/src/fix_box_relax.h @@ -50,6 +50,7 @@ class FixBoxRelax : public Fix { double p_target[6],p_current[6]; double vol0,xprdinit,yprdinit,zprdinit; double vmax,pv2e,pflagsum; + int kspace_flag; int current_lifo; // LIFO stack pointer double boxlo0[2][3]; // box bounds at start of line search From 80ac665b3e79186c28cf156b29945023a8e09936 Mon Sep 17 00:00:00 2001 From: athomps Date: Tue, 27 Apr 2010 20:39:55 +0000 Subject: [PATCH 3/6] Added uphill check to quadratic linesearch. git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4052 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/min_linesearch.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index b94afa3337..41352a326d 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -464,11 +464,13 @@ int MinLineSearch::linemin_quadratic(double eoriginal, double &alpha, if (relerr <= QUADRATIC_TOL && alpha0 > 0.0) { ecurrent = alpha_step(alpha0,1,nfunc); - if (nextra_global) { - int itmp = modify->min_reset_ref(); - if (itmp) ecurrent = energy_force(1); + if (ecurrent < eoriginal) { + if (nextra_global) { + int itmp = modify->min_reset_ref(); + if (itmp) ecurrent = energy_force(1); + } + return 0; } - return 0; } // if backtracking energy change is better than ideal, exit with success From 58c1edd6c0b08e690698250ab9418ed6ecc5537e Mon Sep 17 00:00:00 2001 From: athomps Date: Tue, 27 Apr 2010 20:52:14 +0000 Subject: [PATCH 4/6] Same git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4053 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/min_linesearch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 41352a326d..6eb96cbec8 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -409,7 +409,7 @@ int MinLineSearch::linemin_quadratic(double eoriginal, double &alpha, // double alphatmp = alphamax*1.0e-4; // etmp = alpha_step(alphatmp,1,nfunc); // printf("alpha = %g dele = %g dele_force = %g err = %g\n", - // alphatmp,etmp-eoriginal,-alphatmp*fdothall, + // alphatmp,etmp-eoriginal,-alphatmp*fdothall, // etmp-eoriginal+alphatmp*fdothall); // alpha_step(0.0,1,nfunc); @@ -462,7 +462,7 @@ int MinLineSearch::linemin_quadratic(double eoriginal, double &alpha, relerr = fabs(1.0-(0.5*(alpha-alphaprev)*(fh+fhprev)+ecurrent)/engprev); alpha0 = alpha - (alpha-alphaprev)*fh/delfh; - if (relerr <= QUADRATIC_TOL && alpha0 > 0.0) { + if (relerr <= QUADRATIC_TOL && alpha0 > 0.0 && alpha0 < alphamax) { ecurrent = alpha_step(alpha0,1,nfunc); if (ecurrent < eoriginal) { if (nextra_global) { From b52c481f76931d2bd46a5f2605cf86d9a9c2a36a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 27 Apr 2010 22:01:33 +0000 Subject: [PATCH 5/6] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4054 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 8099d3e26c..3ee0aa3f1e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "26 Apr 2010" +#define LAMMPS_VERSION "27 Apr 2010" From 601ecc9b25ca042587d411d1fb0e4e8725cd3522 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 27 Apr 2010 22:09:09 +0000 Subject: [PATCH 6/6] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4056 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/minimize.html | 23 ++++++++++++++++------- doc/minimize.txt | 23 ++++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/doc/minimize.html b/doc/minimize.html index 0b7a145c40..62ffb44c9a 100644 --- a/doc/minimize.html +++ b/doc/minimize.html @@ -151,13 +151,22 @@ reduced.


-

IMPORTANT NOTE: It is highly recommended that you use a pair -style that goes to 0.0 at the cutoff distance when -performing minimization (even if you later change it when running -dynamics). If this is not done, the total energy of the system will -have discontinuities when the relative distance between any pair of -atoms changes from cutoff+epsilon to cutoff-epsilon and the minimizer -may behave poorly. +

IMPORTANT NOTE: There are several force fields in LAMMPS which have +discontinuities or other approximations which may prevent you from +performing an energy minimization to high tolerances. For example, +you should use a pair style that goes to 0.0 at the +cutoff distance when performing minimization (even if you later change +it when running dynamics). If you do not do this, the total energy of +the system will have discontinuities when the relative distance +between any pair of atoms changes from cutoff+epsilon to +cutoff-epsilon and the minimizer may behave poorly. Some of the +manybody potentials use splines and other internal cutoffs that +inherently have this problem. The long-range Coulombic +styles (PPPM, Ewald) are approximate to within the +user-specified tolerance, which means their energy and forces may not +agree to a higher precision than the Kspace-specified tolerance. In +all these cases, the minimizer may give up and stop before finding a +minimum to the specified energy or force tolerance.

Note that a cutoff Lennard-Jones potential (and others) can be shifted so that its energy is 0.0 at the cutoff via the diff --git a/doc/minimize.txt b/doc/minimize.txt index a37c063aef..5302f233f1 100644 --- a/doc/minimize.txt +++ b/doc/minimize.txt @@ -148,13 +148,22 @@ The iterations and force evaluation values are what is checked by the :line -IMPORTANT NOTE: It is highly recommended that you use a "pair -style"_pair_style.html that goes to 0.0 at the cutoff distance when -performing minimization (even if you later change it when running -dynamics). If this is not done, the total energy of the system will -have discontinuities when the relative distance between any pair of -atoms changes from cutoff+epsilon to cutoff-epsilon and the minimizer -may behave poorly. +IMPORTANT NOTE: There are several force fields in LAMMPS which have +discontinuities or other approximations which may prevent you from +performing an energy minimization to high tolerances. For example, +you should use a "pair style"_pair_style.html that goes to 0.0 at the +cutoff distance when performing minimization (even if you later change +it when running dynamics). If you do not do this, the total energy of +the system will have discontinuities when the relative distance +between any pair of atoms changes from cutoff+epsilon to +cutoff-epsilon and the minimizer may behave poorly. Some of the +manybody potentials use splines and other internal cutoffs that +inherently have this problem. The "long-range Coulombic +styles"_kspace_style.html (PPPM, Ewald) are approximate to within the +user-specified tolerance, which means their energy and forces may not +agree to a higher precision than the Kspace-specified tolerance. In +all these cases, the minimizer may give up and stop before finding a +minimum to the specified energy or force tolerance. Note that a cutoff Lennard-Jones potential (and others) can be shifted so that its energy is 0.0 at the cutoff via the