BALL  1.5.0
forceField.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: forceField.h,v 1.33 2005/12/23 17:01:51 amoll Exp $
5 //
6 
7 #ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
8 #define BALL_MOLMEC_COMMON_FORCEFIELD_H
9 
10 #ifndef BALL_COMMON_H
11 # include <BALL/common.h>
12 #endif
13 
14 #ifndef BALL_KERNEL_SYSTEM_H
15 # include <BALL/KERNEL/system.h>
16 #endif
17 
18 #ifndef BALL_DATATYPE_OPTIONS_H
19 # include <BALL/DATATYPE/options.h>
20 #endif
21 
22 #ifndef BALL_CONCEPT_TIMESTAMP_H
23 # include <BALL/CONCEPT/timeStamp.h>
24 #endif
25 
26 #ifndef BALL_MOLMEC_PARAMETER_FORCEFIELDPARAMETERS_H
28 #endif
29 
30 #ifndef BALL_MOLMEC_PARAMETER_ATOMTYPES_H
32 #endif
33 
34 #ifndef BALL_MOLMEC_COMMON_PERIODIC_BOUNDARY_H
36 #endif
37 
38 #ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
40 #endif
41 
42 #include <vector>
43 
44 namespace BALL
45 {
46  class ForceFieldComponent;
47 
86  {
87  public:
88 
89  friend class ForceFieldComponent;
90 
94 
99  typedef std::vector<std::pair<Atom*, Atom*> > PairVector;
100 
102 
105 
107 
108 
112  ForceField();
113 
118  ForceField(System& system);
119 
124  ForceField(System& system, const Options& options);
125 
128  ForceField(const ForceField& force_field);
129 
132  virtual ~ForceField();
133 
136  virtual void clear()
137  ;
138 
140 
143 
146  ForceField& operator = (const ForceField& force_field);
147 
149 
152 
157  bool isValid() const
158  ;
159 
161 
164 
167  bool setup(System& system);
168 
171  bool setup(System& system, const Options& options);
172 
177  virtual bool specificSetup();
178 
183  void setMaximumNumberOfErrors(Size nr);
184 
188  Size getMaximumNumberOfErrors() const;
189 
191  HashSet<const Atom*>& getUnassignedAtoms();
192 
194 
197 
200  void setName(const String& name);
201 
204  String getName() const;
205 
208  Size getNumberOfAtoms() const;
209 
217  Size getNumberOfMovableAtoms() const;
218 
222  const AtomVector& getAtoms() const ;
223 
227  System* getSystem() ;
228 
232  const System* getSystem() const ;
233 
237  bool getUseSelection() const ;
238 
242  void disableSelection() ;
243 
247  void enableSelection() ;
248 
251  bool isSelectionEnabled() const ;
252 
255  ForceFieldParameters& getParameters();
256 
259  Size countComponents() const;
260 
268  const TimeStamp& getUpdateTime() const
269  ;
270 
278  const TimeStamp& getSetupTime() const
279  ;
280 
285  void insertComponent(ForceFieldComponent* force_field_component);
286 
290  void removeComponent(const ForceFieldComponent* force_field_component);
291 
294  void removeComponent(const String& name);
295 
301  ForceFieldComponent* getComponent(const Size index) const;
302 
306  ForceFieldComponent* getComponent(const String& name) const;
307 
313  double getEnergy() const;
314 
317  double updateEnergy();
318 
321  void updateForces();
322 
325  double getRMSGradient() const;
326 
331  virtual Size getUpdateFrequency() const;
332 
342  virtual void update();
343 
347  virtual String getResults() const
348  { return "undefined";}
349 
350  //_ Report an error and increase the error counter
351  std::ostream& error();
352 
354 
357 
361 
365 
367 
368  protected:
369  /*_ Collect all atoms into the atoms_ vector.
370  */
371  void collectAtoms_(const System& system);
372 
373  /*_ Sort the atom vector wrt selection.
374  */
375  void sortSelectedAtomVector_();
376 
380  virtual void performRequiredUpdates_();
381 
382  /*_ @name Protected Attributes
383  */
384  //_@{
385 
386  /*_ The system the force field is bound to
387  */
389 
390  /*_ The atoms in the simulated system
391  */
393 
394  /*_ An object containing the force field parameters read from a file
395  */
397 
398  /*_ The boolean variable indicates if the setup of the force field was successful
399  */
400  bool valid_;
401 
402  /*_ The force field name
403  */
405 
406  /*_ The total energy
407  */
408  double energy_;
409 
410  /*_ The components of the force field
411  */
412  vector<ForceFieldComponent*> components_;
413 
414  /*_ The number of movable atoms in the force field
415  */
417 
418  /*_ Do we have to check whether atoms are selected?
419  */
421 
422  /*_ This flag can temporarily disable the selection.
423  */
425 
426  /*_ The time of the last call to update.
427  */
429 
430  /*_ The time of the last call to setup.
431  */
433 
434  //_ Atoms, for which the setup of the force field fails
436 
437  //_ max number of unassigned atoms
439 
441 
442  //_@}
443  };
444 
445 # ifndef BALL_NO_INLINE_FUNCTIONS
446 # include <BALL/MOLMEC/COMMON/forceField.iC>
447 # endif
448 
449 } // namespace BALL
450 
451 #endif // BALL_MOLMEC_COMMON_FORCEFIELD_H
BALL::ForceField::name_
String name_
Definition: forceField.h:404
BALL_INLINE
#define BALL_INLINE
Definition: debug.h:15
BALL::ForceField::atoms_
AtomVector atoms_
Definition: forceField.h:392
forceFieldParameters.h
BALL::Options
Definition: options.h:46
atomVector.h
BALL::ForceField::periodic_boundary
PeriodicBoundary periodic_boundary
Definition: forceField.h:364
BALL::ForceField::selection_enabled_
bool selection_enabled_
Definition: forceField.h:424
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::ForceField::energy_
double energy_
Definition: forceField.h:408
system.h
BALL::ForceField::number_of_movable_atoms_
Size number_of_movable_atoms_
Definition: forceField.h:416
BALL::ForceField::PairVector
std::vector< std::pair< Atom *, Atom * > > PairVector
Definition: forceField.h:99
timeStamp.h
BALL::HashSet
Definition: hashSet.h:45
BALL::ForceField::options
Options options
Definition: forceField.h:360
BALL::ForceField::number_of_errors_
Size number_of_errors_
Definition: forceField.h:440
periodicBoundary.h
BALL::ForceField::valid_
bool valid_
Definition: forceField.h:400
BALL::PeriodicBoundary
Definition: periodicBoundary.h:34
BALL::ForceField::getResults
virtual String getResults() const
Definition: forceField.h:347
BALL::ForceField
Definition: forceField.h:85
BALL_SIZE_TYPE
BALL::System
Definition: KERNEL/system.h:38
BALL::ForceField::parameters_
ForceFieldParameters parameters_
Definition: forceField.h:396
BALL::ForceField::unassigned_atoms_
HashSet< const Atom * > unassigned_atoms_
Definition: forceField.h:435
BALL
Definition: constants.h:12
BALL::ForceFieldParameters
Definition: forceFieldParameters.h:29
BALL::String
Definition: string.h:56
options.h
BALL::ForceField::setup_time_stamp_
TimeStamp setup_time_stamp_
Definition: forceField.h:432
BALL::TimeStamp
Definition: timeStamp.h:171
BALL::ForceFieldComponent
Definition: forceFieldComponent.h:34
BALL::ForceField::components_
vector< ForceFieldComponent * > components_
Definition: forceField.h:412
common.h
BALL::ForceField::update_time_stamp_
TimeStamp update_time_stamp_
Definition: forceField.h:428
BALL::ForceField::use_selection_
bool use_selection_
Definition: forceField.h:420
BALL_CREATE
#define BALL_CREATE(name)
Definition: create.h:62
BALL::RTTI::getName
const char * getName()
Definition: rtti.h:97
BALL::ForceField::system_
System * system_
Definition: forceField.h:388
BALL::AtomVector
Definition: atomVector.h:29
atomTypes.h
BALL::ForceField::max_number_of_errors_
Size max_number_of_errors_
Definition: forceField.h:438