File: forceFieldComponent.h

package info (click to toggle)
ball 1.4.3~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 318,984 kB
  • sloc: cpp: 346,579; ansic: 4,097; python: 2,664; yacc: 1,778; lex: 1,099; xml: 964; sh: 688; sql: 316; awk: 118; makefile: 108
file content (177 lines) | stat: -rw-r--r-- 3,587 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: forceFieldComponent.h,v 1.20.18.1 2007/03/25 21:23:49 oliver Exp $
//

// Molecular Mechanics: general force field component class

#ifndef BALL_MOLMEC_FORCEFIELDCOMPONENT_H
#define BALL_MOLMEC_FORCEFIELDCOMPONENT_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
#	include	<BALL/DATATYPE/string.h>
#endif

#ifndef BALL_KERNEL_ATOM_H
#	include	<BALL/KERNEL/atom.h>
#endif

#include <BALL/SCORING/COMMON/scoringComponent.h>

namespace BALL 
{
	class ForceField;

	/**	Generic force field component class.
			
    	\ingroup  MolmecCommon
	*/
	class BALL_EXPORT ForceFieldComponent : public ScoringComponent
	{

		friend class ForceField;

		public:

		/**	@name	Constructors and Destructors 
		*/
		//@{

		public:

		BALL_CREATE(ForceFieldComponent)

		/**	Default constructor.
		*/
		ForceFieldComponent();

		/**	Constructor.
		*/
		ForceFieldComponent(ForceField&	force_field);

		/**	Copy constructor.
				Creates a new instance of the given ForceFieldComponent.
				The created object will not be assigned to an existing force field.
		*/
		ForceFieldComponent(const ForceFieldComponent&	force_field_component);

		/**	Destructor.
		*/
		virtual ~ForceFieldComponent();

		//@} 

		/**	@name Setup method
		*/
		//@{

		/**	Setup method.
		*/
		virtual bool setup()
			throw(Exception::TooManyErrors);

		//@}
		/**	@name	Accessors	
		*/
		//@{

		/**	Returns the parent force field.
				0 is returned, if no force field is assigned.
		*/	
		ForceField*	getForceField() const;

		/**	Sets the force field.
		*/
		void	setForceField(ForceField& force_field);

		/**	Sets the component's name.
		*/
		void	setName(const String& name);

		/**	Returns the component's name 
		*/
		String	getName() const;

		///
		bool isEnabled() const { return enabled_;}

		///
		void setEnabled(bool state) { enabled_ = state;}

		//@}	
		/**	@name	Force field calculations
		*/
		//@{

		/**	Returns the energy of the force field component
		*/
		virtual double getEnergy() const;

		/**	Returns the energy of the force field component.
				The current energy for this force field component is being
				calculated and returned in units of kJ/mol. \par
				If the component isn't assigned to a ForceField object,
				zero is returned.
		*/
		virtual double	updateEnergy();

		/**	Updates the atomic forces in the force field.
				The forces created by this ForceFieldComponent are
				calculated for each atom and updated in the corresponding 
				array (forces) of the ForceField instance this component 
				is assigned to.
		*/
		virtual void updateForces();

		/**	Regular update of the pair list and the like.
				Each component that contains updatable data structures
				(like nonbonded pair lists) should implement
				this method. It is called for each component of a force field
				each time  \link ForceField::update ForceField::update \endlink  is called.
				The default implementation does exactly nothing.
		*/
		virtual void update()
			throw(Exception::TooManyErrors);

		/** interface to ScoringComponent */
		double updateScore();

		protected:

		//@}
		/*_	@name Protected Attributes
		*/
		//_@{

		/*_	The force field this component is registered in
		*/
		ForceField*	force_field_;

		/*_	The energy of the component
		*/
		double	energy_;
			
		private:
		
		//_@}
		/*_	@name Private Attributes
		*/
		//_@{

		/*_	The force field component name
		*/
		String	name_;

		bool 		enabled_;
		
		//_@}

	};
} // namespace BALL

#endif // BALL_MOLMEC_FORCEFIELDCOMPONENT_H