ComputeGBISserMgr Class Reference

List of all members.

Public Member Functions

 ComputeGBISserMgr ()
 ~ComputeGBISserMgr ()
void setCompute (ComputeGBISser *c)
void recvCoord (GBISCoordMsg *)
void recvForce (GBISForceMsg *)

Detailed Description

Definition at line 158 of file ComputeGBISser.C.


Constructor & Destructor Documentation

ComputeGBISserMgr::ComputeGBISserMgr (  ) 

Definition at line 207 of file ComputeGBISser.C.

00207                                      :
00208   gbisProxy(thisgroup), gbisCompute(0), numSources(0), numArrived(0),
00209   inittime(0), 
00210   psitime(0), 
00211   alphatime(0), 
00212   dEdrtime(0), 
00213   dEdasumtime(0), 
00214   dEdaprefixtime(0), 
00215   dEdalooptime(0), slowForce(0),
00216   coordMsgs(0), coord(0), force(0), oldmsg(0), numAtoms(0), timestep(0) {
00217   CkpvAccess(BOCclass_group).computeGBISserMgr = thisgroup;
00218   t_start = clock();
00219   t_stop = clock();
00220   all2all = false;
00221 }

ComputeGBISserMgr::~ComputeGBISserMgr (  ) 

Definition at line 223 of file ComputeGBISser.C.

00223                                       {
00224   for ( int i=0; i<numSources; ++i ) { delete coordMsgs[i]; }
00225   delete [] coordMsgs;
00226   delete [] coord;
00227   delete [] force;
00228   delete [] slowForce;
00229   delete oldmsg;
00230 }


Member Function Documentation

void ComputeGBISserMgr::recvCoord ( GBISCoordMsg  ) 

Definition at line 742 of file ComputeGBISser.C.

References BENCH_PERIOD, GBISCoordMsg::coord, GBISForceMsg::coulEnergy, GBISCoordMsg::doSlow, GBISForceMsg::force, GBISForceMsg::gbInterEnergy, GBIS_COUL_FORCE, GBIS_DEDR_FORCE, GBISForceMsg::gbSelfEnergy, ComputeGBISAtom::id, j, Node::molecule, GBISCoordMsg::numAtoms, Molecule::numAtoms, Node::Object(), PatchMap::Object(), GBISCoordMsg::sequence, and GBISForceMsg::slowForce.

00742                                                    {
00743   //printf("GBIS recvCoord()\n");
00744   if ( ! numSources ) {//init receiving coord
00745     numSources = (PatchMap::Object())->numNodesWithPatches();
00746     coordMsgs = new GBISCoordMsg*[numSources];
00747     for ( int i=0; i<numSources; ++i ) { coordMsgs[i] = 0; }
00748     numArrived = 0;
00749     numAtoms = Node::Object()->molecule->numAtoms;
00750     coord = new ComputeGBISAtom[numAtoms];
00751     force = new ExtForce[numAtoms];
00752     slowForce = new ExtForce[numAtoms];
00753     timestep = msg[0].sequence;
00754   }
00755   
00756 
00757   //receive coord
00758   int i;
00759   for ( i=0; i < msg->numAtoms; ++i ) {
00760     coord[msg->coord[i].id] = msg->coord[i];
00761   }
00762 
00763   coordMsgs[numArrived] = msg;
00764   ++numArrived;
00765 
00766   if ( numArrived < numSources ) return;
00767   numArrived = 0;
00768 
00769 
00770   /**********************************************************
00771    *
00772    *  All sources arrived; calculate energy, forces
00773    *
00774    **********************************************************/
00775   t_start = clock();
00776   //how long did namd take to cycle back here
00777   double namdtime = (double)((double)t_start-(double)t_stop)/CLOCKS_PER_SEC;
00778   totalnamdtime += namdtime;
00779   //choice choose
00780   calcGBISReg(msg->doSlow);
00781   
00782   t_stop = clock();
00783   double gbistime = (double)((double)t_stop-(double)t_start)/CLOCKS_PER_SEC;
00784   //printf("GBIS: elapsednamd(%i)=%f\n", timestep, namdtime);
00785   //printf("GBIS: elapsedgbis(%i)=%f\n", timestep, gbistime);
00786   totalgbistime += gbistime;
00787   //printf("GBIS: total(%i)=%f\n", timestep, totaltime);
00788   if (timestep % BENCH_PERIOD == 0) {
00789     printf("\n");
00790     printf("GBIS:       t_GB=%f sec for %i steps\n",totalgbistime,BENCH_PERIOD);
00791     printf("GBIS:       t_MD=%f sec for %i steps\n",totalnamdtime,BENCH_PERIOD);
00792     printf("GBIS:       init=%f sec for %i steps\n", inittime, BENCH_PERIOD);
00793     printf("GBIS:        psi=%f sec for %i steps\n", psitime, BENCH_PERIOD);
00794     printf("GBIS:      alpha=%f sec for %i steps\n", alphatime, BENCH_PERIOD);
00795     printf("GBIS:    dEdasum=%f sec for %i steps\n", dEdasumtime, BENCH_PERIOD);
00796     printf("GBIS: dEdaprefix=%f sec for %i steps\n",dEdaprefixtime,BENCH_PERIOD);
00797     printf("GBIS:   dEdaloop=%f sec for %i steps\n", dEdalooptime,BENCH_PERIOD);
00798     printf("GBIS:      loop1=%i iters\n", loop1Iter);
00799     printf("GBIS:      loop2=%i iters\n", loop2Iter);
00800     printf("GBIS:      loop3=%i iters\n", loop3Iter);
00801     printf("\n");
00802     totalgbistime = 0;
00803     totalnamdtime = 0;
00804     inittime = 0;
00805     psitime = 0;
00806     alphatime = 0;
00807     dEdrtime = 0;
00808     dEdasumtime = 0;
00809     dEdaprefixtime = 0;
00810     dEdalooptime = 0;
00811   }
00812 
00813   // distribute forces
00814   //printf("GBIS distributing forces\n");
00815   for ( int j=0; j < numSources; ++j ) {
00816     GBISCoordMsg *cmsg = coordMsgs[j];
00817     coordMsgs[j] = 0;
00818     GBISForceMsg *fmsg = new (cmsg->numAtoms, cmsg->numAtoms, 0) GBISForceMsg;
00819     //does this init slowForce, force?
00820     for ( int i=0; i < cmsg->numAtoms; ++i ) {
00821       fmsg->force[i] = force[cmsg->coord[i].id];
00822       fmsg->slowForce[i] = slowForce[cmsg->coord[i].id];
00823       /*
00824       if (i == 1000 ) {
00825         printf("%i force: <", i);
00826         printf("%f, ", fmsg->force[i].force.x);
00827         printf("%f, ", fmsg->force[i].force.y);
00828         printf("%f>\n", fmsg->force[i].force.z);
00829         printf("%i slwfr: <", i);
00830         printf("%f, ", fmsg->slowForce[i].force.x);
00831         printf("%f, ", fmsg->slowForce[i].force.y);
00832         printf("%f>\n", fmsg->slowForce[i].force.z);
00833       }
00834       */
00835     }
00836 
00837     //CkPrintf("GBISENERGY[%i] c = % e, b = % e\n",timestep,coulEnergy, gbEnergy);
00838    if ( ! j ) {
00839 #if GBIS_DEDR_FORCE
00840       fmsg->gbSelfEnergy = gbSelfEnergy;
00841       fmsg->gbInterEnergy = gbInterEnergy;
00842 #else
00843       fmsg->gbSelfEnergy = 0;
00844       fmsg->gbInterEnergy = 0;
00845 #endif
00846 #if GBIS_COUL_FORCE
00847       fmsg->coulEnergy = coulEnergy;
00848 #else
00849       fmsg->coulEnergy = 0;
00850 #endif
00851     } else {
00852       fmsg->gbSelfEnergy = 0;
00853       fmsg->gbInterEnergy = 0;
00854       fmsg->coulEnergy = 0;
00855     }
00856     gbisProxy[cmsg->sourceNode].recvForce(fmsg);
00857     delete cmsg;
00858   }
00859   //printf("GBIS distributing forces COMPLETE!\n");
00860 }

void ComputeGBISserMgr::recvForce ( GBISForceMsg  ) 

Definition at line 862 of file ComputeGBISser.C.

References ComputeGBISser::saveResults().

00862                                                    {
00863   //printf("GBIS recvForce()\n");
00864   gbisCompute->saveResults(msg);
00865   delete oldmsg;
00866   oldmsg = msg;
00867 }

void ComputeGBISserMgr::setCompute ( ComputeGBISser c  )  [inline]

Definition at line 163 of file ComputeGBISser.C.

00163 { gbisCompute = c; }


The documentation for this class was generated from the following file:
Generated on Wed Sep 20 01:17:17 2017 for NAMD by  doxygen 1.4.7