00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _MDPARALLEL_H
00012 #define _MDPARALLEL_H
00013
00014 #include "md.h"
00015
00016 #ifndef _PARALLEL
00017 class MDPARALLELFrame : public MDFrame { };
00018 #else
00019 #include "mpi.h"
00020
00021 enum {MSG_ATOM_LEN, MSG_ATOM, MSG_SKIN_LEN, MSG_SKIN, MSG_NEB_ATOM};
00022
00023
00024 class MDPARALLELFrame : public MDFrame
00025 {
00026 public:
00027
00028
00029 int myIX, myIY, myIZ;
00030 int nXdoms, nYdoms, nZdoms;
00031 int myDomain, numDomains;
00032 double *domBoundX, *domBoundY, *domBoundZ;
00033 double myXmin, myYmin, myZmin;
00034 double myXmax, myYmax, myZmax;
00035 int *domainID, *globalID;
00036 double *_EPOT_IND_global;
00037 Vector3 *_F_global;
00038 Matrix33 *_VIRIAL_IND_global;
00039
00040 int numNeighDoms, *neighDoms;
00041 MPI_Request *inRequests, *outRequests;
00042 MPI_Status *inStatus, *outStatus;
00043
00044
00045 Vector3 *_Rc0, *_Rc1, *_Rc2, *_Fc0, *_Tan;
00046
00047
00048 MDPARALLELFrame(): myIX(0),myIY(0),myIZ(0),
00049 nXdoms(1),nYdoms(1),nZdoms(1),
00050 myDomain(0),numDomains(1),
00051 domBoundX(0),domBoundY(0),domBoundZ(0),
00052 myXmin(-10),myYmin(-10),myZmin(-10),
00053 myXmax(+10),myYmax(+10),myZmax(+10),
00054 domainID(0),globalID(0),
00055 _EPOT_IND_global(0),_F_global(0),_VIRIAL_IND_global(0),
00056 numNeighDoms(0),neighDoms(0),
00057 inRequests(0),outRequests(0),inStatus(0),outStatus(0),
00058 _Rc0(0),_Rc1(0),_Rc2(0),_Fc0(0),_Tan(0)
00059 {
00060 MDFrame::MDFrame();
00061 }
00062
00063 virtual void call_potential() { potential_parallel(); }
00064
00065 virtual void initvars();
00066 virtual void initparser();
00067 virtual int exec(char *name);
00068 virtual void Alloc();
00069
00070 void ParallelInit(int *pargc, char ***pargv);
00071 void WaitForCommand();
00072 void Master_to_Slave(char *cmd);
00073 void Slave_to_Master_Atoms();
00074 void Slave_chdir();
00075 void Broadcast_Atoms();
00076 void Master_Collect_Results();
00077
00078 void Partition_Domains();
00079 void Comm_Neighbor_Domains_Atoms();
00080 void Mark_Local_Atoms();
00081 void potential_parallel();
00082 void eval_parallel();
00083 void run_parallel();
00084 void step_parallel();
00085
00086 void alloc_all();
00087 void quit_all();
00088
00089
00090 void nebrelax_parallel();
00091 void AllocChain_parallel();
00092 void initRchain_parallel();
00093 int readRchain_parallel();
00094 int writeRchain_parallel();
00095 void copyRchaintoCN_parallel();
00096 int writefinalcnfile_parallel(int, bool);
00097
00098 };
00099 #endif //_PARALLEL
00100
00101 #endif //_MD_H