41 DebugM(3,
"Storing data (" << msg->
aid.
size() <<
" positions) on master\n");
43 if ( msg->
step != -1 ) step = msg->
step;
54 for ( ; a_i != a_e; ++a_i, ++p_i ) {
55 receivedAtomIDs.
add(*a_i);
56 receivedAtomPositions.
add(*p_i);
62 for (a_i=msg->
fid.
begin() ; a_i!=a_e; ++a_i,++f_i) {
63 receivedForceIDs.
add(*a_i);
64 receivedTotalForces.
add(*f_i);
69 for ( ; g_i != g_e; ++g_i, ++gm_i ) {
70 DebugM(1,
"Received center of mass "<<*g_i<<
"\n");
71 if(i >= totalGroupsRequested)
NAMD_bug(
"Received too many groups.");
72 receivedGroupPositions[i] += (*g_i);
73 receivedGroupMasses[i] += (*gm_i);
76 if(i!=totalGroupsRequested)
NAMD_bug(
"Received too few groups.");
80 if ( ntf && ntf != receivedGroupTotalForces.
size() )
NAMD_bug(
"Received wrong number of group forces.");
83 for ( i=0 ; gf_i != gf_e; ++gf_i, ++i ) {
84 receivedGroupTotalForces[i] += (*gf_i);
92 for ( i=0 ; gov_i != gov_e; gov_i++, goi_i++, i++ ) {
93 receivedGridObjIndices[i] = (*goi_i);
94 receivedGridObjValues[i] += (*gov_i);
96 if (ngov && ngov != receivedGridObjValues.
size()) {
97 NAMD_bug(
"Received wrong number of grid objects.");
101 if ( latticeCount ) {
102 NAMD_bug(
"GlobalMasterServer::recvData received lattice twice.");
104 lattice = msg->
lat[0];
108 recvCount += msg->
count;
117 DebugM(3,
"received " << recvCount <<
" atom messages and " 118 << recvPatchesCount <<
" patch messages (out of " << numPatches
119 <<
" patches) from the ComputeGlobals\n" <<
endi);
121 int numNeededPatches = totalGridObjsRequested ? numPatches : 0;
122 if (firstTime) numNeededPatches = 0;
124 if (recvCount > numDataSenders + numForceSenders + 1) {
125 NAMD_bug(
"GlobalMasterServer::recvData recvCount too high.");
127 if(recvCount == numDataSenders + numForceSenders + 1) {
128 if ( ! latticeCount ) {
129 NAMD_bug(
"GlobalMasterServer::recvData did not receive lattice.");
132 DebugM(3,
"Received all needed data\n" <<
endi);
135 for (
size_t ig = 0; ig < receivedGroupMasses.
size(); ig++) {
137 DebugM(3,
"Group mass " << ig <<
" = " 138 << receivedGroupMasses[ig] <<
"\n" <<
endi);
140 for (
size_t ig = 0; ig < receivedGridObjValues.
size(); ig++) {
141 DebugM(3,
"Grid object " << receivedGridObjIndices[ig] <<
" = " 142 << receivedGridObjValues[ig] <<
"\n" <<
endi);
146 int oldTotalGroupsRequested = totalGroupsRequested;
148 DebugM(3,
"received messages from each of the ComputeGlobals\n");
149 int resendCoordinates = callClients();
151 if (resendCoordinates) {
157 receivedAtomIDs.
resize(0);
158 receivedAtomPositions.
resize(0);
159 receivedGroupPositions.
resize(totalGroupsRequested);
161 receivedGroupMasses.
resize(totalGroupsRequested);
162 receivedGroupMasses.
setall(0);
163 receivedGridObjIndices.
resize(totalGridObjsRequested);
164 receivedGridObjIndices.
setall(-1);
165 receivedGridObjValues.
resize(totalGridObjsRequested);
166 receivedGridObjValues.
setall(0);
169 recvPatchesCount = 0;
170 if ( resendCoordinates ) {
171 recvCount += numForceSenders;
173 receivedGroupTotalForces.
resize(totalGroupsRequested);
174 receivedGroupTotalForces.
setall(0);
175 receivedForceIDs.
resize(0);
176 receivedTotalForces.
resize(0);
static PatchMap * Object()
BigRealList gridobjvalue
Partial values of the GridForce objects from this message.
std::ostream & endi(std::ostream &s)
int add(const Elem &elem)
void setall(const Elem &elem)
int numPatches(void) const
void NAMD_bug(const char *err_msg)
ResizeArray< Lattice > lat
IntList gridobjindex
Indices of the GridForce objects contained in this message.
int count
Numer of atoms processed for this message.
int patchcount
Number of patches processed for this message.