# | Line 35 | Line 35 | |
---|---|---|
35 | * | |
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). |
38 | > | * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 | > | * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 | > | * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 | */ | |
41 | – | |
42 | ||
43 | + | #ifdef IS_MPI |
44 | + | #include <mpi.h> |
45 | + | #endif |
46 | + | |
47 | #include <sys/types.h> | |
48 | #include <sys/stat.h> | |
49 | ||
# | Line 58 | Line 62 | |
62 | #include "utils/StringTokenizer.hpp" | |
63 | #include "restraints/ObjectRestraint.hpp" | |
64 | #include "restraints/MolecularRestraint.hpp" | |
61 | – | |
62 | – | #ifdef IS_MPI |
63 | – | |
64 | – | #include <mpi.h> |
65 | – | #endif |
65 | ||
66 | namespace OpenMD { | |
67 | ||
68 | void RestReader::scanFile(){ | |
69 | < | int lineNo = 0; |
69 | > | |
70 | std::streampos prevPos; | |
71 | std::streampos currPos; | |
72 | ||
# | Line 81 | Line 80 | namespace OpenMD { | |
80 | prevPos = currPos; | |
81 | ||
82 | bool foundOpenSnapshotTag = false; | |
83 | < | |
83 | > | int lineNo = 0; |
84 | while(!foundOpenSnapshotTag && inFile_->getline(buffer, bufferSize)) { | |
85 | ++lineNo; | |
86 | ||
# | Line 96 | Line 95 | namespace OpenMD { | |
95 | ||
96 | #ifdef IS_MPI | |
97 | } | |
98 | < | MPI_Bcast(&framePos_, 1, MPI_INT, 0, MPI_COMM_WORLD); |
98 | > | MPI_Bcast(&framePos_, 1, MPI_INT, 0, MPI_COMM_WORLD); |
99 | #endif // is_mpi | |
100 | } | |
101 | ||
# | Line 131 | Line 130 | namespace OpenMD { | |
130 | } | |
131 | ||
132 | int sendBufferSize = sendBuffer.size(); | |
133 | < | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
134 | < | MPI_Bcast((void *)sendBuffer.c_str(), sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); |
133 | > | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
134 | > | MPI_Bcast((void *)sendBuffer.c_str(), sendBufferSize, |
135 | > | MPI_CHAR, masterNode, MPI_COMM_WORLD); |
136 | ||
137 | sstream.str(sendBuffer); | |
138 | } else { | |
139 | int sendBufferSize; | |
140 | < | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
140 | > | MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
141 | char * recvBuffer = new char[sendBufferSize+1]; | |
142 | assert(recvBuffer); | |
143 | recvBuffer[sendBufferSize] = '\0'; | |
144 | < | MPI_Bcast(recvBuffer, sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); |
144 | > | MPI_Bcast(recvBuffer, sendBufferSize, MPI_CHAR, masterNode, |
145 | > | MPI_COMM_WORLD); |
146 | sstream.str(recvBuffer); | |
147 | delete [] recvBuffer; | |
148 | } | |
# | Line 279 | Line 280 | namespace OpenMD { | |
280 | ||
281 | int index = tokenizer.nextTokenAsInt(); | |
282 | ||
283 | < | StuntDouble* integrableObject = info_->getIOIndexToIntegrableObject(index); |
283 | > | StuntDouble* sd = info_->getIOIndexToIntegrableObject(index); |
284 | ||
285 | < | if (integrableObject == NULL) { |
285 | > | if (sd == NULL) { |
286 | return; | |
287 | } | |
288 | ||
# | Line 309 | Line 310 | namespace OpenMD { | |
310 | } | |
311 | ||
312 | case 'q' : { | |
313 | < | if (integrableObject->isDirectional()) { |
313 | > | if (sd->isDirectional()) { |
314 | ||
315 | q[0] = tokenizer.nextTokenAsDouble(); | |
316 | q[1] = tokenizer.nextTokenAsDouble(); | |
# | Line 331 | Line 332 | namespace OpenMD { | |
332 | } | |
333 | case 'j' : { | |
334 | Vector3d ji; | |
335 | < | if (integrableObject->isDirectional()) { |
335 | > | if (sd->isDirectional()) { |
336 | ji[0] = tokenizer.nextTokenAsDouble(); | |
337 | ji[1] = tokenizer.nextTokenAsDouble(); | |
338 | ji[2] = tokenizer.nextTokenAsDouble(); | |
# | Line 365 | Line 366 | namespace OpenMD { | |
366 | all_pos_[index] = pos; | |
367 | ||
368 | // is this io restrained? | |
369 | < | GenericData* data = integrableObject->getPropertyByName("Restraint"); |
369 | < | ObjectRestraint* oRest; |
369 | > | GenericData* data = sd->getPropertyByName("Restraint"); |
370 | ||
371 | if (data != NULL) { | |
372 | // make sure we can reinterpret the generic data as restraint data: | |
# | Line 374 | Line 374 | namespace OpenMD { | |
374 | if (restData != NULL) { | |
375 | // make sure we can reinterpet the restraint data as a pointer to | |
376 | // an ObjectRestraint: | |
377 | < | oRest = dynamic_cast<ObjectRestraint*>(restData->getData()); |
377 | > | ObjectRestraint* oRest = dynamic_cast<ObjectRestraint*>(restData->getData()); |
378 | if (oRest != NULL) { | |
379 | < | if (integrableObject->isDirectional()) { |
379 | > | if (sd->isDirectional()) { |
380 | oRest->setReferenceStructure(pos, q.toRotationMatrix3()); | |
381 | } else { | |
382 | oRest->setReferenceStructure(pos); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |