10 #include "StructureFactor.h"
11 #include "StructFactorCache.h"
12 #include "main/CPcharmParaInfoGrp.h"
13 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cpnonlocal.h"
14 #include "src_piny_physics_v1.0/include/class_defs/Interface_ctrl.h"
15 #include "main/PhysScratchCache.h"
20 extern CkVec <CProxy_StructureFactor> UsfCompProxy;
21 extern CkVec <CProxy_StructFactCache> UsfCacheProxy;
22 extern CkVec <CProxy_AtomsCache> UatomsCacheProxy;
23 extern CkVec <CProxy_EnergyGroup> UegroupProxy;
24 extern CProxy_PhysScratchCache pScratchProxy;
25 StructureFactor::StructureFactor(CkMigrateMessage *m){ }
37 int iteration_src = msg->iteration_src;
40 if(sim->ees_nloc_on==1)
41 CkAbort(
"No structure factors under EES nonlocal\n");
47 if(UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration !=
48 UegroupProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration_gsp ||
49 UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration != (iteration_src-1)){
50 CkPrintf(
"Flow of Control Warning in computeSF : atoms slow\n");
52 CkSetQueueing(newMsg, CK_QUEUEING_IFIFO);
53 *(
int*)CkPriorityPtr(newMsg) = config.sfpriority;
54 newMsg->iteration_src = iteration_src;
55 UsfCompProxy[thisInstance.proxyOffset](thisIndex.x,thisIndex.y,thisIndex.z).
computeSF(newMsg);
64 #ifdef _CP_DEBUG_SF_CALC_
65 CkPrintf(
"[%d %d %d] compute\n",thisIndex.x,thisIndex.y,thisIndex.z);
68 if(structFactor==NULL) {
69 structFactor = (
complex *)fftw_malloc(natm_nl_grp_max*gsSize*
sizeof(
complex));
71 if(structFactor_fx==NULL) {
72 structFactor_fx = (
complex *)fftw_malloc(natm_nl_grp_max*gsSize*
sizeof(
complex));
73 structFactor_fy = (
complex *)fftw_malloc(natm_nl_grp_max*gsSize*
sizeof(
complex));
74 structFactor_fz = (
complex *)fftw_malloc(natm_nl_grp_max*gsSize*
sizeof(
complex));
76 AtomsCache *ag = UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
78 CPNONLOCAL::CP_calc_Struct_Fact(gsSize,k_x, k_y,k_z,
79 structFactor,structFactor_fx,structFactor_fy,
80 structFactor_fz,fastAtoms, config.doublePack,
81 numSfGrps,thisIndex.x, pScratchProxy.ckLocalBranch()->psscratch);
84 int totalsize=gsSize*natm_nl_grp_max;
85 for(
int i=0;i<numdest;i++){
87 #ifdef _CP_DEBUG_SF_CALC_
88 CkPrintf(
"[%d %d %d] sending %d to %d\n",thisIndex.x,thisIndex.y,thisIndex.z,i,destinations[i]);
91 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
92 *(
int*)CkPriorityPtr(msg) = config.sfpriority+thisIndex.x;
93 msg->datalen = totalsize;
95 msg->atmGrpIndex = thisIndex.x;
96 msg->planeIndex=thisIndex.y;
97 CmiMemcpy(msg->structFactor,structFactor,totalsize*
sizeof(
complex));
98 CmiMemcpy(msg->structFactor_fx,structFactor_fx,totalsize*
sizeof(
complex));
99 CmiMemcpy(msg->structFactor_fy,structFactor_fy,totalsize*
sizeof(
complex));
100 CmiMemcpy(msg->structFactor_fz,structFactor_fz,totalsize*
sizeof(
complex));
102 UsfCacheProxy[thisInstance.proxyOffset][destinations[i]].acceptStructFact(msg);
107 #ifdef _CP_DEBUG_SF_CALC_
108 CkPrintf(
"[%d %d %d] redundant\n",thisIndex.x,thisIndex.y,thisIndex.z);
116 #include "structureFactor.def.h"
void computeSF(SFDummyMsg *msg)
Add type declarations for simulationConstants class (readonly vars) and once class for each type of o...