ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/minimizers/OOPSEMinimizer.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/minimizers/OOPSEMinimizer.hpp (file contents):
Revision 1899 by tim, Tue Dec 14 19:08:44 2004 UTC vs.
Revision 1900 by tim, Tue Jan 4 22:18:06 2005 UTC

# Line 29 | Line 29
29   #include <iostream>
30  
31   #include "integrators/Integrator.hpp"
32 + #include "io/DumpWriter.hpp"
33 + #include "io/StatWriter.hpp"
34   #include "minimizers/MinimizerParameterSet.hpp"
35 + #include "brains/ForceManager.hpp"
36  
34
35
36
37
37   // base class of minimizer
38  
39   namespace oopse {
# Line 53 | Line 52 | const int LS_ERROR  = -1;
52   const int LS_SUCCEED =1;
53   const int LS_ERROR  = -1;
54  
55 + /** @todo move to math module */
56 + double dotProduct(const std::vector<double>& v1, const std::vector<double>& v2) {
57 +    if (v1.size() != v2.size()) {
58  
59 +    }
60 +
61 +
62 +    double result = 0.0;    
63 +    for (unsigned int i = 0; i < v1.size(); ++i) {
64 +        result += v1[i] * v2[i];
65 +    }
66 +
67 +    return result;
68 + }
69 +
70 + /**
71 + * @class OOPSEMinimizer
72 + * base minimizer class
73 + */
74   class OOPSEMinimizer {
75      public:
76  
77 <        OOPSEMinimizer(SimInfo *theInfo, MinimizerParameterSet* param);
77 >        OOPSEMinimizer(SimInfo *rhs);
78  
79          virtual ~OOPSEMinimizer();
80  
# Line 84 | Line 101 | class OOPSEMinimizer {
101          //save the result when minimization method is done
102          virtual void saveResult(){}
103  
87        //write out the trajectory
88        virtual void writeOut(std::vector<double>&x, double curIter);
89
90
104          //get the status of minimization
105          int getMinStatus() {return minStatus;}
106  
# Line 119 | Line 132 | class OOPSEMinimizer {
132          void setGrad(std::vector<double>& g) {  curG = g;  }
133  
134          //interal function to evaluate the energy and gradient in OOPSE
135 <        void calcEnergyGradient(vector<double>& x,  std::vector<double>& grad, double&
135 >        void calcEnergyGradient(std::vector<double>& x,  std::vector<double>& grad, double&
136                                                   energy, int& status);
137  
138          //calculate the value of object function
# Line 134 | Line 147 | class OOPSEMinimizer {
147          //virtual void calcH(int& status);
148          //virtual void calcH(vector<double>& x,  std::vector<dobule>& g, SymMatrix& h, int& status);
149  
150 +        friend std::ostream& operator<<(std::ostream& os, const OOPSEMinimizer& minimizer);
151  
152      protected:
153  
# Line 143 | Line 157 | class OOPSEMinimizer {
157          // transfrom minimization coordinates into cartesian and rotational coordinates  
158          void setCoor(std::vector<double>& x);
159  
146        //flag of turning on shake algorithm
147        bool bShake;
160  
161 +
162          //constraint the bonds;
163          int shakeR();
164  
165          //remove the force component along the bond direction
166          int shakeF();
167  
168 <
168 >        double calcPotential();
169 >        
170          SimInfo* info;
171 +
172 +        ForceManager* forceMan;
173          
174          //parameter set of minimization method
175          MinimizerParameterSet* paramSet;
176  
177 +        //flag of turning on shake algorithm
178 +        bool usingShake;
179 +        
180          // dimension of the model
181          int ndim;
182  
# Line 172 | Line 191 | class OOPSEMinimizer {
191          //flag of verbose mode
192          bool bVerbose;
193  
175
194          //status of energy and gradient evaluation
195          int egEvalStatus;
196  
# Line 181 | Line 199 | class OOPSEMinimizer {
199  
200          //current value  of the function
201          double curF;
202 +        
203          // current coordinates
204          std::vector<double> curX;
205 +
206          //gradient at curent coordinates
207          std::vector<double> curG;
208  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines