| 36 |  | * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). | 
| 37 |  | * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). | 
| 38 |  | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). | 
| 39 | < | * [4]  Vardeman & Gezelter, in progress (2009). | 
| 39 | > | * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | > | * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 |  | */ | 
| 42 |  |  | 
| 43 |  |  | 
| 97 |  |  | 
| 98 |  | #ifdef IS_MPI | 
| 99 |  | } | 
| 100 | < | MPI_Bcast(&framePos_, 1, MPI_INT, 0, MPI_COMM_WORLD); | 
| 100 | > | MPI::COMM_WORLD.Bcast(&framePos_, 1, MPI::INT, 0); | 
| 101 |  | #endif // is_mpi | 
| 102 |  | } | 
| 103 |  |  | 
| 132 |  | } | 
| 133 |  |  | 
| 134 |  | int sendBufferSize = sendBuffer.size(); | 
| 135 | < | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); | 
| 136 | < | MPI_Bcast((void *)sendBuffer.c_str(), sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); | 
| 135 | > | MPI::COMM_WORLD.Bcast(&sendBufferSize, 1, MPI::INT, masterNode); | 
| 136 | > | MPI::COMM_WORLD.Bcast((void *)sendBuffer.c_str(), sendBufferSize, | 
| 137 | > | MPI::CHAR, masterNode); | 
| 138 |  |  | 
| 139 |  | sstream.str(sendBuffer); | 
| 140 |  | } else { | 
| 141 |  | int sendBufferSize; | 
| 142 | < | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); | 
| 142 | > | MPI::COMM_WORLD.Bcast(&sendBufferSize, 1, MPI::INT, masterNode); | 
| 143 |  | char * recvBuffer = new char[sendBufferSize+1]; | 
| 144 |  | assert(recvBuffer); | 
| 145 |  | recvBuffer[sendBufferSize] = '\0'; | 
| 146 | < | MPI_Bcast(recvBuffer, sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); | 
| 146 | > | MPI::COMM_WORLD.Bcast(recvBuffer, sendBufferSize, MPI::CHAR, masterNode); | 
| 147 |  | sstream.str(recvBuffer); | 
| 148 |  | delete [] recvBuffer; | 
| 149 |  | } | 
| 193 |  |  | 
| 194 |  | scanFile(); | 
| 195 |  |  | 
| 194 | – |  | 
| 196 |  | readSet(); | 
| 197 |  |  | 
| 198 |  |  | 
| 281 |  |  | 
| 282 |  | int index = tokenizer.nextTokenAsInt(); | 
| 283 |  |  | 
| 284 | + | StuntDouble* sd = info_->getIOIndexToIntegrableObject(index); | 
| 285 | + |  | 
| 286 | + | if (sd == NULL) { | 
| 287 | + | return; | 
| 288 | + | } | 
| 289 |  |  | 
| 290 | < | if (index < 1116){ | 
| 291 | < | std::string type = tokenizer.nextToken(); | 
| 292 | < |  | 
| 293 | < | Vector3d pos; | 
| 294 | < |  | 
| 295 | < | pos[0] = tokenizer.nextTokenAsDouble(); | 
| 296 | < | pos[1] = tokenizer.nextTokenAsDouble(); | 
| 297 | < | pos[2] = tokenizer.nextTokenAsDouble(); | 
| 298 | < |  | 
| 299 | < | all_pos_[index] = pos; | 
| 294 | < | }else{ | 
| 295 | < |  | 
| 296 | < | bool exist = false; | 
| 297 | < | int indexCount = 0; | 
| 298 | < |  | 
| 299 | < | while ( (!exist) && (indexCount < stuntDoubleIndex_.size())){ | 
| 300 | < | if (index == stuntDoubleIndex_[indexCount]) | 
| 301 | < | exist = true; | 
| 302 | < | indexCount++; | 
| 303 | < | } | 
| 304 | < |  | 
| 305 | < | StuntDouble* integrableObject; | 
| 306 | < |  | 
| 307 | < | if (exist){ | 
| 308 | < |  | 
| 309 | < | integrableObject = info_->getIOIndexToIntegrableObject(index); | 
| 310 | < |  | 
| 311 | < | int compareindex = integrableObject->getGlobalIntegrableObjectIndex(); | 
| 312 | < |  | 
| 313 | < | if (integrableObject == NULL) { | 
| 314 | < | return; | 
| 315 | < | } | 
| 316 | < |  | 
| 317 | < | std::string type = tokenizer.nextToken(); | 
| 318 | < |  | 
| 319 | < | Vector3d pos; | 
| 320 | < |  | 
| 290 | > | std::string type = tokenizer.nextToken(); | 
| 291 | > | int size = type.size(); | 
| 292 | > |  | 
| 293 | > | Vector3d pos; | 
| 294 | > | Quat4d q; | 
| 295 | > |  | 
| 296 | > | for(int i = 0; i < size; ++i) { | 
| 297 | > | switch(type[i]) { | 
| 298 | > |  | 
| 299 | > | case 'p': { | 
| 300 |  | pos[0] = tokenizer.nextTokenAsDouble(); | 
| 301 |  | pos[1] = tokenizer.nextTokenAsDouble(); | 
| 302 |  | pos[2] = tokenizer.nextTokenAsDouble(); | 
| 303 | < |  | 
| 303 | > | break; | 
| 304 | > | } | 
| 305 | > | case 'v' : { | 
| 306 |  | Vector3d vel; | 
| 307 |  | vel[0] = tokenizer.nextTokenAsDouble(); | 
| 308 |  | vel[1] = tokenizer.nextTokenAsDouble(); | 
| 309 |  | vel[2] = tokenizer.nextTokenAsDouble(); | 
| 310 | < |  | 
| 311 | < |  | 
| 312 | < | Quat4d q; | 
| 313 | < | if (integrableObject->isDirectional()) { | 
| 310 | > | break; | 
| 311 | > | } | 
| 312 | > |  | 
| 313 | > | case 'q' : { | 
| 314 | > | if (sd->isDirectional()) { | 
| 315 |  |  | 
| 316 |  | q[0] = tokenizer.nextTokenAsDouble(); | 
| 317 |  | q[1] = tokenizer.nextTokenAsDouble(); | 
| 318 |  | q[2] = tokenizer.nextTokenAsDouble(); | 
| 319 |  | q[3] = tokenizer.nextTokenAsDouble(); | 
| 320 | < | } | 
| 321 | < | // keep the position in case we need it for a molecular restraint: | 
| 320 | > |  | 
| 321 | > | RealType qlen = q.length(); | 
| 322 | > | if (qlen < OpenMD::epsilon) { //check quaternion is not equal to 0 | 
| 323 | > |  | 
| 324 | > | sprintf(painCave.errMsg, | 
| 325 | > | "RestReader Error: initial quaternion error (q0^2 + q1^2 + q2^2 + q3^2) ~ 0\n"); | 
| 326 | > | painCave.isFatal = 1; | 
| 327 | > | simError(); | 
| 328 | > | } | 
| 329 | > |  | 
| 330 | > | q.normalize(); | 
| 331 | > | } | 
| 332 | > | break; | 
| 333 | > | } | 
| 334 | > | case 'j' : { | 
| 335 | > | Vector3d ji; | 
| 336 | > | if (sd->isDirectional()) { | 
| 337 | > | ji[0] = tokenizer.nextTokenAsDouble(); | 
| 338 | > | ji[1] = tokenizer.nextTokenAsDouble(); | 
| 339 | > | ji[2] = tokenizer.nextTokenAsDouble(); | 
| 340 | > | } | 
| 341 | > | break; | 
| 342 | > | } | 
| 343 | > | case 'f': { | 
| 344 | > | Vector3d force; | 
| 345 | > | force[0] = tokenizer.nextTokenAsDouble(); | 
| 346 | > | force[1] = tokenizer.nextTokenAsDouble(); | 
| 347 | > | force[2] = tokenizer.nextTokenAsDouble(); | 
| 348 | > | break; | 
| 349 | > | } | 
| 350 | > | case 't' : { | 
| 351 | > | Vector3d torque; | 
| 352 | > | torque[0] = tokenizer.nextTokenAsDouble(); | 
| 353 | > | torque[1] = tokenizer.nextTokenAsDouble(); | 
| 354 | > | torque[2] = tokenizer.nextTokenAsDouble(); | 
| 355 | > | break; | 
| 356 | > | } | 
| 357 | > | default: { | 
| 358 | > | sprintf(painCave.errMsg, | 
| 359 | > | "RestReader Error: %s is an unrecognized type\n", type.c_str()); | 
| 360 | > | painCave.isFatal = 1; | 
| 361 | > | simError(); | 
| 362 | > | break; | 
| 363 | > | } | 
| 364 | > | } | 
| 365 | > | // keep the position in case we need it for a molecular restraint: | 
| 366 | > |  | 
| 367 | > | all_pos_[index] = pos; | 
| 368 |  |  | 
| 369 | < | all_pos_[index] = pos; | 
| 370 | < |  | 
| 371 | < | // is this io restrained? | 
| 372 | < | GenericData* data = integrableObject->getPropertyByName("Restraint"); | 
| 373 | < | ObjectRestraint* oRest; | 
| 374 | < |  | 
| 375 | < | if (data != NULL) { | 
| 376 | < | // make sure we can reinterpret the generic data as restraint data: | 
| 377 | < | RestraintData* restData= dynamic_cast<RestraintData*>(data); | 
| 350 | < | if (restData != NULL) { | 
| 351 | < | // make sure we can reinterpet the restraint data as a pointer to | 
| 369 | > | // is this io restrained? | 
| 370 | > | GenericData* data = sd->getPropertyByName("Restraint"); | 
| 371 | > | ObjectRestraint* oRest; | 
| 372 | > |  | 
| 373 | > | if (data != NULL) { | 
| 374 | > | // make sure we can reinterpret the generic data as restraint data: | 
| 375 | > | RestraintData* restData= dynamic_cast<RestraintData*>(data); | 
| 376 | > | if (restData != NULL) { | 
| 377 | > | // make sure we can reinterpet the restraint data as a pointer to | 
| 378 |  | // an ObjectRestraint: | 
| 379 | < | oRest = dynamic_cast<ObjectRestraint*>(restData->getData()); | 
| 380 | < | if (oRest != NULL) { | 
| 381 | < | if (integrableObject->isDirectional()) { | 
| 382 | < | oRest->setReferenceStructure(pos, q.toRotationMatrix3()); | 
| 383 | < | } else { | 
| 384 | < | oRest->setReferenceStructure(pos); | 
| 359 | < | } | 
| 379 | > | oRest = dynamic_cast<ObjectRestraint*>(restData->getData()); | 
| 380 | > | if (oRest != NULL) { | 
| 381 | > | if (sd->isDirectional()) { | 
| 382 | > | oRest->setReferenceStructure(pos, q.toRotationMatrix3()); | 
| 383 | > | } else { | 
| 384 | > | oRest->setReferenceStructure(pos); | 
| 385 |  | } | 
| 386 |  | } | 
| 387 |  | } |