| version 1.2 | version 1.3 |
|---|
| |
| iout << iWARN << "Could not compute all QM groups in parallel.\n" << endi ; | iout << iWARN << "Could not compute all QM groups in parallel.\n" << endi ; |
| } | } |
| | |
| iout << iINFO << "Ranks running QM simulations: " << qmPEs[0] ; | iout << iINFO << "List of ranks running QM simulations: " << qmPEs[0] ; |
| for (int i=1; i < qmPEs.size(); i++) { | for (int i=1; i < qmPEs.size(); i++) { |
| iout << ", " << qmPEs[i] ; | iout << ", " << qmPEs[i] ; |
| } | } |
| |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (! (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.c_str() << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| | |
| |
| | |
| // Builds the command that will be executed | // Builds the command that will be executed |
| qmCommand.clear(); | qmCommand.clear(); |
| | qmCommand.append("cd "); |
| | qmCommand.append(baseDir); |
| | qmCommand.append(" ; "); |
| qmCommand.append(msg->execPath) ; | qmCommand.append(msg->execPath) ; |
| qmCommand.append(" ") ; | qmCommand.append(" ") ; |
| qmCommand.append(inputFileName) ; | qmCommand.append(inputFileName) ; |
| |
| if ( iret < 0 ) { NAMD_die(strerror(errno)); } | if ( iret < 0 ) { NAMD_die(strerror(errno)); } |
| | |
| DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " | DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " |
| << inputFileName << " and " << msg->numAllPntChrgs | << inputFileName.c_str() << " and " << msg->numAllPntChrgs |
| << " point charges in file " << pntChrgFileName << "\n"); | << " point charges in file " << pntChrgFileName.c_str() << "\n"); |
| | |
| // write QM and dummy atom coordinates to input file and | // write QM and dummy atom coordinates to input file and |
| // MM electric field from MM point charges. | // MM electric field from MM point charges. |
| |
| } | } |
| | |
| // runs QM command | // runs QM command |
| DebugM(4,"Running command ->" << qmCommand << "<-" << std::endl); | DebugM(4,"Running command ->" << qmCommand.c_str() << "<-" << std::endl); |
| iret = system(qmCommand.c_str()); | iret = system(qmCommand.c_str()); |
| | |
| if ( iret == -1 ) { NAMD_die(strerror(errno)); } | if ( iret == -1 ) { NAMD_die(strerror(errno)); } |
| |
| // if ( iret ) { NAMD_die(strerror(errno)); } | // if ( iret ) { NAMD_die(strerror(errno)); } |
| | |
| // opens output file | // opens output file |
| DebugM(4,"Reading QM data from file " << outputFileName << std::endl); | DebugM(4,"Reading QM data from file " << outputFileName.c_str() << std::endl); |
| outputFile = fopen(outputFileName.c_str(),"r"); | outputFile = fopen(outputFileName.c_str(),"r"); |
| if ( ! outputFile ) { | if ( ! outputFile ) { |
| iout << iERROR << "Could not find QM output file!\n" << endi; | iout << iERROR << "Could not find QM output file!\n" << endi; |
| |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (! (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.c_str() << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| | |
| |
| | |
| // Builds the command that will be executed | // Builds the command that will be executed |
| qmCommand.clear(); | qmCommand.clear(); |
| | qmCommand.append("cd "); |
| | qmCommand.append(baseDir); |
| | qmCommand.append(" ; "); |
| qmCommand.append(msg->execPath) ; | qmCommand.append(msg->execPath) ; |
| qmCommand.append(" ") ; | qmCommand.append(" ") ; |
| qmCommand.append(inputFileName) ; | qmCommand.append(inputFileName) ; |
| |
| iret = fprintf(inputFile," Units Angs\n coords\n\n"); | iret = fprintf(inputFile," Units Angs\n coords\n\n"); |
| if ( iret < 0 ) { NAMD_die(strerror(errno)); } | if ( iret < 0 ) { NAMD_die(strerror(errno)); } |
| | |
| DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " << inputFileName << " and " << msg->numAllPntChrgs << " point charges in file " << pntChrgFileName << std::endl); | DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " << |
| | inputFileName.c_str() << " and " << msg->numAllPntChrgs << |
| | " point charges in file " << pntChrgFileName.c_str() << "\n"); |
| | |
| // write QM and dummy atom coordinates to input file. | // write QM and dummy atom coordinates to input file. |
| QMAtomData *atmP = msg->data ; | QMAtomData *atmP = msg->data ; |
| |
| } | } |
| | |
| // runs QM command | // runs QM command |
| DebugM(4,"Running command ->" << qmCommand << "<-" << std::endl); | DebugM(4,"Running command ->" << qmCommand.c_str() << "<-" << std::endl); |
| iret = system(qmCommand.c_str()); | iret = system(qmCommand.c_str()); |
| | |
| if ( iret == -1 ) { NAMD_die(strerror(errno)); } | if ( iret == -1 ) { NAMD_die(strerror(errno)); } |
| |
| NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); | NAMD_die("QM calculation could not be ran. Check your qmBaseDir!"); |
| } | } |
| else if (! (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.c_str() << std::endl); |
| int retVal = mkdir(baseDir.c_str(), S_IRWXU); | int retVal = mkdir(baseDir.c_str(), S_IRWXU); |
| } | } |
| | |
| |
| | |
| // Builds the command that will be executed | // Builds the command that will be executed |
| qmCommand.clear(); | qmCommand.clear(); |
| | qmCommand.append("cd "); |
| | qmCommand.append(baseDir); |
| | qmCommand.append(" ; "); |
| qmCommand.append(msg->execPath) ; | qmCommand.append(msg->execPath) ; |
| qmCommand.append(" ") ; | qmCommand.append(" ") ; |
| qmCommand.append(inputFileName) ; | qmCommand.append(inputFileName) ; |
| |
| iret = fprintf(inputFile,"%d %d\n",msg->numAllAtoms, numPntChrgs); | iret = fprintf(inputFile,"%d %d\n",msg->numAllAtoms, numPntChrgs); |
| if ( iret < 0 ) { NAMD_die(strerror(errno)); } | if ( iret < 0 ) { NAMD_die(strerror(errno)); } |
| | |
| DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " << inputFileName << " and " << msg->numAllPntChrgs << " point charges." << std::endl); | DebugM(4, "Writing " << msg->numAllAtoms << " QM atom coords in file " << |
| | inputFileName.c_str() << " and " << msg->numAllPntChrgs << |
| | " point charges." << std::endl); |
| | |
| // write QM and dummy atom coordinates to input file. | // write QM and dummy atom coordinates to input file. |
| QMAtomData *atmP = msg->data ; | QMAtomData *atmP = msg->data ; |
| |
| } | } |
| | |
| // runs QM command | // runs QM command |
| DebugM(4,"Running command ->" << qmCommand << "<-" << std::endl); | DebugM(4,"Running command ->" << qmCommand.c_str() << "<-" << std::endl); |
| iret = system(qmCommand.c_str()); | iret = system(qmCommand.c_str()); |
| | |
| if ( iret == -1 ) { NAMD_die(strerror(errno)); } | if ( iret == -1 ) { NAMD_die(strerror(errno)); } |
| |
| | |
| void ComputeQMMgr::pntChrgSwitching(QMGrpCalcMsg *msg) { | void ComputeQMMgr::pntChrgSwitching(QMGrpCalcMsg *msg) { |
| | |
| // We apply a switching function to the point charges to that there is a | // We apply a switching function to the point charges so that there is a |
| // smooth decay of the electrostatic environment seen by the QM system. | // smooth decay of the electrostatic environment seen by the QM system. |
| | |
| BigReal cutoff2 = msg->cutoff*msg->cutoff; | BigReal cutoff2 = msg->cutoff*msg->cutoff; |