Loading...
Searching...
No Matches
energyMinimizer.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: energyMinimizer.h,v 1.44.20.3 2007/08/07 09:12:33 aleru Exp $
//
// Energy Minimizer: A class for minimizing the energy of molecular systems
#ifndef BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
#define BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
#ifndef BALL_DATATYPE_OPTIONS_H
# include <BALL/DATATYPE/options.h>
#endif
#ifndef BALL_MOLMEC_COMMON_GRADIENT_H
# include <BALL/MOLMEC/COMMON/gradient.h>
#endif
namespace BALL
{
class ForceField;
class SnapShotManager;
class BALL_EXPORT EnergyMinimizer
{
public:
struct BALL_EXPORT Option
{
static const char* MAXIMAL_NUMBER_OF_ITERATIONS;
static const char* ENERGY_OUTPUT_FREQUENCY;
static const char* SNAPSHOT_FREQUENCY;
static const char* NUMBER_OF_ITERATION;
static const char* ENERGY_DIFFERENCE_BOUND;
static const char* MAX_SAME_ENERGY;
static const char* MAX_GRADIENT;
static const char* MAXIMUM_DISPLACEMENT;
};
struct BALL_EXPORT Default
{
static Size MAXIMAL_NUMBER_OF_ITERATIONS;
static Size ENERGY_OUTPUT_FREQUENCY;
static Size SNAPSHOT_FREQUENCY;
static Size NUMBER_OF_ITERATION;
static float ENERGY_DIFFERENCE_BOUND;
static Size MAX_SAME_ENERGY;
static float MAX_GRADIENT;
static float MAXIMUM_DISPLACEMENT;
};
BALL_CREATE(EnergyMinimizer)
EnergyMinimizer();
EnergyMinimizer(ForceField& force_field);
EnergyMinimizer(ForceField& force_field, const Options& options);
EnergyMinimizer(const EnergyMinimizer& energy_minimizer);
virtual ~EnergyMinimizer();
const EnergyMinimizer& operator=(const EnergyMinimizer& energy_minimizer);
bool operator == (const EnergyMinimizer& energy_minimizer) ;
bool isValid() const;
bool setup(ForceField& force_field);
bool setup(ForceField& force_field, SnapShotManager *ssm);
bool setup(ForceField& force_field,
SnapShotManager *ssm, const Options& options);
bool setup(ForceField& force_field, const Options& options);
virtual bool specificSetup();
virtual bool isConverged() const;
virtual double findStep();
virtual void updateDirection();
virtual double updateEnergy();
virtual void updateForces();
void storeGradientEnergy();
virtual void printEnergy() const;
virtual void takeSnapShot() const;
virtual void finishIteration();
Size getNumberOfIterations() const;
Gradient& getDirection();
Gradient& getGradient();
Gradient& getInitialGradient();
double getEnergy() const;
double& getEnergy();
double getInitialEnergy() const;
double& getInitialEnergy();
void setNumberOfIterations(Size number_of_iterations);
Size getMaxNumberOfIterations() const;
void setMaxNumberOfIterations(Size number_of_iterations);
void setMaxSameEnergy(Size number);
Size getMaxSameEnergy() const;
void setEnergyOutputFrequency(Size energy_output_frequency);
Size getEnergyOutputFrequency() const;
void setEnergyDifferenceBound(float energy_difference_bound);
float getEnergyDifferenceBound() const;
void setMaxGradient(float max_gradient);
float getMaxGradient() const;
void setMaximumDisplacement(float maximum_displacement);
float getMaximumDisplacement() const;
void setSnapShotFrequency(Size snapshot_frequency);
Size getSnapShotFrequency() const;
ForceField* getForceField();
Size getForceUpdateCounter() const ;
Size getEnergyUpdateCounter() const ;
virtual bool minimize(Size steps = 0, bool resume = false);
void enableEnergyAbortCondition(bool state);
bool energyAbortConditionEnabled() const;
void setEnergyToAbort(float value);
float getEnergyToAbort() const;
bool wasAborted() const ;
Options options;
protected:
Gradient initial_grad_;
Gradient current_grad_;
double initial_energy_;
double current_energy_;
Gradient old_grad_;
double old_energy_;
Gradient direction_;
bool valid_;
SnapShotManager* snapshot_;
ForceField* force_field_;
Size number_of_iterations_;
Size maximal_number_of_iterations_;
Size energy_output_frequency_;
Size snapshot_frequency_;
double energy_difference_bound_;
double max_gradient_;
Size max_same_energy_;
Size same_energy_counter_;
float maximum_displacement_;
Size force_update_counter_;
Size energy_update_counter_;
float cutlo_;
double step_;
//_
bool abort_by_energy_enabled_;
//_
float abort_energy_;
//_
bool aborted_;
//_@}
};
} // namespace Ball
#endif // BALL_MOLMEC_MINIMIZATION_ENERGYMINIMIZER_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::EnergyMinimizer::isConverged
virtual bool isConverged() const
BALL::EnergyMinimizer::getEnergy
double getEnergy() const
BALL::EnergyMinimizer::initial_energy_
double initial_energy_
Definition energyMinimizer.h:453
BALL::EnergyMinimizer::force_field_
ForceField * force_field_
Definition energyMinimizer.h:483
BALL::EnergyMinimizer::updateEnergy
virtual double updateEnergy()
BALL::EnergyMinimizer::valid_
bool valid_
Definition energyMinimizer.h:473
BALL::EnergyMinimizer::updateForces
virtual void updateForces()
BALL::EnergyMinimizer::getEnergyUpdateCounter
Size getEnergyUpdateCounter() const
BALL::EnergyMinimizer::setSnapShotFrequency
void setSnapShotFrequency(Size snapshot_frequency)
BALL::EnergyMinimizer::energy_output_frequency_
Size energy_output_frequency_
Definition energyMinimizer.h:495
BALL::EnergyMinimizer::getEnergyOutputFrequency
Size getEnergyOutputFrequency() const
BALL::EnergyMinimizer::EnergyMinimizer
EnergyMinimizer()
BALL::EnergyMinimizer::snapshot_
SnapShotManager * snapshot_
Definition energyMinimizer.h:477
BALL::EnergyMinimizer::getMaxSameEnergy
Size getMaxSameEnergy() const
BALL::EnergyMinimizer::abort_by_energy_enabled_
bool abort_by_energy_enabled_
Definition energyMinimizer.h:545
BALL::EnergyMinimizer::getMaxNumberOfIterations
Size getMaxNumberOfIterations() const
BALL::EnergyMinimizer::getGradient
Gradient & getGradient()
BALL::EnergyMinimizer::getMaximumDisplacement
float getMaximumDisplacement() const
BALL::EnergyMinimizer::minimize
virtual bool minimize(Size steps=0, bool resume=false)
BALL::EnergyMinimizer::same_energy_counter_
Size same_energy_counter_
Definition energyMinimizer.h:518
BALL::EnergyMinimizer::finishIteration
virtual void finishIteration()
BALL::EnergyMinimizer::initial_grad_
Gradient initial_grad_
Definition energyMinimizer.h:445
BALL::EnergyMinimizer::step_
double step_
Definition energyMinimizer.h:542
BALL::EnergyMinimizer::force_update_counter_
Size force_update_counter_
Definition energyMinimizer.h:527
BALL::EnergyMinimizer::setup
bool setup(ForceField &force_field)
BALL::EnergyMinimizer::maximal_number_of_iterations_
Size maximal_number_of_iterations_
Definition energyMinimizer.h:491
BALL::EnergyMinimizer::energyAbortConditionEnabled
bool energyAbortConditionEnabled() const
Query if the MDSimulation aborts if the Energy is greater than abort_energy_.
BALL::EnergyMinimizer::max_same_energy_
Size max_same_energy_
Definition energyMinimizer.h:514
BALL::EnergyMinimizer::setMaxSameEnergy
void setMaxSameEnergy(Size number)
BALL::EnergyMinimizer::getEnergyToAbort
float getEnergyToAbort() const
BALL::EnergyMinimizer::getEnergyDifferenceBound
float getEnergyDifferenceBound() const
BALL::EnergyMinimizer::setMaximumDisplacement
void setMaximumDisplacement(float maximum_displacement)
BALL::EnergyMinimizer::current_grad_
Gradient current_grad_
Definition energyMinimizer.h:449
BALL::EnergyMinimizer::setNumberOfIterations
void setNumberOfIterations(Size number_of_iterations)
BALL::EnergyMinimizer::setMaxGradient
void setMaxGradient(float max_gradient)
BALL::EnergyMinimizer::cutlo_
float cutlo_
Definition energyMinimizer.h:537
BALL::EnergyMinimizer::current_energy_
double current_energy_
Definition energyMinimizer.h:457
BALL::EnergyMinimizer::number_of_iterations_
Size number_of_iterations_
Definition energyMinimizer.h:487
BALL::EnergyMinimizer::getInitialGradient
Gradient & getInitialGradient()
BALL::EnergyMinimizer::options
Options options
Definition energyMinimizer.h:434
BALL::EnergyMinimizer::setEnergyToAbort
void setEnergyToAbort(float value)
BALL::EnergyMinimizer::setEnergyDifferenceBound
void setEnergyDifferenceBound(float energy_difference_bound)
BALL::EnergyMinimizer::specificSetup
virtual bool specificSetup()
BALL::EnergyMinimizer::getMaxGradient
float getMaxGradient() const
BALL::EnergyMinimizer::getForceUpdateCounter
Size getForceUpdateCounter() const
BALL::EnergyMinimizer::isValid
bool isValid() const
BALL::EnergyMinimizer::getInitialEnergy
double getInitialEnergy() const
BALL::EnergyMinimizer::printEnergy
virtual void printEnergy() const
BALL::EnergyMinimizer::enableEnergyAbortCondition
void enableEnergyAbortCondition(bool state)
BALL::EnergyMinimizer::setMaxNumberOfIterations
void setMaxNumberOfIterations(Size number_of_iterations)
BALL::EnergyMinimizer::old_energy_
double old_energy_
Definition energyMinimizer.h:465
BALL::EnergyMinimizer::getNumberOfIterations
Size getNumberOfIterations() const
BALL::EnergyMinimizer::storeGradientEnergy
void storeGradientEnergy()
BALL::EnergyMinimizer::getSnapShotFrequency
Size getSnapShotFrequency() const
BALL::EnergyMinimizer::direction_
Gradient direction_
Definition energyMinimizer.h:469
BALL::EnergyMinimizer::snapshot_frequency_
Size snapshot_frequency_
Definition energyMinimizer.h:499
BALL::EnergyMinimizer::energy_difference_bound_
double energy_difference_bound_
Definition energyMinimizer.h:504
BALL::EnergyMinimizer::getForceField
ForceField * getForceField()
BALL::EnergyMinimizer::max_gradient_
double max_gradient_
Definition energyMinimizer.h:508
BALL::EnergyMinimizer::setEnergyOutputFrequency
void setEnergyOutputFrequency(Size energy_output_frequency)
BALL::EnergyMinimizer::wasAborted
bool wasAborted() const
BALL::EnergyMinimizer::getDirection
Gradient & getDirection()
BALL::EnergyMinimizer::updateDirection
virtual void updateDirection()
BALL::EnergyMinimizer::findStep
virtual double findStep()
BALL::EnergyMinimizer::aborted_
bool aborted_
Definition energyMinimizer.h:551
BALL::EnergyMinimizer::maximum_displacement_
float maximum_displacement_
Definition energyMinimizer.h:522
BALL::EnergyMinimizer::takeSnapShot
virtual void takeSnapShot() const
BALL::EnergyMinimizer::energy_update_counter_
Size energy_update_counter_
Definition energyMinimizer.h:532
BALL::EnergyMinimizer::abort_energy_
float abort_energy_
Definition energyMinimizer.h:548
BALL::EnergyMinimizer::old_grad_
Gradient old_grad_
Definition energyMinimizer.h:461
BALL::ForceField
Definition forceField.h:86
BALL::Gradient
Definition gradient.h:45
BALL::Options
Definition options.h:48
BALL::SnapShotManager
Definition snapShotManager.h:34
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
gradient.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
options.h
BALL::EnergyMinimizer::Default
Definition energyMinimizer.h:77
BALL::EnergyMinimizer::Default::SNAPSHOT_FREQUENCY
static Size SNAPSHOT_FREQUENCY
Definition energyMinimizer.h:88
BALL::EnergyMinimizer::Default::MAX_SAME_ENERGY
static Size MAX_SAME_ENERGY
Definition energyMinimizer.h:103
BALL::EnergyMinimizer::Default::MAXIMAL_NUMBER_OF_ITERATIONS
static Size MAXIMAL_NUMBER_OF_ITERATIONS
Definition energyMinimizer.h:80
BALL::EnergyMinimizer::Default::ENERGY_OUTPUT_FREQUENCY
static Size ENERGY_OUTPUT_FREQUENCY
Definition energyMinimizer.h:84
BALL::EnergyMinimizer::Default::ENERGY_DIFFERENCE_BOUND
static float ENERGY_DIFFERENCE_BOUND
Definition energyMinimizer.h:97
BALL::EnergyMinimizer::Default::NUMBER_OF_ITERATION
static Size NUMBER_OF_ITERATION
Definition energyMinimizer.h:92
BALL::EnergyMinimizer::Default::MAX_GRADIENT
static float MAX_GRADIENT
Definition energyMinimizer.h:108
BALL::EnergyMinimizer::Default::MAXIMUM_DISPLACEMENT
static float MAXIMUM_DISPLACEMENT
Definition energyMinimizer.h:112
BALL::EnergyMinimizer::Option
Definition energyMinimizer.h:40
BALL::EnergyMinimizer::Option::MAXIMAL_NUMBER_OF_ITERATIONS
static const char * MAXIMAL_NUMBER_OF_ITERATIONS
Definition energyMinimizer.h:43
BALL::EnergyMinimizer::Option::ENERGY_OUTPUT_FREQUENCY
static const char * ENERGY_OUTPUT_FREQUENCY
Definition energyMinimizer.h:47
BALL::EnergyMinimizer::Option::SNAPSHOT_FREQUENCY
static const char * SNAPSHOT_FREQUENCY
Definition energyMinimizer.h:51
BALL::EnergyMinimizer::Option::MAX_GRADIENT
static const char * MAX_GRADIENT
Definition energyMinimizer.h:69
BALL::EnergyMinimizer::Option::MAX_SAME_ENERGY
static const char * MAX_SAME_ENERGY
Definition energyMinimizer.h:64
BALL::EnergyMinimizer::Option::MAXIMUM_DISPLACEMENT
static const char * MAXIMUM_DISPLACEMENT
Definition energyMinimizer.h:73
BALL::EnergyMinimizer::Option::ENERGY_DIFFERENCE_BOUND
static const char * ENERGY_DIFFERENCE_BOUND
Definition energyMinimizer.h:59
BALL::EnergyMinimizer::Option::NUMBER_OF_ITERATION
static const char * NUMBER_OF_ITERATION
Definition energyMinimizer.h:55