Debian Codegraph @

include/BALL/MOLMEC/COMMON/periodicBoundary.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: periodicBoundary.h,v 1.22 2005/12/23 17:01:51 amoll Exp $
5 //
6
7 #ifndef BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H
8 #define BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H
9
10 #ifndef BALL_COMMON_H
11 # include <BALL/common.h>
12 #endif
13
14 #ifndef BALL_DATATYPE_OPTIONS_H
15 # include <BALL/DATATYPE/options.h>
16 #endif
17
18 #ifndef BALL_MATHS_SIMPLEBOX3_H
19 # include <BALL/MATHS/simpleBox3.h>
20 #endif
21
22 namespace BALL
23 {
24 class ForceField;
25
26 class PeriodicBoundary;
27
28 /** Periodic boundary class for force field simulations.
29 Molecular Mechanics: class representing periodic boundary conditions.
30 \par
31
32 \ingroup MolmecCommon
33 */
34 class BALL_EXPORT PeriodicBoundary
35 {
36 public:
37
38 BALL_CREATE(PeriodicBoundary)
39
40 /** @name Type definitions
41 */
42 //@{
43
44 ///
45 typedef std::pair<Size, Size> AtomIndexPair;
46
47 ///
48 typedef std::vector<AtomIndexPair> AtomIndexArray;
49
50 //@}
51 /** @name Constants used as option keys
52 */
53 //@{
54
55 ///
56 struct BALL_EXPORT Option
57 {
58 /// Vector containing the lower corner of the box
59 static const char* PERIODIC_BOX_LOWER;
60
61 /// Vector containing the upper corner of the box
62 static const char* PERIODIC_BOX_UPPER;
63
64 /// Bool that indicates whether periodic boundary is enabled or not
65 static const char* PERIODIC_BOX_ENABLED;
66
67 /// Minimum distance between solute molecules and the box in Angstrom
68 static const char* PERIODIC_BOX_DISTANCE;
69
70 /// Flag to initiate the addition of solvent to the box
71 static const char* PERIODIC_BOX_ADD_SOLVENT;
72
73 /** Name of the file containing the solvent.
74 This file should contain an equilibrated box of the solvent
75 in the HyperChem format.
76 */
77 static const char* PERIODIC_BOX_SOLVENT_FILE;
78
79 /** Minimum distance between solvent and solute for added solvent.
80 */
81 static const char* PERIODIC_BOX_SOLVENT_SOLUTE_DISTANCE;
82
83 /** Filename for the default solvent.
84 */
85 static const char* PERIODIC_WATER_FILE;
86
87 };
88
89 /// Default values
90 struct BALL_EXPORT Default
91 {
92 /// Default vector for the lower corner of the box
93 static const Vector3 PERIODIC_BOX_LOWER;
94
95 /// Default vector for the upper corner of the box
96 static const Vector3 PERIODIC_BOX_UPPER;
97
98 /// Default bool value for periodic boundary (enabled or not)
99 static const bool PERIODIC_BOX_ENABLED;
100
101 /// Default minimum distance between solute molecules and the box in Angstrom
102 static const float PERIODIC_BOX_DISTANCE;
103
104 /// Default value of the flag to initiate the addition of solvent to the box
105 static const bool PERIODIC_BOX_ADD_SOLVENT;
106
107 /** Default file for adding solvent molecules into the box.
108 This file should contain an equilibrated box of the solvent
109 in the HyperChem format.
110 */
111 static const char* PERIODIC_BOX_SOLVENT_FILE;
112
113 /// Default minimum distance between solvent and solute for added solvent.
114 static const float PERIODIC_BOX_SOLVENT_SOLUTE_DISTANCE;
115
116 /// Default file for default solvent.
117 static const char* PERIODIC_WATER_FILE;
118 };
119
120 //@}
121 /** @name Constructors and Destructors
122 */
123 //@{
124
125 /** Default constructor.
126 */
127 PeriodicBoundary();
128
129 /** Constructor.
130 */
131 PeriodicBoundary(const ForceField& force_field);
132
133 /** Copy constructor
134 */
135 PeriodicBoundary(const PeriodicBoundary& periodic_boundary);
136
137 /** Destructor.
138 */
139 virtual ~PeriodicBoundary();
140
141 //@}
142 /** @name Assignment
143 */
144 //@{
145
146 /** Assignment operator.
147 */
148 PeriodicBoundary& operator = (const PeriodicBoundary& periodic_boundary);
149
150 /** Clear method
151 */
152 virtual void clear();
153
154 //@}
155 /** @name Setup Methods
156 */
157 //@{
158
159 /** Sets up the periodic box
160 */
161 bool setup();
162
163 /** Generate the vector of molecules of the system
164 */
165 Size generateMoleculesVector();
166
167 //@}
168 /** @name Accessors
169 */
170 //@{
171
172 /// Enable periodic boundary conditions
173 void enable();
174
175 /// Disable periodic boundary conditions
176 void disable();
177
178 /** Retrieve the box dimensions.
179 */
180 SimpleBox3 getBox() const;
181
182 /** Set the box dimensions.
183 The box dimensions are additionally stored in options
184 using keys \link lower lower \endlink and \link upper upper \endlink .
185 */
186 void setBox(const SimpleBox3& box);
187
188 /** Fill the defined box with a solvent.
189 This method fills the defined box with solvent molecules.
190 If no box is defined, no solvent is added. The neccessary
191 solvent box template is either taken from the options (solvent_file)
192 or a default is assumed. \par
193 This method replicates the solvent box starting at the box origin in
194 all three dimensions and removes all solvent molecules that are within
195 \link solvent_distance solvent_distance \endlink of a solute molecule
196 or outside the periodic box. \par
197 To ensure periodicity, our SimpleBox instance might be resized to an integral
198 multiple of the spacing of the periodic solvent box.
199 The method returns the number of inserted solvent molecules. All solvent
200 molecules are marked as such by setting their property
201 \link Molecule::PROPERTY__PERIODIC_BOX_SOLVENT Molecule::PROPERTY__PERIODIC_BOX_SOLVENT \endlink . \par
202 @see removeSolvent
203 */
204 Size addSolvent(const String& filename);
205
206 /** Removes all solvent molecules
207 This method removes all molecules that have the property \link Molecule::PROPERTY__PERIODIC_BOX_SOLVENT Molecule::PROPERTY__PERIODIC_BOX_SOLVENT \endlink
208 set from the force field's system.
209 The number of removed solvent molecules is returned.
210 @see addSolvent
211 */
212 Size removeSolvent();
213
214 //@}
215 /** @name Predicates
216 */
217 //@{
218
219 /** Returns <b>true</b> if the periodic boundary is enabled
220 @see enable
221 @see disable
222 */
223 bool isEnabled() const;
224
225 //@}
226 /** @name Periodic boundary methods
227 */
228 //@{
229
230 /** Checks which molecules are inside the box.
231 If the center of mass of a molecule leaves the box,
232 it is inserted on the other side.
233 */
234 void updateMolecules();
235
236 //@}
237 /** @name Variables
238 */
239 //@{
240
241 /** Periodic Boundary options.
242 This is usually a pointer to the options of the force field the PeriodicBoundary object
243 is contained in.
244 */
245 Options* options;
246
247 //@}
248
249 protected:
250
251 private:
252
253 /*_ @name Private Attributes
254 */
255 //_@{
256
257 //_ Pointer to the force field of the periodic boundary
258 ForceField* force_field_;
259
260 //_ Indicates if periodic boundary is enabled or not
261 bool enabled_;
262
263 //_ The box of the periodic boundary
264 SimpleBox3 box_;
265
266 //_ An pair vector with the start and end indices of all molecules (atoms of the molecules)
267 AtomIndexArray molecules_;
268
269 //_@}
270
271 };
272
273 } // namespace BALL
274
275 #endif // BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H