12 #include "cp_state_ctrl/CP_State_GSpacePlane.h"
14 #include "CPcharmParaInfoGrp.h"
22 #include "src_piny_physics_v1.0/include/class_defs/Interface_ctrl.h"
23 #include "src_piny_physics_v1.0/include/class_defs/piny_constants.h"
24 #include "src_piny_physics_v1.0/include/class_defs/ATOM_OPERATIONS/class_atomintegrate.h"
25 #include "src_piny_physics_v1.0/include/class_defs/ATOM_OPERATIONS/class_atomoutput.h"
26 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cprspaceion.h"
30 extern CkVec <IntMap2on2> GSImaptable;
32 extern CkVec <CProxy_CP_State_GSpacePlane> UgSpacePlaneProxy;
33 extern CkVec <CProxy_GSpaceDriver> UgSpaceDriverProxy;
34 extern CkVec <CProxy_AtomsCache> UatomsCacheProxy;
35 extern CkVec <CProxy_AtomsCompute> UatomsComputeProxy;
36 extern CkVec <CProxy_EnergyGroup> UegroupProxy;
37 extern CkVec <CProxy_StructFactCache> UsfCacheProxy;
38 extern CkVec <CProxy_eesCache> UeesCacheProxy;
39 extern CProxy_TemperController temperControllerProxy;
41 extern CProxy_CPcharmParaInfoGrp scProxy;
53 AtomsCache::AtomsCache(
int _natm,
int n_nl,
Atom *a,
UberCollection _thisInstance) : natm(_natm), natm_nl(n_nl), thisInstance(_thisInstance)
58 fastAtoms.natm = natm;
60 temperScreenFile = NULL;
61 fastAtoms.q =
new double[natm];
62 fastAtoms.x =
new double[natm];
63 fastAtoms.y =
new double[natm];
64 fastAtoms.z =
new double[natm];
65 fastAtoms.fx =
new double[natm];
66 fastAtoms.fy =
new double[natm];
67 fastAtoms.fz =
new double[natm];
68 fastAtoms.fxu =
new double[natm];
69 fastAtoms.fyu =
new double[natm];
70 fastAtoms.fzu =
new double[natm];
71 for(
int i=0;i<natm;i++){
72 fastAtoms.q[i] = a[i].q;
73 fastAtoms.x[i] = a[i].x;
74 fastAtoms.y[i] = a[i].y;
75 fastAtoms.z[i] = a[i].z;
76 fastAtoms.fx[i] = a[i].fx;
77 fastAtoms.fy[i] = a[i].fy;
78 fastAtoms.fz[i] = a[i].fz;
80 if(config.UberKmax>1 || config.UberImax>1 )
83 temperScreenFile =
openScreenfWrite(
"TEMPER_OUT",
"screen", thisInstance.idxU.z,thisInstance.idxU.x,
true);
87 temperScreenFile = stdout;
110 double *ftot =
new double[(3*natm)];
111 for(i=0,j=0; i<natm; i++,j+=3){
112 ftot[j] = fastAtoms.fx[i];
113 ftot[j+1] = fastAtoms.fy[i];
114 ftot[j+2] = fastAtoms.fz[i];
116 #ifdef _CP_DEBUG_ATMS_
118 CkPrintf(
"GJM_DBG: inside contribute forces %d : %d\n",myid,natm);
120 CkCallback cb(CkIndex_AtomsCompute::recvContributeForces(NULL), UatomsComputeProxy[thisInstance.proxyOffset]);
121 contribute((3*natm)*
sizeof(
double),ftot,CkReduction::sum_double,cb);
139 for(
int atomI = msg->natmStr, j=0; atomI < msg->natmEnd ; atomI++ ,j+=9){
140 #ifdef _CP_DEBUG_ATMS_
143 CkPrintf(
"{%d} AtomPos[%d] updated to %.5g,%.5g,%.5g from %.5g,%.5g,%.5g\n",thisInstance.proxyOffset, atomI, msg->data[j], msg->data[j+1], msg->data[j+2], fastAtoms.x[atomI], fastAtoms.y[atomI], fastAtoms.z[atomI]);
146 fastAtoms.x[atomI]=msg->data[j];
147 fastAtoms.y[atomI]=msg->data[j+1];
148 fastAtoms.z[atomI]=msg->data[j+2];
152 CkCallback cb(CkIndex_AtomsCache::atomsDone(NULL),UatomsCacheProxy[thisInstance.proxyOffset]);
153 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
154 EnergyGroup *eg = UegroupProxy[thisInstance.proxyOffset].ckLocalBranch();
155 eg->estruct.potPIMDChain = msg->data[(msg->nsize-4)];
156 eg->estruct.eKinetic_atm = msg->data[(msg->nsize-2)];
157 eg->estruct.eKineticNhc_atm = msg->data[(msg->nsize-2)];
158 eg->estruct.potNhc_atm = msg->data[(msg->nsize-2)];
194 EnergyGroup *eg = UegroupProxy[thisInstance.proxyOffset].ckLocalBranch();
196 eg->estruct.iteration_atm = iteration;
197 eg->iteration_atm = iteration;
200 #ifdef _DEBUG_CHECK_ATOM_COMM_
202 sprintf(fname,
"atoms.out.%d.%d",iteration,myid);
203 FILE *fp = fopen(fname,
"w");
204 for(
int i=0;i<natm;i++){
205 fprintf(fp,
"%.10g %.10g %.10g\n",atoms[i].x,atoms[i].y,atoms[i].z);
227 for(
int kpoint=0; kpoint< config.UberJmax; kpoint++){
230 thisPoint.idxU.y=kpoint;
232 eesCache *eesData = UeesCacheProxy[thisPoint.proxyOffset].ckLocalBranch ();
233 CkAssert(eesData!=NULL);
234 int *indState = eesData->gspStateInd;
235 int *indPlane = eesData->gspPlaneInd;
236 int ngo = eesData->nchareGSPProcT;
238 for(
int i=0; i<ngo; i++){
239 int iadd = UgSpacePlaneProxy[thisPoint.proxyOffset](indState[i],indPlane[i]).ckLocal()->registrationFlag;
241 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
242 CkPrintf(
"atom : Bad registration cache flag on proc %d %d %d %d\n",
243 myid,iadd,indState[i],indPlane[i]);
244 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
248 UgSpaceDriverProxy[thisPoint.proxyOffset](indState[i],indPlane[i]).doneMovingAtoms(iteration);
265 delete [] fastAtoms.q;
266 delete [] fastAtoms.x;
267 delete [] fastAtoms.y;
268 delete [] fastAtoms.z;
269 delete [] fastAtoms.fx;
270 delete [] fastAtoms.fy;
271 delete [] fastAtoms.fz;
272 delete [] fastAtoms.fxu;
273 delete [] fastAtoms.fyu;
274 delete [] fastAtoms.fzu;
FILE * openScreenfWrite(const char *dirnameBase, const char *fname, int temper, int bead, bool beadfile)
this stuff is in a C file because multiple includes of .def will give you too many implementations of...
holds the UberIndex and the offset for proxies
CProxy_InstanceController instControllerProxy
void contributeforces()
Contributeforces Every proc assigned an electronic structure chare of the bead=i temper=j (i...
Author: Eric J Bohm Date Created: June 4th, 2006.
void atomsDone()
= Needs to have each proc invoke directly doneMovingAtoms method of the GSpaceDrivers which are mappe...
void acceptAtoms(AtomMsg *)
acceptAtoms
void releaseGSP()
= Use eesCache's registered GSPs to
Group Container class : Only allowed chare data classes have data.