36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
#include <cmath> |
45 |
|
#include "minimizers/CGFamilyMinimizer.hpp" |
46 |
|
#include "primitives/Molecule.hpp" |
47 |
|
#include "utils/Utility.hpp" |
48 |
+ |
#ifdef IS_MPI |
49 |
+ |
#include <mpi.h> |
50 |
+ |
#endif |
51 |
|
|
52 |
|
namespace OpenMD { |
53 |
|
|
66 |
|
RealType gTol; |
67 |
|
RealType relativeGTol; |
68 |
|
RealType gnorm; |
65 |
– |
|
69 |
|
|
70 |
|
// test function tolerance test |
71 |
|
fTol =paramSet->getFTol(); |
72 |
< |
relativeFTol = fTol * std::max(1.0,fabs(curF)); // relative tolerance |
72 |
> |
|
73 |
> |
relativeFTol = fTol * std::max(RealType(1.0), fabs(curF)); // relative tolerance |
74 |
> |
|
75 |
|
deltaF = prevF - curF; |
76 |
|
|
77 |
|
if (fabs(deltaF) <= relativeFTol) { |
86 |
|
|
87 |
|
//gradient tolerance test |
88 |
|
gTol = paramSet->getGTol(); |
89 |
< |
relativeGTol = gTol * std::max(1.0,fabs(curF)); |
89 |
> |
relativeGTol = gTol * std::max(RealType(1.0), fabs(curF)); |
90 |
|
|
91 |
|
#ifndef IS_MPI |
92 |
|
gnorm = sqrt(dotProduct(curG, curG)); |