#include <ComputeMsm.h>
Inheritance diagram for ComputeMsm:

Public Member Functions | |
| ComputeMsm (ComputeID c) | |
| virtual | ~ComputeMsm () |
| void | doWork () |
| void | saveResults () |
| void | setMgr (ComputeMsmMgr *mgr) |
|
|
Definition at line 5864 of file ComputeMsm.C. References COULOMB, SimParameters::dielectric, ReductionMgr::Object(), Node::Object(), REDUCTIONS_BASIC, Node::simParameters, simParams, and ReductionMgr::willSubmit(). 05864 : ComputeHomePatches(c) 05865 { 05866 CProxy_ComputeMsmMgr::ckLocalBranch( 05867 CkpvAccess(BOCclass_group).computeMsmMgr)->setCompute(this); 05868 SimParameters *simParams = Node::Object()->simParameters; 05869 qscaling = sqrtf(COULOMB / simParams->dielectric); 05870 reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC); 05871 #ifdef DEBUG_MSM_VERBOSE 05872 printf("ComputeMsm: (constructor) PE=%d\n", CkMyPe()); 05873 #endif 05874 }
|
|
|
Definition at line 5876 of file ComputeMsm.C. 05877 {
05878 // free memory
05879 #ifdef DEBUG_MSM_VERBOSE
05880 printf("ComputeMsm: (destructor) PE=%d\n", CkMyPe());
05881 #endif
05882 }
|
|
|
Reimplemented from Compute. Definition at line 5884 of file ComputeMsm.C. References msm::Array< T >::append(), ASSERT, msm::AtomCoordArray, ResizeArrayIter< T >::begin(), CompAtom::charge, ComputeMsmMgr::compute(), msm::PatchData::coordArray(), ResizeArrayIter< T >::end(), CompAtomExt::id, msm::PatchData::init(), msm::Array< T >::len(), ComputeMsmMgr::mapData(), ComputeMsmMgr::patchPtrArray(), msm::PatchPtrArray, CompAtom::position, msm::Array< T >::resize(), Compute::sequence(), msm::PatchData::sequence, ResizeArray< Elem >::size(), and SubmitReduction::submit(). 05885 {
05886 // for each patch do stuff
05887 #ifdef DEBUG_MSM_VERBOSE
05888 printf("ComputeMsm: doWork() PE=%d\n", CkMyPe());
05889 #endif
05890
05891 #if 0
05892 #ifdef MSM_TIMING
05893 myMgr->initTiming();
05894 #endif
05895 #ifdef MSM_PROFILING
05896 myMgr->initProfiling();
05897 #endif
05898 #endif
05899
05900 // patchList is inherited from ComputeHomePatches
05901 ResizeArrayIter<PatchElem> ap(patchList);
05902 numLocalPatches = patchList.size();
05903 cntLocalPatches = 0;
05904 ASSERT(cntLocalPatches < numLocalPatches);
05905
05906 #ifdef DEBUG_MSM_VERBOSE
05907 printf("patchList size = %d\n", patchList.size() );
05908 #endif
05909
05910 // Skip computations if nothing to do.
05911 if ( ! patchList[0].p->flags.doFullElectrostatics ) {
05912 for (ap = ap.begin(); ap != ap.end(); ap++) {
05913 CompAtom *x = (*ap).positionBox->open();
05914 Results *r = (*ap).forceBox->open();
05915 (*ap).positionBox->close(&x);
05916 (*ap).forceBox->close(&r);
05917 }
05918 reduction->submit();
05919 return;
05920 }
05921 msm::Map& map = myMgr->mapData();
05922 // This is the patchPtr array for MSM; any local patch will be set up
05923 // with a non-NULL pointer to its supporting data structure.
05924 msm::PatchPtrArray& patchPtr = myMgr->patchPtrArray();
05925 // also store just a list of IDs for the local patches
05926 msm::Array<int> patchIDList(numLocalPatches);
05927 patchIDList.resize(0); // to use append on pre-allocated array buffer
05928 int cnt=0, n;
05929 for (ap = ap.begin(); ap != ap.end(); ap++) {
05930 CompAtom *x = (*ap).positionBox->open();
05931 CompAtomExt *xExt = (*ap).p->getCompAtomExtInfo();
05932 if ( patchList[0].p->flags.doMolly ) {
05933 (*ap).positionBox->close(&x);
05934 x = (*ap).avgPositionBox->open();
05935 }
05936 int numAtoms = (*ap).p->getNumAtoms();
05937 int patchID = (*ap).patchID;
05938 patchIDList.append(patchID);
05939 if (patchPtr[patchID] == NULL) {
05940 // create PatchData if it doesn't exist for this patchID
05941 patchPtr[patchID] = new msm::PatchData(myMgr, patchID);
05942 #ifdef DEBUG_MSM_VERBOSE
05943 printf("Creating new PatchData: patchID=%d PE=%d\n",
05944 patchID, CkMyPe());
05945 #endif
05946 }
05947 msm::PatchData& patch = *(patchPtr[patchID]);
05948 patch.init(numAtoms);
05949 msm::AtomCoordArray& coord = patch.coordArray();
05950 ASSERT(coord.len() == numAtoms);
05951 for (n = 0; n < numAtoms; n++) {
05952 coord[n].position = x[n].position;
05953 coord[n].charge = qscaling * x[n].charge;
05954 coord[n].id = xExt[n].id;
05955 }
05956 if ( patchList[0].p->flags.doMolly ) {
05957 (*ap).avgPositionBox->close(&x);
05958 }
05959 else {
05960 (*ap).positionBox->close(&x);
05961 }
05962 patch.sequence = sequence();
05963 }
05964
05965 myMgr->compute(patchIDList);
05966 }
|
|
|
Definition at line 5968 of file ComputeMsm.C. References ASSERT, ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), msm::PatchData::energy, Results::f, Float, msm::PatchData::force, Force, SubmitReduction::item(), ComputeMsmMgr::mapData(), NAMD_die(), msm::Map::patchList, msm::PatchPtrArray, ComputeMsmMgr::patchPtrArray(), REDUCTION_ELECT_ENERGY_SLOW, SubmitReduction::submit(), and ComputeMsmMgr::virial. Referenced by ComputeMsmMgr::doneCompute(). 05969 {
05970 if (++cntLocalPatches != numLocalPatches) return;
05971
05972 // NAMD patches
05973 ResizeArrayIter<PatchElem> ap(patchList);
05974 #ifdef DEBUG_MSM
05975 for (ap = ap.begin(); ap != ap.end(); ap++) {
05976 int patchID = (*ap).patchID;
05977 ASSERT(myMgr->patchPtrArray()[patchID]->cntRecvs ==
05978 myMgr->mapData().patchList[patchID].numRecvs);
05979 }
05980 #endif
05981
05982 // get results from ComputeMsmMgr
05983 msm::PatchPtrArray& patchPtr = myMgr->patchPtrArray();
05984
05985 #ifdef DEBUG_MSM_VERBOSE
05986 printf("ComputeMsm: saveResults() PE=%d\n", CkMyPe());
05987 #endif
05988 // store force updates
05989 // submit reductions
05990
05991 // add in forces
05992 int cnt=0, n;
05993 for (ap = ap.begin(); ap != ap.end(); ap++) {
05994 Results *r = (*ap).forceBox->open();
05995 Force *f = r->f[Results::slow];
05996 int numAtoms = (*ap).p->getNumAtoms();
05997 int patchID = (*ap).patchID;
05998 if (patchPtr[patchID] == NULL) {
05999 char msg[100];
06000 snprintf(msg, sizeof(msg), "Expecting patch %d to exist on PE %d",
06001 patchID, CkMyPe());
06002 NAMD_die(msg);
06003 }
06004 msm::PatchData& patch = *(patchPtr[patchID]);
06005 ASSERT(numAtoms == patch.force.len() );
06006 for (n = 0; n < numAtoms; n++) {
06007 f[n] += patch.force[n];
06008 }
06009 (*ap).forceBox->close(&r);
06010
06011 reduction->item(REDUCTION_ELECT_ENERGY_SLOW) += patch.energy;
06012 // reduction->item(REDUCTION_VIRIAL_SLOW_XX) += patch.virial[0][0];
06013 // reduction->item(REDUCTION_VIRIAL_SLOW_XY) += patch.virial[0][1];
06014 // reduction->item(REDUCTION_VIRIAL_SLOW_XZ) += patch.virial[0][2];
06015 // reduction->item(REDUCTION_VIRIAL_SLOW_YX) += patch.virial[1][0];
06016 // reduction->item(REDUCTION_VIRIAL_SLOW_YY) += patch.virial[1][1];
06017 // reduction->item(REDUCTION_VIRIAL_SLOW_YZ) += patch.virial[1][2];
06018 // reduction->item(REDUCTION_VIRIAL_SLOW_ZX) += patch.virial[2][0];
06019 // reduction->item(REDUCTION_VIRIAL_SLOW_ZY) += patch.virial[2][1];
06020 // reduction->item(REDUCTION_VIRIAL_SLOW_ZZ) += patch.virial[2][2];
06021 Float *virial = myMgr->virial;
06022 reduction->item(REDUCTION_VIRIAL_SLOW_XX) += virial[ComputeMsmMgr::VXX];
06023 reduction->item(REDUCTION_VIRIAL_SLOW_XY) += virial[ComputeMsmMgr::VXY];
06024 reduction->item(REDUCTION_VIRIAL_SLOW_XZ) += virial[ComputeMsmMgr::VXZ];
06025 reduction->item(REDUCTION_VIRIAL_SLOW_YX) += virial[ComputeMsmMgr::VXY];
06026 reduction->item(REDUCTION_VIRIAL_SLOW_YY) += virial[ComputeMsmMgr::VYY];
06027 reduction->item(REDUCTION_VIRIAL_SLOW_YZ) += virial[ComputeMsmMgr::VYZ];
06028 reduction->item(REDUCTION_VIRIAL_SLOW_ZX) += virial[ComputeMsmMgr::VXZ];
06029 reduction->item(REDUCTION_VIRIAL_SLOW_ZY) += virial[ComputeMsmMgr::VYZ];
06030 reduction->item(REDUCTION_VIRIAL_SLOW_ZZ) += virial[ComputeMsmMgr::VZZ];
06031 }
06032 reduction->submit();
06033 }
|
|
|
Definition at line 32 of file ComputeMsm.h. Referenced by ComputeMsmMgr::setCompute(). 00032 { myMgr = mgr; }
|
1.3.9.1