#include <ComputeGBISser.h>
Public Member Functions | |
ComputeGBISser (ComputeID c) | |
virtual | ~ComputeGBISser () |
void | doWork () |
void | saveResults (GBISForceMsg *) |
Definition at line 25 of file ComputeGBISser.h.
ComputeGBISser::ComputeGBISser | ( | ComputeID | c | ) |
Definition at line 232 of file ComputeGBISser.C.
References ReductionMgr::Object(), REDUCTIONS_BASIC, and ReductionMgr::willSubmit().
00232 : 00233 ComputeHomePatches(c) 00234 { 00235 CProxy_ComputeGBISserMgr::ckLocalBranch( 00236 CkpvAccess(BOCclass_group).computeGBISserMgr)->setCompute(this); 00237 00238 reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC); 00239 00240 }
ComputeGBISser::~ComputeGBISser | ( | ) | [virtual] |
Definition at line 242 of file ComputeGBISser.C.
void ComputeGBISser::doWork | ( | void | ) | [virtual] |
Reimplemented from Compute.
Definition at line 905 of file ComputeGBISser.C.
References atoms, ResizeArrayIter< T >::begin(), CompAtom::charge, ComputeGBISAtom::charge, GBISCoordMsg::coord, SimParameters::coulomb_radius_offset, GBISCoordMsg::doSlow, ResizeArrayIter< T >::end(), CompAtomExt::id, ComputeGBISAtom::id, ComputeGBISAtom::mass, MassToRadius(), MassToScreen(), GBISCoordMsg::numAtoms, Node::Object(), ComputeHomePatches::patchList, CompAtom::position, ComputeGBISAtom::position, ComputeGBISAtom::rho, ComputeGBISAtom::rho0, ComputeGBISAtom::rhos, Compute::sequence(), GBISCoordMsg::sequence, Node::simParameters, GBISCoordMsg::sourceNode, SubmitReduction::submit(), CompAtom::vdwType, and ComputeGBISAtom::vdwType.
00906 { 00907 //printf("GBIS doWork()\n"); 00908 ResizeArrayIter<PatchElem> ap(patchList); 00909 00910 #if 1 00911 // Skip computations if nothing to do. 00912 if ( ! patchList[0].p->flags.doNonbonded ) 00913 { 00914 for (ap = ap.begin(); ap != ap.end(); ap++) { 00915 CompAtom *x = (*ap).positionBox->open(); 00916 //CkPrintf("GBIS%i: ComputeGBIS(%i)::doWork() openedForceBox",CkMyPe(),cid); 00917 Results *r = (*ap).forceBox->open(); 00918 (*ap).positionBox->close(&x); 00919 //CkPrintf("GBIS%i: ComputeGBIS(%i)::doWork() closedForceBox",CkMyPe(),cid); 00920 (*ap).forceBox->close(&r); 00921 } 00922 reduction->submit(); 00923 return; 00924 } 00925 #endif 00926 00927 00928 // allocate message 00929 int numLocalAtoms = 0; 00930 for (ap = ap.begin(); ap != ap.end(); ap++) { 00931 numLocalAtoms += (*ap).p->getNumAtoms(); 00932 } 00933 00934 GBISCoordMsg *msg = new (numLocalAtoms, 0) GBISCoordMsg; 00935 msg->sourceNode = CkMyPe(); 00936 msg->numAtoms = numLocalAtoms; 00937 ComputeGBISAtom *data_ptr = msg->coord; 00938 SimParameters *simParams = Node::Object()->simParameters; 00939 msg->doSlow = patchList[0].p->flags.doFullElectrostatics; 00940 //CkPrintf("SERIAL SLOW %i\n",msg->doSlow); 00941 msg->sequence = sequence(); 00942 00943 // get positions 00944 for (ap = ap.begin(); ap != ap.end(); ap++) { 00945 FullAtomList &atoms = (*ap).p->getAtomList(); 00946 CompAtom *x = (*ap).positionBox->open(); 00947 CompAtomExt *xExt = (*ap).p->getCompAtomExtInfo(); 00948 int numAtoms = (*ap).p->getNumAtoms(); 00949 for(int i=0; i<numAtoms; ++i) 00950 { 00951 data_ptr->position = x[i].position; 00952 data_ptr->charge = x[i].charge; 00953 data_ptr->mass = atoms[i].mass; 00954 data_ptr->id = xExt[i].id; 00955 data_ptr->rho = MassToRadius(data_ptr->mass); 00956 SimParameters *simParams = Node::Object()->simParameters; 00957 data_ptr->rho0 = data_ptr->rho - simParams->coulomb_radius_offset; 00958 data_ptr->rhos = data_ptr->rho0 * MassToScreen(data_ptr->mass); 00959 data_ptr->vdwType = x[i].vdwType; 00960 ++data_ptr; 00961 } 00962 00963 #if 0 00964 if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); } 00965 else { (*ap).positionBox->close(&x); } 00966 #endif 00967 (*ap).positionBox->close(&x); 00968 } 00969 00970 CProxy_ComputeGBISserMgr gbisProxy(CkpvAccess(BOCclass_group).computeGBISserMgr); 00971 gbisProxy[0].recvCoord(msg); 00972 00973 }
void ComputeGBISser::saveResults | ( | GBISForceMsg * | msg | ) |
Definition at line 869 of file ComputeGBISser.C.
References ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), Results::f, ExtForce::force, GBISForceMsg::force, GBISForceMsg::gbInterEnergy, GBISForceMsg::gbSelfEnergy, SubmitReduction::item(), Results::nbond, ComputeHomePatches::patchList, REDUCTION_ELECT_ENERGY, Results::slow, GBISForceMsg::slowForce, and SubmitReduction::submit().
Referenced by ComputeGBISserMgr::recvForce().
00869 { 00870 //printf("GBIS saveResults()\n"); 00871 ResizeArrayIter<PatchElem> ap(patchList); 00872 00873 ExtForce *results_ptr = msg->force; 00874 ExtForce *results_ptr_slow = msg->slowForce; 00875 00876 // add in forces 00877 for (ap = ap.begin(); ap != ap.end(); ap++) { 00878 //CkPrintf("GBIS%i: ComputeGBIS(%i)::saveResults() openedForceBox",CkMyPe(),cid); 00879 Results *r = (*ap).forceBox->open(); 00880 Force *f = r->f[Results::nbond]; 00881 Force *sf = r->f[Results::slow]; 00882 int numAtoms = (*ap).p->getNumAtoms(); 00883 00884 for(int i=0; i<numAtoms; ++i) { 00885 f[i] += results_ptr->force; 00886 sf[i] += results_ptr_slow->force; 00887 //CkPrintf("GBIS%i: slow[%i] = % e\n",CkMyPe(),i,sf[i].x); 00888 ++results_ptr; 00889 ++results_ptr_slow; 00890 } 00891 //CkPrintf("GBIS%i: ComputeGBIS(%i)::saveResults() closedForceBox",CkMyPe(),cid); 00892 (*ap).forceBox->close(&r); 00893 } 00894 00895 //reduction->item(REDUCTION_ELECT_ENERGY) += msg->coulEnergy; 00896 reduction->item(REDUCTION_ELECT_ENERGY) += msg->gbInterEnergy; 00897 reduction->item(REDUCTION_ELECT_ENERGY) += msg->gbSelfEnergy; 00898 //CkPrintf("energies= % e, % e, % e\n",msg->coulEnergy, msg->gbInterEnergy, msg->gbSelfEnergy); 00899 reduction->submit(); 00900 }