00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H
00011 #define BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H
00012
00013 #ifndef BALL_COMMON_H
00014 # include <BALL/common.h>
00015 #endif
00016
00017 #ifndef BALL_DATATYPE_OPTIONS_H
00018 # include <BALL/DATATYPE/options.h>
00019 #endif
00020
00021 #ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
00022 # include <BALL/MOLMEC/COMMON/atomVector.h>
00023 #endif
00024
00025 #include <vector>
00026
00027 namespace BALL
00028 {
00029
00030 class SnapShotManager;
00031 class ForceField;
00032 class System;
00033
00042 class BALL_EXPORT MolecularDynamics
00043 {
00044 public:
00045
00049 struct BALL_EXPORT Option
00050 {
00051
00054 static const char* MAXIMAL_NUMBER_OF_ITERATIONS;
00055
00059 static const char* MAXIMAL_SIMULATION_TIME;
00060
00063 static const char* NUMBER_OF_ITERATION;
00064
00067 static const char* ENERGY_OUTPUT_FREQUENCY;
00068
00071 static const char* SNAPSHOT_FREQUENCY;
00072
00075 static const char* TIME_STEP;
00076
00079 static const char* REFERENCE_TEMPERATURE;
00080
00084 static const char* BATH_RELAXATION_TIME;
00085
00088 static const char* CURRENT_TIME;
00089 };
00090
00091 struct BALL_EXPORT Default
00092 {
00093
00096 static const Size MAXIMAL_NUMBER_OF_ITERATIONS;
00097
00101 static const double MAXIMAL_SIMULATION_TIME;
00102
00105 static const Size NUMBER_OF_ITERATION;
00106
00110 static const Size ENERGY_OUTPUT_FREQUENCY;
00111
00114 static const Size SNAPSHOT_FREQUENCY;
00115
00118 static const double TIME_STEP;
00119
00122 static const double REFERENCE_TEMPERATURE;
00123
00126 static const double BATH_RELAXATION_TIME;
00127
00131 static const double CURRENT_TIME;
00132 };
00133
00137
00138 BALL_CREATE(MolecularDynamics)
00139
00140
00142 MolecularDynamics();
00143
00146 MolecularDynamics(ForceField& force_field);
00147
00150 MolecularDynamics(const MolecularDynamics& rhs);
00151
00154 virtual ~MolecularDynamics();
00155
00157
00160
00163 const MolecularDynamics& operator =(const MolecularDynamics& rhs);
00164
00167 void set(const MolecularDynamics& rhs);
00168
00170
00173
00176 bool isValid() const;
00177
00179
00182
00185 virtual bool setup(ForceField& force_field, SnapShotManager* snapshot_man);
00186
00189 virtual bool setup(ForceField& forcefield, SnapShotManager* snapshot_man, const Options& myoptions);
00190
00194 virtual bool specificSetup();
00195
00197
00200
00203 void setNumberOfIteration(Size number);
00204
00209 void setMaximalNumberOfIterations(Size number);
00210
00215 void setMaximalSimulationTime(double time);
00216
00220 virtual void setTimeStep(double step);
00221
00226 void setReferenceTemperature(double temperature);
00227
00230 void setCurrentTime(double time);
00231
00236 void setEnergyOutputFrequency(Size number);
00237
00240 void setSnapShotFrequency(Size number);
00241
00244 Size getEnergyOutputFrequency() const;
00245
00248 Size getNumberOfIterations() const;
00249
00252 Size getMaximalNumberOfIterations() const;
00253
00256 double getMaximalSimulationTime() const;
00257
00260 double getTimeStep() const;
00261
00264 Size getSnapShotFrequency() const;
00265
00268 double getTemperature() const;
00269
00272 double getTime() const;
00273
00276 double getTotalEnergy() const;
00277
00280 double getPotentialEnergy() const;
00281
00284 double getKineticEnergy() const;
00285
00288 ForceField* getForceField() const;
00289
00296 bool simulate(bool restart = false);
00297
00304 bool simulateTime(double simulation_time, bool restart = false);
00305
00313 virtual bool simulateIterations(Size number, bool restart = false);
00314
00317 void enableEnergyAbortCondition(bool state);
00318
00320 bool energyAbortConditionEnabled() const;
00321
00325 void setEnergyToAbort(float value);
00326
00330 float getEnergyToAbort() const;
00331
00333
00337
00340 Options options;
00341
00342 protected:
00343
00345
00346
00347
00348
00349
00350
00351
00352 void updateInstantaneousTemperature();
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 bool valid_;
00363
00364
00365
00366 ForceField* force_field_ptr_;
00367
00368
00369
00370 System* system_ptr_;
00371
00372
00373
00374 AtomVector atom_vector_;
00375
00376
00377
00378 Size number_of_iteration_;
00379
00380
00381
00382
00383 Size maximal_number_of_iterations_;
00384
00385
00386
00387 double time_step_;
00388
00389
00390
00391 double reference_temperature_;
00392
00393
00394
00395 double current_temperature_;
00396
00397
00398
00399 double kinetic_energy_;
00400
00401
00402
00403 double total_energy_;
00404
00405
00406
00407 double current_time_;
00408
00409
00410
00411 Size energy_output_frequency_;
00412
00413
00414
00415 Size snapshot_frequency_;
00416
00417
00418
00419 SnapShotManager* snapshot_manager_ptr_;
00420
00421
00422 bool abort_by_energy_enabled_;
00423
00424
00425 float abort_energy_;
00426
00427
00428
00429 };
00430 }
00431
00432 #endif // BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H