| 1 | // -*- Mode: C++; tab-width: 2; -*- |
| 2 | // vi: set ts=2: |
| 3 | // |
| 4 | // $Id: steepestDescent.h,v 1.24.20.4 2007/08/07 09:12:35 aleru Exp $ |
| 5 | // |
| 6 | |
| 7 | #ifndef BALL_MOLMEC_MINIMIZATION_STEEPESTDESCENT_H |
| 8 | #define BALL_MOLMEC_MINIMIZATION_STEEPESTDESCENT_H |
| 9 | |
| 10 | #ifndef BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H |
| 11 | # include <BALL/MOLMEC/MINIMIZATION/energyMinimizer.h> |
| 12 | #endif |
| 13 | |
| 14 | #ifndef BALL_MOLMEC_MINIMIZATION_LINESEARCH_H |
| 15 | # include <BALL/MOLMEC/MINIMIZATION/lineSearch.h> |
| 16 | #endif |
| 17 | |
| 18 | namespace BALL |
| 19 | { |
| 20 | /** A minimizer for geometry optimization based on steepest descent steps. |
| 21 | * \ingroup MolmecEnergyMinimizer |
| 22 | */ |
| 23 | class BALL_EXPORT SteepestDescentMinimizer |
| 24 | : public EnergyMinimizer |
| 25 | { |
| 26 | |
| 27 | public: |
| 28 | |
| 29 | /** @name Constructors and Destructors |
| 30 | */ |
| 31 | //@{ |
| 32 | |
| 33 | BALL_CREATE(SteepestDescentMinimizer) |
| 34 | |
| 35 | /** Default constructor. |
| 36 | */ |
| 37 | SteepestDescentMinimizer(); |
| 38 | |
| 39 | /** Constructor. |
| 40 | */ |
| 41 | SteepestDescentMinimizer(ForceField& force_field); |
| 42 | |
| 43 | /** Constructor. |
| 44 | */ |
| 45 | SteepestDescentMinimizer(ForceField& force_field,SnapShotManager *ssm); |
| 46 | |
| 47 | /** Constructor. |
| 48 | */ |
| 49 | SteepestDescentMinimizer(ForceField& force_field, const Options& options); |
| 50 | |
| 51 | /** Constructor. |
| 52 | */ |
| 53 | SteepestDescentMinimizer(ForceField& force_field, SnapShotManager* ssm, const Options& options); |
| 54 | |
| 55 | /** Copy constructor |
| 56 | */ |
| 57 | SteepestDescentMinimizer(const SteepestDescentMinimizer& minimizer); |
| 58 | |
| 59 | /** Destructor. |
| 60 | */ |
| 61 | virtual ~SteepestDescentMinimizer(); |
| 62 | |
| 63 | //@} |
| 64 | /** @name Assignments |
| 65 | */ |
| 66 | //@{ |
| 67 | |
| 68 | /** Assignment operator |
| 69 | */ |
| 70 | const SteepestDescentMinimizer& operator = (const SteepestDescentMinimizer& minimizer); |
| 71 | |
| 72 | //@} |
| 73 | /** @name Setup methods |
| 74 | */ |
| 75 | //@{ |
| 76 | |
| 77 | /** Specific setup |
| 78 | */ |
| 79 | virtual bool specificSetup(); |
| 80 | |
| 81 | //@} |
| 82 | /** @name Accessors |
| 83 | */ |
| 84 | //@{ |
| 85 | |
| 86 | /** Minimize the energy of the system using steepest descent steps. |
| 87 | * This method executes at most <tt>iterations</tt> minimization steps. |
| 88 | * If the number of iterations is not given, the number specified in the |
| 89 | * options is taken. |
| 90 | * @param iterations the maximum number of iterations |
| 91 | * @param resume <b>true</b> to resume a previous run |
| 92 | * @see EnergyMinimizer::minimize |
| 93 | */ |
| 94 | virtual bool minimize(Size steps = 0, bool resume = false); |
| 95 | |
| 96 | /** Find the next step. |
| 97 | * First, this method calls updateDirection. Second, it performs a line search |
| 98 | * along the calculated direction afterwards. |
| 99 | * @return double \f$\geq 0\f$ if the line search found an acceptable solution, otherwise -1. |
| 100 | * @see EnergyMinimizer::findStep |
| 101 | */ |
| 102 | virtual double findStep(); |
| 103 | |
| 104 | /** Update the search direction. |
| 105 | * This algorithm uses only steepest descent searches. |
| 106 | * Therefore, updateDirection only assigns direction to the last gradient |
| 107 | * computed. |
| 108 | */ |
| 109 | virtual void updateDirection(); |
| 110 | |
| 111 | protected: |
| 112 | |
| 113 | //@} |
| 114 | /** @name Protected Attributes |
| 115 | */ |
| 116 | //@{ |
| 117 | |
| 118 | /** The line search minimizer. |
| 119 | * This member is used to perform the line search in findStep |
| 120 | */ |
| 121 | LineSearch line_search_; |
| 122 | //@} |
| 123 | |
| 124 | }; |
| 125 | } // namespace BALL |
| 126 | |
| 127 | #endif // BALL_MOLMEC_MINIMIZATION_STEEPESTDESCENT_H |