Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Controller.h

Go to the documentation of this file.
00001 
00007 #ifndef CONTROLLER_H
00008 #define CONTROLLER_H
00009 
00010 #include "converse.h"
00011 #include "Node.h"
00012 #include "common.h"
00013 #include <fstream>
00014 
00015 class ControllerBroadcasts;
00016 class NamdState;
00017 class SimParameters;
00018 class RequireReduction;
00019 
00020 #ifdef MEM_OPT_VERSION
00021 class CollectionMasterHandler;
00022 #else
00023 class CollectionMaster;
00024 #endif
00025 
00026 class Random;
00027 class PressureProfileReduction;
00028 
00029 class Controller
00030 {
00031 public:
00032     Controller(NamdState *s);
00033     virtual ~Controller(void);
00034     void run(void);             // spawn thread, etc.
00035     void awaken(void) { CthAwaken(thread); };
00036 
00037 protected:
00038     friend class ScriptTcl;
00039     virtual void algorithm(void);       // subclasses redefine this method
00040 
00041     void integrate(); // Verlet integrator
00042     void minimize(); // CG minimizer
00043 
00044     void receivePressure(int step, int minimize = 0);
00045       Tensor pressure_normal;
00046       Tensor pressure_nbond;
00047       Tensor pressure_slow;
00048       Tensor groupPressure_normal;
00049       Tensor groupPressure_nbond;
00050       Tensor groupPressure_slow;
00051       Tensor controlPressure_normal;
00052       Tensor controlPressure_nbond;
00053       Tensor controlPressure_slow;
00054       int nbondFreq;
00055       int slowFreq;
00056       BigReal temp_avg;
00057       BigReal pressure_avg;
00058       BigReal groupPressure_avg;
00059       int avg_count;
00060       Tensor pressure_tavg;
00061       Tensor groupPressure_tavg;
00062       int tavg_count;
00063     void compareChecksums(int,int=0);
00064       int computeChecksum;
00065       int marginViolations;
00066       int pairlistWarnings;
00067     void printTiming(int);
00068     void printMinimizeEnergies(int);
00069       BigReal min_energy;
00070       BigReal min_f_dot_f;
00071       BigReal min_f_dot_v;
00072       BigReal min_v_dot_v;
00073       int min_huge_count;
00074     void printDynamicsEnergies(int);
00075     void printEnergies(int step, int minimize);
00076       int numDegFreedom;
00077       BigReal totalEnergy;
00078       BigReal electEnergy;
00079       BigReal electEnergySlow;
00080       BigReal ljEnergy;
00081 //fepb
00082       BigReal electEnergy_f;
00083       BigReal electEnergySlow_f;
00084       BigReal ljEnergy_f;
00085       BigReal exp_dE_ByRT;
00086       BigReal net_dE;
00087       BigReal dG;
00088       int FepNo;
00089       void printFepMessage(int);
00090       BigReal fepSum;
00091 //fepe
00092 
00093       BigReal electEnergy_ti_1;
00094       BigReal electEnergySlow_ti_1;
00095       BigReal ljEnergy_ti_1;
00096       BigReal electEnergy_ti_2;
00097       BigReal electEnergySlow_ti_2;
00098       BigReal ljEnergy_ti_2;
00099       BigReal net_dEdl_elec_1;
00100       BigReal net_dEdl_elec_2;
00101       BigReal net_dEdl_lj_1;
00102       BigReal net_dEdl_lj_2;
00103       BigReal electEnergyPME_ti_1;
00104       BigReal electEnergyPME_ti_2;
00105       int TiNo;
00106       BigReal recent_dEdl_elec_1;
00107       BigReal recent_dEdl_elec_2;
00108       BigReal recent_dEdl_lj_1;
00109       BigReal recent_dEdl_lj_2;
00110       int recent_TiNo;
00111       void printTiMessage(int);
00112 
00113       BigReal drudeComTemp;  // temperature of Drude centers of mass
00114       BigReal drudeBondTemp; // temperature of Drude bonds
00115       BigReal drudeComTempAvg;
00116       BigReal drudeBondTempAvg;
00117 
00118       BigReal kineticEnergy;
00119       BigReal kineticEnergyHalfstep;
00120       BigReal kineticEnergyCentered;
00121       BigReal temperature;
00122       BigReal smooth2_avg;
00123       BigReal smooth2_avg2;  // avoid internal compiler error
00124       Tensor pressure;
00125       Tensor groupPressure;
00126       int controlNumDegFreedom;
00127       Tensor controlPressure;
00128     void enqueueCollections(int);
00129     void correctMomentum(int step);
00130     void rescaleVelocities(int);
00131       BigReal rescaleVelocities_sumTemps;
00132       int rescaleVelocities_numTemps;
00133     void reassignVelocities(int);
00134     void tcoupleVelocities(int);
00135     void berendsenPressure(int);
00136       Tensor berendsenPressure_avg;
00137       int berendsenPressure_count;
00138     void langevinPiston1(int);
00139     void langevinPiston2(int);
00140       Tensor langevinPiston_strainRate;
00141 
00142     int ldbSteps;
00143     void rebalanceLoad(int);
00144       int fflush_count;
00145     void cycleBarrier(int,int);
00146 
00147     // void suspend(void) { CthSuspend(); };
00148     void terminate(void);
00149 
00150     Random *random;
00151     SimParameters *const simParams;     // for convenience
00152     NamdState *const state;             // access data in state
00153     RequireReduction *reduction;
00154 
00155     // data for pressure profile reductions and output
00156     PressureProfileReduction *ppbonded;
00157     PressureProfileReduction *ppnonbonded;
00158     PressureProfileReduction *ppint;
00159     int pressureProfileSlabs;
00160     int pressureProfileCount;
00161     BigReal *pressureProfileAverage;
00162 
00163     #ifdef MEM_OPT_VERSION
00164     CollectionMasterHandler *const collection;
00165     #else
00166     CollectionMaster *const collection;
00167     #endif
00168     ControllerBroadcasts * broadcast;
00169     std::ofstream xstFile;
00170     void outputExtendedSystem(int step);
00171     void writeExtendedSystemLabels(std::ofstream &file);
00172     void writeExtendedSystemData(int step, std::ofstream &file);
00173 
00174 //fepb
00175     std::ofstream fepFile;
00176     void outputFepEnergy(int step);
00177     void writeFepEnergyData(int step, std::ofstream &file);
00178 //fepe
00179     std::ofstream tiFile;
00180     void outputTiEnergy(int step);
00181     void writeTiEnergyData(int step, std::ofstream &file);
00182 
00183     // for checkpoint/revert
00184     int checkpoint_stored;
00185     Lattice checkpoint_lattice;
00186     Tensor checkpoint_langevinPiston_strainRate;
00187     Tensor checkpoint_berendsenPressure_avg;
00188     int checkpoint_berendsenPressure_count;
00189 
00190 private:
00191     CthThread thread;
00192     static void threadRun(Controller*);
00193 
00194     double startCTime;
00195     double startWTime;
00196     double firstCTime;
00197     double firstWTime;
00198     double startBenchTime;
00199 
00200 };
00201 
00202 #endif // CONTROLLER_H
00203 

Generated on Sat Oct 11 04:07:41 2008 for NAMD by  doxygen 1.3.9.1