NAMD
Public Member Functions | List of all members
ComputeGBISserMgr Class Reference
Inheritance diagram for ComputeGBISserMgr:

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.

207  :
208  gbisProxy(thisgroup), gbisCompute(0), numSources(0), numArrived(0),
209  inittime(0),
210  psitime(0),
211  alphatime(0),
212  dEdrtime(0),
213  dEdasumtime(0),
214  dEdaprefixtime(0),
215  dEdalooptime(0), slowForce(0),
216  coordMsgs(0), coord(0), force(0), oldmsg(0), numAtoms(0), timestep(0) {
217  CkpvAccess(BOCclass_group).computeGBISserMgr = thisgroup;
218  t_start = clock();
219  t_stop = clock();
220  all2all = false;
221 }
ComputeGBISserMgr::~ComputeGBISserMgr ( )

Definition at line 223 of file ComputeGBISser.C.

223  {
224  for ( int i=0; i<numSources; ++i ) { delete coordMsgs[i]; }
225  delete [] coordMsgs;
226  delete [] coord;
227  delete [] force;
228  delete [] slowForce;
229  delete oldmsg;
230 }

Member Function Documentation

void ComputeGBISserMgr::recvCoord ( GBISCoordMsg msg)

Definition at line 742 of file ComputeGBISser.C.

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

742  {
743  //printf("GBIS recvCoord()\n");
744  if ( ! numSources ) {//init receiving coord
745  numSources = (PatchMap::Object())->numNodesWithPatches();
746  coordMsgs = new GBISCoordMsg*[numSources];
747  for ( int i=0; i<numSources; ++i ) { coordMsgs[i] = 0; }
748  numArrived = 0;
749  numAtoms = Node::Object()->molecule->numAtoms;
750  coord = new ComputeGBISAtom[numAtoms];
751  force = new ExtForce[numAtoms];
752  slowForce = new ExtForce[numAtoms];
753  timestep = msg[0].sequence;
754  }
755 
756 
757  //receive coord
758  int i;
759  for ( i=0; i < msg->numAtoms; ++i ) {
760  coord[msg->coord[i].id] = msg->coord[i];
761  }
762 
763  coordMsgs[numArrived] = msg;
764  ++numArrived;
765 
766  if ( numArrived < numSources ) return;
767  numArrived = 0;
768 
769 
770  /**********************************************************
771  *
772  * All sources arrived; calculate energy, forces
773  *
774  **********************************************************/
775  t_start = clock();
776  //how long did namd take to cycle back here
777  double namdtime = (double)((double)t_start-(double)t_stop)/CLOCKS_PER_SEC;
778  totalnamdtime += namdtime;
779  //choice choose
780  calcGBISReg(msg->doSlow);
781 
782  t_stop = clock();
783  double gbistime = (double)((double)t_stop-(double)t_start)/CLOCKS_PER_SEC;
784  //printf("GBIS: elapsednamd(%i)=%f\n", timestep, namdtime);
785  //printf("GBIS: elapsedgbis(%i)=%f\n", timestep, gbistime);
786  totalgbistime += gbistime;
787  //printf("GBIS: total(%i)=%f\n", timestep, totaltime);
788  if (timestep % BENCH_PERIOD == 0) {
789  printf("\n");
790  printf("GBIS: t_GB=%f sec for %i steps\n",totalgbistime,BENCH_PERIOD);
791  printf("GBIS: t_MD=%f sec for %i steps\n",totalnamdtime,BENCH_PERIOD);
792  printf("GBIS: init=%f sec for %i steps\n", inittime, BENCH_PERIOD);
793  printf("GBIS: psi=%f sec for %i steps\n", psitime, BENCH_PERIOD);
794  printf("GBIS: alpha=%f sec for %i steps\n", alphatime, BENCH_PERIOD);
795  printf("GBIS: dEdasum=%f sec for %i steps\n", dEdasumtime, BENCH_PERIOD);
796  printf("GBIS: dEdaprefix=%f sec for %i steps\n",dEdaprefixtime,BENCH_PERIOD);
797  printf("GBIS: dEdaloop=%f sec for %i steps\n", dEdalooptime,BENCH_PERIOD);
798  printf("GBIS: loop1=%i iters\n", loop1Iter);
799  printf("GBIS: loop2=%i iters\n", loop2Iter);
800  printf("GBIS: loop3=%i iters\n", loop3Iter);
801  printf("\n");
802  totalgbistime = 0;
803  totalnamdtime = 0;
804  inittime = 0;
805  psitime = 0;
806  alphatime = 0;
807  dEdrtime = 0;
808  dEdasumtime = 0;
809  dEdaprefixtime = 0;
810  dEdalooptime = 0;
811  }
812 
813  // distribute forces
814  //printf("GBIS distributing forces\n");
815  for ( int j=0; j < numSources; ++j ) {
816  GBISCoordMsg *cmsg = coordMsgs[j];
817  coordMsgs[j] = 0;
818  GBISForceMsg *fmsg = new (cmsg->numAtoms, cmsg->numAtoms, 0) GBISForceMsg;
819  //does this init slowForce, force?
820  for ( int i=0; i < cmsg->numAtoms; ++i ) {
821  fmsg->force[i] = force[cmsg->coord[i].id];
822  fmsg->slowForce[i] = slowForce[cmsg->coord[i].id];
823  /*
824  if (i == 1000 ) {
825  printf("%i force: <", i);
826  printf("%f, ", fmsg->force[i].force.x);
827  printf("%f, ", fmsg->force[i].force.y);
828  printf("%f>\n", fmsg->force[i].force.z);
829  printf("%i slwfr: <", i);
830  printf("%f, ", fmsg->slowForce[i].force.x);
831  printf("%f, ", fmsg->slowForce[i].force.y);
832  printf("%f>\n", fmsg->slowForce[i].force.z);
833  }
834  */
835  }
836 
837  //CkPrintf("GBISENERGY[%i] c = % e, b = % e\n",timestep,coulEnergy, gbEnergy);
838  if ( ! j ) {
839 #if GBIS_DEDR_FORCE
840  fmsg->gbSelfEnergy = gbSelfEnergy;
841  fmsg->gbInterEnergy = gbInterEnergy;
842 #else
843  fmsg->gbSelfEnergy = 0;
844  fmsg->gbInterEnergy = 0;
845 #endif
846 #if GBIS_COUL_FORCE
847  fmsg->coulEnergy = coulEnergy;
848 #else
849  fmsg->coulEnergy = 0;
850 #endif
851  } else {
852  fmsg->gbSelfEnergy = 0;
853  fmsg->gbInterEnergy = 0;
854  fmsg->coulEnergy = 0;
855  }
856  gbisProxy[cmsg->sourceNode].recvForce(fmsg);
857  delete cmsg;
858  }
859  //printf("GBIS distributing forces COMPLETE!\n");
860 }
static Node * Object()
Definition: Node.h:86
static PatchMap * Object()
Definition: PatchMap.h:27
BigReal gbSelfEnergy
BigReal coulEnergy
int numAtoms
Definition: Molecule.h:556
ExtForce * slowForce
BigReal gbInterEnergy
ComputeGBISAtom * coord
Molecule * molecule
Definition: Node.h:176
#define BENCH_PERIOD
ExtForce * force
void ComputeGBISserMgr::recvForce ( GBISForceMsg msg)

Definition at line 862 of file ComputeGBISser.C.

References ComputeGBISser::saveResults().

862  {
863  //printf("GBIS recvForce()\n");
864  gbisCompute->saveResults(msg);
865  delete oldmsg;
866  oldmsg = msg;
867 }
void saveResults(GBISForceMsg *)
void ComputeGBISserMgr::setCompute ( ComputeGBISser c)
inline

Definition at line 163 of file ComputeGBISser.C.

163 { gbisCompute = c; }

The documentation for this class was generated from the following file: