Difference for src/ComputeQM.C from version 1.1 to 1.2

version 1.1version 1.2
Line 47
Line 47
 #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
Line 278
Line 275
     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())
Line 800
Line 797
                  
         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 {
Line 953
Line 950
             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) {
Line 1117
Line 1114
         // 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: " 
Line 1980
Line 1977
                  
         // 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);
         }         }
                  
Line 2130
Line 2127
         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
Line 2278
Line 2275
          
     // 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 " 
Line 2299
Line 2296
          
     // 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 " 
Line 2600
Line 2597
                   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);
     }     }
Line 2898
Line 2895
         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';
Line 2913
Line 2910
                                  
                 // 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 ;
Line 2935
Line 2932
         }         }
                  
         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';
Line 2955
Line 2952
                                          
                     // 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.
Line 3058
Line 3055
 //     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!");
     }     }
          
Line 3282
Line 3279
                   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);
     }     }
Line 3573
Line 3570
                          
             // 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.
Line 3724
Line 3721
                                          
                     // 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;
Line 3794
Line 3791
                                          
                     // 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;
Line 4049
Line 4046
                   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);
     }     }
Line 4253
Line 4250
                  
         // 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,


Legend:
Removed in v.1.1 
changed lines
 Added in v.1.2



Made by using version 1.53 of cvs2html