35 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cplocal.h"
36 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cpxcfnctls.h"
37 #include "src_piny_physics_v1.0/include/proto_defs/proto_cp_ewald_corrs.h"
38 #include "src_piny_physics_v1.0/include/class_defs/Interface_ctrl.h"
39 #include "main/PhysScratchCache.h"
49 extern CkVec <CProxy_CP_Rho_RealSpacePlane> UrhoRealProxy;
50 extern CProxy_CPcharmParaInfoGrp scProxy;
51 extern CProxy_PhysScratchCache pScratchProxy;
52 extern CkVec <CProxy_AtomsCache> UatomsCacheProxy;
53 extern CkVec <CProxy_CP_Rho_GHartExt> UrhoGHartExtProxy;
54 extern CkVec <CProxy_CP_Rho_RHartExt> UrhoRHartExtProxy;
55 extern CkVec <CProxy_eesCache> UeesCacheProxy;
56 extern CkVec <CProxy_FFTcache> UfftCacheProxy;
58 extern ComlibInstanceHandle commGHartInstance;
59 extern ComlibInstanceHandle commGHartRHartIns0;
60 extern ComlibInstanceHandle commGHartRHartIns1;
76 CP_Rho_GHartExt::CP_Rho_GHartExt(
77 int _ngridaEext,
int _ngridbEext,
int _ngridcEext,
int _ees_eext_on,
85 CkVec <RunDescriptor> *sortedRunDescriptors = sim->RhosortedRunDescriptors;
90 rhoRsubplanes = config.rhoRsubplanes;
91 rhoGHelpers = config.rhoGHelpers;
92 nchareHartAtmT = config.nchareHartAtmT;
95 ngridaEext = _ngridaEext;
96 ngridbEext = _ngridbEext;
97 ngridcEext = _ngridcEext;
98 ees_eext_on = _ees_eext_on;
99 natmTypTot = _natmTyp;
100 CkAssert(natmTypTot>=nchareHartAtmT);
119 recvCountFromRHartExt = 0;
120 for(
int i=0;i<rhoRsubplanes;i++){
121 if(sim->nline_send_eext_y[thisIndex.x][i]>0){recvCountFromRHartExt++;}
123 recvCountFromRHartExt*=ngridcEext;
125 recvCountFromRHartExt=ngridcEext;
131 int div = (natmTypTot/nchareHartAtmT);
132 int rem = (natmTypTot % nchareHartAtmT);
133 int max = (thisIndex.y < rem ? thisIndex.y : rem);
134 natmTyp = (thisIndex.y<rem ? div+1 : div);
135 atmTypoff = div*thisIndex.y + max;
137 if(ees_eext_on==0 && nchareHartAtmT>1){
138 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
139 CkPrintf(
"Parallel atom type not supported without ees Eext\n");
140 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
148 ind_xdiv = (ind_x/rhoGHelpers);
149 ind_xrem = (ind_x%rhoGHelpers);
150 int numLines_tot = sortedRunDescriptors[ind_xdiv].size()/2;
153 rhoGHelpers,ind_xrem);
158 rho_gs.sizeX = sizeX;
159 rho_gs.sizeY = sim->sizeY;
160 rho_gs.sizeZ = sim->sizeZ;
161 rho_gs.xdim = rho_gs.sizeX;
162 rho_gs.ydim = rho_gs.sizeY;
165 rho_gs.numLines = numLines;
166 rho_gs.numRuns = (numLines*2);
167 rho_gs.numFull = (numLines*rho_gs.sizeZ);
168 rho_gs.size = rho_gs.numFull;
171 rho_gs.numPoints = 0;
172 for (
int r = (2*istrt_lines),s=0; r < (2*iend_lines); r++,s++) {
173 rho_gs.numPoints += sortedRunDescriptors[ind_xdiv][r].length;
174 rho_gs.runs[s] = sortedRunDescriptors[ind_xdiv][r];
179 rho_gs.nPacked=nPacked;
180 CkAssert(nPacked==rho_gs.numPoints);
182 int numFull = rho_gs.numFull;
183 numFullEext = numLines*ngridcEext;
192 rho_gs.divRhoX = NULL;
193 rho_gs.divRhoY = NULL;
194 rho_gs.divRhoZ = NULL;
197 rho_gs.packedRho = (
complex *)fftw_malloc(nPacked*
sizeof(
complex));
199 if(ees_eext_on==1 && nchareHartAtmT>1 && thisIndex.y==1){
206 if(nchareHartAtmT>1 && thisIndex.y==0){
207 atmSFtotRecv = (
complex *)fftw_malloc(numFullEext*
sizeof(
complex));
215 setMigratable(
false);
218 if(config.lbdensity){
221 setMigratable(
false);
239 eesCache *eesData = UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch ();
240 eesData->
registerCacheGHart(thisIndex.x,rho_gs.nPacked,rho_gs.k_x,rho_gs.k_y,rho_gs.k_z);
242 CkCallback cb(CkIndex_CP_Rho_GHartExt::registrationDone(NULL),UrhoGHartExtProxy[thisInstance.proxyOffset]);
243 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
249 rho_gs.iperd = iperd;
251 int nPacked = rho_gs.nPacked;
252 rho_gs.perdCorr = (
double *)fftw_malloc(nPacked*
sizeof(
double));
253 setput_nd_eext_corrs(nPacked,rho_gs.k_x,rho_gs.k_y,rho_gs.k_z,rho_gs.perdCorr);
259 setMigratable(
false);
261 rhoRealProxy_com = UrhoRealProxy[thisInstance.proxyOffset];
264 if(config.useGHartInsRhoRP){
265 ComlibAssociateProxy(commGHartInstance,rhoRealProxy_com);
269 if (ees_eext_on == 1)
271 rhoRHartProxy_com0 = UrhoRHartExtProxy[thisInstance.proxyOffset];
272 rhoRHartProxy_com1 = UrhoRHartExtProxy[thisInstance.proxyOffset];
274 if(config.useGHartInsRHart)
276 ComlibAssociateProxy(commGHartRHartIns0,rhoRHartProxy_com0);
277 ComlibAssociateProxy(commGHartRHartIns1,rhoRHartProxy_com1);
295 if(nchareHartAtmT>1 && thisIndex.y==1){fftw_free(VksRecv);}
296 if(nchareHartAtmT>1 && thisIndex.y==0){fftw_free(atmSFtotRecv);}
310 void CP_Rho_GHartExt::pup(PUP::er &p){
313 ArrayElement2D::pup(p);
349 p|rhoRHartProxy_com0;
350 p|rhoRHartProxy_com1;
369 int cp_min_opt = sim->cp_min_opt;
375 if(UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration != iteration-1){
376 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
377 CkPrintf(
"Flow of Control Error in GHartExtVks : atoms slow %d %d\n",
378 UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration,iteration);
379 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
385 for(
int i=0;i<msg->size ;i++){
386 CkAssert(isnan(msg->data[i].re)==0);
387 CkAssert(isnan(msg->data[i].im)==0);
394 int ncoef = rho_gs.numPoints;
395 CkAssert(ncoef==msg->size);
397 CmiMemcpy(rho_gs.packedRho,msg->data,
sizeof(
complex)*ncoef);
423 #ifdef _CP_GHART_VERBOSE_
424 CkPrintf(
"Ghart %d Here in hartextvskg at %d on %d\n",thisIndex.x,CkMyPe());
427 AtomsCache *ag = UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
431 int numPoints = rho_gs.numPoints;
432 int numFull = rho_gs.numFull;
433 complex *rho = rho_gs.packedRho;
435 int *k_x = rho_gs.k_x;
436 int *k_y = rho_gs.k_y;
437 int *k_z = rho_gs.k_z;
446 #if CMK_TRACE_ENABLED
447 double StartTime=CmiWallTimer();
450 double *perdCorr = rho_gs.perdCorr;
451 CPLOCAL::CP_hart_eext_calc(numPoints,rho,natm,fastAtoms,vks,
452 &ehart_ret,&eext_ret,&ewd_ret,k_x,k_y,k_z,perdCorr,
454 #if CMK_TRACE_ENABLED
455 traceUserBracketEvent(HartExcVksG_, StartTime, CmiWallTimer());
458 #ifdef _CP_DEBUG_RHOG_VKSA_
459 char myFileName[100];
460 sprintf(myFileName,
"Vks_Gspace_%d%d.out", thisIndex.x,thisIndex.y);
461 FILE *fp = fopen(myFileName,
"w");
462 for (
int i = 0; i < numPoints; i++){
463 fprintf(fp,
" %d %d %d : %g %g\n",
464 k_x[i],k_y[i],k_z[i],
465 vks[i].re,vks[i].im);
470 #ifdef _CP_GHART_VERBOSE_
471 CkPrintf(
"Ghart %d Here in hartextvskg completed at %d on %d\n",thisIndex.x,CkMyPe());
481 contribute(3 *
sizeof(
double),e,CkReduction::sum_double);
497 #ifdef _CP_GHART_VERBOSE_
498 CkPrintf(
"Ghart %d %d Here in fftvks at %d on %d\n",
499 thisIndex.x,thisIndex.y,iterAtmTyp,CkMyPe());
502 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
503 fftcache->getCacheMem(
"CP_Rho_GHartExt::FFTVks");
505 complex *vksScr = fftcache->tmpData;
508 rho_gs.numRuns,rho_gs.runs,rho_gs.sizeZ,ind_x);
510 #ifdef _CP_DEBUG_RHOG_VKSA_
511 int numFull = rho_gs.numFull;
512 sprintf(myFileName,
"Vks_GspaceAFFT_%d%d.out", thisIndex.x,thisIndex.y);
513 fp = fopen(myFileName,
"w");
514 for(
int i = 0; i < numFull; i++){
515 fprintf(fp,
" %g %g\n",VksExpd[i].re, VksExpd[i].im);
538 #ifdef _CP_GHART_VERBOSE_
539 CkPrintf(
"Ghart %d %d Here in sendvks at %d on %d\n",
540 thisIndex.x,thisIndex.y,iterAtmTyp,CkMyPe());
543 #ifdef _CP_DEBUG_RHOG_VERBOSE_
544 CkPrintf(
"Communicating data from RhoGHart to RhoR : %d %d\n",
545 thisIndex.x,thisIndex.y);
551 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
552 complex *vksScr = fftcache->tmpData;
554 int ix = thisIndex.x;
555 int sendLines = numLines;
560 nline_send = sim->nline_send_eext_y[ix];
561 index_pack = sim->index_tran_pack_eext_ys[ix];
567 if(rhoRsubplanes==1){
569 if(config.useGHartInsRhoRP){commGHartInstance.beginIteration();}
571 if(config.useGHartInsRhoRP){ComlibBegin(rhoRealProxy_com,0);}
578 int sizeZ=rho_gs.sizeZ;
579 for(
int z=0; z < sizeZ; z++) {
580 for(
int s=0;s<rhoRsubplanes;s++){
582 if(rhoRsubplanes>1){sendLines = nline_send[s];}
587 msg->size = sendLines;
588 msg->index = thisIndex.x;
589 msg->senderBigIndex = ind_xdiv;
590 msg->senderStrtLine = istrt_lines;
592 if(config.prioFFTMsg){
593 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
594 *(
int*)CkPriorityPtr(msg) = config.rhorpriority + thisIndex.x + thisIndex.y;
599 if(rhoRsubplanes==1){
600 for (
int i=0,j=z; i<sendLines; i++,j+=sizeZ){data[i] = vksScr[j];}
602 for(
int i=0; i< sendLines; i++){
603 data[i] = vksScr[(z+index_pack[s][i])];
607 if(rhoRsubplanes==1){
608 rhoRealProxy_com(z,0).acceptHartVks(msg);
610 UrhoRealProxy[thisInstance.proxyOffset](z,s).acceptHartVks(msg);
621 if(rhoRsubplanes==1){
623 if(config.useGHartInsRhoRP){commGHartInstance.endIteration();}
625 if(config.useGHartInsRhoRP){ComlibEnd(rhoRealProxy_com,0);}
630 fftcache->freeCacheMem(
"CP_Rho_GHartExt::sendVks");
644 int sum = ((
int *)msg->getData())[0];
647 #ifdef _CP_GHART_VERBOSE_
648 CkPrintf(
"HI, I am Ghart chare %d in reg : %d %d on %d\n",
649 thisIndex.x,sum,natmTyp,CkMyPe());
653 if(launchFlag==1){launchFlag=0;
FFTEesBck();}
669 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
670 CkPrintf(
"Yo dawg, ees eext is off. You can't recvFromRhoRhart\n");
671 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
681 int size = msg->size;
682 int offset = msg->offset;
683 int isub = msg->offsetGx;
684 int iter = msg->iter;
685 complex *partlyIFFTd = msg->data;
687 int ix = thisIndex.x;
688 int numLinesNow = numLines;
691 int *nline_send = sim->nline_send_eext_y[ix];
692 index_pack = sim->index_tran_pack_eext_y[ix];
693 numLinesNow = nline_send[isub];
700 for(
int i=0;i<msg->size ;i++){
701 CkAssert(isnan(msg->data[i].re)==0);
702 CkAssert(isnan(msg->data[i].im)==0);
706 if(iter!= (iterAtmTyp+1) ){
707 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
708 CkPrintf(
"Atm Type Iteration out of whack. %d %d : chare %d %d : %d %d\n",
709 iter,iterAtmTyp,thisIndex.x,thisIndex.y,natmTyp,atmTypoff);
710 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
713 CkAssert(numLinesNow == size);
718 if(rhoRsubplanes==1){
719 for(
int i=0,j=offset; i< numLines; i++,j+=ngridcEext){atmSF[j] = partlyIFFTd[i];}
721 for(
int i=0; i< numLinesNow; i++){
722 atmSF[(offset+index_pack[isub][i])] = partlyIFFTd[i];
732 if (countEextFFT == recvCountFromRHartExt) {
733 #ifdef _DEBUG_GLENN_KPT_
735 sprintf(name,
"SfAtmGxGyZ_inG.p%d.t%d.out",thisIndex.x,iter);
736 FILE *fp = fopen(name,
"w");
737 for(
int ix =0;ix<numLines;ix++){
738 for(
int iy =0;iy<ngridcEext;iy++){
739 int i = ix*ngridcEext + iy;
740 fprintf(fp,
"%d %d : %g %g\n",iy,ix,atmSF[i].re,atmSF[i].im);
746 #ifndef _DEBUG_INT_TRANS_FWD_
748 if(registrationFlag==1){launchFlag=0; thisProxy(thisIndex.x, thisIndex.y).FFTEesBck();}
751 sprintf(name,
"partFFTGxGyZT%d.out.%d",rhoRsubplanes,thisIndex.x);
752 FILE *fp = fopen(name,
"w");
753 for(
int ix =0;ix<numLines;ix++){
754 for(
int iy =0;iy<ngridcEext;iy++){
755 int i = ix*ngridcEext + iy;
756 fprintf(fp,
"%d %d : %g %g\n",iy,ix,atmSF[i].re,atmSF[i].im);
782 if(iterAtmTyp>1 && densityHere==0){
783 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
784 CkPrintf(
"Yo dawg, the density has not arrived. You can't keep going. GhartEext\n");
785 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
792 #ifdef _CP_GHART_VERBOSE_
793 CkPrintf(
"GHart %d %d starting FFTBck at %d on %d\n",thisIndex.x, thisIndex.y,
794 iterAtmTyp,CkMyPe());
797 int numPoints = rho_gs.numPoints;
798 UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->doEextFFTRtoG_Gchare(atmSF,numFullEext,numPoints,
799 numLines,rho_gs.numRuns,rho_gs.runs,ngridcEext,ind_x);
818 #ifdef _CP_GHART_VERBOSE_
819 CkPrintf(
"GHart %d %d starting getHartEextEes at %d on %d\n",
820 thisIndex.x,thisIndex.y,iterAtmTyp,CkMyPe());
824 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
825 CkPrintf(
"Yo dawg, ees eext is off. You can't getHartEextEes\n");
826 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
835 eesCache *eesData = UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch ();
837 int myChareG = thisIndex.x;
838 int iterAtmTypFull = iterAtmTyp+atmTypoff;
840 int ncoef = rho_gs.nPacked;
842 complex *rho = rho_gs.packedRho;
843 int *k_x = rho_gs.k_x;
844 int *k_y = rho_gs.k_y;
845 int *k_z = rho_gs.k_z;
846 double *b_re = eesData->RhoGHartData[myChareG]->b_re;
847 double *b_im = eesData->RhoGHartData[myChareG]->b_im;
852 bzero(vks,ncoef*
sizeof(
complex));
853 bzero(atmSFtot,ncoef*
sizeof(
complex));
861 #if CMK_TRACE_ENABLED
862 double StartTime=CmiWallTimer();
864 double *perdCorr = rho_gs.perdCorr;
865 CPLOCAL::eesHartEextGchare(ncoef,iterAtmTypFull,rho,vks,atmSF,atmSFtot,
867 #if CMK_TRACE_ENABLED
868 traceUserBracketEvent(eesHartExcG_, StartTime, CmiWallTimer());
871 #ifdef _CP_GHART_VERBOSE_
872 CkPrintf(
"Ghart %d %d Here in hartees: EHart %.10g Eext %.10g at %d on %d\n",
873 thisIndex.x,thisIndex.y,ehart_ret,eext_ret,iterAtmTyp,CkMyPe());
879 if(iterAtmTyp==natmTyp && nchareHartAtmT==1){
880 #if CMK_TRACE_ENABLED
881 double StartTime=CmiWallTimer();
883 double *perdCorr = rho_gs.perdCorr;
884 CPLOCAL::eesEwaldGchare(ncoef,atmSFtot,b_re,b_im,&ewd_ret,k_x,k_y,k_z,perdCorr,myChareG,config.
nfreq_cplocal_eesewald);
885 #if CMK_TRACE_ENABLED
886 traceUserBracketEvent(eesEwaldG_, StartTime, CmiWallTimer());
888 #ifdef _CP_GHART_VERBOSE_
889 CkPrintf(
"Ghart %d %d iter %d Here in hartees: EwaldRecip : %.10g on\n",
890 thisIndex.x,thisIndex.y,iterAtmTyp,ewd_ret,CkMyPe());
898 if(iterAtmTyp==natmTyp){
899 #ifdef _CP_GHART_VERBOSE_
900 CkPrintf(
"Ghart %d reduces energies at %d on %d\n",iterAtmTyp,CkMyPe());
902 if(thisIndex.y!=0 || nchareHartAtmT==1){
907 contribute(3*
sizeof(
double),e,CkReduction::sum_double);
916 if(iterAtmTyp==natmTyp){
917 if(nchareHartAtmT==1){
920 UrhoGHartExtProxy[thisInstance.proxyOffset](thisIndex.x,0).
acceptAtmSFTot(ncoef,atmSFtot);
926 if(iterAtmTyp==natmTyp){
927 if(nchareHartAtmT==1) {
930 UrhoGHartExtProxy[thisInstance.proxyOffset](thisIndex.x,1).
acceptVks(ncoef,vks);
952 #ifdef _CP_GHART_VERBOSE_
953 CkPrintf(
"Ghart %d %d Here in FFT to r: %.10g %.10g : with %d at %d %d on %d\n",
954 thisIndex.x,thisIndex.y,ehart_ret,eext_ret,flag,iterAtmTyp,natmTyp,CkMyPe());
959 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
960 fftcache->getCacheMem(
"CP_Rho_GHartExt::FFTEesFwd");
961 complex *data_out = fftcache->tmpData;
962 complex *data;
if(flag==0){data=atmSF;}
else{data=atmSFtot;}
967 rho_gs.numRuns,rho_gs.runs,ngridcEext,ind_x);
985 #ifdef _CP_GHART_VERBOSE_
986 CkPrintf(
"Ghart %d %d Here in send to Rhart with opt %d at %d %d on %d\n",
987 thisIndex.x,thisIndex.y,flag,iterAtmTyp,natmTyp,CkMyPe());
991 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
992 complex *senddata = fftcache->tmpData;
993 int ix = thisIndex.x;
994 int numLinesNow = numLines;
998 nline_send = sim->nline_send_eext_y[ix];
999 index_pack = sim->index_tran_pack_eext_y[ix];
1005 if(rhoRsubplanes==1){
1008 case 0 :
if(config.useGHartInsRHart) commGHartRHartIns0.beginIteration();
break;
1009 case 1 :
if(config.useGHartInsRHart) commGHartRHartIns1.beginIteration();
break;
1011 case 0 :
if(config.useGHartInsRHart) ComlibBegin(rhoRHartProxy_com0,1);
break;
1012 case 1 :
if(config.useGHartInsRHart) ComlibBegin(rhoRHartProxy_com1,1);
break;
1021 int priority =config.rhorHartpriority + thisIndex.x*10;
1022 int prioritybits = 8*
sizeof(int);
1024 for(
int z=0; z < ngridcEext; z++) {
1025 for(
int s=0;s<rhoRsubplanes;s++){
1027 if(rhoRsubplanes>1){numLinesNow = nline_send[s];}
1030 msg->size = numLinesNow;
1031 msg->senderIndex = thisIndex.x;
1033 msg->iter = iterAtmTyp;
1035 if(config.prioEextFFTMsg){
1036 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
1037 *(
int*)CkPriorityPtr(msg) = priority;
1042 if(rhoRsubplanes==1){
1043 for (
int i=0,j=z; i<numLines; i++,j+=ngridcEext){data[i] = senddata[j];}
1045 int *index_packs=index_pack[s];
1046 for(
int i=0; i< numLinesNow; i++){
1047 data[i] = senddata[(z+index_packs[i])];
1051 if(rhoRsubplanes==1){
1053 case 0 : rhoRHartProxy_com0(z,0,thisIndex.y).recvAtmForcFromRhoGHart(msg);
break;
1054 case 1 : rhoRHartProxy_com1(z,0,thisIndex.y).recvAtmForcFromRhoGHart(msg);
break;
1058 case 0 : UrhoRHartExtProxy[thisInstance.proxyOffset](z,s,thisIndex.y).recvAtmForcFromRhoGHart(msg);
break;
1059 case 1 : UrhoRHartExtProxy[thisInstance.proxyOffset](z,s,thisIndex.y).recvAtmForcFromRhoGHart(msg);
break;
1071 if(rhoRsubplanes==1){
1074 case 0 :
if(config.useGHartInsRHart) commGHartRHartIns0.endIteration();
break;
1075 case 1 :
if(config.useGHartInsRHart) commGHartRHartIns1.endIteration();
break;
1077 case 0 :
if(config.useGHartInsRHart) ComlibEnd(rhoRHartProxy_com0,1);
break;
1078 case 1 :
if(config.useGHartInsRHart) ComlibEnd(rhoRHartProxy_com1,1);
break;
1088 int nsendExpect=natmTyp;
1089 if(thisIndex.y==0){nsendExpect++;}
1092 if(nsendAtmTyp==nsendExpect){
1099 fftcache->freeCacheMem(
"CP_Rho_GHartExt::FFTEesFwd");
1114 CkAssert(thisIndex.y==0);
1116 if(countAtmSFtot==0){bzero(atmSFtotRecv,size*
sizeof(
complex));}
1119 for(
int i=0;i<size;i++){atmSFtotRecv[i]+=inSF[i];}
1124 if(countAtmSFtot==nchareHartAtmT){
1129 int myChareG = thisIndex.x;
1130 int ncoef = rho_gs.nPacked;
1131 int *k_x = rho_gs.k_x;
1132 int *k_y = rho_gs.k_y;
1133 int *k_z = rho_gs.k_z;
1134 eesCache *eesData = UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch ();
1135 double *b_re = eesData->RhoGHartData[myChareG]->b_re;
1136 double *b_im = eesData->RhoGHartData[myChareG]->b_im;
1137 #if CMK_TRACE_ENABLED
1138 double StartTime=CmiWallTimer();
1140 double *perdCorr = rho_gs.perdCorr;
1141 CPLOCAL::eesEwaldGchare(ncoef,atmSFtotRecv,b_re,b_im,&ewd_ret,k_x,k_y,k_z,perdCorr,myChareG,config.
nfreq_cplocal_eesewald);
1142 #if CMK_TRACE_ENABLED
1143 traceUserBracketEvent(eesEwaldG_, StartTime, CmiWallTimer());
1152 contribute(3*
sizeof(
double),e,CkReduction::sum_double);
1157 atmSFtot=atmSFtotRecv;
1177 CkAssert(thisIndex.y==1);
1179 if(countVksTot==0){bzero(VksRecv,size*
sizeof(
complex));}
1182 for(
int i=0;i<size;i++){VksRecv[i] += inVks[i];}
1187 if(countVksTot==nchareHartAtmT){
1190 rho_gs.Vks= VksRecv;
1209 int nchareG = sim->nchareRhoGEext;
1212 if(CountDebug==nchareG*nchareHartAtmT){
1214 CkPrintf(
"I am in the exitfordebuging rhoghartext puppy. Bye-bye\n");
void acceptAtmSFTot(int size, complex *inAtm)
Collect the SF from all the atm type chares on chare 0 //////////////////////////////////////////////...
void getHartEextEes()
compute HartreeEextEes
holds the UberIndex and the offset for proxies
void doEextFFTGtoR_Gchare(complex *, complex *, int, int, int, int, RunDescriptor *, int, int)
Eext : Gchare : data(gx,gy,gz) -> data(gx,gy,z) : forward ///////////////////////////////////////////...
void registrationDone(CkReductionMsg *msg)
= Make sure everyone is registered on the 1st time step
void recvAtmSFFromRhoRHart(RhoGHartMsg *msg)
Recv Atm SF from RhoRhart : Euler Exponential spline based method ///////////////////////////////////...
int nfreq_cplocal_eesewald
CPLOCAL::eesEwaldGchare.
void FFTEesFwd(int)
Statr FFting to R-space atmSF(gx,gy,gz) -> atmSF(gx,gy,z) ///////////////////////////////////////////...
void registerCacheGHart(int, int, int *, int *, int *)
= RhoGhart Cache Management tool
void acceptVks(int size, complex *inVks)
Collect the VKS from all the atm type chares on chare 1 /////////////////////////////////////////////...
Add type declarations for simulationConstants class (readonly vars) and once class for each type of o...
== Index logic for lines of constant x,y in gspace.
void sendAtmSF(int)
Send the SF data to back to Rhart to get atm forces /////////////////////////////////////////////////...
void FFTVks()
Partly fft vks(gx,gy,gz) -> vks(gx,gy,z)
void acceptData(RhoGHartMsg *msg)
The density arrives from RhoGspace ONCE a time step /////////////////////////////////////////////////...
~CP_Rho_GHartExt()
Destructor /////////////////////////////////////////////////////////////////////////// //////////////...
int nfreq_cplocal_hartext
CPLOCAL::CP_hart_eext_calc.
Some basic data structures and the array map classes are defined here.
void init()
Post constructor initialization /////////////////////////////////////////////////////////////////////...
void getSplitDecomp(int *, int *, int *, int, int, int)
Initialization Function /////////////////////////////////////////////////////////////////////////// /...
void sendVks()
Send vks_hart_ext back to rho_real where fft(gx,gy) will be performed ///////////////////////////////...
Group Container class : Only allowed chare data classes have data.
void FFTEesBck()
Finish FFting to G-space :: 2D) atmSF(gx,gy,z) -> atmSF(gx,gy,gz)
int nfreq_cplocal_eeshart
CPLOCAL::eesHartEextGchare.
void HartExtVksG()
Compute hartree eext and vks using the N^2 method ///////////////////////////////////////////////////...
void doHartFFTGtoR_Gchare(complex *, complex *, int, int, int, int, RunDescriptor *, int, int)
Hartree : Gchare : data(gx,gy,gz) -> data(gx,gy,z) : forward ////////////////////////////////////////...
void exitForDebugging()
Glenn's special exit.