00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "charm++.h"
00023 #include "../../include/debug_flags.h"
00024 #include "util.h"
00025 #include "cpaimd.h"
00026 #include "groups.h"
00027 #include "fftCacheSlab.h"
00028 #include "CP_State_Plane.h"
00029 #include "lambda.h"
00030 #include <unistd.h>
00031 #include "../../src_mathlib/mathlib.h"
00032
00033
00034
00035
00036 extern Config config;
00037 extern int nstates;
00038 extern CProxy_main mainProxy;
00039 extern CProxy_CPcharmParaInfoGrp scProxy;
00040 extern CProxy_CP_State_GSpacePlane gSpacePlaneProxy;
00041 extern PairCalcID PairCalcID1;
00042 extern PairCalcID pairCalcID2;
00043 extern CProxy_AtomsGrp atomsGrpProxy;
00044 extern CProxy_CP_Rho_RealSpacePlane rhoRealProxy;
00045 extern CProxy_CP_Rho_GSpacePlane rhoGProxy;
00046 extern CProxy_CP_Rho_GHartExt rhoGHartExtProxy;
00047
00048
00049
00050
00051
00052
00053 void Lambda::acceptAllLambda(CkReductionMsg *msg) {
00054 delete msg;
00055 CkAbort("do not call acceptAllLambda");
00056 }
00057
00058
00059
00060
00061
00062
00063 void Lambda::acceptSectionLambda(CkReductionMsg *msg) {
00064
00065
00066 double *lambda = (double *)msg->getData();
00067 int lambdaCount = msg->getSize()/sizeof(double);
00068
00069
00070 finishPairCalcSection(lambdaCount, lambda, &lPairCalcID2, thisIndex.x, thisIndex.y, 0, lPairCalcID2.priority+1);
00071 #ifdef _CP_DEBUG_LAMBDA_VERBOSE_
00072 if(thisIndex.x==0 && thisIndex.y==0)
00073 CkPrintf("[%d,%d] finishing asymm\n",thisIndex.x, thisIndex.y);
00074 #endif
00075 delete msg;
00076
00077
00078 }
00079
00080
00081
00082
00083
00084
00085 void Lambda::makeSections(int indexSize, int *indexZ){
00086
00087 int s1=thisIndex.x*lambdaGrainSize;
00088 int s2=thisIndex.y*lambdaGrainSize;
00089 if(lambdaGrainSize!=sGrainSize)
00090 {
00091
00092 s1=s1/sGrainSize*sGrainSize;
00093 s2=s2/sGrainSize*sGrainSize;
00094 }
00095
00096
00097 initOneRedSect(indexSize, indexZ, config.numChunksAsym, &lPairCalcID2, CkCallback(CkIndex_Lambda::acceptSectionLambda(NULL), thisProxy(thisIndex.x, thisIndex.y)) , CkCallback(CkIndex_main::doneInit(NULL),mainProxy),s1, s2, thisIndex.x, thisIndex.y, lambdaGrainSize, false, false, config.useOrthoDirect);
00098 initOneRedSect(indexSize, indexZ, config.numChunksAsym, &lPairCalcID2, CkCallback(CkIndex_Lambda::acceptSectionLambda(NULL), thisProxy(thisIndex.x, thisIndex.y)) , CkCallback(CkIndex_main::doneInit(NULL),mainProxy),s1, s2, thisIndex.x, thisIndex.y, lambdaGrainSize, false, true, config.useOrthoDirect);
00099
00100
00101
00102 }
00103
00104
00105
00106
00107