BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
energyMinimizer.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: energyMinimizer.h,v 1.44.20.3 2007/08/07 09:12:33 aleru Exp $
5 //
6 
7 // Energy Minimizer: A class for minimizing the energy of molecular systems
8 
9 #ifndef BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
10 #define BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
11 
12 #ifndef BALL_DATATYPE_OPTIONS_H
13 # include <BALL/DATATYPE/options.h>
14 #endif
15 
16 #ifndef BALL_MOLMEC_COMMON_GRADIENT_H
18 #endif
19 
20 namespace BALL
21 {
22  class ForceField;
23  class SnapShotManager;
24 
30  {
31  public:
32 
36 
40  {
43  static const char* MAXIMAL_NUMBER_OF_ITERATIONS;
44 
47  static const char* ENERGY_OUTPUT_FREQUENCY;
48 
51  static const char* SNAPSHOT_FREQUENCY;
52 
55  static const char* NUMBER_OF_ITERATION;
56 
59  static const char* ENERGY_DIFFERENCE_BOUND;
60 
64  static const char* MAX_SAME_ENERGY;
65 
69  static const char* MAX_GRADIENT;
70 
73  static const char* MAXIMUM_DISPLACEMENT;
74  };
75 
77  {
81 
85 
89 
93 
98 
104 
108  static float MAX_GRADIENT;
109 
112  static float MAXIMUM_DISPLACEMENT;
113  };
114 
116 
119 
121 
122 
124  EnergyMinimizer();
125 
128  EnergyMinimizer(ForceField& force_field);
129 
132  EnergyMinimizer(ForceField& force_field, const Options& options);
133 
136  EnergyMinimizer(const EnergyMinimizer& energy_minimizer);
137 
140  virtual ~EnergyMinimizer();
141 
143 
146 
149  const EnergyMinimizer& operator=(const EnergyMinimizer& energy_minimizer);
150 
152 
155  bool operator == (const EnergyMinimizer& energy_minimizer) ;
156 
160 
163  bool isValid() const;
164 
166 
169 
172  bool setup(ForceField& force_field);
173 
176  bool setup(ForceField& force_field, SnapShotManager *ssm);
177 
180  bool setup(ForceField& force_field,
181  SnapShotManager *ssm, const Options& options);
182 
185  bool setup(ForceField& force_field, const Options& options);
186 
189  virtual bool specificSetup();
190 
192 
195 
208  virtual bool isConverged() const;
209 
218  virtual double findStep();
219 
224  virtual void updateDirection();
225 
230  virtual double updateEnergy();
231 
236  virtual void updateForces();
237 
243  void storeGradientEnergy();
244 
252  virtual void printEnergy() const;
253 
262  virtual void takeSnapShot() const;
263 
282  virtual void finishIteration();
283 
286  Size getNumberOfIterations() const;
287 
290  Gradient& getDirection();
291 
294  Gradient& getGradient();
295 
298  Gradient& getInitialGradient();
299 
302  double getEnergy() const;
303 
306  double& getEnergy();
307 
310  double getInitialEnergy() const;
311 
314  double& getInitialEnergy();
315 
318  void setNumberOfIterations(Size number_of_iterations);
319 
322  Size getMaxNumberOfIterations() const;
323 
326  void setMaxNumberOfIterations(Size number_of_iterations);
327 
331  void setMaxSameEnergy(Size number);
332 
336  Size getMaxSameEnergy() const;
337 
340  void setEnergyOutputFrequency(Size energy_output_frequency);
341 
344  Size getEnergyOutputFrequency() const;
345 
348  void setEnergyDifferenceBound(float energy_difference_bound);
349 
352  float getEnergyDifferenceBound() const;
353 
357  void setMaxGradient(float max_gradient);
358 
362  float getMaxGradient() const;
363 
367  void setMaximumDisplacement(float maximum_displacement);
368 
371  float getMaximumDisplacement() const;
372 
375  void setSnapShotFrequency(Size snapshot_frequency);
376 
379  Size getSnapShotFrequency() const;
380 
383  ForceField* getForceField();
384 
387  Size getForceUpdateCounter() const ;
388 
391  Size getEnergyUpdateCounter() const ;
392 
404  virtual bool minimize(Size steps = 0, bool resume = false);
405 
408  void enableEnergyAbortCondition(bool state);
409 
411  bool energyAbortConditionEnabled() const;
412 
417  void setEnergyToAbort(float value);
418 
420  float getEnergyToAbort() const;
421 
425  bool wasAborted() const ;
426 
428 
431 
434  Options options;
436 
437  protected:
438 
442 
445  Gradient initial_grad_;
446 
449  Gradient current_grad_;
450 
453  double initial_energy_;
454 
457  double current_energy_;
458 
461  Gradient old_grad_;
462 
465  double old_energy_;
466 
469  Gradient direction_;
470 
473  bool valid_;
474 
477  SnapShotManager* snapshot_;
478 
483  ForceField* force_field_;
484 
487  Size number_of_iterations_;
488 
491  Size maximal_number_of_iterations_;
492 
495  Size energy_output_frequency_;
496 
499  Size snapshot_frequency_;
500 
504  double energy_difference_bound_;
505 
508  double max_gradient_;
509 
514  Size max_same_energy_;
515 
518  Size same_energy_counter_;
519 
522  float maximum_displacement_;
523 
527  Size force_update_counter_;
528 
532  Size energy_update_counter_;
533 
537  float cutlo_;
538 
542  double step_;
543 
544  //_
545  bool abort_by_energy_enabled_;
546 
547  //_
548  float abort_energy_;
549 
550  //_
551  bool aborted_;
552 
553  //_@}
554  };
555 
556 } // namespace Ball
557 
558 #endif // BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
static const char * MAXIMAL_NUMBER_OF_ITERATIONS
#define BALL_CREATE(name)
Definition: create.h:62
static const char * MAX_SAME_ENERGY
static const char * SNAPSHOT_FREQUENCY
static const char * ENERGY_OUTPUT_FREQUENCY
static const char * NUMBER_OF_ITERATION
static const char * MAXIMUM_DISPLACEMENT
static const char * ENERGY_DIFFERENCE_BOUND
static const char * MAX_GRADIENT
#define BALL_EXPORT
Definition: COMMON/global.h:50