3 #include "cp_state_ctrl/CP_State_GSpacePlane.h"
6 #include "CPcharmParaInfoGrp.h"
9 extern CkVec <CProxy_EnergyGroup> UegroupProxy;
10 extern CProxy_TemperController temperControllerProxy;
11 extern CkVec <CProxy_eesCache> UeesCacheProxy;
12 extern CkVec <CProxy_CP_State_GSpacePlane> UgSpacePlaneProxy;
13 extern CkVec <CProxy_GSpaceDriver> UgSpaceDriverProxy;
22 kpointEnergyDoneCount=0;
34 estruct.eewald_recip = 0;
35 estruct.eewald_real = 0;
46 estruct.totalElecEnergy = 0;
47 estruct.iteration_gsp = 0;
50 estruct.eKinetic_atm = 0;
51 estruct.eKineticNhc_atm = 0;
52 estruct.potNhc_atm = 0;
54 estruct.iteration_atm = 0;
55 estruct.potPIMDChain = 0;
72 if(config.UberJmax>1 || config.UberMmax >1)
74 estruct.enl += es.enl;
75 estruct.eke += es.eke;
76 estruct.fictEke += es.fictEke;
77 estruct.fmagPsi += es.fmagPsi;
83 estruct.fictEke = es.fictEke;
84 estruct.fmagPsi = es.fmagPsi;
88 estruct.eext = es.eext;
89 estruct.ehart = es.ehart;
90 estruct.eewald_recip = es.eewald_recip;
91 estruct.egga = es.egga;
92 estruct.eexc = es.eexc;
98 CkPrintf(
"GLENN!! you need to fix estruct.totalElecEnergy for k-points\n");
99 estruct.totalElecEnergy = es.totalElecEnergy;
100 estruct.iteration_gsp= es.iteration_gsp;
101 iteration_gsp = es.iteration_gsp;
102 #ifdef _DEBUG_ESTRUCT_
103 CkPrintf(
"Energies received %lf, %lf, %lf, %lf, %lf\n",
104 estruct.enl,estruct.eke,estruct.eext,estruct.ehart,
105 estruct.eewald_recipt,estruct.egga,estruct.eexc,
106 estruct.fictEke,estruct.totalEnergy);
109 CkCallback cb(CkIndex_EnergyGroup::energyDone(NULL),UegroupProxy[thisInstance.proxyOffset]);
110 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
128 if(++kpointEnergyDoneCount==config.UberJmax)
130 kpointEnergyDoneCount=0;
131 if(config.UberKmax>1 && config.temperCycle >0 && iteration_atm % config.temperCycle == 0)
136 CkCallback cb(CkIndex_EnergyGroup::sendToTemper(NULL),0, UegroupProxy[thisInstance.proxyOffset]);
137 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
148 void EnergyGroup::sendToTemper(CkReductionMsg *m)
151 temperControllerProxy[0].acceptData(thisInstance.idxU.x, estruct);
154 void EnergyGroup::resumeFromTemper()
158 if(ktemps==config.UberJmax)
177 for(
int kpoint=0; kpoint< config.UberJmax; kpoint++){
183 thisPoint.idxU.y=kpoint;
186 eesCache *eesData = UeesCacheProxy[thisPoint.proxyOffset].ckLocalBranch ();
187 int *indState = eesData->gspStateInd;
188 int *indPlane = eesData->gspPlaneInd;
189 int ngo = eesData->nchareGSPProcT;
190 for(
int i=0; i<ngo; i++){
191 int iadd = UgSpacePlaneProxy[thisPoint.proxyOffset](indState[i],indPlane[i]).ckLocal()->registrationFlag;
193 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
194 CkPrintf(
"Energy : Bad registration cache flag on proc %d %d %d %d\n",
195 myid,iadd,indState[i],indPlane[i]);
196 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
199 UgSpaceDriverProxy[thisPoint.proxyOffset](indState[i],indPlane[i]).doneComputingEnergy(iteration_atm);
210 EnergyStruct GetEnergyStruct() {
211 return UegroupProxy[thisInstance.proxyOffset].ckLocalBranch()->getEnergyStruct();
215 #include "EnergyGroup.def.h"
holds the UberIndex and the offset for proxies
void updateEnergiesFromGS(EnergyStruct &, UberCollection)
CP_StateGspacePlane(0,0) calls this to replicate the energies everywhere for consistency and toleranc...
Add type declarations for simulationConstants class (readonly vars) and once class for each type of o...
Author: Eric J Bohm Date Created: June 4th, 2006.
EnergyGroup(UberCollection thisInstance)
= Energy group that can retrieve the energies from
void energyDone()
= Needs to have each proc invoke directly the doneComputingEnergy method of the GSpaceDrivers which a...
Group Container class : Only allowed chare data classes have data.