void BasisSet::initCalculation() { if (m_init) return; // This currently just involves normalising all contraction coefficients m_numAtoms = m_atomPos.size(); m_gtoCN.clear(); // Initialise the new data structures that are hopefully more efficient unsigned int indexMO = 0; m_moIndices.resize(m_symmetry.size()); // Add a final entry to the gtoIndices m_gtoIndices.push_back(m_gtoA.size()); for(unsigned int i = 0; i < m_symmetry.size(); ++i) { switch (m_symmetry[i]) { case S: m_moIndices[i] = indexMO++; m_cIndices.push_back(m_gtoCN.size()); // Normalization of the S-type orbitals (normalization used in JMol) // (8 * alpha^3 / pi^3)^0.25 * exp(-alpha * r^2) for(unsigned j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) { m_gtoCN.push_back(m_gtoC[j] * pow(m_gtoA[j], 0.75) * 0.71270547); } break; case P: m_moIndices[i] = indexMO; indexMO += 3; m_cIndices.push_back(m_gtoCN.size()); // Normalization of the P-type orbitals (normalization used in JMol) // (128 alpha^5 / pi^3)^0.25 * [x|y|z]exp(-alpha * r^2) for(unsigned j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) { m_gtoCN.push_back(m_gtoC[j] * pow(m_gtoA[j], 1.25) * 1.425410941); m_gtoCN.push_back(m_gtoCN.back()); m_gtoCN.push_back(m_gtoCN.back()); } break; case D: // Cartesian - 6 d components // Order in xx, yy, zz, xy, xz, yz m_moIndices[i] = indexMO; indexMO += 6; m_cIndices.push_back(m_gtoCN.size()); // Normalization of the P-type orbitals (normalization used in JMol) // xx|yy|zz: (2048 alpha^7/9pi^3)^0.25 [xx|yy|zz]exp(-alpha r^2) // xy|xz|yz: (2048 alpha^7/pi^3)^0.25 [xy|xz|yz]exp(-alpha r^2) for(unsigned j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) { m_gtoCN.push_back(m_gtoC[j] * pow(m_gtoA[j], 1.75) * 1.645922781); m_gtoCN.push_back(m_gtoCN.back()); m_gtoCN.push_back(m_gtoCN.back()); m_gtoCN.push_back(m_gtoC[j] * pow(m_gtoA[j], 1.75) * 2.850821881); m_gtoCN.push_back(m_gtoCN.back()); m_gtoCN.push_back(m_gtoCN.back()); } break; case D5: // Spherical - 5 d components // Order in d0, d+1, d-1, d+2, d-2 // Form d(z^2-r^2), dxz, dyz, d(x^2-y^2), dxy m_moIndices[i] = indexMO; indexMO += 5; m_cIndices.push_back(m_gtoCN.size()); for(unsigned j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) { m_gtoCN.push_back(m_gtoC[j] * pow(2048.0 * pow(m_gtoA[j], 7.0) / (9.0 * M_PI*M_PI*M_PI), 0.25)); m_gtoCN.push_back(m_gtoC[j] * pow(2048.0 * pow(m_gtoA[j], 7.0) / (M_PI*M_PI*M_PI), 0.25)); m_gtoCN.push_back(m_gtoCN.back()); // I think this is correct but reaally need to check... m_gtoCN.push_back(m_gtoC[j] * pow(128.0 * pow(m_gtoA[j], 7.0) / (M_PI*M_PI*M_PI), 0.25)); m_gtoCN.push_back(m_gtoC[j] * pow(2048.0 * pow(m_gtoA[j], 7.0) / (M_PI*M_PI*M_PI), 0.25)); } break; case F: m_moIndices[i] = indexMO; indexMO += 8; m_cIndices.push_back(m_gtoCN.size()); qDebug() << "F Basis set not handled - results may be incorrect."; break; case F7: m_moIndices[i] = indexMO; indexMO += 7; m_cIndices.push_back(m_gtoCN.size()); qDebug() << "F7 Basis set not handled - results may be incorrect."; break; default: qDebug() << "Basis set not handled - results may be incorrect."; } } m_init = true; outputAll(); }
int main(int argc, char **argv) { char *outputFile = argv[1]; char *pathName = argv[2]; char ans[0]; char strp[999]; struct stat status; struct dirent *pDirent; //struct dirent *ini; DIR* dir; SortedListPtr list = SLCreate(compareStrings); int st = 0; if(argc != 3) { printf("Incorrect amount of arguments"); return 0; } FILE *ofp; ofp = fopen(outputFile, "w"); if(!ofp) { perror("Cannot open output file"); exit(EXIT_FAILURE); } st = stat(pathName,&status); if(st != 0) { printf("Error"); return 1; } if(S_ISREG(status.st_mode)) { readprocess(pathName, list); outputAll(list, ofp, pathName); fclose(ofp); return 1; } dir = opendir(pathName); //returns pointer to stream if(dir == NULL) printf("Could not open directory: %s\n", pathName); else printf("\nWe are inside: %s \n", pathName); char *currentPath = malloc(strlen(pathName)+1); currentPath = pathName; pDirent = readdir(dir); while(pDirent != NULL) { if(pDirent->d_type == DT_REG) { char thePath[9999]; strcpy(thePath, currentPath); strcat(strcat(thePath,"/"),pDirent->d_name); char *sv = thePath; strcpy(charptr[i], sv); readprocess(charptr[i], list); i++; } if(pDirent->d_type == DT_DIR && strcmp(pDirent->d_name, ".") != 0 && strcmp(pDirent->d_name, "..") != 0 ) { //printf("%s\n\n", pDirent->d_name); subDirectory(pDirent->d_name, currentPath, list); } pDirent = readdir(dir); } //closes parent directory closedir(dir); //-=-=-=-=--=-==-=-=-==-THIS WILL OUTPUT TO FILE-=-=--=-==-=-=-==-==--=-= //pass the list and print it outputAll(list, ofp, pathName); fclose(ofp); printf("Goodbye\n"); //-=-=-=-=-=-=--=-==-=-=-=-=-=-=--=-==-=-=-==-==--=-=-===-==-=-=-=-==-=-=- return 0; }