strangLBFGS.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: strangLBFGS.h,v 1.1.4.6 2007/08/07 09:12:36 aleru Exp $ 
00005 //
00006 
00007 #ifndef BALL_MOLMEC_MINIMIZATION_STRANGLBFGS_H 
00008 #define BALL_MOLMEC_MINIMIZATION_STRANGLBFGS_H 
00009 
00010 #ifndef BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
00011 # include <BALL/MOLMEC/MINIMIZATION/energyMinimizer.h>
00012 #endif
00013 
00014 #ifndef BALL_MOLMEC_MINIMIZATION_LINESEARCH_H
00015 # include <BALL/MOLMEC/MINIMIZATION/lineSearch.h>
00016 #endif
00017 
00018 namespace BALL 
00019 {
00038   class BALL_EXPORT StrangLBFGSMinimizer 
00039     : public EnergyMinimizer
00040   {
00041     public:
00042     
00043     BALL_CREATE(StrangLBFGSMinimizer)
00044     
00045       
00048       
00049       
00054       struct Option 
00055       {
00058         static const char* IMPROVED;
00059         
00062         static const char* NUM_OF_STORED_VECT_PAIRS;
00063       };
00064       
00065       struct BALL_EXPORT Default
00066       {
00070         static const bool IMPROVED;
00071         
00075         static const Size NUM_OF_STORED_VECT_PAIRS;
00076       };
00077       
00079 
00082       
00085       StrangLBFGSMinimizer();
00086       
00089       StrangLBFGSMinimizer(ForceField& force_field);
00090       
00093       StrangLBFGSMinimizer(ForceField& force_field, SnapShotManager *ssm);
00094       
00097       StrangLBFGSMinimizer(ForceField& force_field, SnapShotManager* ssm, const Options& options);
00098       
00101       StrangLBFGSMinimizer(ForceField& force_field, const Options& options);
00102       
00105       StrangLBFGSMinimizer(const StrangLBFGSMinimizer& rhs);
00106       
00109       virtual ~StrangLBFGSMinimizer();
00110       
00112 
00115       
00118       const StrangLBFGSMinimizer& operator=(const StrangLBFGSMinimizer& rhs);
00119       
00121 
00124       
00127       virtual bool specificSetup();
00128       
00130 
00133       
00136       void setMaxNumOfStoredVectPairs(Size num);
00137       
00140       Size getMaxNumOfStoredVectPairs() const;
00141       
00144       void setImprovedFlag(bool flag);
00145       
00148       bool getImprovedFlag() const;
00149       
00156       virtual double findStep();
00157       
00163       virtual void updateDirection();
00164       
00173       virtual bool minimize(Size iterations = 0, bool resume = false);
00174       
00175     protected:
00176       
00178 
00181       
00184       LineSearch line_search_;
00185       
00188       bool first_iter_;
00189       
00192       Size number_of_atoms_;
00193       
00196       Size max_num_of_vect_pairs_;
00197       
00200       Size curr_num_of_vect_pairs_;
00201       
00204       bool improved_;
00205       
00208       vector<float> rho_;
00209       
00212       vector<Vector3> stored_s_;
00213       
00217       vector<Vector3> stored_y_;
00218       
00222       vector<float> work_val_;
00223       
00227       Size index_of_free_vect_;
00228       
00232       std::vector<Vector3> initial_atoms_;
00233       
00235       
00236   };
00237 } // end of namespace BALL
00238 
00239 #endif // BALL_MOLMEC_MINIMIZATION_STRANGLBFGS_H