00001
00007 #ifndef SEQUENCER_H
00008 #define SEQUENCER_H
00009
00010 #include "converse.h"
00011 #include "PatchTypes.h"
00012
00013 class HomePatch;
00014 class SimParameters;
00015 class SubmitReduction;
00016 class CollectionMgr;
00017 class ControllerBroadcasts;
00018 class LdbCoordinator;
00019 class Random;
00020
00021 class Sequencer
00022 {
00023 friend class HomePatch;
00024 public:
00025 Sequencer(HomePatch *p);
00026 virtual ~Sequencer(void);
00027 void run(void);
00028 void awaken(void) { CthAwaken(thread); }
00029 void suspend(void) { CthSuspend(); }
00030
00031 protected:
00032 virtual void algorithm(void);
00033
00034 void integrate();
00035 void minimize();
00036
00037 void runComputeObjects(int migration = 1, int pairlists = 0);
00038 int pairlistsAreValid;
00039 int pairlistsAge;
00040
00041 void submitReductions(int);
00042 void submitHalfstep(int);
00043 void submitMinimizeReductions(int);
00044 void submitCollections(int step, int zeroVel = 0);
00045
00046 void submitMomentum(int step);
00047 void correctMomentum(int step, BigReal drifttime);
00048
00049 void saveForce(const int ftag = Results::normal);
00050 void addForceToMomentum(BigReal, const int ftag = Results::normal,
00051 const int useSaved = 0, const int pressure = 0);
00052 void addVelocityToPosition(BigReal);
00053
00054
00055 void redistrib_tip4p_forces(const int, const int);
00056
00057 void addRotDragToPosition(BigReal);
00058 void addMovDragToPosition(BigReal);
00059
00060 void newMinimizeDirection(BigReal);
00061 void newMinimizePosition(BigReal);
00062 void quenchVelocities();
00063
00064 void rattle1(BigReal,int);
00065 void rattle2(BigReal,int);
00066
00067 void maximumMove(BigReal);
00068 void minimizationQuenchVelocity(void);
00069
00070 void reloadCharges();
00071
00072 void rescaleVelocities(int);
00073 int rescaleVelocities_numTemps;
00074 void reassignVelocities(BigReal,int);
00075 void reinitVelocities(void);
00076 void rescaleVelocitiesByFactor(BigReal);
00077 void tcoupleVelocities(BigReal,int);
00078 void berendsenPressure(int);
00079 int berendsenPressure_count;
00080 int checkpoint_berendsenPressure_count;
00081 void langevinPiston(int);
00082 int slowFreq;
00083 void langevinVelocities(BigReal);
00084 void langevinVelocitiesBBK1(BigReal);
00085 void langevinVelocitiesBBK2(BigReal);
00086
00087 void cycleBarrier(int,int);
00088 void terminate(void);
00089
00090 Random *random;
00091 SimParameters *const simParams;
00092 HomePatch *const patch;
00093 SubmitReduction *reduction;
00094 SubmitReduction *pressureProfileReduction;
00095
00096 CollectionMgr *const collection;
00097 ControllerBroadcasts * broadcast;
00098
00099 int ldbSteps;
00100 void rebalanceLoad(int timestep);
00101
00102
00103 private:
00104 CthThread thread;
00105 static void threadRun(Sequencer*);
00106
00107 LdbCoordinator *ldbCoordinator;
00108 };
00109
00110 #endif