basisset.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                          basisset.cpp  -  description
00003                              -------------------
00004     begin                : Mon Jun 30 2003
00005     copyright            : (C) 2003-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00028 
00029 
00030 
00032 
00033 // C++ heqder files
00034 #include <cassert>
00035 
00036 // Qt header files
00037 #include <qstring.h>
00038 #include <qstringlist.h>
00039 
00040 // Xbrabo header files
00041 #include <basisset.h>
00042 
00043 
00047 
00049 unsigned int Basisset::basisToNum(const QString& basis)
00052 {
00053   initBasissets(); // checks itself whether the call was needed
00054 
00055   assert(basToNum.find(basis) != basToNum.end());
00056   
00057   return basToNum[basis];
00058 }
00059 
00061 QString Basisset::numToBasis(const unsigned int basis)
00064 {
00065   initBasissets(); // checks itself whether the call was needed
00066 
00067   assert(basis < numBasissets);
00068   
00069   return numToBas[basis];
00070 }
00071 
00073 QString Basisset::numToBasisDir(const unsigned int basis)
00076 {
00077   initBasissets(); // checks itself whether the call was needed
00078 
00079   assert(basis < numBasissets);
00080 
00081   return numToDir[basis];
00082 }
00083 
00085 QString Basisset::extension()
00087 {
00088   return QString("basis");
00089 }
00090 
00092 unsigned int Basisset::maxBasissets()
00094 {
00095   initBasissets(); // checks itself whether the call was needed
00096 
00097   return numBasissets;
00098 }
00099 
00101 unsigned int Basisset::contractedFunctions(const unsigned int basis, const unsigned int atom)
00106 {
00107   initBasissets(); // checks itself whether the call was needed
00108 
00109   if(atom < 1 || basis >= numBasissets)
00110     return 0;
00111   else if(atom < 3)
00112     return ncf[basis][0];
00113   else if(atom < 11)
00114     return ncf[basis][1];
00115   else if(atom < 19)
00116     return ncf[basis][2];
00117   else if(atom < 21)
00118     return ncf[basis][3];
00119   else if(atom < 31)
00120     return ncf[basis][4];
00121   else if(atom < 37)
00122     return ncf[basis][5];
00123   else if(atom < 39)
00124     return ncf[basis][6];
00125   else if(atom < 49)
00126     return ncf[basis][7];
00127   else if(atom < 55)
00128     return ncf[basis][8];
00129 
00130   return 0; // if atom > 54, so also for unknown atoms
00131 }
00132 
00136 
00138 Basisset::Basisset()
00140 {
00141 
00142 }
00143 
00145 Basisset::~Basisset()
00147 {
00148 
00149 }
00150 
00152 void Basisset::initBasissets()
00155 {  
00156   if(isInitialized)
00157     return;
00158   isInitialized = true;
00159 
00161   numToBas.clear();
00162   numToDir.clear();
00163   basToNum.clear();
00164   ncf.clear();
00165 
00166   QString basis, basdir;
00167   std::vector<unsigned int> periods(9);
00168   numBasissets = 0;
00169   basis = "3-21G";              basdir = "3-21G";              numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00170     periods[0] =  2; periods[1] =  9; periods[2] = 13; periods[3] = 17; periods[4] = 29; 
00171     periods[5] = 23; periods[6] = 27; periods[7] = 39; periods[8] = 33; ncf.push_back(periods);
00172   basis = "3-21G*";             basdir = "3-21Gp";             numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00173     periods[0] =  2; periods[1] =  9; periods[2] = 19; periods[3] = 23; periods[4] = 29; 
00174     periods[5] = 29; periods[6] = 33; periods[7] = 39; periods[8] = 39; ncf.push_back(periods);
00175   basis = "3-21G**";            basdir = "3-21Gpp";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00176     periods[0] =  5; periods[1] =  9; periods[2] = 19; periods[3] = 23; periods[4] = 29; 
00177     periods[5] = 29; periods[6] = 33; periods[7] = 39; periods[8] = 39; ncf.push_back(periods);
00178   basis = "3-21+G";             basdir = "3-21+G";             numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00179     periods[0] =  2; periods[1] = 13; periods[2] = 17; periods[3] =  0; periods[4] =  0; 
00180     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00181   basis = "3-21+G*";            basdir = "3-21+Gp";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00182     periods[0] =  2; periods[1] = 13; periods[2] = 23; periods[3] =  0; periods[4] =  0; 
00183     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00184   basis = "3-21+G**";           basdir = "3-21+Gpp";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00185     periods[0] =  5; periods[1] = 13; periods[2] = 23; periods[3] =  0; periods[4] =  0; 
00186     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00187   basis = "6-31G";              basdir = "6-31G";              numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00188     periods[0] =  2; periods[1] =  9; periods[2] = 13; periods[3] = 17; periods[4] = 29; 
00189     periods[5] = 24; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00190   basis = "6-31G*";             basdir = "6-31Gp";             numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00191     periods[0] =  2; periods[1] = 15; periods[2] = 19; periods[3] = 23; periods[4] = 36; 
00192     periods[5] = 30; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00193   basis = "6-31G**";            basdir = "6-31Gpp";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00194     periods[0] =  5; periods[1] = 15; periods[2] = 19; periods[3] = 23; periods[4] = 36; 
00195     periods[5] = 30; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00196   basis = "6-31+G";             basdir = "6-31+G";             numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00197     periods[0] =  2; periods[1] = 13; periods[2] = 17; periods[3] = 21; periods[4] = 42; 
00198     periods[5] = 28; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00199   basis = "6-31+G*";            basdir = "6-31+Gp";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00200     periods[0] =  2; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00201     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00202   basis = "6-31+G**";           basdir = "6-31+Gpp";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00203     periods[0] =  5; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00204     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00205   basis = "6-31++G";            basdir = "6-31++G";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00206     periods[0] =  3; periods[1] = 13; periods[2] = 17; periods[3] = 21; periods[4] = 42; 
00207     periods[5] = 28; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00208   basis = "6-31++G*";           basdir = "6-31++Gp";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00209     periods[0] =  3; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00210     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00211   basis = "6-31++G**";          basdir = "6-31++Gpp";          numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00212     periods[0] =  6; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00213     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00214   basis = "6-311G";             basdir = "6-311G";             numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00215     periods[0] =  3; periods[1] = 13; periods[2] = 21; periods[3] = 34; periods[4] = 39; 
00216     periods[5] = 39; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00217   basis = "6-311G*";            basdir = "6-311Gp";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00218     periods[0] =  3; periods[1] = 18; periods[2] = 26; periods[3] = 39; periods[4] = 46; 
00219     periods[5] = 44; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00220   basis = "6-311G**";           basdir = "6-311Gpp";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00221     periods[0] =  6; periods[1] = 18; periods[2] = 26; periods[3] = 39; periods[4] = 46; 
00222     periods[5] = 44; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00223   basis = "6-311+G";            basdir = "6-311+G";            numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00224     periods[0] =  3; periods[1] = 17; periods[2] = 25; periods[3] = 38; periods[4] = 51; 
00225     periods[5] = 43; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00226   basis = "6-311+G*";           basdir = "6-311+Gp";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00227     periods[0] =  3; periods[1] = 22; periods[2] = 30; periods[3] = 43; periods[4] = 58; 
00228     periods[5] = 48; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00229   basis = "6-311+G**";          basdir = "6-311+Gpp";          numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00230     periods[0] =  6; periods[1] = 22; periods[2] = 30; periods[3] = 43; periods[4] = 58; 
00231     periods[5] = 48; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00232   basis = "6-311++G";           basdir = "6-311++G";           numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00233     periods[0] =  4; periods[1] = 17; periods[2] = 25; periods[3] = 38; periods[4] = 51; 
00234     periods[5] = 43; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00235   basis = "6-311++G*";          basdir = "6-311++Gp";          numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00236     periods[0] =  4; periods[1] = 22; periods[2] = 30; periods[3] = 43; periods[4] = 58; 
00237     periods[5] = 48; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00238   basis = "6-311++G**";         basdir = "6-311++Gpp";         numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00239     periods[0] =  7; periods[1] = 22; periods[2] = 30; periods[3] = 43; periods[4] = 58; 
00240     periods[5] = 48; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00241   basis = "Scaled STO-3G";      basdir = "Scaled_STO-3G";      numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00242     periods[0] =  1; periods[1] =  5; periods[2] =  9; periods[3] = 13; periods[4] = 18; 
00243     periods[5] = 18; periods[6] = 22; periods[7] = 27; periods[8] = 27; ncf.push_back(periods);
00244   basis = "Scaled STO-3G*";     basdir = "Scaled_STO-3Gp";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00245     periods[0] =  1; periods[1] =  5; periods[2] = 14; periods[3] = 18; periods[4] = 23; 
00246     periods[5] = 23; periods[6] = 27; periods[7] = 32; periods[8] = 32; ncf.push_back(periods);
00247   basis = "Scaled 4-31G";       basdir = "Scaled_4-31G";       numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00248     periods[0] =  2; periods[1] =  9; periods[2] =  0; periods[3] =  0; periods[4] =  0; 
00249     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00250   basis = "Scaled 4-31G*";      basdir = "Scaled_4-31Gp";      numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00251     periods[0] =  2; periods[1] = 15; periods[2] =  0; periods[3] =  0; periods[4] =  0; 
00252     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00253   basis = "Scaled 4-31G**";     basdir = "Scaled_4-31Gpp";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00254     periods[0] =  5; periods[1] = 15; periods[2] =  0; periods[3] =  0; periods[4] =  0; 
00255     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00256   basis = "Scaled 6-21G";       basdir = "Scaled_6-21G";       numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00257     periods[0] =  2; periods[1] =  9; periods[2] = 13; periods[3] =  0; periods[4] =  0; 
00258     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00259   basis = "Scaled 6-21G*";      basdir = "Scaled_6-21Gp";      numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00260     periods[0] =  2; periods[1] =  9; periods[2] = 13; periods[3] =  0; periods[4] =  0; 
00261     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00262   basis = "Scaled 6-21G**";     basdir = "Scaled_6-21Gpp";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00263     periods[0] =  5; periods[1] =  9; periods[2] = 13; periods[3] =  0; periods[4] =  0; 
00264     periods[5] =  0; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00265   basis = "Scaled 6-31G";       basdir = "Scaled_6-31G";       numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00266     periods[0] =  2; periods[1] =  9; periods[2] = 13; periods[3] = 17; periods[4] = 29; 
00267     periods[5] = 24; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00268   basis = "Scaled 6-31G*";      basdir = "Scaled_6-31Gp";      numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00269     periods[0] =  2; periods[1] = 15; periods[2] = 19; periods[3] = 23; periods[4] = 36; 
00270     periods[5] = 30; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00271   basis = "Scaled 6-31G**";     basdir = "Scaled_6-31Gpp";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00272     periods[0] =  5; periods[1] = 15; periods[2] = 19; periods[3] = 23; periods[4] = 36; 
00273     periods[5] = 30; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00274   basis = "Scaled 6-31+G";      basdir = "Scaled_6-31+G";      numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00275     periods[0] =  2; periods[1] = 13; periods[2] = 17; periods[3] = 21; periods[4] = 42; 
00276     periods[5] = 28; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00277   basis = "Scaled 6-31+G*";     basdir = "Scaled_6-31+Gp";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00278     periods[0] =  2; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00279     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00280   basis = "Scaled 6-31+G**";    basdir = "Scaled_6-31+Gpp";    numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00281     periods[0] =  5; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00282     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00283   basis = "Scaled 6-31++G";     basdir = "Scaled_6-31++G";     numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00284     periods[0] =  3; periods[1] = 13; periods[2] = 17; periods[3] = 21; periods[4] = 42; 
00285     periods[5] = 28; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00286   basis = "Scaled 6-31++G*";    basdir = "Scaled_6-31++Gp";    numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00287     periods[0] =  3; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00288     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00289   basis = "Scaled 6-31++G**";   basdir = "Scaled_6-31++Gpp";   numToBas += basis; numToDir += basdir; basToNum[basis] = numBasissets++;
00290     periods[0] =  6; periods[1] = 19; periods[2] = 23; periods[3] = 27; periods[4] = 49; 
00291     periods[5] = 34; periods[6] =  0; periods[7] =  0; periods[8] =  0; ncf.push_back(periods);
00292 }
00293 
00297 
00298 bool Basisset::isInitialized = false; 
00299 QStringList Basisset::numToBas = QStringList(); 
00300 QStringList Basisset::numToDir = QStringList(); 
00301 QMap <QString, unsigned int> Basisset::basToNum = QMap<QString, unsigned int>(); 
00302 unsigned int Basisset::numBasissets = 0; 
00303 std::vector < std::vector<unsigned int> > Basisset::ncf; 
00304 

Generated on Fri May 19 14:31:53 2006 for Brabosphere by  doxygen 1.4.6-NO