39 DebugM(3,
"Storing data (" << msg->
aid.
size() <<
" positions) on master\n");
41 if ( msg->
step != -1 ) step = msg->
step;
52 for ( ; a_i != a_e; ++a_i, ++p_i ) {
53 receivedAtomIDs.
add(*a_i);
54 receivedAtomPositions.
add(*p_i);
60 for (a_i=msg->
fid.
begin() ; a_i!=a_e; ++a_i,++f_i) {
61 receivedForceIDs.
add(*a_i);
62 receivedTotalForces.
add(*f_i);
67 for ( ; g_i != g_e; ++g_i, ++gm_i ) {
68 DebugM(1,
"Received center of mass "<<*g_i<<
"\n");
69 if(i >= totalGroupsRequested)
NAMD_bug(
"Received too many groups.");
70 receivedGroupPositions[i] += (*g_i);
71 receivedGroupMasses[i] += (*gm_i);
74 if(i!=totalGroupsRequested)
NAMD_bug(
"Received too few groups.");
78 if ( ntf && ntf != receivedGroupTotalForces.
size() )
NAMD_bug(
"Received wrong number of group forces.");
81 for ( i=0 ; gf_i != gf_e; ++gf_i, ++i ) {
82 receivedGroupTotalForces[i] += (*gf_i);
90 for ( i=0 ; gov_i != gov_e; gov_i++, goi_i++, i++ ) {
91 receivedGridObjIndices[i] = (*goi_i);
92 receivedGridObjValues[i] += (*gov_i);
94 if (ngov && ngov != receivedGridObjValues.
size()) {
95 NAMD_bug(
"Received wrong number of grid objects.");
100 NAMD_bug(
"GlobalMasterServer::recvData received lattice twice.");
102 lattice = msg->
lat[0];
106 recvCount += msg->
count;
115 DebugM(3,
"received " << recvCount <<
" atom messages and "
116 << recvPatchesCount <<
" patch messages (out of " << numPatches
117 <<
" patches) from the ComputeGlobals\n" <<
endi);
119 int numNeededPatches = totalGridObjsRequested ? numPatches : 0;
120 if (firstTime) numNeededPatches = 0;
122 if (recvCount > numDataSenders + numForceSenders + 1) {
123 NAMD_bug(
"GlobalMasterServer::recvData recvCount too high.");
126 if (recvPatchesCount > numPatches) {
127 NAMD_bug(
"GlobalMasterServer::recvData too many patches received.");
130 if ((recvCount == numDataSenders + numForceSenders + 1) &&
131 (recvPatchesCount == numNeededPatches)) {
133 if ( ! latticeCount ) {
134 NAMD_bug(
"GlobalMasterServer::recvData did not receive lattice.");
137 DebugM(3,
"Received all needed data\n" <<
endi);
140 for (
size_t ig = 0; ig < receivedGroupMasses.
size(); ig++) {
142 DebugM(3,
"Group mass " << ig <<
" = "
143 << receivedGroupMasses[ig] <<
"\n" <<
endi);
145 for (
size_t ig = 0; ig < receivedGridObjValues.
size(); ig++) {
146 DebugM(3,
"Grid object " << receivedGridObjIndices[ig] <<
" = "
147 << receivedGridObjValues[ig] <<
"\n" <<
endi);
151 int oldTotalGroupsRequested = totalGroupsRequested;
153 int resendCoordinates = callClients();
155 if (resendCoordinates) {
161 receivedAtomIDs.
resize(0);
162 receivedAtomPositions.
resize(0);
163 receivedGroupPositions.
resize(totalGroupsRequested);
165 receivedGroupMasses.
resize(totalGroupsRequested);
166 receivedGroupMasses.
setall(0);
167 receivedGridObjIndices.
resize(totalGridObjsRequested);
168 receivedGridObjIndices.
setall(-1);
169 receivedGridObjValues.
resize(totalGridObjsRequested);
170 receivedGridObjValues.
setall(0);
173 recvPatchesCount = 0;
174 if ( resendCoordinates ) {
175 recvCount += numForceSenders;
177 receivedGroupTotalForces.
resize(totalGroupsRequested);
178 receivedGroupTotalForces.
setall(0);
179 receivedForceIDs.
resize(0);
180 receivedTotalForces.
resize(0);
static PatchMap * Object()
BigRealList gridobjvalue
Partial values of the GridForce objects from this message.
std::ostream & endi(std::ostream &s)
void NAMD_bug(const char *err_msg)
ResizeArray< Lattice > lat
IntList gridobjindex
Indices of the GridForce objects contained in this message.
void setall(const Elem &elem)
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ cudaTextureObject_t const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
int add(const Elem &elem)
int numPatches(void) const
int count
Numer of atoms processed for this message.
int patchcount
Number of patches processed for this message.