Loading...
Searching...
No Matches
forceField.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: forceField.h,v 1.33 2005/12/23 17:01:51 amoll Exp $
//
#ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
#define BALL_MOLMEC_COMMON_FORCEFIELD_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_KERNEL_SYSTEM_H
# include <BALL/KERNEL/system.h>
#endif
#ifndef BALL_DATATYPE_OPTIONS_H
# include <BALL/DATATYPE/options.h>
#endif
#ifndef BALL_CONCEPT_TIMESTAMP_H
# include <BALL/CONCEPT/timeStamp.h>
#endif
#ifndef BALL_MOLMEC_PARAMETER_FORCEFIELDPARAMETERS_H
# include <BALL/MOLMEC/PARAMETER/forceFieldParameters.h>
#endif
#ifndef BALL_MOLMEC_PARAMETER_ATOMTYPES_H
# include <BALL/MOLMEC/PARAMETER/atomTypes.h>
#endif
#ifndef BALL_MOLMEC_COMMON_PERIODIC_BOUNDARY_H
# include <BALL/MOLMEC/COMMON/periodicBoundary.h>
#endif
#ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
# include <BALL/MOLMEC/COMMON/atomVector.h>
#endif
#include <vector>
namespace BALL
{
class ForceFieldComponent;
class BALL_EXPORT ForceField
{
public:
friend class ForceFieldComponent;
typedef std::vector<std::pair<Atom*, Atom*> > PairVector;
BALL_CREATE(ForceField)
ForceField();
ForceField(System& system);
ForceField(System& system, const Options& options);
ForceField(const ForceField& force_field);
virtual ~ForceField();
virtual void clear()
;
ForceField& operator = (const ForceField& force_field);
bool isValid() const
;
bool setup(System& system);
bool setup(System& system, const Options& options);
virtual bool specificSetup();
void setMaximumNumberOfErrors(Size nr);
Size getMaximumNumberOfErrors() const;
HashSet<const Atom*>& getUnassignedAtoms();
void setName(const String& name);
String getName() const;
Size getNumberOfAtoms() const;
Size getNumberOfMovableAtoms() const;
BALL_INLINE
const AtomVector& getAtoms() const ;
BALL_INLINE
System* getSystem() ;
BALL_INLINE
const System* getSystem() const ;
BALL_INLINE
bool getUseSelection() const ;
BALL_INLINE
void disableSelection() ;
BALL_INLINE
void enableSelection() ;
BALL_INLINE
bool isSelectionEnabled() const ;
ForceFieldParameters& getParameters();
Size countComponents() const;
const TimeStamp& getUpdateTime() const
;
const TimeStamp& getSetupTime() const
;
void insertComponent(ForceFieldComponent* force_field_component);
void removeComponent(const ForceFieldComponent* force_field_component);
void removeComponent(const String& name);
ForceFieldComponent* getComponent(const Size index) const;
ForceFieldComponent* getComponent(const String& name) const;
double getEnergy() const;
double updateEnergy();
void updateForces();
double getRMSGradient() const;
virtual Size getUpdateFrequency() const;
virtual void update();
virtual String getResults() const
{ return "undefined";}
//_ Report an error and increase the error counter
std::ostream& error();
Options options;
PeriodicBoundary periodic_boundary;
protected:
/*_ Collect all atoms into the atoms_ vector.
*/
void collectAtoms_(const System& system);
/*_ Sort the atom vector wrt selection.
*/
void sortSelectedAtomVector_();
virtual void performRequiredUpdates_();
/*_ @name Protected Attributes
*/
//_@{
/*_ The system the force field is bound to
*/
System* system_;
/*_ The atoms in the simulated system
*/
AtomVector atoms_;
/*_ An object containing the force field parameters read from a file
*/
ForceFieldParameters parameters_;
/*_ The boolean variable indicates if the setup of the force field was successful
*/
bool valid_;
/*_ The force field name
*/
String name_;
/*_ The total energy
*/
double energy_;
/*_ The components of the force field
*/
vector<ForceFieldComponent*> components_;
/*_ The number of movable atoms in the force field
*/
Size number_of_movable_atoms_;
/*_ Do we have to check whether atoms are selected?
*/
bool use_selection_;
/*_ This flag can temporarily disable the selection.
*/
bool selection_enabled_;
/*_ The time of the last call to update.
*/
TimeStamp update_time_stamp_;
/*_ The time of the last call to setup.
*/
TimeStamp setup_time_stamp_;
//_ Atoms, for which the setup of the force field fails
HashSet<const Atom*> unassigned_atoms_;
//_ max number of unassigned atoms
Size max_number_of_errors_;
Size number_of_errors_;
//_@}
};
# ifndef BALL_NO_INLINE_FUNCTIONS
# include <BALL/MOLMEC/COMMON/forceField.iC>
# endif
} // namespace BALL
#endif // BALL_MOLMEC_COMMON_FORCEFIELD_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
system.h
atomTypes.h
atomVector.h
BALL::AtomVector
Definition atomVector.h:31
BALL::Atom
Definition atom.h:90
BALL::ForceFieldComponent
Definition forceFieldComponent.h:35
BALL::ForceFieldParameters
Definition forceFieldParameters.h:31
BALL::ForceField::setMaximumNumberOfErrors
void setMaximumNumberOfErrors(Size nr)
BALL::ForceField::error
std::ostream & error()
BALL::ForceField::periodic_boundary
PeriodicBoundary periodic_boundary
Definition forceField.h:364
BALL::ForceField::updateForces
void updateForces()
BALL::ForceField::clear
virtual void clear()
BALL::ForceField::PairVector
std::vector< std::pair< Atom *, Atom * > > PairVector
Definition forceField.h:99
BALL::ForceField::getSetupTime
const TimeStamp & getSetupTime() const
BALL::ForceField::max_number_of_errors_
Size max_number_of_errors_
Definition forceField.h:438
BALL::ForceField::options
Options options
Definition forceField.h:360
BALL::ForceField::getEnergy
double getEnergy() const
BALL::ForceField::getRMSGradient
double getRMSGradient() const
BALL::ForceField::getNumberOfMovableAtoms
Size getNumberOfMovableAtoms() const
BALL::ForceField::getNumberOfAtoms
Size getNumberOfAtoms() const
BALL::ForceField::number_of_movable_atoms_
Size number_of_movable_atoms_
Definition forceField.h:416
BALL::ForceField::ForceField
ForceField()
BALL::ForceField::use_selection_
bool use_selection_
Definition forceField.h:420
BALL::ForceField::setup
bool setup(System &system)
BALL::ForceField::parameters_
ForceFieldParameters parameters_
Definition forceField.h:396
BALL::ForceField::name_
String name_
Definition forceField.h:404
BALL::ForceField::updateEnergy
double updateEnergy()
BALL::ForceField::getUpdateFrequency
virtual Size getUpdateFrequency() const
BALL::ForceField::system_
System * system_
Definition forceField.h:388
BALL::ForceField::ForceFieldComponent
friend class ForceFieldComponent
Definition forceField.h:89
BALL::ForceField::isSelectionEnabled
BALL_INLINE bool isSelectionEnabled() const
BALL::ForceField::components_
vector< ForceFieldComponent * > components_
Definition forceField.h:412
BALL::ForceField::getUnassignedAtoms
HashSet< const Atom * > & getUnassignedAtoms()
Get the atoms, for which the force field setup failed.
BALL::ForceField::specificSetup
virtual bool specificSetup()
BALL::ForceField::collectAtoms_
void collectAtoms_(const System &system)
BALL::ForceField::number_of_errors_
Size number_of_errors_
Definition forceField.h:440
BALL::ForceField::update
virtual void update()
BALL::ForceField::sortSelectedAtomVector_
void sortSelectedAtomVector_()
BALL::ForceField::atoms_
AtomVector atoms_
Definition forceField.h:392
BALL::ForceField::setup_time_stamp_
TimeStamp setup_time_stamp_
Definition forceField.h:432
BALL::ForceField::getParameters
ForceFieldParameters & getParameters()
BALL::ForceField::performRequiredUpdates_
virtual void performRequiredUpdates_()
BALL::ForceField::countComponents
Size countComponents() const
BALL::ForceField::insertComponent
void insertComponent(ForceFieldComponent *force_field_component)
BALL::ForceField::getComponent
ForceFieldComponent * getComponent(const Size index) const
BALL::ForceField::removeComponent
void removeComponent(const ForceFieldComponent *force_field_component)
BALL::ForceField::isValid
bool isValid() const
BALL::ForceField::setName
void setName(const String &name)
BALL::ForceField::energy_
double energy_
Definition forceField.h:408
BALL::ForceField::getMaximumNumberOfErrors
Size getMaximumNumberOfErrors() const
BALL::ForceField::valid_
bool valid_
Definition forceField.h:400
BALL::ForceField::selection_enabled_
bool selection_enabled_
Definition forceField.h:424
BALL::ForceField::update_time_stamp_
TimeStamp update_time_stamp_
Definition forceField.h:428
BALL::ForceField::enableSelection
BALL_INLINE void enableSelection()
BALL::ForceField::getSystem
BALL_INLINE System * getSystem()
BALL::ForceField::getUseSelection
BALL_INLINE bool getUseSelection() const
BALL::ForceField::getAtoms
BALL_INLINE const AtomVector & getAtoms() const
BALL::ForceField::getName
String getName() const
BALL::ForceField::getUpdateTime
const TimeStamp & getUpdateTime() const
BALL::ForceField::disableSelection
BALL_INLINE void disableSelection()
BALL::ForceField::getResults
virtual String getResults() const
Definition forceField.h:347
BALL::ForceField::unassigned_atoms_
HashSet< const Atom * > unassigned_atoms_
Definition forceField.h:435
BALL::HashSet
Definition hashSet.h:46
BALL::Options
Definition options.h:48
BALL::PeriodicBoundary
Definition periodicBoundary.h:35
BALL::String
Definition string.h:57
BALL::System
Definition KERNEL/system.h:40
BALL::TimeStamp
Definition timeStamp.h:172
common.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL_INLINE
#define BALL_INLINE
Definition debug.h:15
forceFieldParameters.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
options.h
periodicBoundary.h
timeStamp.h