/usr/include/BALL/MOLMEC/MINIMIZATION/conjugateGradient.h is in libball1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: conjugateGradient.h,v 1.29.20.6 2007/08/07 09:12:33 aleru Exp $
//
#ifndef BALL_MOLMEC_MINIMIZATION_CONJUGATEGRADIENT_H
#define BALL_MOLMEC_MINIMIZATION_CONJUGATEGRADIENT_H
#ifndef BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
# include <BALL/MOLMEC/MINIMIZATION/energyMinimizer.h>
#endif
#ifndef BALL_MOLMEC_MINIMIZATION_LINESEARCH_H
# include <BALL/MOLMEC/MINIMIZATION/lineSearch.h>
#endif
namespace BALL
{
/** A minimizer for geometry optimization based on different
* conjugate gradient (CG) algorithms. See
*
* [1] Fletcher, R. and Reeves, C.M. "Function Minimization by
* Conjugate Gradients" Comp. J., 7, 149-154, 1964
*
* [2] David Shanno "Conjugate Gradient Methods With Inexact Searches"
* Mathematics of Operations Research, Vol. 3, No. 3, August 1978, pp. 244-256
*
* [3] S. Watowich et. al "A Stable Rapidly Converging
* Conjugate Gradient Method for Energy Minimization" Journal of Computational
* Chemistry, Vol. 9, No. 6, pp. 650-661 (1988)
*
* [4] M.J.D. Powell "Convergence properties of algorithms for nonlinear
* optimization" Report No. DAMPT 1985/NA1, University of Cambridge, 1985
*
* [5] D.F. Shanno "Globally convergent conjugate gradient algorithms"
* Mathematical Programming 33 (1985), pp. 61-67
* \ingroup MolmecEnergyMinimizer
*/
class BALL_EXPORT ConjugateGradientMinimizer
: public EnergyMinimizer
{
public:
/** @name Enums
*/
//@{
/** The different conjugate gradient methods implemented.
* @see updateDirection for details on the implementation and references
*/
enum UpdateMethod
{
/** Polak-Ribiere method
*/
POLAK_RIBIERE = 1,
/** Fletcher-Reeves method
*/
FLETCHER_REEVES = 2,
/** Shanno
*/
SHANNO = 3
};
//@}
/** @name Options and Defaults
*/
//@{
/** Options names
*/
struct Option
{
/** The initial step length used in the line search
*/
static const char* UPDATE_METHOD;
};
/** Defaults for all options
*/
struct BALL_EXPORT Default
{
/** The initial step length used in the line search
*/
static const Size UPDATE_METHOD;
};
//@}
/** @name Constructors and Destructors
*/
//@{
BALL_CREATE(ConjugateGradientMinimizer)
/** Default constructor.
*/
ConjugateGradientMinimizer();
/** Constructor expecting a valid force field
*/
ConjugateGradientMinimizer(ForceField& force_field);
/** Constructor expecting a valid force field and a snapshot manager
*/
ConjugateGradientMinimizer(ForceField& force_field,SnapShotManager *ssm);
/** Constructor expecting a valid force field, a snapshot manager and options
*/
ConjugateGradientMinimizer(ForceField& force_field,
SnapShotManager* ssm, const Options& options);
/** Constructor expecting a valid force field and options
*/
ConjugateGradientMinimizer(ForceField& force_field, const Options& options);
/** Copy constructor
*/
ConjugateGradientMinimizer(const ConjugateGradientMinimizer& rhs);
/** Destructor.
*/
virtual ~ConjugateGradientMinimizer();
//@}
/** @name Assignments
*/
//@{
/** Assignment operator
*/
const ConjugateGradientMinimizer& operator = (const ConjugateGradientMinimizer& rhs);
//@}
/** @name Setup methods. They do all necessary preparations.
*/
//@{
/** Specific setup
*/
virtual bool specificSetup();
//@}
/** @name Accessors
*/
//@{
/** Set explicitly the criterion used for updateDirection. If the
* method is not recognized, this function fails.
*/
void setUpdateMethod(UpdateMethod method);
/** Returns the current method for updateDirection.
*/
UpdateMethod getUpdateMethod() const;
/** Calculate the next step.
* First, this method updates the model. Second, it performs a line search
* along the calculated direction afterwards.
* @return double \f$\geq 0\f$ if the line search found an acceptable solution, otherwise -1.
* @see EnergyMinimizer::findStep
*/
virtual double findStep();
/** Update the search direction.
* This method updates the search direction.
* It uses the different conjugate gradient caculations
* dependend on the options.
*/
virtual void updateDirection();
/** Minimize the energy of the system.
* This method executes at most <tt>iterations</tt> minimization steps.
* If the number of iterations is not given, the number specified in the
* options is taken.
* @param iterations the maximum number of iterations
* @param resume <b>true</b> to resume a previous run
* @see EnergyMinimizer::minimize
*/
virtual bool minimize(Size iterations = 0, bool resume = false);
protected:
//@}
/** @name Protected Attributes
*/
//@{
/** The line search
*/
LineSearch line_search_;
/** Unscaled last search direction
*/
Gradient unscaled_direction_;
/** Number of movable atoms.
*/
Size number_of_atoms_;
/** Update method used for the CG
*/
Size updt_method_;
/** Is this the (initial) first iteration?
*/
bool first_iter_;
/** \f$g^T \cdot g\f$ where \f$g\f$ is the gradient of the last iteration
*/
double old_gtg_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> a_i_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> b_i_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> p_t_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> y_t_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> p_i_;
/** Variable needed for the Shanno direction calculation
*/
vector<Vector3> y_i_;
/** Variable needed for the Shanno direction calculation
*/
double D_1_;
/** Variable needed for the Shanno direction calculation
*/
double D_4_;
/** Frequency for restarts.
*/
Size restart_frequency_;
/** We count the iterations since the last restart.
* There are other necessities for a restart so the
* iteration counter may not coincide (by modulo) with the
* restart frequency.
*/
Size last_restart_iter_;
//@}
};
} // end of namespace BALL
#endif // BALL_MOLMEC_MINIMIZATION_CONJUGATEGRADIENT_H
|