00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: periodicBoundary.h,v 1.22 2005/12/23 17:01:51 amoll Exp $ 00005 // 00006 00007 #ifndef BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H 00008 #define BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H 00009 00010 #ifndef BALL_COMMON_H 00011 # include <BALL/common.h> 00012 #endif 00013 00014 #ifndef BALL_DATATYPE_OPTIONS_H 00015 # include <BALL/DATATYPE/options.h> 00016 #endif 00017 00018 #ifndef BALL_MATHS_SIMPLEBOX3_H 00019 # include <BALL/MATHS/simpleBox3.h> 00020 #endif 00021 00022 namespace BALL 00023 { 00024 class ForceField; 00025 00026 class PeriodicBoundary; 00027 00034 class BALL_EXPORT PeriodicBoundary 00035 { 00036 public: 00037 00038 BALL_CREATE(PeriodicBoundary) 00039 00040 00043 00044 00045 typedef std::pair<Size, Size> AtomIndexPair; 00046 00048 typedef std::vector<AtomIndexPair> AtomIndexArray; 00049 00051 00054 00056 struct BALL_EXPORT Option 00057 { 00059 static const char* PERIODIC_BOX_LOWER; 00060 00062 static const char* PERIODIC_BOX_UPPER; 00063 00065 static const char* PERIODIC_BOX_ENABLED; 00066 00068 static const char* PERIODIC_BOX_DISTANCE; 00069 00071 static const char* PERIODIC_BOX_ADD_SOLVENT; 00072 00077 static const char* PERIODIC_BOX_SOLVENT_FILE; 00078 00081 static const char* PERIODIC_BOX_SOLVENT_SOLUTE_DISTANCE; 00082 00085 static const char* PERIODIC_WATER_FILE; 00086 00087 }; 00088 00090 struct BALL_EXPORT Default 00091 { 00093 static const Vector3 PERIODIC_BOX_LOWER; 00094 00096 static const Vector3 PERIODIC_BOX_UPPER; 00097 00099 static const bool PERIODIC_BOX_ENABLED; 00100 00102 static const float PERIODIC_BOX_DISTANCE; 00103 00105 static const bool PERIODIC_BOX_ADD_SOLVENT; 00106 00111 static const char* PERIODIC_BOX_SOLVENT_FILE; 00112 00114 static const float PERIODIC_BOX_SOLVENT_SOLUTE_DISTANCE; 00115 00117 static const char* PERIODIC_WATER_FILE; 00118 }; 00119 00121 00124 00127 PeriodicBoundary(); 00128 00131 PeriodicBoundary(const ForceField& force_field); 00132 00135 PeriodicBoundary(const PeriodicBoundary& periodic_boundary); 00136 00139 virtual ~PeriodicBoundary(); 00140 00142 00145 00148 PeriodicBoundary& operator = (const PeriodicBoundary& periodic_boundary); 00149 00152 virtual void clear() 00153 ; 00154 00156 00159 00162 bool setup(); 00163 00166 Size generateMoleculesVector(); 00167 00169 00172 00174 void enable(); 00175 00177 void disable(); 00178 00181 SimpleBox3 getBox() const; 00182 00187 void setBox(const SimpleBox3& box); 00188 00201 Size addSolvent(const String& filename) const; 00202 00209 Size removeSolvent() const; 00210 00212 00215 00220 bool isEnabled() const; 00221 00223 00226 00231 void updateMolecules(); 00232 00234 00237 00242 Options* options; 00243 00245 00246 protected: 00247 00248 private: 00249 00250 /*_ @name Private Attributes 00251 */ 00252 //_@{ 00253 00254 //_ Pointer to the force field of the periodic boundary 00255 ForceField* force_field_; 00256 00257 //_ Indicates if periodic boundary is enabled or not 00258 bool enabled_; 00259 00260 //_ The box of the periodic boundary 00261 SimpleBox3 box_; 00262 00263 //_ An pair vector with the start and end indices of all molecules (atoms of the molecules) 00264 AtomIndexArray molecules_; 00265 00266 //_@} 00267 00268 }; 00269 00270 } // namespace BALL 00271 00272 #endif // BALL_MOLMEC_COMMON_PERIODICBOUNDARY_H