Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Trajectory.h

Go to the documentation of this file.
00001 #ifndef TrajectoryH
00002 #define TrajectoryH
00003 
00004 /*******************************************************************************
00005 Copyright 2002 Petr Kulhanek
00006 
00007     This file is part of Core plugin.
00008 
00009     Core plugin is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     Core plugin is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with Core plugin; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023 In this file is also the part of code from the Gromacs package
00024 www.gromacs.org)
00025 see below in Trajectory.cpp
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  INTERNAL UNIT FORMATS
00043 
00044  Masses:        g/mol
00045  Velocities:
00046  Time:          a.u (
00047  Distances:
00048  Temperature:   K
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;             // coordinates of trajectory
00065     CPoint*     Velocities;         // coordinates of trajectory
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   // general settings ----------------------------------------------------------
00082     bool __fastcall ChangeMemoryMode(bool inmemory);
00083 
00084   // manipulating with snapshots -----------------------------------------------
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   // get some interanal values -------------------------------------------------
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   // virtual function for snapshot manipulation --------------------------------
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   // protected data --------------------------------------------------------------
00107     protected:
00108     CMolecule*              Molecule;       // molecule of project
00109     int                     NumOfAtoms;     // number of atoms
00110     int                     NumOfConstraint;// number of constraints (for temperature det.)
00111     CPoint                  Centrum;        // auxilirary centrum of scene - inside of box
00112     CTrajectorySnapshot*    CurrentSnapshot;// coordinates of trajectory
00113     CTrajectorySnapshot*    Snapshots;      // field of snapshots
00114     int*                    Zs;             // proton numbers
00115     double*                 Isotopes;       // masses of atoms
00116 
00117     int         NumOfSnapshots;     // number of snapshots
00118     int         CurrentSnapshotIndex;    // index of current snapshot
00119     double      StartTime;          // time at beginning of trajectory
00120     double      TimeStep;           // time step
00121     bool        AllInMemory;        // all data is stored in memory
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

Generated on Sun Feb 9 12:53:51 2003 for NemesisCore by doxygen1.3-rc2