| version 1.1 | version 1.2 |
|---|
| |
| #define S_ISDIR(X) ((X) & S_IFDIR) | #define S_ISDIR(X) ((X) & S_IFDIR) |
| #endif | #endif |
| | |
| #define not ! | |
| #define and && | |
| | |
| #ifndef SQRT_PI | #ifndef SQRT_PI |
| #define SQRT_PI 1.7724538509055160273 /* mathematica 15 digits*/ | #define SQRT_PI 1.7724538509055160273 /* mathematica 15 digits*/ |
| #endif | #endif |
| |
| bool operator==(const lssDistSort& ref) { | bool operator==(const lssDistSort& ref) { |
| bool returnVal = true; | bool returnVal = true; |
| | |
| if (not (type == ref.type && dist == ref.dist)) | if (! (type == ref.type && dist == ref.dist)) |
| return false; | return false; |
| | |
| if (idIndx.size() != ref.idIndx.size()) | if (idIndx.size() != ref.idIndx.size()) |
| |
| | |
| noPC = simParams->qmNoPC ; | noPC = simParams->qmNoPC ; |
| meNumMMIndx = molPtr->get_qmMeNumBonds(); | meNumMMIndx = molPtr->get_qmMeNumBonds(); |
| if (noPC and meNumMMIndx == 0) { | if (noPC && meNumMMIndx == 0) { |
| pntChrgCoordMsgs = NULL; | pntChrgCoordMsgs = NULL; |
| } | } |
| else { | else { |
| |
| numPlacedQMGrps = 1; | numPlacedQMGrps = 1; |
| } | } |
| | |
| while ( (numPlacedQMGrps < numQMGrps) and (simsPerNode > 0) ) { | while ( (numPlacedQMGrps < numQMGrps) && (simsPerNode > 0) ) { |
| | |
| // If we searched all nodes, break the loop. | // If we searched all nodes, break the loop. |
| if (nodeIt == numNodes) { | if (nodeIt == numNodes) { |
| |
| // Each force receives the home index of its atom with respect to the | // Each force receives the home index of its atom with respect to the |
| // local set of atoms in each node. | // local set of atoms in each node. |
| if (force[qmCoord[i].id].homeIndx != -1 | if (force[qmCoord[i].id].homeIndx != -1 |
| and force[qmCoord[i].id].homeIndx != qmCoord[i].homeIndx | && force[qmCoord[i].id].homeIndx != qmCoord[i].homeIndx |
| ) { | ) { |
| iout << iERROR << "Overloading QM atom " | iout << iERROR << "Overloading QM atom " |
| << qmCoord[i].id << "; home index: " | << qmCoord[i].id << "; home index: " |
| |
| | |
| // If we have a frequency for LSS update, check if we shoudl do it in | // If we have a frequency for LSS update, check if we shoudl do it in |
| // the current time step. | // the current time step. |
| if ( qmLSSFreq > 0 and ((timeStep + 1) % qmLSSFreq == 0 )) { | if ( qmLSSFreq > 0 && ((timeStep + 1) % qmLSSFreq == 0 )) { |
| lssUpdate(grpIter, grpQMAtmVec, grpPntChrgVec); | lssUpdate(grpIter, grpQMAtmVec, grpPntChrgVec); |
| } | } |
| | |
| |
| if (msg->secProcOn) | if (msg->secProcOn) |
| strncpy(msg->secProc, simParams->qmSecProc, 256); | strncpy(msg->secProc, simParams->qmSecProc, 256); |
| | |
| if (simParams->qmPrepProcOn and (timeStep == simParams->firstTimestep)) { | if (simParams->qmPrepProcOn && (timeStep == simParams->firstTimestep)) { |
| msg->prepProcOn = true; | msg->prepProcOn = true; |
| strncpy(msg->prepProc, simParams->qmPrepProc, 256); | strncpy(msg->prepProc, simParams->qmPrepProc, 256); |
| } else | } else |
| |
| | |
| // Writes a DCD file with the charges of all QM atoms at a frequency | // Writes a DCD file with the charges of all QM atoms at a frequency |
| // defined by the user in qmOutFreq. | // defined by the user in qmOutFreq. |
| if ( simParams->qmOutFreq > 0 and | if ( simParams->qmOutFreq > 0 && |
| timeStep % simParams->qmOutFreq == 0 ) { | timeStep % simParams->qmOutFreq == 0 ) { |
| | |
| iout << iINFO << "Writing QM charge output at step " | iout << iINFO << "Writing QM charge output at step " |
| |
| | |
| // Writes a DCD file with the charges of all QM atoms at a frequency | // Writes a DCD file with the charges of all QM atoms at a frequency |
| // defined by the user in qmPosOutFreq. | // defined by the user in qmPosOutFreq. |
| if ( simParams->qmPosOutFreq > 0 and | if ( simParams->qmPosOutFreq > 0 && |
| timeStep % simParams->qmPosOutFreq == 0 ) { | timeStep % simParams->qmPosOutFreq == 0 ) { |
| | |
| iout << iINFO << "Writing QM position output at step " | iout << iINFO << "Writing QM position output at step " |
| |
| CkMyPe(), baseDir.c_str() ); | CkMyPe(), baseDir.c_str() ); |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (not (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { | else if (! (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { |
| DebugM(4,"Creating directory " << baseDir << std::endl); | DebugM(4,"Creating directory " << baseDir << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| |
| size_t strIndx = 0; | size_t strIndx = 0; |
| | |
| if (chargeFields) { | if (chargeFields) { |
| while ((strIndx < (strlen(line)-9)) and (strlen(line)-1 >=9 ) ) { | while ((strIndx < (strlen(line)-9)) && (strlen(line)-1 >=9 ) ) { |
| | |
| strncpy(result, line+strIndx,9) ; | strncpy(result, line+strIndx,9) ; |
| result[9] = '\0'; | result[9] = '\0'; |
| |
| | |
| // If we are reading charges from Dummy atoms, | // If we are reading charges from Dummy atoms, |
| // place them on the appropriate QM atom. | // place them on the appropriate QM atom. |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| // The dummy atom points to the QM atom to which it is bound. | // The dummy atom points to the QM atom to which it is bound. |
| int qmInd = atmP[atmIndx].bountToIndx ; | int qmInd = atmP[atmIndx].bountToIndx ; |
| |
| } | } |
| | |
| if (gradFields) { | if (gradFields) { |
| while ((strIndx < (strlen(line)-9)) and (strlen(line)-1 >=9 ) ) { | while ((strIndx < (strlen(line)-9)) && (strlen(line)-1 >=9 ) ) { |
| | |
| strncpy(result, line+strIndx,9) ; | strncpy(result, line+strIndx,9) ; |
| result[9] = '\0'; | result[9] = '\0'; |
| |
| | |
| // This implementation was based on the description in | // This implementation was based on the description in |
| // DOI: 10.1002/jcc.20857 : Equations 30 to 32 | // DOI: 10.1002/jcc.20857 : Equations 30 to 32 |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| // The dummy atom points to the QM atom to which it is bound. | // The dummy atom points to the QM atom to which it is bound. |
| // The QM atom and the MM atom (in a QM-MM bond) point to each other. | // The QM atom and the MM atom (in a QM-MM bond) point to each other. |
| |
| // iret = remove(outputFileName); | // iret = remove(outputFileName); |
| // if ( iret ) { NAMD_die(strerror(errno)); } | // if ( iret ) { NAMD_die(strerror(errno)); } |
| | |
| if (not (chargesRead and gradsRead) ) { | if (! (chargesRead && gradsRead) ) { |
| NAMD_die("Error reading QM forces file. Not all data could be read!"); | NAMD_die("Error reading QM forces file. Not all data could be read!"); |
| } | } |
| | |
| |
| CkMyPe(), baseDir.c_str() ); | CkMyPe(), baseDir.c_str() ); |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (not (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { | else if (! (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { |
| DebugM(4,"Creating directory " << baseDir << std::endl); | DebugM(4,"Creating directory " << baseDir << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| |
| | |
| // This implementation was based on the description in | // This implementation was based on the description in |
| // DOI: 10.1002/jcc.20857 : Equations 30 to 32 | // DOI: 10.1002/jcc.20857 : Equations 30 to 32 |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| // The dummy atom points to the QM atom to which it is bound. | // The dummy atom points to the QM atom to which it is bound. |
| // The QM atom and the MM atom (in a QM-MM bond) point to each other. | // The QM atom and the MM atom (in a QM-MM bond) point to each other. |
| |
| | |
| // If we are reading charges from Dummy atoms, | // If we are reading charges from Dummy atoms, |
| // place the on the appropriate QM atom. | // place the on the appropriate QM atom. |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| int qmInd = atmP[atmIndx].bountToIndx ; | int qmInd = atmP[atmIndx].bountToIndx ; |
| atmP[qmInd].charge += localCharge; | atmP[qmInd].charge += localCharge; |
| |
| | |
| // If we are reading charges from Dummy atoms, | // If we are reading charges from Dummy atoms, |
| // place the on the appropriate QM atom. | // place the on the appropriate QM atom. |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| int qmInd = atmP[atmIndx].bountToIndx ; | int qmInd = atmP[atmIndx].bountToIndx ; |
| atmP[qmInd].charge += localCharge; | atmP[qmInd].charge += localCharge; |
| |
| CkMyPe(), baseDir.c_str() ); | CkMyPe(), baseDir.c_str() ); |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (not (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { | else if (! (stat(baseDir.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) ) { |
| DebugM(4,"Creating directory " << baseDir << std::endl); | DebugM(4,"Creating directory " << baseDir << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| |
| | |
| // This implementation was based on the description in | // This implementation was based on the description in |
| // DOI: 10.1002/jcc.20857 : Equations 30 to 32 | // DOI: 10.1002/jcc.20857 : Equations 30 to 32 |
| if ( msg->numQMAtoms <= atmIndx and | if ( msg->numQMAtoms <= atmIndx && |
| atmIndx < msg->numAllAtoms ) { | atmIndx < msg->numAllAtoms ) { |
| | |
| // If we are reading charges from Dummy atoms, | // If we are reading charges from Dummy atoms, |