00001 #ifndef TrajectoryH
00002 #define TrajectoryH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00031 #include "CoreMainHeader.h"
00032 #include "Point.h"
00033 #include "ExtObject.h"
00034 #include "WorkSceneEventer.h"
00035
00036 class CMolecule;
00037 #undef GetCurrentTime
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00055
00058 class NEMESIS_CORE_PACKAGE CTrajectorySnapshot {
00059 public:
00060 __fastcall CTrajectorySnapshot(int num_of_atoms);
00061 virtual __fastcall ~CTrajectorySnapshot(void);
00062
00063 public:
00064 CPoint* Coords;
00065 CPoint* Velocities;
00066 CPoint BoxSize;
00067 CPoint BoxAngles;
00068 };
00069
00070
00071
00073
00076 class NEMESIS_CORE_PACKAGE CTrajectory : public CExtObject{
00077 public:
00078 __fastcall CTrajectory(CMolecule* p_molecule);
00079 __fastcall ~CTrajectory(void);
00080
00081
00082 bool __fastcall ChangeMemoryMode(bool inmemory);
00083
00084
00085 void __fastcall SetBegining(void);
00086 void __fastcall SetEnd(void);
00087 void __fastcall NextSnapshot(int step=1);
00088 void __fastcall PreviousSnapshot(int step=1);
00089 void __fastcall Play(int step=1);
00090 void __fastcall SetSnapshot(int snapshot);
00091
00092
00093 inline int __fastcall GetNumOfSnapshots(void);
00094 inline int __fastcall GetCurrentSnapshot(void);
00095 inline double __fastcall GetCurrentTime(void);
00096 inline double __fastcall GetTotalTime(void);
00097 inline CPoint& __fastcall GetSceneCentrum(void);
00098
00099
00100 virtual bool __fastcall ReadFirstSnapshot(void);
00101 virtual bool __fastcall ReadLastSnapshot(void);
00102 virtual bool __fastcall ReadNextSnapshot(int step);
00103 virtual bool __fastcall ReadPrevSnapshot(int step);
00104 virtual CTrajectorySnapshot* __fastcall AllocateSnapshots(int num_of_snapshots);
00105
00106
00107 protected:
00108 CMolecule* Molecule;
00109 int NumOfAtoms;
00110 int NumOfConstraint;
00111 CPoint Centrum;
00112 CTrajectorySnapshot* CurrentSnapshot;
00113 CTrajectorySnapshot* Snapshots;
00114 int* Zs;
00115 double* Isotopes;
00116
00117 int NumOfSnapshots;
00118 int CurrentSnapshotIndex;
00119 double StartTime;
00120 double TimeStep;
00121 bool AllInMemory;
00122
00123 void __fastcall SetAtomCoords(CTrajectorySnapshot* snapshot);
00124
00125 const CPoint __fastcall CalculateSnapshotCentrum(CTrajectorySnapshot* snapshot);
00126 double __fastcall CalculateTemperature(CTrajectorySnapshot* snapshot);
00127 double __fastcall CalculateCOMTemperature(CTrajectorySnapshot* snapshot);
00128 double __fastcall CalculateROTTemperature(CTrajectorySnapshot* snapshot);
00129 double __fastcall CalculateROTEnergy(CTrajectorySnapshot* snapshot);
00130 };
00131
00132
00133
00134 DECLARE_EVENT(Trajectory_ChangeSnapshot);
00135
00136
00137
00138 inline int __fastcall CTrajectory::GetNumOfSnapshots(void)
00139 {
00140 return(NumOfSnapshots);
00141 }
00142
00143
00144
00145 inline int __fastcall CTrajectory::GetCurrentSnapshot(void)
00146 {
00147 return(CurrentSnapshotIndex);
00148 }
00149
00150
00151
00152 inline double __fastcall CTrajectory::GetTotalTime(void)
00153 {
00154 return(TimeStep*(NumOfSnapshots-1));
00155 }
00156
00157
00158
00159 inline double __fastcall CTrajectory::GetCurrentTime(void)
00160 {
00161 return(TimeStep*CurrentSnapshotIndex+StartTime);
00162 }
00163
00164
00165
00166 inline CPoint& __fastcall CTrajectory::GetSceneCentrum(void)
00167 {
00168 return(Centrum);
00169 }
00170
00171
00172
00173 #endif