brabobase.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                         brabobase.cpp  -  description
00003                              -------------------
00004     begin                : Sun Jul 28 2002
00005     copyright            : (C) 2002-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  ***************************************************************************/
00018 
00027 
00028 
00029 
00031 
00032 // C++ header files
00033 #include <algorithm>
00034 #include <cassert>
00035 #include <cmath>  
00036 
00037 // Qt header files
00038 #include <qapplication.h>
00039 #include <qbuttongroup.h>
00040 #include <qcheckbox.h>
00041 #include <qcombobox.h>
00042 #include <qdom.h>
00043 #include <qfiledialog.h>
00044 #include <qlabel.h>
00045 #include <qlayout.h>
00046 #include <qlineedit.h>
00047 #include <qlistbox.h>
00048 #include <qlistview.h>
00049 #include <qmessagebox.h>
00050 #include <qpixmap.h>
00051 #include <qprocess.h>
00052 #include <qpushbutton.h>
00053 #include <qradiobutton.h>
00054 #include <qspinbox.h>
00055 #include <qstring.h>
00056 #include <qtable.h>
00057 #include <qtextedit.h>
00058 #include <qtoolbutton.h>
00059 #include <qvalidator.h>
00060 #include <qwidgetstack.h>
00061 
00062 // Xbrabo header files
00063 #include "atomset.h"
00064 #include "basisset.h"
00065 #include "brabobase.h"
00066 #include "domutils.h"
00067 #include "iconsets.h"
00068 #include "paths.h"
00069 #include "textviewwidget.h"
00070 #include "utils.h"
00071 #include "version.h"
00072 
00073 
00077 
00079 BraboBase::BraboBase(AtomSet* atomset, QWidget* parent, const char* name, bool modal, WFlags fl) : BraboWidget(parent, name, modal, fl),
00080   atoms(atomset)
00082 {
00083   assert(atomset != 0);
00084   makeConnections();
00085   init();
00086 }
00087 
00089 BraboBase::~BraboBase()
00091 {
00092 
00093 }
00094 
00096 void BraboBase::setForces(const bool state)
00099 {  
00100   if(calcForces != state)
00101   {
00102     calcForces = state;
00103     if(calcForces)
00104     {
00106       if(ComboBoxSCFMethod->currentItem() == 2)
00107         ComboBoxSCFMethod->setCurrentItem(0);
00108       ComboBoxSCFMethod->removeItem(2);
00110       GroupBoxFORC->setEnabled(true);
00111       CheckBoxDebugFORC->setEnabled(true);
00112       GroupBoxExtraFORC->setEnabled(true);      
00113     }
00114     else
00115     {
00117       ComboBoxSCFMethod->insertItem("RMP2");
00119       GroupBoxFORC->setEnabled(false);
00120       CheckBoxDebugFORC->setEnabled(false);
00121       GroupBoxExtraFORC->setEnabled(false);
00122     }
00123   }
00124 }
00125 
00127 void BraboBase::setDescription(const QString description)
00129 {  
00130   calcDescription = description;
00131 }
00132 
00134 void BraboBase::setName(const QString name)
00136 {  
00137   calcName = name;
00138 }
00139 
00141 void BraboBase::setExtendedFormat(const bool state)
00143 {  
00144   calcXF = state;
00145 }
00146 
00148 void BraboBase::setPVMHosts(const QStringList& hosts)
00150 {  
00151   ListBoxNOTH2->clear();
00152   ListBoxNOTH2->insertStringList(hosts);
00153 }
00154 
00156 QString BraboBase::method() const
00158 {
00159   QString result = ComboBoxSCFMethod->currentText() + "(" + ComboBoxSCFType->currentText() + ")//";
00160   if(RadioButtonBAS1->isChecked())
00161   {
00163     result += ComboBoxBAS1->currentText();
00164   }
00165   else
00166   {
00167     if(ListViewBAS->childCount() != 0)
00168       result += ListViewBAS->firstChild()->text(1);
00169   }
00170   return result;  
00171 }
00172 
00174 QStringList BraboBase::basissets(bool& ok)
00178 {
00179   assert(data.listAtoms.size() == data.listBasissets.size());
00180 
00181   vector<unsigned int> neededAtoms = atoms->usedAtomicNumbers();
00182   vector<unsigned int> missingAtoms;
00183   QStringList result;
00184   for(vector<unsigned int>::const_iterator it = neededAtoms.begin(); it != neededAtoms.end(); it++)
00185   {
00186     if(data.useOneBasisset)
00187       result += QString(Paths::basisset + QDir::separator() + Basisset::numToBasisDir(data.basisset1) + QDir::separator() + AtomSet::numToAtom(*it).stripWhiteSpace() + "." + Basisset::extension());
00188     else
00189     {
00191       vector<unsigned int>::iterator itBasissets = data.listBasissets.begin();
00192       vector<unsigned int>::iterator itAtoms;
00193       for(itAtoms = data.listAtoms.begin(); itAtoms != data.listAtoms.end(); itAtoms++, itBasissets++)
00194       {
00195         if(*it == *itAtoms)
00196           break;
00197       }
00198       if(itAtoms == data.listAtoms.end())
00199       {
00201         missingAtoms.push_back(*it);
00202       }
00203       else
00204       {
00206         result += QString(Paths::basisset + QDir::separator() + Basisset::numToBasisDir(*itBasissets) + QDir::separator() + AtomSet::numToAtom(*it).stripWhiteSpace() + "." + Basisset::extension());
00207       }
00208     }
00209   }
00210   
00211   if(missingAtoms.empty())
00212     // all atoms have a basisset
00213     ok = true;
00214   else
00215   {
00216     // show an error with the missing atoms/basissets
00217     QString atomList;
00218     for(vector<unsigned int>::iterator it = missingAtoms.begin(); it != missingAtoms.end(); it++)
00219       atomList += QString(" " + AtomSet::numToAtom(*it));
00220     QMessageBox::warning(this, tr("Check basis sets") , tr("The following atom types do not have a basis set assigned:") + "\n" + atomList);
00221     ok = false;
00222   }
00223   return result;
00224 }
00225 
00227 QString BraboBase::startVector(bool& prefer, unsigned int& size1, unsigned int& size2)
00236 {
00238   prefer = data.preferStartvector;
00239 
00241   unsigned int nel = 0;
00242   for(unsigned int i = 0; i < atoms->count(); i++)
00243     nel += atoms->atomicNumber(i);
00244   nel += data.charge;
00245   nel /= 2;
00246   qDebug("number of electrons = %d", nel);
00247 
00249   vector<unsigned int> usedAtoms = atoms->usedAtomicNumbers();
00250   vector<unsigned int> ncfAtoms(usedAtoms.size());
00251   for(unsigned int i = 0; i < usedAtoms.size(); i++)
00252   {
00253     // get the basis set number for this atom type (very similar to the code of basissets()
00254     unsigned int basisNum = 0;
00255     if(data.useOneBasisset)
00256       basisNum = data.basisset1;
00257     else
00258     {
00259       vector<unsigned int>::iterator itBasissets = data.listBasissets.begin();
00260       vector<unsigned int>::iterator itAtoms;
00261       for(itAtoms = data.listAtoms.begin(); itAtoms != data.listAtoms.end(); itAtoms++, itBasissets++)
00262       {
00263         if(usedAtoms[i] == *itAtoms)
00264           break;
00265       }
00266       if(itAtoms == data.listAtoms.end())
00267       {
00269         // should never happen whem basissets was called previously, so no messagebox is shown
00270         size1 = 0;
00271         size2 = 0;
00272         return QString::null;
00273       }
00274       else
00276         basisNum = *itBasissets;
00277     }
00278     
00279     // get the NCF for this atom type
00280     ncfAtoms[i] = Basisset::contractedFunctions(basisNum, usedAtoms[i]);
00281   }
00282   // sum all ncf's into NCF
00283   unsigned int ncf = 0;
00284   for(unsigned int i = 0; i < atoms->count(); i++)
00285   {
00286     // get the ncf for this atom
00287     vector<unsigned int>::iterator it1 = std::find(usedAtoms.begin(), usedAtoms.end(), atoms->atomicNumber(i)); // should always return something within range
00288     ncf += ncfAtoms[std::distance(usedAtoms.begin(), it1)]; 
00289     qDebug("ncf after atom %d is %d", i, ncf);
00290   }
00291   
00293   size1 = nel * (10*ncf + static_cast<unsigned int>(ceil(ncf/8.0)));   // *nix
00294   size2 = nel * (10*ncf + 2*static_cast<unsigned int>(ceil(ncf/8.0))); // Windows
00295   qDebug("BraboBase::startVector: sizes are %d and %d",size1, size2);
00296 
00297   if(!data.useStartvector)
00298     return QString::null;
00299 
00300   return data.startvector;
00301 }
00302 
00304 unsigned int BraboBase::maxIterations() const
00306 {
00307   if(data.numIter == -1)
00308     return 50;
00309 
00310   return static_cast<unsigned int>(data.numIter);
00311 }
00312 
00314 QStringList BraboBase::generateInput(unsigned int program)
00319 {
00320   QStringList result, extra;
00321   
00322   result += "! " + tr("This file has been generated by") + " " + Version::appName + " " + Version::appVersion;
00323   result += "! " + tr("All changes made in this file will be lost!");
00324 
00325   switch(program)
00326   {
00327     case BRABO:
00330       result += "F02=" + calcName + ".crd";
00332       result += "F04=" + calcName + ".out";
00334       result += "F07=" + calcName + ".pun";
00336       if(CheckBoxF11->isOn() || CheckBoxSTOCK->isOn())
00337       {
00338         if(Paths::bin.isNull())
00339           result += "F11=" + calcName + ".11";
00340         else
00341           result += "F11=" + Paths::bin + QDir::separator() + calcName + ".11";
00342       }
00344       result += "F99=" + calcName + ".sta";
00345       
00348       result += "mole      " + calcName;
00350       if(!calcDescription.isEmpty())
00351         result += "text      " + calcDescription;
00353       if(CheckBoxDST->isChecked())
00354         result += "dst";
00356       if(CheckBoxACD->isChecked())
00357         result += "acd";
00359       result += tableContents(TableMain);
00360 
00362       if(CheckBoxPVM->isChecked())
00363       {
00365         result += "PVM";
00366         for(unsigned int i = 0; i < ListBoxNOTH1->count(); i++)
00367           result += "noth      " + ListBoxNOTH1->text(i);
00369         if(SpinBoxNCST->value() != 0)
00370           result += inputLine("ncst", SpinBoxNCST->value());
00372         if(SpinBoxNTAS->value() != 0)
00373           result += inputLine("ntas", SpinBoxNTAS->value());
00375         if(CheckBoxNOSE->isChecked())
00376           result += "nose";
00378         if(SpinBoxNICE->value() != -1)
00379           result += inputLine("nice", SpinBoxNICE->value());
00381         if(CheckBoxPACK->isChecked())
00382           result += "pack";
00384         if(CheckBoxDebugPVM->isChecked())
00385           result += "prin";
00386       }
00388       result += tableContents(TablePVM);
00389 
00391       result += "INTE";
00392       switch (ComboBoxSCFType->currentItem())
00393       {
00394         case 0: 
00395                 result += "mia";
00396                 break;
00397         case 1: 
00398                 break;
00399         case 2: 
00400                 result += "twoe";
00401       }
00403       result += "angs";
00404       result += "exfi";
00406       if(calcXF)
00407         result += "xfcr";
00409       if(CheckBoxSYMM->isChecked())
00410       {
00411         if(RadioButtonSYMM1->isOn())
00412           result += "symm";
00413         else
00414           result += validatedSYMMLine(CheckBoxSYMMx, CheckBoxSYMMy, CheckBoxSYMMz, CheckBoxSYMMxy, CheckBoxSYMMxz, CheckBoxSYMMyz, CheckBoxSYMMxyz);
00415       }
00417       { 
00418         double threINTE = - log10(LineEditThreINTEa->text().toDouble()*pow(10.0, - LineEditThreINTEb->text().toDouble()));
00419         if(fabs(threINTE - 8.0) > 0.00001)
00420           result += inputLine("thre", threINTE);
00421       }  
00423       if(CheckBoxSKPC->isChecked())
00424         result += "skpc";
00426       if(CheckBoxGEOP->isChecked())
00427         result += "geop";
00429       if(CheckBoxGoonINTE->isChecked())
00430         result += "goon";
00432       result += parsedNUCLlines();
00434       if(CheckBoxIntINTE->isChecked())
00435         result += "prin";
00437       if(CheckBoxShellsINTE->isChecked())
00438         result += "long";      
00440       result += "xfba";
00442       if(RadioButtonBAS1->isChecked())
00443       {
00444         QString tempstring = Paths::basisset + QDir::separator() + Basisset::numToBasisDir(ComboBoxBAS1->currentItem());
00445         result += QString("gbas      %1%2").arg(Basisset::extension(),-10).arg(tempstring);
00446       }
00447       else
00448       {
00449         QString tempstring;
00450         QListViewItemIterator it(ListViewBAS);
00451         for( ; it.current(); ++it)
00452         {
00453           tempstring = it.current()->text(0);
00454           result += "abas      " + tempstring + "        " + Paths::basisset + QDir::separator() + Basisset::numToBasisDir(Basisset::basisToNum(it.current()->text(1))) + QDir::separator() + tempstring.stripWhiteSpace() + "." + Basisset::extension();
00455         }
00456       }
00458       result += tableContents(TableINTE);
00459 
00461       result += "SCF";
00462       switch (ComboBoxSCFMethod->currentItem())
00463       {
00464         case 0: 
00465                 break;
00466         case 1: 
00467                 result += "uhf";
00468                 break;
00469         case 2: 
00470                 if(RadioButtonMP2E1->isOn())
00471                   result += inputLine("mp2e", 0);
00472                 else if(RadioButtonMP2E2->isOn())
00473                   result += inputLine("mp2e", -1);
00474                 else
00475                   result += inputLine("mp2e", SpinBoxMP2E1->value(), SpinBoxMP2E2->value());
00476                 break;
00477         /*
00478         case 3: // UMP2
00479                 result += "uhf";
00480                 result += "mp2e";
00481                 break;
00482         case 4: // RCIS
00483                 result += "cis";
00484                 break;
00485         case 5: // UCIS
00486                 result += "uhf";
00487                 result += "cis";
00488                 break;
00489         */
00490       }
00492       if(ComboBoxSCFType->currentItem() == 1)
00493         result += "drct";
00495       result += inputLine("ipol", LineEditIPOL->text().toDouble());
00497       result += inputLine("star",0,0,99);
00499       if(SpinBoxCHAR->value() != 0)
00500         result += inputLine("char", SpinBoxCHAR->value());
00502       if((ComboBoxSCFMethod->currentItem() == 2) && CheckBoxMP2D->isChecked())
00503       {
00504         if(RadioButtonMP2E1->isOn())
00505           result += inputLine("mp2d", 0);
00506         else if(RadioButtonMP2E2->isOn())
00507           result += inputLine("mp2d", -1);
00508         else
00509           result += inputLine("mp2d", SpinBoxMP2E1->value(), SpinBoxMP2E2->value());
00510       }
00512       if(CheckBoxSCRF->isChecked())
00513         result += inputLine("scrf", LineEditSCRF1->text().toDouble(), LineEditSCRF2->text().toDouble());
00515       if(CheckBoxFIEL->isChecked())
00516         result += inputLine("fiel", LineEditFIELx->text().toDouble(), LineEditFIELy->text().toDouble(), LineEditFIELz->text().toDouble()); 
00518       if(CheckBoxELMO->isChecked())
00519         result += "elmo";           
00521       if(CheckBoxMULL1->isChecked())
00522       {
00523         if(CheckBoxMULL2->isChecked())
00524           result += inputLine("mull", 1);
00525         else
00526           result += "mull";
00527         if(CheckBoxMULL3->isChecked())
00528         {
00529           if(CheckBoxMULL2->isChecked())
00530             result += inputLine("mul1", 1);
00531           else
00532             result += "mul1";
00533         }
00534       }
00536       if(CheckBoxLOCA->isChecked())
00537         result += inputLine("loca", SpinBoxLOCA->value(), LineEditLOCA->text().toDouble());
00539       if(CheckBoxEXIT->isChecked())
00540         result += "exit";
00542       if(CheckBoxJAB->isChecked())
00543         result += "jab";
00545       if(SpinBoxITER->value() != -1)
00546         result += inputLine("iter", SpinBoxITER->value());
00548       {
00549         QString a, c;
00550         bool addit;
00551         double threSCF = - log10(LineEditThreSCF1a->text().toDouble()*pow(10.0, - LineEditThreSCF1b->text().toDouble()));
00552         if(fabs(threSCF - 8.0) > 0.00001)
00553         {
00554           a.setNum(threSCF,'f',10).truncate(10);
00555           addit = true;
00556         }
00557         else
00558         {
00559           a = "          ";
00560           addit = false;
00561         }        
00562         threSCF = - log10(LineEditThreSCF2a->text().toDouble()*pow(10.0, - LineEditThreSCF2b->text().toDouble()));
00563         if(fabs(threSCF + log10(3.0*pow(10.0, -6.0))) > 0.00001)
00564         {
00565           c.setNum(threSCF,'f',10).truncate(10);
00566           addit = true;
00567         }
00568         else
00569           c = "          ";
00570         if(addit)
00571           result += "thre      " + a + "          " + c;
00572       }     
00574       { 
00575         double threSTHR = - log10(LineEditSthrSCFa->text().toDouble() * pow(10.0, - LineEditSthrSCFb->text().toDouble()));
00576         if(fabs(threSTHR - 4.0) > 0.00001)
00577           result += inputLine("sthr",threSTHR);
00578       }     
00580       if(CheckBoxVTHR->isChecked())
00581         result += "vthr";
00583       if(CheckBoxDIIS->isChecked())
00584         result += inputLine("diis",-1);
00585       else
00586       {
00587         qDebug("generateInput: MAXD = %d",SpinBoxDIIS->value());
00588         if(fabs(LineEditDIIS->text().toDouble() - 0.03) > 0.00001)
00589           result += inputLine("diis", LineEditDIIS->text().toDouble());
00590         if(SpinBoxDIIS->value() != -1)
00591           result +=inputLine("maxd", SpinBoxDIIS->value());
00592       }
00594       if(CheckBoxGoonSCF->isChecked())
00595         result += "goon";
00597       if(fabs(LineEditLVSH->text().toDouble()) > 0.00001)
00598       {
00599         if(CheckBoxDLVS->isChecked())
00600           result += inputLine("dlvs", LineEditLVSH->text().toDouble());
00601         else
00602           result +=inputLine("lvsh", LineEditLVSH->text().toDouble());
00603       }
00605       if(CheckBoxPRWF->isChecked())
00606         result += "prwf";
00608       if(CheckBoxPRDM->isChecked())
00609         result += "prdm";    
00611       if(CheckBoxJACO->isChecked())
00612         result += "jaco";
00614       {
00615         int b = 0;
00616         if(CheckBoxPrintSCF3->isChecked())
00617           b = 3;
00618         else if(CheckBoxPrintSCF2->isChecked())
00619           b = 2;
00620         else if(CheckBoxPrintSCF1->isChecked())
00621           b = 1;
00622         if(b != 0)
00623           result += inputLine("prin", SpinBoxPrintSCF->value(), b);
00624       }      
00626       result += "punc";
00628       result += tableContents(TableSCF);
00629 
00631       if(calcForces)
00632       {
00633         result += "FORC";
00635         result += "punc";
00637         if(calcXF)
00638           result += "xffo";      
00640         if(CheckBoxFATO->isChecked())
00641           result += inputLine("fato", SpinBoxFATO->value());
00643         if(CheckBoxMIAForc->isChecked())
00644           result += "mia";
00646         if(CheckBoxDebugFORC->isChecked())
00647           result += "prin";
00648       }
00650       result += tableContents(TableFORC);
00651 
00653       result += "STOP";
00654       break;
00655 
00656     case STOCK:
00657       if(!CheckBoxSTOCK->isChecked())
00658         return QStringList();
00659 
00661       result += "mole      " + calcName;
00663       if(!Paths::bin.isEmpty())
00664         result += "F11=" + Paths::bin + QDir::separator() + calcName + ".11";
00666       result += "atde      " + calcName + ".atdens";
00668       if(!calcDescription.isEmpty())
00669         result += "text      " + calcDescription;
00671       if(RadioButtonStockDENS2->isChecked())
00672         result += "homd";
00674       else if(RadioButtonStockDENS3->isChecked())
00675         result += "lumd";
00677       else if(RadioButtonStockDENS4->isChecked())
00678         result += inputLine("trde", SpinBoxStockTRDE1->value(), SpinBoxStockTRDE2->value());
00680       if(ComboBoxSCFMethod->currentItem() == 1)
00681       {
00682         if(RadioButtonStockDENS5->isChecked())
00683           result += "uhf      1.";
00684         else
00685           result += "uhf";
00686       }
00688       if(ComboBoxStockMOLD->currentItem() == 1)
00689         result += "mold";
00691       if(CheckBoxStockELMO->isChecked())
00692         result += "elmo";
00694       if(CheckBoxStockEPAR->isChecked())
00695         result += "epar";
00696 
00698       result += "STOP";
00699       break;
00700   }
00701   
00702   return result;
00703 }
00704 
00706 QString BraboBase::generateAtdens(bool& ok)
00712 {
00713   if(!data.useStock)
00714     return QString::null;
00715 
00716   assert(data.listAtoms.size() == data.listBasissets.size());
00717 
00718   QStringList missingFiles;
00719   QString result;
00720   vector<unsigned int> neededAtoms = atoms->usedAtomicNumbers();
00721   for(vector<unsigned int>::const_iterator it = neededAtoms.begin(); it != neededAtoms.end(); it++)
00722   {
00723     QFile source;
00724     if(data.useOneBasisset)
00725       source.setName(Paths::basisset + QDir::separator() + Basisset::numToBasisDir(data.basisset1) + QDir::separator() + AtomSet::numToAtom(*it).stripWhiteSpace() + ".atdens");
00726     else
00727     {
00729       vector<unsigned int>::const_iterator itBasissets = data.listBasissets.begin();
00730       for(vector<unsigned int>::const_iterator itAtoms = data.listAtoms.begin(); itAtoms != data.listAtoms.end(); itAtoms++, itBasissets++)
00731       {
00732         if(*it == *itAtoms)
00733           break;
00734       }
00735       if(itBasissets != data.listBasissets.end())
00736         source.setName(Paths::basisset + QDir::separator() + Basisset::numToBasisDir(*itBasissets) + QDir::separator() + AtomSet::numToAtom(*it).stripWhiteSpace() + ".atdens");
00737       else
00738       {
00739         ok = false;
00740         return QString::null;
00741       }
00742     }
00744     if(!source.exists() || !source.open(IO_ReadOnly))
00745       missingFiles += source.name();
00746     else
00747     {
00748       // add the contents of the file to the result;
00749       QTextStream stream(&source);
00750       result += stream.read();
00751     }
00752   }
00753   
00754   if(missingFiles.isEmpty())
00755     // all atoms have a basisset
00756     ok = true;
00757   else
00758   {
00759     // show an error with the missing basissets
00760     QMessageBox::warning(this, tr("Building a custom atomic density basis set file") , tr("The following atomic density basis set files could not be found") + ":\n" + missingFiles.join("\n"));
00761     ok = false;
00762     result = QString::null;
00763   }
00764   return result;
00765 }
00766 
00768 void BraboBase::loadCML(const QDomElement* root)
00770 { 
00773   assert(!isVisible());
00774 
00775   const QString prefix = "energy_and_forces_";
00776   QDomNode childNode = root->firstChild();
00777   while(!childNode.isNull())
00778   {
00779     if(childNode.isElement() && childNode.toElement().tagName() == "parameter")
00780     {
00782       if(DomUtils::dictEntry(childNode, prefix + xml.SCFMethod))
00783         DomUtils::readNode(&childNode, &data.SCFMethod);
00784       else if(DomUtils::dictEntry(childNode, prefix + xml.SCFType))
00785         DomUtils::readNode(&childNode, &data.SCFType);
00786       else if(DomUtils::dictEntry(childNode, prefix + xml.useStartvector))
00787         DomUtils::readNode(&childNode, &data.useStartvector);
00788       else if(DomUtils::dictEntry(childNode, prefix + xml.startvector))
00789         DomUtils::readNode(&childNode, &data.startvector);
00790       else if(DomUtils::dictEntry(childNode, prefix + xml.preferStartvector))
00791         DomUtils::readNode(&childNode, &data.preferStartvector);
00792       else if(DomUtils::dictEntry(childNode, prefix + xml.charge))
00793         DomUtils::readNode(&childNode, &data.charge);
00794 
00796       else if(DomUtils::dictEntry(childNode, prefix + xml.useOneBasisset))
00797         DomUtils::readNode(&childNode, &data.useOneBasisset);
00798       else if(DomUtils::dictEntry(childNode, prefix + xml.basisset1))
00799         DomUtils::readNode(&childNode, &data.basisset1);
00800       else if(DomUtils::dictEntry(childNode, prefix + xml.basissetAtom))
00801         DomUtils::readNode(&childNode, &data.basissetAtom);
00802       else if(DomUtils::dictEntry(childNode, prefix + xml.basisset2))
00803         DomUtils::readNode(&childNode, &data.basisset2);
00804 
00805       else if(DomUtils::dictEntry(childNode, prefix + xml.listAtoms))
00806         DomUtils::readNode(&childNode, &data.listAtoms);
00807       else if(DomUtils::dictEntry(childNode, prefix + xml.listBasissets))
00808         DomUtils::readNode(&childNode, &data.listBasissets);
00809 
00811       else if(DomUtils::dictEntry(childNode, prefix + xml.MP2Type))
00812         DomUtils::readNode(&childNode, &data.MP2Type);
00813       else if(DomUtils::dictEntry(childNode, prefix + xml.MP2ExcludeOcc))
00814         DomUtils::readNode(&childNode, &data.MP2ExcludeOcc);
00815       else if(DomUtils::dictEntry(childNode, prefix + xml.MP2ExcludeVirt))
00816         DomUtils::readNode(&childNode, &data.MP2ExcludeVirt);
00817       else if(DomUtils::dictEntry(childNode, prefix + xml.MP2Density))
00818         DomUtils::readNode(&childNode, &data.MP2Density);
00819       else if(DomUtils::dictEntry(childNode, prefix + xml.useField))
00820         DomUtils::readNode(&childNode, &data.useField);
00821       else if(DomUtils::dictEntry(childNode, prefix + xml.fieldX))
00822         DomUtils::readNode(&childNode, &data.fieldX);
00823       else if(DomUtils::dictEntry(childNode, prefix + xml.fieldY))
00824         DomUtils::readNode(&childNode, &data.fieldY);
00825       else if(DomUtils::dictEntry(childNode, prefix + xml.fieldZ))
00826         DomUtils::readNode(&childNode, &data.fieldZ);
00827       else if(DomUtils::dictEntry(childNode, prefix + xml.useSCRF))
00828         DomUtils::readNode(&childNode, &data.useSCRF);
00829       else if(DomUtils::dictEntry(childNode, prefix + xml.SCRFEpsilon))
00830         DomUtils::readNode(&childNode, &data.SCRFEpsilon);
00831       else if(DomUtils::dictEntry(childNode, prefix + xml.SCRFRadius))
00832         DomUtils::readNode(&childNode, &data.SCRFRadius);
00833 
00835       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmetry))
00836         DomUtils::readNode(&childNode, &data.useSymmetry);
00837       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmAuto))
00838         DomUtils::readNode(&childNode, &data.useSymmAuto);
00839       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmX))
00840         DomUtils::readNode(&childNode, &data.useSymmX);
00841       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmY))
00842         DomUtils::readNode(&childNode, &data.useSymmY);
00843       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmZ))
00844         DomUtils::readNode(&childNode, &data.useSymmZ);
00845       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmXY))
00846         DomUtils::readNode(&childNode, &data.useSymmXY);
00847       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmYZ))
00848         DomUtils::readNode(&childNode, &data.useSymmYZ);
00849       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmXZ))
00850         DomUtils::readNode(&childNode, &data.useSymmXZ);
00851       else if(DomUtils::dictEntry(childNode, prefix + xml.useSymmXYZ))
00852         DomUtils::readNode(&childNode, &data.useSymmXYZ);
00853 
00855       else if(DomUtils::dictEntry(childNode, prefix + xml.valueIpol))
00856         DomUtils::readNode(&childNode, &data.valueIpol);
00857       else if(DomUtils::dictEntry(childNode, prefix + xml.useSkpc))
00858         DomUtils::readNode(&childNode, &data.useSkpc);
00859       else if(DomUtils::dictEntry(childNode, prefix + xml.printGeop))
00860         DomUtils::readNode(&childNode, &data.printGeop);
00861       else if(DomUtils::dictEntry(childNode, prefix + xml.printWF))
00862         DomUtils::readNode(&childNode, &data.printWF);
00863       else if(DomUtils::dictEntry(childNode, prefix + xml.printDM))
00864         DomUtils::readNode(&childNode, &data.printDM);
00865       else if(DomUtils::dictEntry(childNode, prefix + xml.useDST))
00866         DomUtils::readNode(&childNode, &data.useDST);
00867       else if(DomUtils::dictEntry(childNode, prefix + xml.useACD))
00868         DomUtils::readNode(&childNode, &data.useACD);
00869       else if(DomUtils::dictEntry(childNode, prefix + xml.saveF11))
00870         DomUtils::readNode(&childNode, &data.saveF11);
00871       else if(DomUtils::dictEntry(childNode, prefix + xml.useFato))
00872         DomUtils::readNode(&childNode, &data.useFato);
00873       else if(DomUtils::dictEntry(childNode, prefix + xml.numFato))
00874         DomUtils::readNode(&childNode, &data.numFato);
00875       else if(DomUtils::dictEntry(childNode, prefix + xml.useMIAForce))
00876         DomUtils::readNode(&childNode, &data.useMIAForce);
00877 
00879       else if(DomUtils::dictEntry(childNode, prefix + xml.useMulliken))
00880         DomUtils::readNode(&childNode, &data.useMulliken);
00881       else if(DomUtils::dictEntry(childNode, prefix + xml.MullikenNoOverlap))
00882         DomUtils::readNode(&childNode, &data.MullikenNoOverlap);
00883       else if(DomUtils::dictEntry(childNode, prefix + xml.MullikenEachIter))
00884         DomUtils::readNode(&childNode, &data.MullikenEachIter);
00885       else if(DomUtils::dictEntry(childNode, prefix + xml.useStock))
00886         DomUtils::readNode(&childNode, &data.useStock);
00887       else if(DomUtils::dictEntry(childNode, prefix + xml.stockType))
00888         DomUtils::readNode(&childNode, &data.stockType);
00889       else if(DomUtils::dictEntry(childNode, prefix + xml.stockTotalDensity))
00890         DomUtils::readNode(&childNode, &data.stockTotalDensity);
00891       else if(DomUtils::dictEntry(childNode, prefix + xml.stockTransition1))
00892         DomUtils::readNode(&childNode, &data.stockTransition1);
00893       else if(DomUtils::dictEntry(childNode, prefix + xml.stockTransition2))
00894         DomUtils::readNode(&childNode, &data.stockTransition2);
00895       else if(DomUtils::dictEntry(childNode, prefix + xml.useStockElmo))
00896         DomUtils::readNode(&childNode, &data.useStockElmo);
00897       else if(DomUtils::dictEntry(childNode, prefix + xml.useStockEpar))
00898         DomUtils::readNode(&childNode, &data.useStockEpar);
00899 
00901       else if(DomUtils::dictEntry(childNode, prefix + xml.useBoys))
00902         DomUtils::readNode(&childNode, &data.useBoys);
00903       else if(DomUtils::dictEntry(childNode, prefix + xml.numBoysIter))
00904         DomUtils::readNode(&childNode, &data.numBoysIter);
00905       else if(DomUtils::dictEntry(childNode, prefix + xml.BoysThreshold))
00906         DomUtils::readNode(&childNode, &data.BoysThreshold);
00907       else if(DomUtils::dictEntry(childNode, prefix + xml.listNucl))
00908         DomUtils::readNode(&childNode, &data.listNucl);
00909       else if(DomUtils::dictEntry(childNode, prefix + xml.useElmo))
00910         DomUtils::readNode(&childNode, &data.useElmo);
00911       else if(DomUtils::dictEntry(childNode, prefix + xml.useExit))
00912         DomUtils::readNode(&childNode, &data.useExit);
00913       else if(DomUtils::dictEntry(childNode, prefix + xml.useJab))
00914         DomUtils::readNode(&childNode, &data.useJab);
00915 
00917       else if(DomUtils::dictEntry(childNode, prefix + xml.numIter))
00918         DomUtils::readNode(&childNode, &data.numIter);
00919       else if(DomUtils::dictEntry(childNode, prefix + xml.useJacobi))
00920         DomUtils::readNode(&childNode, &data.useJacobi);
00921       else if(DomUtils::dictEntry(childNode, prefix + xml.useDIIS))
00922         DomUtils::readNode(&childNode, &data.useDIIS);
00923       else if(DomUtils::dictEntry(childNode, prefix + xml.DIISThre))
00924         DomUtils::readNode(&childNode, &data.DIISThre);
00925       else if(DomUtils::dictEntry(childNode, prefix + xml.numDIISCoeff))
00926         DomUtils::readNode(&childNode, &data.numDIISCoeff);
00927       else if(DomUtils::dictEntry(childNode, prefix + xml.valueLvsh))
00928         DomUtils::readNode(&childNode, &data.valueLvsh);
00929       else if(DomUtils::dictEntry(childNode, prefix + xml.useDlvs))
00930         DomUtils::readNode(&childNode, &data.useDlvs);
00931       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdINTEa))
00932         DomUtils::readNode(&childNode, &data.thresholdINTEa);
00933       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdINTEb))
00934         DomUtils::readNode(&childNode, &data.thresholdINTEb);
00935       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdMIAa))
00936         DomUtils::readNode(&childNode, &data.thresholdMIAa);
00937       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdMIAb))
00938         DomUtils::readNode(&childNode, &data.thresholdMIAb);
00939       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdSCFa))
00940         DomUtils::readNode(&childNode, &data.thresholdSCFa);
00941       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdSCFb))
00942         DomUtils::readNode(&childNode, &data.thresholdSCFb);
00943       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdOverlapa))
00944         DomUtils::readNode(&childNode, &data.thresholdOverlapa);
00945       else if(DomUtils::dictEntry(childNode, prefix + xml.thresholdOverlapb))
00946         DomUtils::readNode(&childNode, &data.thresholdOverlapb);
00947       else if(DomUtils::dictEntry(childNode, prefix + xml.useVarThreMIA))
00948         DomUtils::readNode(&childNode, &data.useVarThreMIA);
00949 
00951       else if(DomUtils::dictEntry(childNode, prefix + xml.usePVM))
00952         DomUtils::readNode(&childNode, &data.usePVM);
00953       else if(DomUtils::dictEntry(childNode, prefix + xml.PVMNumShells))
00954         DomUtils::readNode(&childNode, &data.PVMNumShells);
00955       else if(DomUtils::dictEntry(childNode, prefix + xml.PVMNumTasks))
00956         DomUtils::readNode(&childNode, &data.PVMNumTasks);
00957       else if(DomUtils::dictEntry(childNode, prefix + xml.notOnMaster))
00958         DomUtils::readNode(&childNode, &data.notOnMaster);
00959       else if(DomUtils::dictEntry(childNode, prefix + xml.valueNice))
00960         DomUtils::readNode(&childNode, &data.valueNice);
00961       else if(DomUtils::dictEntry(childNode, prefix + xml.usePacked))
00962         DomUtils::readNode(&childNode, &data.usePacked);
00963 
00964       else if(DomUtils::dictEntry(childNode, prefix + xml.PVMExcludeHosts))
00965         DomUtils::readNode(&childNode, &data.PVMExcludeHosts);
00966 
00968       else if(DomUtils::dictEntry(childNode, prefix + xml.printDebugPVM))
00969         DomUtils::readNode(&childNode, &data.printDebugPVM);
00970       else if(DomUtils::dictEntry(childNode, prefix + xml.printDebugFORC))
00971         DomUtils::readNode(&childNode, &data.printDebugFORC);
00972       else if(DomUtils::dictEntry(childNode, prefix + xml.goonINTE))
00973         DomUtils::readNode(&childNode, &data.goonINTE);
00974       else if(DomUtils::dictEntry(childNode, prefix + xml.goonSCF))
00975         DomUtils::readNode(&childNode, &data.goonSCF);
00976       else if(DomUtils::dictEntry(childNode, prefix + xml.printIntegrals))
00977         DomUtils::readNode(&childNode, &data.printIntegrals);
00978       else if(DomUtils::dictEntry(childNode, prefix + xml.printShells))
00979         DomUtils::readNode(&childNode, &data.printShells);
00980       else if(DomUtils::dictEntry(childNode, prefix + xml.levelPrintSCF))
00981         DomUtils::readNode(&childNode, &data.levelPrintSCF);
00982       else if(DomUtils::dictEntry(childNode, prefix + xml.numVirtual))
00983         DomUtils::readNode(&childNode, &data.numVirtual);
00984 
00986       else if(DomUtils::dictEntry(childNode, prefix + xml.numLinesExtraMain))
00987         DomUtils::readNode(&childNode, &data.numLinesExtraMain);
00988       else if(DomUtils::dictEntry(childNode, prefix + xml.numLinesExtraPVM))
00989         DomUtils::readNode(&childNode, &data.numLinesExtraPVM);
00990       else if(DomUtils::dictEntry(childNode, prefix + xml.numLinesExtraINTE))
00991         DomUtils::readNode(&childNode, &data.numLinesExtraINTE);
00992       else if(DomUtils::dictEntry(childNode, prefix + xml.numLinesExtraSCF))
00993         DomUtils::readNode(&childNode, &data.numLinesExtraSCF);
00994       else if(DomUtils::dictEntry(childNode, prefix + xml.numLinesExtraFORC))
00995         DomUtils::readNode(&childNode, &data.numLinesExtraFORC);       
00996 
00997       else if(DomUtils::dictEntry(childNode, prefix + xml.hPosExtraMain))
00998         DomUtils::readNode(&childNode, &data.hPosExtraMain);
00999       else if(DomUtils::dictEntry(childNode, prefix + xml.hPosExtraPVM))
01000         DomUtils::readNode(&childNode, &data.hPosExtraPVM);
01001       else if(DomUtils::dictEntry(childNode, prefix + xml.hPosExtraINTE))
01002         DomUtils::readNode(&childNode, &data.hPosExtraINTE);
01003       else if(DomUtils::dictEntry(childNode, prefix + xml.hPosExtraSCF))
01004         DomUtils::readNode(&childNode, &data.hPosExtraSCF);
01005       else if(DomUtils::dictEntry(childNode, prefix + xml.hPosExtraFORC))
01006         DomUtils::readNode(&childNode, &data.hPosExtraFORC);
01007       else if(DomUtils::dictEntry(childNode, prefix + xml.vPosExtraMain))
01008         DomUtils::readNode(&childNode, &data.vPosExtraMain);
01009       else if(DomUtils::dictEntry(childNode, prefix + xml.vPosExtraPVM))
01010         DomUtils::readNode(&childNode, &data.vPosExtraPVM);
01011       else if(DomUtils::dictEntry(childNode, prefix + xml.vPosExtraINTE))
01012         DomUtils::readNode(&childNode, &data.vPosExtraINTE);
01013       else if(DomUtils::dictEntry(childNode, prefix + xml.vPosExtraSCF))
01014         DomUtils::readNode(&childNode, &data.vPosExtraSCF);
01015       else if(DomUtils::dictEntry(childNode, prefix + xml.vPosExtraFORC))
01016         DomUtils::readNode(&childNode, &data.vPosExtraFORC);
01017       else if(DomUtils::dictEntry(childNode, prefix + xml.contentsExtraMain))
01018           DomUtils::readNode(&childNode, &data.contentsExtraMain);
01019       else if(DomUtils::dictEntry(childNode, prefix + xml.contentsExtraPVM))
01020           DomUtils::readNode(&childNode, &data.contentsExtraPVM);
01021       else if(DomUtils::dictEntry(childNode, prefix + xml.contentsExtraINTE))
01022           DomUtils::readNode(&childNode, &data.contentsExtraINTE);
01023       else if(DomUtils::dictEntry(childNode, prefix + xml.contentsExtraSCF))
01024           DomUtils::readNode(&childNode, &data.contentsExtraSCF);
01025       else if(DomUtils::dictEntry(childNode, prefix + xml.contentsExtraFORC))
01026           DomUtils::readNode(&childNode, &data.contentsExtraFORC);      
01027     }
01028     childNode = childNode.nextSibling();
01029   }
01030   restoreWidgets();
01031   widgetChanged = false;
01032 }
01033 
01035 void BraboBase::saveCML(QDomElement* root)
01037 {  
01040   assert(!isVisible());
01041   
01042   const QString prefix = "energy_and_forces_";
01044   DomUtils::makeNode(root, data.SCFMethod, prefix +  xml.SCFMethod);
01045   DomUtils::makeNode(root, data.SCFType, prefix +  xml.SCFType);
01046   DomUtils::makeNode(root, data.useStartvector, prefix +  xml.useStartvector);
01047   DomUtils::makeNode(root, data.startvector, prefix +  xml.startvector);
01048   DomUtils::makeNode(root, data.preferStartvector, prefix +  xml.preferStartvector);
01049   DomUtils::makeNode(root, data.charge, prefix +  xml.charge);
01050 
01052   DomUtils::makeNode(root, data.useOneBasisset, prefix +  xml.useOneBasisset);
01053   DomUtils::makeNode(root, data.basisset1, prefix +  xml.basisset1);
01054   DomUtils::makeNode(root, data.basissetAtom, prefix +  xml.basissetAtom);
01055   DomUtils::makeNode(root, data.basisset2, prefix +  xml.basisset2);
01056   DomUtils::makeNode(root, data.listAtoms, prefix +  xml.listAtoms);
01057   DomUtils::makeNode(root, data.listBasissets, prefix +  xml.listBasissets);
01058 
01060   DomUtils::makeNode(root, data.MP2Type, prefix +  xml.MP2Type);
01061   DomUtils::makeNode(root, data.MP2ExcludeOcc, prefix +  xml.MP2ExcludeOcc);
01062   DomUtils::makeNode(root, data.MP2ExcludeVirt, prefix +  xml.MP2ExcludeVirt);
01063   DomUtils::makeNode(root, data.MP2Density, prefix +  xml.MP2Density);
01064   DomUtils::makeNode(root, data.useField, prefix +  xml.useField);
01065   DomUtils::makeNode(root, data.fieldX, prefix +  xml.fieldX);
01066   DomUtils::makeNode(root, data.fieldY, prefix +  xml.fieldY);
01067   DomUtils::makeNode(root, data.fieldZ, prefix +  xml.fieldZ);
01068   DomUtils::makeNode(root, data.useSCRF, prefix +  xml.useSCRF);
01069   DomUtils::makeNode(root, data.SCRFEpsilon, prefix +  xml.SCRFEpsilon);
01070   DomUtils::makeNode(root, data.SCRFRadius, prefix +  xml.SCRFRadius);
01071 
01073   DomUtils::makeNode(root, data.useSymmetry, prefix +  xml.useSymmetry);
01074   DomUtils::makeNode(root, data.useSymmAuto, prefix +  xml.useSymmAuto);
01075   DomUtils::makeNode(root, data.useSymmX, prefix +  xml.useSymmX);
01076   DomUtils::makeNode(root, data.useSymmY, prefix +  xml.useSymmY);
01077   DomUtils::makeNode(root, data.useSymmZ, prefix +  xml.useSymmZ);
01078   DomUtils::makeNode(root, data.useSymmXY, prefix +  xml.useSymmXY);
01079   DomUtils::makeNode(root, data.useSymmYZ, prefix +  xml.useSymmYZ);
01080   DomUtils::makeNode(root, data.useSymmXZ, prefix +  xml.useSymmXZ);
01081   DomUtils::makeNode(root, data.useSymmXYZ, prefix +  xml.useSymmXYZ);
01082 
01084   DomUtils::makeNode(root, data.valueIpol, prefix +  xml.valueIpol);
01085   DomUtils::makeNode(root, data.useSkpc, prefix +  xml.useSkpc);
01086   DomUtils::makeNode(root, data.printGeop, prefix +  xml.printGeop);
01087   DomUtils::makeNode(root, data.printWF, prefix +  xml.printWF);
01088   DomUtils::makeNode(root, data.printDM, prefix +  xml.printDM);
01089   DomUtils::makeNode(root, data.useDST, prefix +  xml.useDST);
01090   DomUtils::makeNode(root, data.useACD, prefix +  xml.useACD);
01091   DomUtils::makeNode(root, data.saveF11, prefix +  xml.saveF11);
01092   DomUtils::makeNode(root, data.useFato, prefix +  xml.useFato);
01093   DomUtils::makeNode(root, data.numFato, prefix +  xml.numFato);
01094   DomUtils::makeNode(root, data.useMIAForce, prefix +  xml.useMIAForce);
01095 
01097   DomUtils::makeNode(root, data.useMulliken, prefix +  xml.useMulliken);
01098   DomUtils::makeNode(root, data.MullikenNoOverlap, prefix +  xml.MullikenNoOverlap);
01099   DomUtils::makeNode(root, data.MullikenEachIter, prefix +  xml.MullikenEachIter);
01100   DomUtils::makeNode(root, data.useStock, prefix +  xml.useStock);
01101   DomUtils::makeNode(root, data.stockType, prefix +  xml.stockType);
01102   DomUtils::makeNode(root, data.stockTotalDensity, prefix +  xml.stockTotalDensity);
01103   DomUtils::makeNode(root, data.stockTransition1, prefix +  xml.stockTransition1);
01104   DomUtils::makeNode(root, data.stockTransition2, prefix +  xml.stockTransition2);
01105   DomUtils::makeNode(root, data.useStockElmo, prefix +  xml.useStockElmo);
01106   DomUtils::makeNode(root, data.useStockEpar, prefix +  xml.useStockEpar);
01107 
01109   DomUtils::makeNode(root, data.useBoys, prefix +  xml.useBoys);
01110   DomUtils::makeNode(root, data.numBoysIter, prefix +  xml.numBoysIter);
01111   DomUtils::makeNode(root, data.BoysThreshold, prefix +  xml.BoysThreshold);
01112   DomUtils::makeNode(root, data.listNucl, prefix +  xml.listNucl);
01113   DomUtils::makeNode(root, data.useElmo, prefix +  xml.useElmo);
01114   DomUtils::makeNode(root, data.useExit, prefix +  xml.useExit);
01115   DomUtils::makeNode(root, data.useJab, prefix +  xml.useJab);
01116 
01118   DomUtils::makeNode(root, data.numIter, prefix +  xml.numIter);
01119   DomUtils::makeNode(root, data.useJacobi, prefix +  xml.useJacobi);
01120   DomUtils::makeNode(root, data.useDIIS, prefix +  xml.useDIIS);
01121   DomUtils::makeNode(root, data.DIISThre, prefix +  xml.DIISThre);
01122   DomUtils::makeNode(root, data.numDIISCoeff, prefix +  xml.numDIISCoeff);
01123   DomUtils::makeNode(root, data.valueLvsh, prefix +  xml.valueLvsh);
01124   DomUtils::makeNode(root, data.useDlvs, prefix +  xml.useDlvs);
01125   DomUtils::makeNode(root, data.thresholdINTEa, prefix +  xml.thresholdINTEa);
01126   DomUtils::makeNode(root, data.thresholdINTEb, prefix +  xml.thresholdINTEb);
01127   DomUtils::makeNode(root, data.thresholdMIAa, prefix +  xml.thresholdMIAa);
01128   DomUtils::makeNode(root, data.thresholdMIAb, prefix +  xml.thresholdMIAb);
01129   DomUtils::makeNode(root, data.thresholdSCFa, prefix +  xml.thresholdSCFa);
01130   DomUtils::makeNode(root, data.thresholdSCFb, prefix +  xml.thresholdSCFb);
01131   DomUtils::makeNode(root, data.thresholdOverlapa, prefix +  xml.thresholdOverlapa);
01132   DomUtils::makeNode(root, data.thresholdOverlapb, prefix +  xml.thresholdOverlapb);
01133   DomUtils::makeNode(root, data.useVarThreMIA, prefix +  xml.useVarThreMIA);
01134 
01136   DomUtils::makeNode(root, data.usePVM, prefix +  xml.usePVM);
01137   DomUtils::makeNode(root, data.PVMExcludeHosts, prefix +  xml.PVMExcludeHosts);
01138   DomUtils::makeNode(root, data.PVMNumShells, prefix +  xml.PVMNumShells);
01139   DomUtils::makeNode(root, data.PVMNumTasks, prefix +  xml.PVMNumTasks);
01140   DomUtils::makeNode(root, data.notOnMaster, prefix +  xml.notOnMaster);
01141   DomUtils::makeNode(root, data.valueNice, prefix +  xml.valueNice);
01142   DomUtils::makeNode(root, data.usePacked, prefix +  xml.usePacked);
01143 
01145   DomUtils::makeNode(root, data.printDebugPVM, prefix +  xml.printDebugPVM);
01146   DomUtils::makeNode(root, data.printDebugFORC, prefix +  xml.printDebugFORC);
01147   DomUtils::makeNode(root, data.goonINTE, prefix +  xml.goonINTE);
01148   DomUtils::makeNode(root, data.goonSCF, prefix +  xml.goonSCF);
01149   DomUtils::makeNode(root, data.printIntegrals, prefix +  xml.printIntegrals);
01150   DomUtils::makeNode(root, data.printShells, prefix +  xml.printShells);
01151   DomUtils::makeNode(root, data.levelPrintSCF, prefix +  xml.levelPrintSCF);
01152   DomUtils::makeNode(root, data.numVirtual, prefix +  xml.numVirtual);
01153 
01155   DomUtils::makeNode(root, data.numLinesExtraMain, prefix +  xml.numLinesExtraMain);
01156   DomUtils::makeNode(root, data.numLinesExtraPVM, prefix +  xml.numLinesExtraPVM);
01157   DomUtils::makeNode(root, data.numLinesExtraINTE, prefix +  xml.numLinesExtraINTE);
01158   DomUtils::makeNode(root, data.numLinesExtraSCF, prefix +  xml.numLinesExtraSCF);
01159   DomUtils::makeNode(root, data.numLinesExtraFORC, prefix +  xml.numLinesExtraFORC);
01160   DomUtils::makeNode(root, data.hPosExtraMain, prefix +  xml.hPosExtraMain);
01161   DomUtils::makeNode(root, data.hPosExtraPVM, prefix +  xml.hPosExtraPVM);
01162   DomUtils::makeNode(root, data.hPosExtraINTE, prefix +  xml.hPosExtraINTE);
01163   DomUtils::makeNode(root, data.hPosExtraSCF, prefix +  xml.hPosExtraSCF);
01164   DomUtils::makeNode(root, data.hPosExtraFORC, prefix +  xml.hPosExtraFORC);
01165   DomUtils::makeNode(root, data.vPosExtraMain, prefix +  xml.vPosExtraMain);
01166   DomUtils::makeNode(root, data.vPosExtraPVM, prefix +  xml.vPosExtraPVM);
01167   DomUtils::makeNode(root, data.vPosExtraINTE, prefix +  xml.vPosExtraINTE);
01168   DomUtils::makeNode(root, data.vPosExtraSCF, prefix +  xml.vPosExtraSCF);
01169   DomUtils::makeNode(root, data.vPosExtraFORC, prefix +  xml.vPosExtraFORC);
01170   DomUtils::makeNode(root, data.contentsExtraMain, prefix +  xml.contentsExtraMain);
01171   DomUtils::makeNode(root, data.contentsExtraPVM, prefix +  xml.contentsExtraPVM);
01172   DomUtils::makeNode(root, data.contentsExtraINTE, prefix +  xml.contentsExtraINTE);
01173   DomUtils::makeNode(root, data.contentsExtraSCF, prefix +  xml.contentsExtraSCF);
01174   DomUtils::makeNode(root, data.contentsExtraFORC, prefix +  xml.contentsExtraFORC);
01175 }
01176 
01178 void BraboBase::setPreferredBasisset(const unsigned int basisset)
01180 {  
01181   preferredBasisset = basisset;
01182 }
01183 
01184 
01188 
01190 void BraboBase::reset()
01193 {
01194   
01196   ComboBoxSCFMethod->setCurrentItem(0); 
01197   ComboBoxSCFType->setCurrentItem(0); 
01198   CheckBoxSTAR->setChecked(false); 
01199   CheckBoxSTAR2->setChecked(true); 
01200   LineEditSTAR->clear(); 
01201   SpinBoxCHAR->setValue(0); 
01202 
01204   RadioButtonBAS1->setChecked(true); 
01205   RadioButtonBAS2->setChecked(false); 
01206   ComboBoxBAS1->setCurrentItem(preferredBasisset);
01207   ComboBoxBAS2->setCurrentItem(0); 
01208   ComboBoxBAS3->setCurrentItem(preferredBasisset);
01209   ListViewBAS->clear(); 
01210 
01212   ButtonGroupMP2->setButton(0); 
01213   SpinBoxMP2E1->setValue(1);
01214   SpinBoxMP2E2->setValue(0);
01215   CheckBoxMP2D->setChecked(false); 
01216   CheckBoxFIEL->setChecked(false);
01217   LineEditFIELx->clear();
01218   LineEditFIELy->clear();
01219   LineEditFIELz->clear();
01220   CheckBoxSCRF->setChecked(false);
01221   LineEditSCRF1->clear();
01222   LineEditSCRF2->clear();
01223 
01225   CheckBoxSYMM->setChecked(false);
01226   RadioButtonSYMM1->setChecked(true);
01227   RadioButtonSYMM2->setChecked(false);
01228   CheckBoxSYMMx->setChecked(false);
01229   CheckBoxSYMMy->setChecked(false);
01230   CheckBoxSYMMz->setChecked(false);
01231   CheckBoxSYMMxy->setChecked(false);
01232   CheckBoxSYMMxz->setChecked(false);
01233   CheckBoxSYMMyz->setChecked(false);
01234   CheckBoxSYMMxyz->setChecked(false);
01235 
01237   LineEditIPOL->setText("0.75");
01238   CheckBoxSKPC->setChecked(false);
01239   CheckBoxGEOP->setChecked(false);
01240   CheckBoxPRWF->setChecked(false);
01241   CheckBoxPRDM->setChecked(false);
01242   CheckBoxDST->setChecked(false);
01243   CheckBoxACD->setChecked(false);
01244   CheckBoxF11->setChecked(false);
01245   CheckBoxFATO->setChecked(false);
01246   SpinBoxFATO->setValue(0);
01247   CheckBoxMIAForc->setChecked(false);
01248 
01250   CheckBoxMULL1->setChecked(false);
01251   CheckBoxMULL2->setChecked(false);
01252   CheckBoxMULL3->setChecked(false);
01253   CheckBoxSTOCK->setChecked(false);
01254   ButtonGroupSTOCK->setButton(0);
01255   SpinBoxStockTRDE1->setValue(1);
01256   SpinBoxStockTRDE2->setValue(1);
01257   ComboBoxStockMOLD->setCurrentItem(0);
01258   CheckBoxStockELMO->setChecked(false);
01259   CheckBoxStockEPAR->setChecked(false);
01260 
01262   CheckBoxLOCA->setChecked(false);
01263   SpinBoxLOCA->setValue(0);
01264   LineEditLOCA->setText("0.05");
01265   LineEditNUCL->clear();
01266   CheckBoxELMO->setChecked(false);
01267   CheckBoxEXIT->setChecked(false);
01268   CheckBoxJAB->setChecked(false);
01269 
01271   SpinBoxITER->setValue(-1);
01272   CheckBoxJACO->setChecked(false);
01273   CheckBoxDIIS->setChecked(false);
01274   LineEditDIIS->setText("0.03");
01275   SpinBoxDIIS->setValue(-1);
01276   LineEditLVSH->clear();
01277   CheckBoxDLVS->setChecked(false);
01278   LineEditThreINTEa->setText("1.0");
01279   LineEditThreINTEb->setText("8.0");
01280   LineEditThreSCF1a->setText("1.0");
01281   LineEditThreSCF1b->setText("8.0");
01282   LineEditThreSCF2a->setText("3.0");
01283   LineEditThreSCF2b->setText("6.0");
01284   LineEditSthrSCFa->setText("1.0");
01285   LineEditSthrSCFb->setText("4.0");
01286   CheckBoxVTHR->setChecked(false);
01287 
01289   CheckBoxPVM->setChecked(false);
01290   ListBoxNOTH1->clear();
01291   SpinBoxNCST->setValue(0);
01292   SpinBoxNTAS->setValue(0);
01293   CheckBoxNOSE->setChecked(false); 
01294   CheckBoxPACK->setChecked(false);
01295 
01297   CheckBoxDebugPVM->setChecked(false);
01298   CheckBoxDebugFORC->setChecked(false);
01299   CheckBoxGoonINTE->setChecked(false);
01300   CheckBoxGoonSCF->setChecked(false);
01301   CheckBoxIntINTE->setChecked(false);
01302   CheckBoxShellsINTE->setChecked(false);
01303   CheckBoxPrintSCF1->setChecked(false);
01304   CheckBoxPrintSCF2->setChecked(false);
01305   CheckBoxPrintSCF3->setChecked(false);
01306   SpinBoxPrintSCF->setValue(0);
01307 
01309   resetTable(TableMain);
01310   resetTable(TablePVM);
01311   resetTable(TableINTE);
01312   resetTable(TableSCF);
01313   resetTable(TableFORC);
01314 }
01315 
01316 
01320 
01322 void BraboBase::accept()
01325 {
01334   if(widgetChanged)
01335   {
01336     widgetChanged = false;
01337     saveWidgets();
01338     BraboWidget::accept();
01339   }
01340   else
01341     BraboWidget::reject();
01342 }
01343 
01345 void BraboBase::reject()
01348 {
01349   if(widgetChanged)
01350   {
01351     widgetChanged = false;
01352     restoreWidgets();
01353   }
01354   BraboWidget::reject();
01355 }
01356 
01357 
01361 
01363 void BraboBase::showPreview()
01365 { 
01366   // prepare the widget
01367   TextViewWidget* preview = new TextViewWidget(this, 0, true, 0);
01368   if(CheckBoxSTOCK->isChecked())
01369     preview->setCaption(tr("Preview input files ") + calcName + ".inp, " + calcName + ".stin");
01370   else
01371     preview->setCaption(tr("Preview input file ") + calcName + ".inp");
01372   preview->TextEdit->setTextFormat(Qt::LogText);
01373   QFontMetrics metrics(preview->TextEdit->currentFont());
01374   int newWidth = 81*metrics.width(" ") + 2*preview->layout()->margin() + preview->TextEdit->verticalScrollBar()->sliderRect().width(); // 20 = 2 x layoutMargin
01375   preview->resize(newWidth, preview->height()); 
01376 
01377   // generate the text
01378   QStringList input = generateInput(BRABO);
01379   if(CheckBoxSTOCK->isChecked())
01380   {
01381     input += "________________________________________________________________________________";
01382     input += "";
01383     input += generateInput(STOCK);
01384   }
01385 
01386   // load the text and show it
01387   preview->TextEdit->setText(input.join("\n"));      
01388   preview->exec();
01389   delete preview;
01390 }
01391 
01393 void BraboBase::readInputFile()
01395 {
01396   // sometimes misused for building the atomic density basis set files.
01397   //buildAtdens();
01398 
01400   QString filename = QFileDialog::getOpenFileName(QString::null, "*.inp", this, 0, tr("Choose a BRABO input file"));
01401   if(filename.isEmpty())
01402     return;
01403 
01405   QFile file(filename);
01406   if(!file.open(IO_ReadOnly))
01407     return;
01408   QTextStream stream(&file);
01409   QString line;
01410   QStringList input;
01411   while(!stream.atEnd() && line.left(4).lower() != "stop")
01412   {
01413     line = stream.readLine();
01414     if(line.left(1) != "!" && !line.stripWhiteSpace().isEmpty())
01415       input += line;
01416   }
01417 
01419   reset();
01420 
01422   // 0: Main
01423   // 1: PVM
01424   // 2: INTE
01425   // 3: SCF
01426   // 4: FORC
01427   unsigned int section = 0;
01428   for(QStringList::Iterator it = input.begin(); it != input.end(); it++)
01429   {
01430     line = (*it);
01431     QString key = line.left(4).lower() + " ";
01432     key.truncate(4);
01433 
01435     if(key == "dst ")
01436       CheckBoxDST->setChecked(true);
01437     else if(key == "acd ")
01438       CheckBoxACD->setChecked(true);
01439     else if(key == "pvm ")
01440     {
01441       section = 1;
01442       CheckBoxPVM->setChecked(true);
01443     }
01444     else if(key == "prin" || section == 1)
01445       CheckBoxDebugPVM->setChecked(true);
01446     else if(key == "noth")
01447       ; // ignore
01448     else if(key == "ncst")
01449       SpinBoxNCST->setValue(line.mid(10,10).toInt());
01450     else if(key == "ntas")
01451       SpinBoxNTAS->setValue(line.mid(10,10).toInt());
01452     else if(key == "nose")
01453       CheckBoxNOSE->setChecked(true);
01454     else if(key == "nice")
01455       SpinBoxNICE->setValue(line.mid(10,10).toInt());
01456     else if(key == "pack")
01457       CheckBoxPACK->setChecked(true);
01458     else if(key == "inte")    
01459       section = 2;
01460     else if(key == "mia ")
01461       ComboBoxSCFType->setCurrentItem(0);
01462     else if(key == "twoe")
01463       ComboBoxSCFType->setCurrentItem(2);
01464     else if(key == "angs" || key == "exfi" || key == "xfcr")
01465       ; // ignore
01466     else if(key == "symm")
01467     {
01468       CheckBoxSYMM->setChecked(true);
01469       if(line.mid(10).isEmpty())
01470         RadioButtonSYMM1->setChecked(true);
01471       else
01472       {
01473         RadioButtonSYMM1->setChecked(false);
01474         for(unsigned int i = 0; i < 7; i++)
01475         {
01476           QString symmType = line.mid(10+10*i,10).stripWhiteSpace();
01477           if(symmType == "all")
01478           {
01479             CheckBoxSYMMx->setChecked(true);
01480             CheckBoxSYMMy->setChecked(true);
01481             CheckBoxSYMMz->setChecked(true);
01482             CheckBoxSYMMxy->setChecked(true);
01483             CheckBoxSYMMxz->setChecked(true);
01484             CheckBoxSYMMyz->setChecked(true);
01485             CheckBoxSYMMxyz->setChecked(true);
01486             break;
01487           }
01488           else if(symmType == "x")
01489             CheckBoxSYMMx->setChecked(true);
01490           else if(symmType == "y")
01491             CheckBoxSYMMy->setChecked(true);
01492           else if(symmType == "z")
01493             CheckBoxSYMMz->setChecked(true);
01494           else if(symmType == "xy")
01495             CheckBoxSYMMxy->setChecked(true);
01496           else if(symmType == "xz")
01497             CheckBoxSYMMxz->setChecked(true);
01498           else if(symmType == "yz")
01499             CheckBoxSYMMyz->setChecked(true);
01500           else if(symmType == "xyz")
01501             CheckBoxSYMMxyz->setChecked(true);
01502         }
01503       }
01504     }
01505     else if(key == "thre" && section == 2)
01506     {
01507       double thre = line.mid(10,10).toDouble();
01508       double threA = log10(floor(thre) - thre);
01509       int threB = static_cast<int>(thre); // maybe change to floor() ? 
01510       LineEditThreINTEa->setText(QString::number(threA));
01511       LineEditThreINTEb->setText(QString::number(threB));
01512     }
01513     else if(key == "skpc")
01514       CheckBoxSKPC->setChecked(true);
01515     else if(key == "geop")
01516       CheckBoxGEOP->setChecked(true);
01517     else if(key == "goon" && section == 2)
01518       CheckBoxGoonINTE->setChecked(true);
01519     else if(key == "nucl")
01520     {
01521       if(!LineEditNUCL->text().isEmpty())
01522         LineEditNUCL->setText(",");
01523       LineEditNUCL->setText(LineEditNUCL->text() + QString::number(line.mid(10,10).toUInt()));
01524     }
01525     else if(key == "prin" || section == 2)
01526       CheckBoxIntINTE->setChecked(true);
01527     else if(key == "long")
01528       CheckBoxShellsINTE->setChecked(true);
01529     else if(key == "xfba" || key == "gbas" || key == "abas")
01530       ; // ignore
01531     else if(key == "scf ")
01532       section = 3;
01533     else if(key == "uhf ")
01534       ComboBoxSCFMethod->setCurrentItem(1);
01535     else if(key == "mp2e")
01536     {
01537       ComboBoxSCFMethod->setCurrentItem(2);
01538       int mp2type = line.mid(10,10).toInt();
01539       switch(mp2type)
01540       {
01541         case  0: RadioButtonMP2E1->setChecked(true);
01542                  break;
01543         case -1: RadioButtonMP2E2->setChecked(true);
01544                  break;
01545         default: RadioButtonMP2E3->setChecked(true);
01546                  SpinBoxMP2E1->setValue(mp2type);
01547                  SpinBoxMP2E2->setValue(line.mid(20,10).toInt());
01548       }
01549     }
01550     else if(key == "drct")
01551       ComboBoxSCFType->setCurrentItem(1);
01552     else if(key == "ipol")
01553       LineEditIPOL->setText(QString::number(line.mid(10,10).toDouble()));
01554     else if(key == "star")
01555       ; // ignore
01556     else if(key == "char")
01557       SpinBoxCHAR->setValue(line.mid(10,10).toInt());
01558     else if(key == "mp2d")
01559     {
01560       CheckBoxMP2D->setChecked(true);
01561       int mp2type = line.mid(10,10).toInt();
01562       switch(mp2type)
01563       {
01564         case  0: RadioButtonMP2E1->setChecked(true);
01565                  break;
01566         case -1: RadioButtonMP2E2->setChecked(true);
01567                  break;
01568         default: RadioButtonMP2E3->setChecked(true);
01569                  SpinBoxMP2E1->setValue(mp2type);
01570                  SpinBoxMP2E2->setValue(line.mid(20,10).toInt());
01571       }
01572     }
01573     else if(key == "scrf")
01574     {
01575       LineEditSCRF1->setText(QString::number(line.mid(10,10).toDouble()));
01576       LineEditSCRF2->setText(QString::number(line.mid(20,10).toDouble()));
01577     }
01578     else if(key == "fiel")
01579     {
01580       CheckBoxFIEL->setChecked(true);
01581       LineEditFIELx->setText(QString::number(line.mid(10,10).toDouble()));
01582       LineEditFIELy->setText(QString::number(line.mid(20,10).toDouble()));
01583       LineEditFIELz->setText(QString::number(line.mid(30,10).toDouble()));
01584     }
01585     else if(key == "elmo")
01586       CheckBoxELMO->setChecked(true);
01587     else if(key == "mull")
01588     {
01589       CheckBoxMULL1->setChecked(true);
01590       if(line.mid(10,10).toUInt() == 1)
01591         CheckBoxMULL2->setChecked(true);
01592     }
01593     else if(key == "mul1")
01594     {
01595       CheckBoxMULL3->setChecked(true);
01596       if(line.mid(10,10).toUInt() == 1)
01597         CheckBoxMULL2->setChecked(true);
01598     }
01599     else if(key == "loca")
01600     {
01601       CheckBoxLOCA->setChecked(true);
01602       SpinBoxLOCA->setValue(line.mid(10,10).toUInt());
01603       LineEditLOCA->setText(QString::number(line.mid(20,10).toDouble()));
01604     }
01605     else if(key == "exit")
01606       CheckBoxEXIT->setChecked(true);
01607     else if(key == "jab ")
01608       CheckBoxJAB->setChecked(true);
01609     else if(key == "iter")
01610       SpinBoxITER->setValue(line.mid(10,10).toUInt());
01611     else if(key == "thre" && section == 3)
01612     {
01613       double thre1 = line.mid(10,10).toDouble();
01614       double thre2 = line.mid(20,10).toDouble();
01615       if(thre1 >= 1.0)
01616       {
01617         double threA = log10(floor(thre1) - thre1);
01618         int threB = static_cast<int>(thre1); // maybe change to floor? 
01619         LineEditThreSCF1a->setText(QString::number(threA));
01620         LineEditThreSCF1b->setText(QString::number(threB));
01621       }
01622       if(thre2 >= 1.0)
01623       {
01624         double threA = log10(floor(thre2) - thre2);
01625         int threB = static_cast<int>(thre2); // maybe change to floor? 
01626         LineEditThreSCF2a->setText(QString::number(threA));
01627         LineEditThreSCF2b->setText(QString::number(threB));
01628       }
01629     }
01630     else if(key == "sthr")
01631     {
01632       double thre = line.mid(10,10).toDouble();
01633       if(thre >= 1.0)
01634       {
01635         double threA = log10(floor(thre) - thre);
01636         int threB = static_cast<int>(thre); // maybe change to floor? 
01637         LineEditSthrSCFa->setText(QString::number(threA));
01638         LineEditSthrSCFb->setText(QString::number(threB));
01639       }
01640     }
01641     else if(key == "vhtr")
01642       CheckBoxVTHR->setChecked(true);
01643     else if(key == "diis")
01644     {
01645       double num = line.mid(10,10).toDouble();
01646       if(int(num) == -1)
01647         CheckBoxDIIS->setChecked(true);
01648       else
01649         LineEditDIIS->setText(QString::number(num));
01650     }
01651     else if(key == "maxd")
01652       SpinBoxDIIS->setValue(line.mid(10,10).toUInt());
01653     else if(key == "goon" && section == 3)
01654       CheckBoxGoonSCF->setChecked(true);
01655     else if(key == "lvsh")
01656       LineEditLVSH->setText(QString::number(line.mid(10,10).toDouble()));
01657     else if(key == "dlvs")
01658     {
01659       CheckBoxDLVS->setChecked(true);
01660       LineEditLVSH->setText(QString::number(line.mid(10,10).toDouble()));
01661     }
01662     else if(key == "prwf")
01663       CheckBoxPRWF->setChecked(true);
01664     else if(key == "prdm")
01665       CheckBoxPRDM->setChecked(true);
01666     else if(key == "jaco")
01667       CheckBoxJACO->setChecked(true);
01668     else if(key == "prin" && section == 3)
01669     {
01670       SpinBoxPrintSCF->setValue(line.mid(10,10).toUInt());
01671       switch(line.mid(20,10).toUInt())
01672       {
01673         case 3: CheckBoxPrintSCF3->setChecked(true);
01674         case 2: CheckBoxPrintSCF2->setChecked(true);
01675         case 1: CheckBoxPrintSCF1->setChecked(true);
01676       }
01677     }
01678     else if(key == "punc" && section == 3)
01679       ; // ignore
01680     else if(key == "forc")
01681       section = 4;
01682     else if(key == "punc" && section == 4)
01683       ; // ignore
01684     else if(key == "xffo")
01685       ; // ignore
01686     else if(key == "fato")
01687     {
01688       CheckBoxFATO->setChecked(true);
01689       SpinBoxFATO->setValue(line.mid(10,10).toUInt());
01690     }
01691     else if(key == "prin" || section == 4)
01692       CheckBoxDebugFORC->setChecked(true);
01693     else if(key.left(1) == "f" && key.mid(3,1) == "=")
01694       ; // ignore
01695     else
01696     {
01697       QStringList texts;
01698       for(unsigned int i = 0; i < 8; i++)
01699         texts += line.mid(i*10,10);
01700       int row;
01701       switch(section)
01702       {
01703         case 0: row = firstEmptyTableRow(TableMain);
01704                 for(unsigned int i = 0; i < 8; i++)
01705                 {
01706                   if(!(*(texts.at(i))).isEmpty())
01707                     TableMain->setText(row, i, *(texts.at(i)));
01708                 }
01709                 break;
01710         case 1: row = firstEmptyTableRow(TablePVM);
01711                 for(unsigned int i = 0; i < 8; i++)
01712                 {
01713                   if(!(*(texts.at(i))).isEmpty())
01714                     TablePVM->setText(row, i, *(texts.at(i)));
01715                 }
01716                 break;
01717         case 2: row = firstEmptyTableRow(TableINTE);
01718                 for(unsigned int i = 0; i < 8; i++)
01719                 {
01720                   if(!(*(texts.at(i))).isEmpty())
01721                     TableINTE->setText(row, i, *(texts.at(i)));
01722                 }
01723                 break;
01724         case 3: row = firstEmptyTableRow(TableSCF);
01725                 for(unsigned int i = 0; i < 8; i++)
01726                 {
01727                   if(!(*(texts.at(i))).isEmpty())
01728                     TableSCF->setText(row, i, *(texts.at(i)));
01729                 }
01730                 break;
01731         case 4: row = firstEmptyTableRow(TableFORC);
01732                 for(unsigned int i = 0; i < 8; i++)
01733                 {
01734                   if(!(*(texts.at(i))).isEmpty())
01735                     TableFORC->setText(row, i, *(texts.at(i)));
01736                 }
01737                 break;
01738       }
01739     }
01740   }
01741 }
01742 
01744 void BraboBase::changed()
01746 {
01747   widgetChanged = true;
01748 }
01749 
01751 void BraboBase::selectWidget(QListViewItem* newItem)
01753 {  
01754   if(newItem->childCount() != 0)
01755   {
01757     newItem->setOpen(true);
01758     ListViewCategory->setSelected(newItem->firstChild(), true);
01759     return;
01760   }
01761   
01763   if(newItem->parent() == 0)
01764   {
01766     if(newItem->text(0) == category[BASIC])
01767       WidgetStackCategory->raiseWidget(0);
01768     else if(newItem->text(0) == category[SCFCONVERGENCE])
01769       WidgetStackCategory->raiseWidget(7);
01770     else if(newItem->text(0) == category[PVM])
01771       WidgetStackCategory->raiseWidget(9);
01772     else if(newItem->text(0) == category[DEBUG1])
01773       WidgetStackCategory->raiseWidget(10);
01774   }
01775   else
01776   {
01778     //if(newItem->parent()->text(0) == category[BASIC])
01779     //{
01780     //  if(newItem->text(0) == category[BASIC_METHOD])
01781     //    WidgetStackCategory->raiseWidget(0);
01782     //  else if(newItem->text(0) == category[BASIC_BASISSET])
01783     //    WidgetStackCategory->raiseWidget(1);
01784     //}
01785     if(newItem->parent()->text(0) == category[ADVANCED])
01786     {
01787       if(newItem->text(0) == category[ADVANCED_METHOD])
01788         WidgetStackCategory->raiseWidget(2);
01789       else if(newItem->text(0) == category[ADVANCED_SYMMETRY])
01790         WidgetStackCategory->raiseWidget(3);
01791       else if(newItem->text(0) == category[ADVANCED_OTHER])
01792         WidgetStackCategory->raiseWidget(4);
01793     }
01794     else if(newItem->parent()->text(0) == category[PROPERTIES])
01795     {
01796       if(newItem->text(0) == category[PROPERTIES_CHARGES])
01797         WidgetStackCategory->raiseWidget(5);
01798       else if(newItem->text(0) == category[PROPERTIES_OTHER])
01799         WidgetStackCategory->raiseWidget(6);
01800     }
01801     else if(newItem->parent()->text(0) == category[EXTRA])
01802     {
01803       if(newItem->text(0) == category[EXTRA_MAIN])
01804         WidgetStackCategory->raiseWidget(11);
01805       else if(newItem->text(0) == category[EXTRA_PVM])
01806         WidgetStackCategory->raiseWidget(12);
01807       else if(newItem->text(0) == category[EXTRA_INTE])
01808         WidgetStackCategory->raiseWidget(13);
01809       else if(newItem->text(0) == category[EXTRA_SCF])
01810         WidgetStackCategory->raiseWidget(14);
01811       else if(newItem->text(0) == category[EXTRA_FORC])
01812         WidgetStackCategory->raiseWidget(15);
01813     }
01814   }
01815 }
01816 
01818 void BraboBase::updateSCFMethodWidgets(int index)
01820 {  
01821   switch(index)
01822   {
01823     case 0: 
01824       GroupBoxMP2->setEnabled(false);
01825       GroupBoxFIEL->setEnabled(true);
01826       if(ComboBoxSCFType->currentItem() == 2)
01827         GroupBoxSCRF->setEnabled(true);
01828       else
01829         GroupBoxSCRF->setEnabled(false);
01830       ButtonGroupSYMM->setEnabled(true);
01831       RadioButtonStockDENS5->setEnabled(false);
01832       break;
01833     case 1: 
01834       GroupBoxMP2->setEnabled(false);
01835       GroupBoxFIEL->setEnabled(false);
01836       GroupBoxSCRF->setEnabled(false);
01837       RadioButtonStockDENS5->setEnabled(true);
01838       if(ComboBoxSCFType->currentItem() == 0)
01839         ButtonGroupSYMM->setEnabled(true);
01840       else
01841         ButtonGroupSYMM->setEnabled(false);
01842       break;
01843     case 2: 
01844       GroupBoxMP2->setEnabled(true);
01845       GroupBoxFIEL->setEnabled(true);
01846       if(ComboBoxSCFType->currentItem() == 2)
01847         GroupBoxSCRF->setEnabled(true);
01848       else
01849         GroupBoxSCRF->setEnabled(false);
01850       ButtonGroupSYMM->setEnabled(true);
01851       RadioButtonStockDENS5->setEnabled(false);
01852   }
01853 }
01854 
01856 void BraboBase::updateSCFTypeWidgets(int index)
01858 {
01859   switch(index)
01860   {
01861     case 0: 
01862       GroupBoxSCRF->setEnabled(false);
01863       if(calcForces && CheckBoxMIAForc->isChecked())
01864       {
01865         CheckBoxPVM->setChecked(false);
01866         CheckBoxPVM->setEnabled(false);
01867       }
01868       else
01869         CheckBoxPVM->setEnabled(true);
01870       CheckBoxDST->setEnabled(true);
01871       CheckBoxACD->setEnabled(true);
01872       CheckBoxMIAForc->setEnabled(true);
01873       LabelThreMIA1->setEnabled(true);
01874       LineEditThreSCF1a->setEnabled(true);
01875       LabelThreMIA2->setEnabled(true);
01876       LineEditThreSCF1b->setEnabled(true);
01877       CheckBoxVTHR->setEnabled(true);
01878       break;
01879     case 1: 
01880       GroupBoxSCRF->setEnabled(false);
01881       CheckBoxPVM->setEnabled(true);
01882       CheckBoxDST->setEnabled(true);
01883       CheckBoxACD->setEnabled(true);
01884       LabelThreMIA1->setEnabled(false);
01885       LineEditThreSCF1a->setEnabled(false);
01886       LabelThreMIA2->setEnabled(false);
01887       LineEditThreSCF1b->setEnabled(false);
01888       CheckBoxVTHR->setEnabled(false);
01889       break;
01890     case 2: 
01891       CheckBoxMIAForc->setEnabled(false);
01892       if(ComboBoxSCFMethod->currentItem() != 1)
01893         GroupBoxSCRF->setEnabled(true);
01894       else
01895         GroupBoxSCRF->setEnabled(false);
01896       CheckBoxPVM->setChecked(false);
01897       CheckBoxPVM->setEnabled(false);
01898       CheckBoxDST->setEnabled(false);
01899       CheckBoxACD->setEnabled(false);
01900       LabelThreMIA1->setEnabled(false);
01901       LineEditThreSCF1a->setEnabled(false);
01902       LabelThreMIA2->setEnabled(false);
01903       LineEditThreSCF1b->setEnabled(false);
01904       CheckBoxVTHR->setEnabled(false);
01905   }
01906 }
01907 
01909 void BraboBase::selectStartvector()
01911 {  
01912   QString filename = QFileDialog::getOpenFileName(LineEditSTAR->text(),tr("Startvectors (*.sta)"),this, 0, tr("Choose a startvector"));
01913   if(!filename.isNull())
01914     LineEditSTAR->setText(QDir::convertSeparators(filename));
01915 }
01916 
01918 void BraboBase::oneBasisset(bool on)
01921 {
01922   ComboBoxBAS1->setEnabled(on);
01923   TextLabelBAS1->setEnabled(!on);
01924   TextLabelBAS2->setEnabled(!on);
01925   ComboBoxBAS2->setEnabled(!on);
01926   ComboBoxBAS3->setEnabled(!on);
01927   ToolButtonBAS1->setEnabled(!on);
01928   ToolButtonBAS2->setEnabled(!on);
01929   ListViewBAS->setEnabled(!on);
01930 }
01931 
01933 void BraboBase::addBasisset()
01936 {
01938   bool dupefound = false;
01939   QListViewItemIterator it(ListViewBAS);
01940   for( ; it.current(); ++it)
01941   {
01942     if(it.current()->text(0) == ComboBoxBAS2->currentText())
01943     {
01944       dupefound = true;
01945       break;
01946     }
01947   }
01949   if(!dupefound)
01950   {
01951     (void) new QListViewItem(ListViewBAS,ComboBoxBAS2->currentText(),ComboBoxBAS3->currentText());
01952     widgetChanged = true;
01953   }
01954 }
01955 
01957 void BraboBase::removeBasisset()
01959 {
01960   if(ListViewBAS->currentItem() != 0)
01961   {
01962     delete ListViewBAS->currentItem();
01963     widgetChanged = true;
01964   }
01965 }
01966 
01968 void BraboBase::toggleDIIS(bool on)
01970 {
01971   LineEditDIIS->setEnabled(!on);
01972   SpinBoxDIIS->setEnabled(!on);
01973   LabelDIIS1->setEnabled(!on);
01974   LabelDIIS2->setEnabled(!on);  
01975 }
01976 
01978 void BraboBase::addPVMHost()
01981 {
01983   QString host = ListBoxNOTH2->currentText();
01984   if(host.isNull())
01985     return;
01986 
01988   if(ListBoxNOTH1->findItem(host, Qt::ExactMatch) != 0)
01989     return;
01990 
01992   ListBoxNOTH1->insertItem(host);
01993 }
01994 
01996 void BraboBase::removePVMHost()
01998 {
01999   ListBoxNOTH1->removeItem(ListBoxNOTH1->currentItem());
02000 }
02001 
02003 void BraboBase::adjustPrintSCF()
02006 {
02007   if(CheckBoxPrintSCF3->isChecked())
02008     CheckBoxPrintSCF2->setChecked(true);
02009   if(CheckBoxPrintSCF2->isChecked())
02010     CheckBoxPrintSCF1->setChecked(true);
02011   if(CheckBoxPrintSCF1->isChecked())
02012   {
02013     SpinBoxPrintSCF->setEnabled(true);
02014     LabelPrintSCF2->setEnabled(true);
02015   }
02016   else
02017   {
02018     SpinBoxPrintSCF->setEnabled(false);
02019     LabelPrintSCF2->setEnabled(false);
02020   }
02021 }
02022 
02024 void BraboBase::checkOverflowMain(int row, int col)
02028 {
02029   checkTableOverflow(TableMain, row, col);
02030 }
02031 
02033 void BraboBase::checkOverflowPVM(int row, int col)
02037 {
02038   checkTableOverflow(TablePVM, row, col);
02039 }
02040 
02042 void BraboBase::checkOverflowINTE(int row, int col)
02046 {
02047   checkTableOverflow(TableINTE, row, col);
02048 }
02049 
02051 void BraboBase::checkOverflowSCF(int row, int col)
02055 {
02056   checkTableOverflow(TableSCF, row, col);
02057 }
02058 
02060 void BraboBase::checkOverflowFORC(int row, int col)
02064 {
02065   checkTableOverflow(TableFORC, row, col);
02066 }
02067 
02069 void BraboBase::addRowMain()
02073 {
02074   addTableRow(TableMain);
02075 }
02076 
02078 void BraboBase::addRowPVM()
02082 {
02083   addTableRow(TablePVM);
02084 }
02085 
02087 void BraboBase::addRowINTE()
02091 {
02092   addTableRow(TableINTE);
02093 }
02094 
02096 void BraboBase::addRowSCF()
02100 {
02101   addTableRow(TableSCF);
02102 }
02103 
02105 void BraboBase::addRowFORC()
02109 {
02110   addTableRow(TableFORC);
02111 }
02112 
02114 void BraboBase::removeRowMain()
02116 {
02117   if(removeTableRow(TableMain))
02118     changed();
02119 }
02120 
02122 void BraboBase::removeRowPVM()
02124 {
02125   if(removeTableRow(TablePVM))
02126     changed();
02127 }
02128 
02130 void BraboBase::removeRowINTE()
02132 {
02133   if(removeTableRow(TableINTE))
02134     changed();
02135 }
02136 
02138 void BraboBase::removeRowSCF()
02140 {
02141   if(removeTableRow(TableSCF))
02142     changed();
02143 }
02144 
02146 void BraboBase::removeRowFORC()
02148 {
02149   if(removeTableRow(TableFORC))
02150     changed();
02151 }
02152 
02154 void BraboBase::clearSelectionMain()
02156 {
02157   if(clearTableSelection(TableMain))
02158     changed();  
02159 }
02160 
02162 void BraboBase::clearSelectionPVM()
02164 {
02165   if(clearTableSelection(TablePVM))
02166     changed();  
02167 }
02168 
02170 void BraboBase::clearSelectionINTE()
02172 {
02173   if(clearTableSelection(TableINTE))
02174     changed();  
02175 }
02176 
02178 void BraboBase::clearSelectionSCF()
02180 {
02181   if(clearTableSelection(TableSCF))
02182     changed();  
02183 }
02184 
02186 void BraboBase::clearSelectionFORC()
02188 {
02189   if(clearTableSelection(TableFORC))
02190     changed();  
02191 }
02192 
02193 
02197 
02199 void BraboBase::makeConnections()
02201 {
02203   connect(ListViewCategory, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectWidget(QListViewItem*)));
02204 
02207   connect(ButtonOK, SIGNAL(clicked()), this, SLOT(accept()));
02208   connect(ButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
02209   connect(ButtonPreview, SIGNAL(clicked()), this, SLOT(showPreview()));
02210   connect(ButtonRead, SIGNAL(clicked()), this, SLOT(readInputFile()));
02211   connect(ButtonReset, SIGNAL(clicked()), this, SLOT(reset()));
02213   connect(ToolButtonSTAR, SIGNAL(clicked()), this, SLOT(selectStartvector()));
02215   connect(ToolButtonBAS1, SIGNAL(clicked()), this, SLOT(addBasisset()));
02216   connect(ToolButtonBAS2, SIGNAL(clicked()), this, SLOT(removeBasisset()));
02218   connect(ToolButtonNOTHadd, SIGNAL(clicked()), this, SLOT(addPVMHost()));
02219   connect(ToolButtonNOTHremove, SIGNAL(clicked()), this, SLOT(removePVMHost()));
02220 
02223   connect(ComboBoxSCFMethod, SIGNAL(activated(int)), this, SLOT(updateSCFMethodWidgets(int)));
02224   connect(ComboBoxSCFType, SIGNAL(activated(int)), this, SLOT(updateSCFTypeWidgets(int)));
02226   connect(RadioButtonBAS1, SIGNAL(toggled(bool)),this,SLOT(oneBasisset(bool)));
02228   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LineEditFIELx, SLOT(setEnabled(bool)));
02229   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LineEditFIELy, SLOT(setEnabled(bool)));
02230   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LineEditFIELz, SLOT(setEnabled(bool)));
02231   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LabelFIELx, SLOT(setEnabled(bool)));
02232   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LabelFIELy, SLOT(setEnabled(bool)));
02233   connect(CheckBoxFIEL, SIGNAL(toggled(bool)), LabelFIELz, SLOT(setEnabled(bool)));
02234   connect(CheckBoxSCRF, SIGNAL(toggled(bool)), LineEditSCRF1, SLOT(setEnabled(bool)));
02235   connect(CheckBoxSCRF, SIGNAL(toggled(bool)), LineEditSCRF2, SLOT(setEnabled(bool)));
02236   connect(CheckBoxSCRF, SIGNAL(toggled(bool)), LabelSCRF1, SLOT(setEnabled(bool)));
02237   connect(CheckBoxSCRF, SIGNAL(toggled(bool)), LabelSCRF2, SLOT(setEnabled(bool)));
02239   connect(CheckBoxSYMM, SIGNAL(toggled(bool)), RadioButtonSYMM1, SLOT(setEnabled(bool)));
02240   connect(CheckBoxSYMM, SIGNAL(toggled(bool)), RadioButtonSYMM2, SLOT(setEnabled(bool)));
02241   connect(CheckBoxSYMM, SIGNAL(toggled(bool)), GroupBoxSYMM, SLOT(setEnabled(bool)));
02242   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMx, SLOT(setEnabled(bool)));
02243   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMy, SLOT(setEnabled(bool)));
02244   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMz, SLOT(setEnabled(bool)));
02245   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMxy, SLOT(setEnabled(bool)));
02246   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMxz, SLOT(setEnabled(bool)));
02247   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMyz, SLOT(setEnabled(bool)));
02248   connect(RadioButtonSYMM2, SIGNAL(toggled(bool)), CheckBoxSYMMxyz, SLOT(setEnabled(bool)));  
02250   connect(CheckBoxMULL1, SIGNAL(toggled(bool)), CheckBoxMULL2, SLOT(setEnabled(bool)));
02251   connect(CheckBoxMULL1, SIGNAL(toggled(bool)), CheckBoxMULL3, SLOT(setEnabled(bool)));
02252   connect(CheckBoxSTOCK, SIGNAL(toggled(bool)), ButtonGroupSTOCK, SLOT(setEnabled(bool)));
02253   connect(CheckBoxSTOCK, SIGNAL(toggled(bool)), GroupBoxSTOCK, SLOT(setEnabled(bool)));
02254   connect(RadioButtonStockDENS4, SIGNAL(toggled(bool)), SpinBoxStockTRDE1, SLOT(setEnabled(bool)));
02255   connect(RadioButtonStockDENS4, SIGNAL(toggled(bool)), SpinBoxStockTRDE2, SLOT(setEnabled(bool)));
02256   connect(RadioButtonStockDENS4, SIGNAL(toggled(bool)), LabelStockTRDE, SLOT(setEnabled(bool)));  
02258   connect(CheckBoxLOCA, SIGNAL(toggled(bool)), SpinBoxLOCA, SLOT(setEnabled(bool)));
02259   connect(CheckBoxLOCA, SIGNAL(toggled(bool)), LineEditLOCA, SLOT(setEnabled(bool)));
02260   connect(CheckBoxLOCA, SIGNAL(toggled(bool)), LabelLOCA1, SLOT(setEnabled(bool)));
02261   connect(CheckBoxLOCA, SIGNAL(toggled(bool)), LabelLOCA2, SLOT(setEnabled(bool)));
02262   // SCF Convergence
02263   connect(CheckBoxDIIS, SIGNAL(toggled(bool)), this, SLOT(toggleDIIS(bool)));
02265   connect(CheckBoxPVM, SIGNAL(toggled(bool)), GroupBoxPVM1, SLOT(setEnabled(bool)));
02266   connect(CheckBoxPVM, SIGNAL(toggled(bool)), GroupBoxPVM2, SLOT(setEnabled(bool)));
02267   connect(CheckBoxPVM, SIGNAL(toggled(bool)), GroupBoxPVM3, SLOT(setEnabled(bool)));
02269   connect(CheckBoxPrintSCF1, SIGNAL(clicked()), this, SLOT(adjustPrintSCF()));
02270   connect(CheckBoxPrintSCF2, SIGNAL(clicked()), this, SLOT(adjustPrintSCF()));
02271   connect(CheckBoxPrintSCF3, SIGNAL(clicked()), this, SLOT(adjustPrintSCF()));
02273   connect(CheckBoxPVM, SIGNAL(toggled(bool)), GroupBoxExtraPVM, SLOT(setEnabled(bool)));  
02274   
02277   connect(ComboBoxSCFMethod, SIGNAL(activated(int)), this, SLOT(changed()));
02278   connect(ComboBoxSCFType, SIGNAL(activated(int)), this, SLOT(changed()));
02279   connect(CheckBoxSTAR, SIGNAL(clicked()), this, SLOT(changed()));
02280   connect(CheckBoxSTAR2, SIGNAL(clicked()), this, SLOT(changed()));
02281   connect(LineEditSTAR, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02282   connect(SpinBoxCHAR, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02284   connect(RadioButtonBAS1, SIGNAL(clicked()), this, SLOT(changed()));
02285   connect(RadioButtonBAS2, SIGNAL(clicked()), this, SLOT(changed()));
02286   connect(ComboBoxBAS1, SIGNAL(activated(int)), this, SLOT(changed()));
02287   connect(ComboBoxBAS2, SIGNAL(activated(int)), this, SLOT(changed()));
02288   connect(ComboBoxBAS3, SIGNAL(activated(int)), this, SLOT(changed()));
02289   connect(ToolButtonBAS1, SIGNAL(clicked()), this, SLOT(changed()));
02290   connect(ToolButtonBAS2, SIGNAL(clicked()), this, SLOT(changed()));
02292   connect(ButtonGroupMP2, SIGNAL(clicked(int)), this, SLOT(changed()));
02293   connect(SpinBoxMP2E1, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02294   connect(SpinBoxMP2E2, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02295   connect(CheckBoxMP2D, SIGNAL(clicked()), this, SLOT(changed()));
02296   connect(CheckBoxFIEL, SIGNAL(clicked()), this, SLOT(changed()));
02297   connect(LineEditFIELx, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02298   connect(LineEditFIELy, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02299   connect(LineEditFIELz, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02300   connect(CheckBoxSCRF, SIGNAL(clicked()), this, SLOT(changed()));
02301   connect(LineEditSCRF1, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02302   connect(LineEditSCRF2, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02304   connect(CheckBoxSYMM, SIGNAL(clicked()), this, SLOT(changed()));
02305   connect(ButtonGroupSYMM, SIGNAL(clicked(int)), this, SLOT(changed()));
02306   connect(CheckBoxSYMMx, SIGNAL(clicked()), this, SLOT(changed()));
02307   connect(CheckBoxSYMMy, SIGNAL(clicked()), this, SLOT(changed()));
02308   connect(CheckBoxSYMMz, SIGNAL(clicked()), this, SLOT(changed()));
02309   connect(CheckBoxSYMMxy, SIGNAL(clicked()), this, SLOT(changed()));
02310   connect(CheckBoxSYMMyz, SIGNAL(clicked()), this, SLOT(changed()));
02311   connect(CheckBoxSYMMxz, SIGNAL(clicked()), this, SLOT(changed()));
02312   connect(CheckBoxSYMMxyz, SIGNAL(clicked()), this, SLOT(changed()));
02314   connect(LineEditIPOL, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02315   connect(CheckBoxSKPC, SIGNAL(clicked()), this, SLOT(changed()));
02316   connect(CheckBoxGEOP, SIGNAL(clicked()), this, SLOT(changed()));
02317   connect(CheckBoxPRWF, SIGNAL(clicked()), this, SLOT(changed()));
02318   connect(CheckBoxPRDM, SIGNAL(clicked()), this, SLOT(changed()));
02319   connect(CheckBoxDST, SIGNAL(clicked()), this, SLOT(changed()));
02320   connect(CheckBoxACD, SIGNAL(clicked()), this, SLOT(changed()));
02321   connect(CheckBoxF11, SIGNAL(clicked()), this, SLOT(changed()));
02322   connect(CheckBoxFATO, SIGNAL(clicked()), this, SLOT(changed()));
02323   connect(SpinBoxFATO, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02324   connect(CheckBoxMIAForc, SIGNAL(clicked()), this, SLOT(changed()));
02326   connect(CheckBoxMULL1, SIGNAL(clicked()), this, SLOT(changed()));
02327   connect(CheckBoxMULL2, SIGNAL(clicked()), this, SLOT(changed()));
02328   connect(CheckBoxMULL3, SIGNAL(clicked()), this, SLOT(changed()));
02329   connect(CheckBoxSTOCK, SIGNAL(clicked()), this, SLOT(changed()));
02330   connect(ButtonGroupSTOCK, SIGNAL(clicked(int)), this, SLOT(changed()));
02331   connect(SpinBoxStockTRDE1, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02332   connect(SpinBoxStockTRDE2, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02333   connect(ComboBoxStockMOLD, SIGNAL(activated(int)), this, SLOT(changed()));
02334   connect(CheckBoxStockELMO, SIGNAL(clicked()), this, SLOT(changed()));
02335   connect(CheckBoxStockEPAR, SIGNAL(clicked()), this, SLOT(changed()));
02337   connect(CheckBoxLOCA, SIGNAL(clicked()), this, SLOT(changed()));
02338   connect(SpinBoxLOCA, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02339   connect(LineEditLOCA, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02340   connect(LineEditNUCL, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02341   connect(CheckBoxELMO, SIGNAL(clicked()), this, SLOT(changed()));
02342   connect(CheckBoxEXIT, SIGNAL(clicked()), this, SLOT(changed()));
02343   connect(CheckBoxJAB, SIGNAL(clicked()), this, SLOT(changed()));
02345   connect(SpinBoxITER, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02346   connect(CheckBoxJACO, SIGNAL(clicked()), this, SLOT(changed()));
02347   connect(CheckBoxDIIS, SIGNAL(clicked()), this, SLOT(changed()));
02348   connect(LineEditDIIS, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02349   connect(SpinBoxDIIS, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02350   connect(LineEditLVSH, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02351   connect(CheckBoxDLVS, SIGNAL(clicked()), this, SLOT(changed()));
02352   connect(LineEditThreINTEa, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02353   connect(LineEditThreINTEb, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02354   connect(LineEditThreSCF1a, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02355   connect(LineEditThreSCF1b, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02356   connect(LineEditThreSCF2a, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02357   connect(LineEditThreSCF2b, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02358   connect(LineEditSthrSCFa, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02359   connect(LineEditSthrSCFb, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
02360   connect(CheckBoxVTHR, SIGNAL(clicked()), this, SLOT(changed()));
02362   connect(CheckBoxPVM, SIGNAL(clicked()), this, SLOT(changed()));
02363   connect(ToolButtonNOTHadd, SIGNAL(clicked()), this, SLOT(changed()));
02364   connect(ToolButtonNOTHremove, SIGNAL(clicked()), this, SLOT(changed()));
02365   connect(SpinBoxNCST, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02366   connect(SpinBoxNTAS, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02367   connect(CheckBoxNOSE, SIGNAL(clicked()), this, SLOT(changed()));
02368   connect(SpinBoxNICE, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02369   connect(CheckBoxPACK, SIGNAL(clicked()), this, SLOT(changed()));
02371   connect(CheckBoxDebugPVM, SIGNAL(clicked()), this, SLOT(changed()));
02372   connect(CheckBoxDebugFORC, SIGNAL(clicked()), this, SLOT(changed()));
02373   connect(CheckBoxGoonINTE, SIGNAL(clicked()), this, SLOT(changed()));
02374   connect(CheckBoxGoonSCF, SIGNAL(clicked()), this, SLOT(changed()));
02375   connect(CheckBoxIntINTE, SIGNAL(clicked()), this, SLOT(changed()));
02376   connect(CheckBoxShellsINTE, SIGNAL(clicked()), this, SLOT(changed()));
02377   connect(CheckBoxPrintSCF1, SIGNAL(clicked()), this, SLOT(changed()));
02378   connect(CheckBoxPrintSCF2, SIGNAL(clicked()), this, SLOT(changed()));
02379   connect(CheckBoxPrintSCF3, SIGNAL(clicked()), this, SLOT(changed()));
02380   connect(SpinBoxPrintSCF, SIGNAL(valueChanged(int)), this, SLOT(changed()));
02382   connect(TableMain, SIGNAL(valueChanged(int, int)), this, SLOT(changed()));
02383   connect(TablePVM, SIGNAL(valueChanged(int, int)), this, SLOT(changed()));
02384   connect(TableINTE, SIGNAL(valueChanged(int, int)), this, SLOT(changed()));
02385   connect(TableSCF, SIGNAL(valueChanged(int, int)), this, SLOT(changed()));
02386   connect(TableFORC, SIGNAL(valueChanged(int, int)), this, SLOT(changed()));
02387   connect(ToolButtonAddMain, SIGNAL(clicked()), this, SLOT(changed()));
02388   connect(ToolButtonAddPVM, SIGNAL(clicked()), this, SLOT(changed()));
02389   connect(ToolButtonAddINTE, SIGNAL(clicked()), this, SLOT(changed()));
02390   connect(ToolButtonAddSCF, SIGNAL(clicked()), this, SLOT(changed()));
02391   connect(ToolButtonAddFORC, SIGNAL(clicked()), this, SLOT(changed()));
02392   // Remove's and Clear's changes are handled in the slots removeRow and clearSelection
02393 
02395   connect(TableMain, SIGNAL(valueChanged(int, int)), this, SLOT(checkOverflowMain(int, int)));
02396   connect(TablePVM, SIGNAL(valueChanged(int, int)), this, SLOT(checkOverflowPVM(int, int)));
02397   connect(TableINTE, SIGNAL(valueChanged(int, int)), this, SLOT(checkOverflowINTE(int, int)));
02398   connect(TableSCF, SIGNAL(valueChanged(int, int)), this, SLOT(checkOverflowSCF(int, int)));
02399   connect(TableFORC, SIGNAL(valueChanged(int, int)), this, SLOT(checkOverflowFORC(int, int)));
02400   connect(ToolButtonAddMain, SIGNAL(clicked()), this, SLOT(addRowMain()));
02401   connect(ToolButtonAddPVM, SIGNAL(clicked()), this, SLOT(addRowPVM()));
02402   connect(ToolButtonAddINTE, SIGNAL(clicked()), this, SLOT(addRowINTE()));
02403   connect(ToolButtonAddSCF, SIGNAL(clicked()), this, SLOT(addRowSCF()));
02404   connect(ToolButtonAddFORC, SIGNAL(clicked()), this, SLOT(addRowFORC()));
02405   connect(ToolButtonRemoveMain, SIGNAL(clicked()), this, SLOT(removeRowMain()));
02406   connect(ToolButtonRemovePVM, SIGNAL(clicked()), this, SLOT(removeRowPVM()));
02407   connect(ToolButtonRemoveINTE, SIGNAL(clicked()), this, SLOT(removeRowINTE()));
02408   connect(ToolButtonRemoveSCF, SIGNAL(clicked()), this, SLOT(removeRowSCF()));
02409   connect(ToolButtonRemoveFORC, SIGNAL(clicked()), this, SLOT(removeRowFORC()));
02410   connect(ToolButtonClearMain, SIGNAL(clicked()), this, SLOT(clearSelectionMain()));
02411   connect(ToolButtonClearPVM, SIGNAL(clicked()), this, SLOT(clearSelectionPVM()));
02412   connect(ToolButtonClearINTE, SIGNAL(clicked()), this, SLOT(clearSelectionINTE()));
02413   connect(ToolButtonClearSCF, SIGNAL(clicked()), this, SLOT(clearSelectionSCF()));
02414   connect(ToolButtonClearFORC, SIGNAL(clicked()), this, SLOT(clearSelectionFORC()));
02415 }
02416 
02418 void BraboBase::init()
02421 {
02423   calcForces = true; // so the call to setForces does something
02424   setForces(false);
02425   setDescription(tr("not specified"));
02426   setName(tr("not specified"));
02427   setExtendedFormat(false);
02428   
02430   category.clear();
02431   //TODO: setsize to the desired final size
02432   category.push_back(tr("Basic"));          // root
02433   category.push_back(tr("Advanced"));
02434   category.push_back(tr("Properties"));
02435   category.push_back(tr("SCF Convergence"));
02436   category.push_back(tr("PVM"));
02437   category.push_back(tr("Debug"));
02438   category.push_back(tr("Extra"));
02439   //category.push_back(tr("Method"));         // Basic
02440   //category.push_back(tr("Basis Set"));
02441   category.push_back(tr("Method"));         // Advanced
02442   category.push_back(tr("Symmetry"));
02443   category.push_back(tr("Other"));
02444   category.push_back(tr("Charges"));        // Properties
02445   category.push_back(tr("Other"));
02446   category.push_back(tr("Main"));           // Extra
02447   category.push_back(tr("PVM"));
02448   category.push_back(tr("INTE"));
02449   category.push_back(tr("SCF"));
02450   category.push_back(tr("FORC"));
02451 
02453   ListViewCategory->clear();
02454   ListViewCategory->setSorting(-1);
02455   ListViewCategory->header()->hide();
02457   QListViewItem* rootItem;
02459   rootItem = new QListViewItem(ListViewCategory, category[EXTRA]);
02460     new QListViewItem(rootItem, category[EXTRA_FORC]);
02461     new QListViewItem(rootItem, category[EXTRA_SCF]);
02462     new QListViewItem(rootItem, category[EXTRA_INTE]);
02463     new QListViewItem(rootItem, category[EXTRA_PVM]);
02464     new QListViewItem(rootItem, category[EXTRA_MAIN]);
02466   new QListViewItem(ListViewCategory, category[DEBUG1]);
02468   new QListViewItem(ListViewCategory, category[PVM]);
02470   new QListViewItem(ListViewCategory, category[SCFCONVERGENCE]);
02472   rootItem = new QListViewItem(ListViewCategory, category[PROPERTIES]);
02473     new QListViewItem(rootItem, category[PROPERTIES_OTHER]);
02474     new QListViewItem(rootItem, category[PROPERTIES_CHARGES]);
02476   rootItem = new QListViewItem(ListViewCategory, category[ADVANCED]);
02477     new QListViewItem(rootItem, category[ADVANCED_OTHER]);
02478     new QListViewItem(rootItem, category[ADVANCED_SYMMETRY]);
02479     new QListViewItem(rootItem, category[ADVANCED_METHOD]);
02481   rootItem = new QListViewItem(ListViewCategory, category[BASIC]);
02482   ListViewCategory->setSelected(rootItem, true);
02483   //rootItem = new QListViewItem(ListViewCategory, category[BASIC]);
02484   //  new QListViewItem(rootItem, category[BASIC_BASISSET]);
02485   //  new QListViewItem(rootItem, category[BASIC_METHOD]);
02486   //  rootItem->setOpen(true);
02487   //  ///// select Method (signals are not connected yet)
02488   //  ListViewCategory->setSelected(rootItem->itemBelow(), true);
02490   rootItem = 0;
02492   QListViewItemIterator it(ListViewCategory);
02493   int minWidth = 0;
02494   while(it.current())
02495   {
02496     int itemWidth = it.current()->width(fontMetrics(), ListViewCategory, 0);
02497     if(itemWidth > minWidth)
02498       minWidth = itemWidth;
02499     it++;
02500   }
02501   ListViewCategory->setFixedWidth(minWidth + 2*ListViewCategory->treeStepSize());
02502 
02505   // positive or negative
02506   QDoubleValidator* v = new QDoubleValidator(-99999999.0,999999999.,9,this);
02507   LineEditFIELx->setValidator(v);
02508   LineEditFIELy->setValidator(v);
02509   LineEditFIELz->setValidator(v);
02510   LineEditLVSH->setValidator(v);
02511   // positive only
02512   v = new QDoubleValidator(0.0,999999999.,9,this);
02513   LineEditSCRF1->setValidator(v);
02514   LineEditSCRF2->setValidator(v);
02515   LineEditIPOL->setValidator(v);
02516   LineEditLOCA->setValidator(v);
02517   LineEditDIIS->setValidator(v);
02518   LineEditThreINTEa->setValidator(v);
02519   LineEditThreINTEb->setValidator(v);
02520   LineEditThreSCF1a->setValidator(v);
02521   LineEditThreSCF1b->setValidator(v);
02522   LineEditThreSCF2a->setValidator(v);
02523   LineEditThreSCF2b->setValidator(v);
02524   LineEditSthrSCFa->setValidator(v);
02525   LineEditSthrSCFb->setValidator(v);
02526   v = 0;  
02527   
02529   ToolButtonSTAR->setIconSet(IconSets::getIconSet(IconSets::Open));
02530   ToolButtonBAS1->setIconSet(IconSets::getIconSet(IconSets::ArrowDown));
02531   ToolButtonBAS2->setIconSet(IconSets::getIconSet(IconSets::ArrowUp));
02532   ToolButtonNOTHadd->setIconSet(IconSets::getIconSet(IconSets::ArrowLeft));
02533   ToolButtonNOTHremove->setIconSet(IconSets::getIconSet(IconSets::ArrowRight));
02534   ToolButtonAddMain->setIconSet(IconSets::getIconSet(IconSets::New));
02535   ToolButtonRemoveMain->setIconSet(IconSets::getIconSet(IconSets::Cut));
02536   ToolButtonClearMain->setIconSet(IconSets::getIconSet(IconSets::Clear));
02537   ToolButtonAddPVM->setIconSet(IconSets::getIconSet(IconSets::New));
02538   ToolButtonRemovePVM->setIconSet(IconSets::getIconSet(IconSets::Cut));
02539   ToolButtonClearPVM->setIconSet(IconSets::getIconSet(IconSets::Clear));
02540   ToolButtonAddINTE->setIconSet(IconSets::getIconSet(IconSets::New));
02541   ToolButtonRemoveINTE->setIconSet(IconSets::getIconSet(IconSets::Cut));
02542   ToolButtonClearINTE->setIconSet(IconSets::getIconSet(IconSets::Clear));
02543   ToolButtonAddSCF->setIconSet(IconSets::getIconSet(IconSets::New));
02544   ToolButtonRemoveSCF->setIconSet(IconSets::getIconSet(IconSets::Cut));
02545   ToolButtonClearSCF->setIconSet(IconSets::getIconSet(IconSets::Clear));
02546   ToolButtonAddFORC->setIconSet(IconSets::getIconSet(IconSets::New));
02547   ToolButtonRemoveFORC->setIconSet(IconSets::getIconSet(IconSets::Cut));
02548   ToolButtonClearFORC->setIconSet(IconSets::getIconSet(IconSets::Clear));
02550   CheckBoxSYMMx->setPixmap(IconSets::getPixmap(IconSets::SymmX));
02551   CheckBoxSYMMy->setPixmap(IconSets::getPixmap(IconSets::SymmY));
02552   CheckBoxSYMMz->setPixmap(IconSets::getPixmap(IconSets::SymmZ));
02553   CheckBoxSYMMxy->setPixmap(IconSets::getPixmap(IconSets::SymmXY));
02554   CheckBoxSYMMxz->setPixmap(IconSets::getPixmap(IconSets::SymmXZ));
02555   CheckBoxSYMMyz->setPixmap(IconSets::getPixmap(IconSets::SymmYZ));
02556   CheckBoxSYMMxyz->setPixmap(IconSets::getPixmap(IconSets::SymmXYZ));
02557   
02559   fillComboBoxes();
02561   GroupBoxPVM1->setEnabled(false);
02562   GroupBoxPVM2->setEnabled(false);
02563   GroupBoxPVM3->setEnabled(false);  
02565   resize(1,1);
02567   reset();
02568   saveWidgets();
02569   widgetChanged = false;
02570 }
02571 
02573 void BraboBase::fillComboBoxes()
02575 {
02577   ComboBoxBAS1->clear();
02578   { for(unsigned int i = 0; i < Basisset::maxBasissets(); i++)
02579       ComboBoxBAS1->insertItem(Basisset::numToBasis(i)); }
02581   ComboBoxBAS2->clear();
02582   { for(unsigned int i = 1; i <= AtomSet::maxElements; i++)
02583       ComboBoxBAS2->insertItem(AtomSet::numToAtom(i)); }
02585   ComboBoxBAS3->clear();
02586   { for(unsigned int i = 0; i < Basisset::maxBasissets(); i++)
02587       ComboBoxBAS3->insertItem(Basisset::numToBasis(i)); }
02588 }
02589 
02591 void BraboBase::saveWidgets()
02593 {
02595   data.SCFMethod = ComboBoxSCFMethod->currentItem();
02596   data.SCFType = ComboBoxSCFType->currentItem();
02597   data.useStartvector = CheckBoxSTAR->isOn();
02598   if(data.useStartvector)
02599     data.startvector = LineEditSTAR->text();
02600   data.preferStartvector = CheckBoxSTAR2->isOn();
02601   data.charge = SpinBoxCHAR->value();
02602 
02604   data.useOneBasisset = RadioButtonBAS1->isChecked();
02605   data.basisset1 = ComboBoxBAS1->currentItem();
02606   data.basissetAtom = ComboBoxBAS2->currentItem();
02607   data.basisset2 = ComboBoxBAS3->currentItem();
02608   data.listAtoms.clear();
02609   data.listBasissets.clear();
02610   QListViewItemIterator it(ListViewBAS);
02611   for( ; it.current(); ++it)
02612   {
02613     data.listAtoms.push_back(AtomSet::atomToNum(it.current()->text(0)));
02614     data.listBasissets.push_back(Basisset::basisToNum(it.current()->text(1)));
02615   }
02616 
02618   if(RadioButtonMP2E1->isChecked())
02619     data.MP2Type = 0;
02620   else if(RadioButtonMP2E2->isChecked())
02621     data.MP2Type = 1;
02622   else if(RadioButtonMP2E3->isChecked())
02623     data.MP2Type = 2;
02624   data.MP2ExcludeOcc = SpinBoxMP2E1->value();
02625   data.MP2ExcludeVirt = SpinBoxMP2E1->value();
02626   data.MP2Density = CheckBoxMP2D->isChecked();
02627   data.useField = CheckBoxFIEL->isChecked();
02628   data.fieldX = LineEditFIELx->text();
02629   data.fieldY = LineEditFIELy->text();
02630   data.fieldZ = LineEditFIELz->text();
02631   data.useSCRF = CheckBoxSCRF->isChecked();
02632   data.SCRFEpsilon = LineEditSCRF1->text();
02633   data.SCRFRadius = LineEditSCRF2->text();
02634 
02636   data.useSymmetry = CheckBoxSYMM->isChecked();
02637   data.useSymmAuto = RadioButtonSYMM1->isChecked();
02638   data.useSymmX = CheckBoxSYMMx->isChecked();
02639   data.useSymmY = CheckBoxSYMMy->isChecked();
02640   data.useSymmZ = CheckBoxSYMMz->isChecked();
02641   data.useSymmXY = CheckBoxSYMMxy->isChecked();
02642   data.useSymmYZ = CheckBoxSYMMyz->isChecked();
02643   data.useSymmXZ = CheckBoxSYMMxz->isChecked();
02644   data.useSymmXYZ = CheckBoxSYMMxyz->isChecked();
02645 
02647   data.valueIpol = LineEditIPOL->text();
02648   data.useSkpc = CheckBoxSKPC->isChecked();
02649   data.printGeop = CheckBoxGEOP->isChecked();
02650   data.printWF = CheckBoxPRWF->isChecked();
02651   data.printDM = CheckBoxPRDM->isChecked();
02652   data.useDST = CheckBoxDST->isChecked();
02653   data.useACD = CheckBoxACD->isChecked();
02654   data.saveF11 = CheckBoxF11->isChecked();
02655   data.useFato = CheckBoxFATO->isChecked();
02656   data.numFato = SpinBoxFATO->value();
02657   data.useMIAForce = CheckBoxMIAForc->isChecked();
02658 
02660   data.useMulliken = CheckBoxMULL1->isChecked();
02661   data.MullikenNoOverlap = CheckBoxMULL2->isChecked();
02662   data.MullikenEachIter = CheckBoxMULL3->isChecked();
02663   data.useStock = CheckBoxSTOCK->isChecked();
02664   if(RadioButtonStockDENS1->isChecked())
02665     data.stockType = 0;
02666   else if(RadioButtonStockDENS2->isChecked())
02667     data.stockType = 1;
02668   else if(RadioButtonStockDENS3->isChecked())
02669     data.stockType = 2;
02670   else if(RadioButtonStockDENS4->isChecked())
02671     data.stockType = 3;
02672   else if(RadioButtonStockDENS5->isChecked())
02673     data.stockType = 4;
02674   data.stockTotalDensity = ComboBoxStockMOLD->currentItem() && 1;
02675   data.stockTransition1 = SpinBoxStockTRDE1->value();
02676   data.stockTransition2 = SpinBoxStockTRDE2->value();
02677   data.useStockElmo = CheckBoxStockELMO->isChecked();
02678   data.useStockEpar = CheckBoxStockEPAR->isChecked();
02679 
02681   data.useBoys = CheckBoxLOCA->isChecked();
02682   data.numBoysIter = SpinBoxLOCA->value();
02683   data.BoysThreshold = LineEditLOCA->text();
02684   data.listNucl = LineEditNUCL->text();
02685   data.useElmo = CheckBoxELMO->isChecked();
02686   data.useExit = CheckBoxEXIT->isChecked();
02687   data.useJab = CheckBoxJAB->isChecked();
02688 
02690   data.numIter = SpinBoxITER->value();
02691   data.useJacobi = CheckBoxJACO->isChecked();
02692   data.useDIIS = !CheckBoxDIIS->isChecked();
02693   data.DIISThre = LineEditDIIS->text();
02694   data.numDIISCoeff = SpinBoxDIIS->value();
02695   data.valueLvsh = LineEditLVSH->text();
02696   data.useDlvs = CheckBoxDLVS->isChecked();
02697   data.thresholdINTEa = LineEditThreINTEa->text();
02698   data.thresholdINTEb = LineEditThreINTEb->text();
02699   data.thresholdMIAa = LineEditThreSCF1a->text();
02700   data.thresholdMIAb = LineEditThreSCF1b->text();
02701   data.thresholdSCFa = LineEditThreSCF2a->text();
02702   data.thresholdSCFb = LineEditThreSCF2b->text();
02703   data.thresholdOverlapa = LineEditSthrSCFa->text();
02704   data.thresholdOverlapb = LineEditSthrSCFb->text();
02705   data.useVarThreMIA = CheckBoxVTHR->isChecked();
02706 
02708   data.usePVM = CheckBoxPVM->isChecked();
02709   data.PVMExcludeHosts.clear();
02710   for(unsigned int i = 0; i<ListBoxNOTH1->count(); i++)
02711     data.PVMExcludeHosts += ListBoxNOTH1->text(i);
02712   data.PVMNumShells = SpinBoxNCST->value();
02713   data.PVMNumTasks = SpinBoxNTAS->value();
02714   data.notOnMaster = CheckBoxNOSE->isChecked();
02715   data.valueNice = SpinBoxNICE->value();
02716   data.usePacked = CheckBoxPACK->isChecked();
02717 
02719   data.printDebugPVM = CheckBoxDebugPVM->isChecked();
02720   data.printDebugFORC = CheckBoxDebugFORC->isChecked();
02721   data.goonINTE = CheckBoxGoonINTE->isChecked();
02722   data.goonSCF = CheckBoxGoonSCF->isChecked();
02723   data.printIntegrals = CheckBoxIntINTE->isChecked();
02724   data.printShells = CheckBoxShellsINTE->isChecked();
02725   if(CheckBoxPrintSCF3->isChecked())
02726     data.levelPrintSCF = 3;
02727   else if(CheckBoxPrintSCF2->isChecked())
02728     data.levelPrintSCF = 2;
02729   else if(CheckBoxPrintSCF1->isChecked())
02730     data.levelPrintSCF = 1;
02731   else
02732     data.levelPrintSCF = 0;
02733   data.numVirtual = SpinBoxPrintSCF->value();
02734 
02736   saveTable(TableMain, data.numLinesExtraMain, data.hPosExtraMain, data.vPosExtraMain, data.contentsExtraMain);
02737   saveTable(TablePVM,  data.numLinesExtraPVM,  data.hPosExtraPVM,  data.vPosExtraPVM,  data.contentsExtraPVM);
02738   saveTable(TableINTE, data.numLinesExtraINTE, data.hPosExtraINTE, data.vPosExtraINTE, data.contentsExtraINTE);
02739   saveTable(TableSCF,  data.numLinesExtraSCF,  data.hPosExtraSCF,  data.vPosExtraSCF,  data.contentsExtraSCF);
02740   saveTable(TableFORC, data.numLinesExtraFORC, data.hPosExtraFORC, data.vPosExtraFORC, data.contentsExtraFORC);
02741 }
02742 
02744 void BraboBase::restoreWidgets()
02746 {
02748   ComboBoxSCFMethod->setCurrentItem(data.SCFMethod);
02749   ComboBoxSCFType->setCurrentItem(data.SCFType);
02750   CheckBoxSTAR->setChecked(data.useStartvector);
02751   if(data.useStartvector)
02752     LineEditSTAR->setText(data.startvector);
02753   CheckBoxSTAR2->setChecked(data.preferStartvector);
02754   SpinBoxCHAR->setValue(data.charge);
02755 
02757   RadioButtonBAS1->setChecked(data.useOneBasisset);
02758   ComboBoxBAS1->setCurrentItem(data.basisset1);
02759   ComboBoxBAS2->setCurrentItem(data.basissetAtom);
02760   ComboBoxBAS3->setCurrentItem(data.basisset2);
02761   ListViewBAS->clear();
02762   for (unsigned int i = 0; i < data.listAtoms.size(); i++)
02763     new QListViewItem(ListViewBAS, AtomSet::numToAtom(data.listAtoms[i]), Basisset::numToBasis(data.listBasissets[i]));
02764 
02766   switch(data.MP2Type)
02767   {
02768     case 0: RadioButtonMP2E1->setChecked(true);
02769             break;
02770     case 1: RadioButtonMP2E2->setChecked(true);
02771             break;
02772     case 2: RadioButtonMP2E3->setChecked(true);
02773   }
02774   SpinBoxMP2E1->setValue(data.MP2ExcludeOcc);
02775   SpinBoxMP2E2->setValue(data.MP2ExcludeVirt);
02776   CheckBoxMP2D->setChecked(data.MP2Density);
02777   CheckBoxFIEL->setChecked(data.useField);
02778   LineEditFIELx->setText(data.fieldX);
02779   LineEditFIELy->setText(data.fieldY);
02780   LineEditFIELz->setText(data.fieldZ);
02781   CheckBoxSCRF->setChecked(data.useSCRF);
02782   LineEditSCRF1->setText(data.SCRFEpsilon);
02783   LineEditSCRF2->setText(data.SCRFRadius);
02784 
02786   CheckBoxSYMM->setChecked(data.useSymmetry);
02787   RadioButtonSYMM1->setChecked(data.useSymmAuto);
02788   CheckBoxSYMMx->setChecked(data.useSymmX);
02789   CheckBoxSYMMy->setChecked(data.useSymmY);
02790   CheckBoxSYMMz->setChecked(data.useSymmZ);
02791   CheckBoxSYMMxy->setChecked(data.useSymmXY);
02792   CheckBoxSYMMyz->setChecked(data.useSymmYZ);
02793   CheckBoxSYMMxz->setChecked(data.useSymmXZ);
02794   CheckBoxSYMMxyz->setChecked(data.useSymmXYZ);
02795 
02797   LineEditIPOL->setText(data.valueIpol);
02798   CheckBoxSKPC->setChecked(data.useSkpc);
02799   CheckBoxGEOP->setChecked(data.printGeop);
02800   CheckBoxPRWF->setChecked(data.printWF);
02801   CheckBoxPRDM->setChecked(data.printDM);
02802   CheckBoxDST->setChecked(data.useDST);
02803   CheckBoxACD->setChecked(data.useACD);
02804   CheckBoxF11->setChecked(data.saveF11);
02805   CheckBoxFATO->setChecked(data.useFato);
02806   SpinBoxFATO->setValue(data.numFato);
02807   CheckBoxMIAForc->setChecked(data.useMIAForce);
02808 
02810   CheckBoxMULL1->setChecked(data.useMulliken);
02811   CheckBoxMULL2->setChecked(data.MullikenNoOverlap);
02812   CheckBoxMULL3->setChecked(data.MullikenEachIter);
02813   CheckBoxSTOCK->setChecked(data.useStock);
02814   switch(data.stockType)
02815   {
02816     case 0: RadioButtonStockDENS1->setChecked(true);
02817             break;
02818     case 1: RadioButtonStockDENS2->setChecked(true);
02819             break;
02820     case 2: RadioButtonStockDENS3->setChecked(true);
02821             break;
02822     case 3: RadioButtonStockDENS4->setChecked(true);
02823             break;
02824     case 4: RadioButtonStockDENS5->setChecked(true);
02825   }
02826   if(data.stockTotalDensity)
02827     ComboBoxStockMOLD->setCurrentItem(1);
02828   else
02829     ComboBoxStockMOLD->setCurrentItem(0);
02830   SpinBoxStockTRDE1->setValue(data.stockTransition1);
02831   SpinBoxStockTRDE2->setValue(data.stockTransition2);
02832   CheckBoxStockELMO->setChecked(data.useStockElmo);
02833   CheckBoxStockEPAR->setChecked(data.useStockEpar);
02834 
02836   CheckBoxLOCA->setChecked(data.useBoys);
02837   SpinBoxLOCA->setValue(data.numBoysIter);
02838   LineEditLOCA->setText(data.BoysThreshold);
02839   LineEditNUCL->setText(data.listNucl);
02840   CheckBoxELMO->setChecked(data.useElmo);
02841   CheckBoxEXIT->setChecked(data.useExit);
02842   CheckBoxJAB->setChecked(data.useJab);
02843 
02845   SpinBoxITER->setValue(data.numIter);
02846   CheckBoxJACO->setChecked(data.useJacobi);
02847   CheckBoxDIIS->setChecked(!data.useDIIS);
02848   LineEditDIIS->setText(data.DIISThre);
02849   SpinBoxDIIS->setValue(data.numDIISCoeff);
02850   LineEditLVSH->setText(data.valueLvsh);
02851   CheckBoxDLVS->setChecked(data.useDlvs);
02852   LineEditThreINTEa->setText(data.thresholdINTEa);
02853   LineEditThreINTEb->setText(data.thresholdINTEb);
02854   LineEditThreSCF1a->setText(data.thresholdMIAa);
02855   LineEditThreSCF1b->setText(data.thresholdMIAb);
02856   LineEditThreSCF2a->setText(data.thresholdSCFa);
02857   LineEditThreSCF2b->setText(data.thresholdSCFb);
02858   LineEditSthrSCFa->setText(data.thresholdOverlapa);
02859   LineEditSthrSCFb->setText(data.thresholdOverlapb);
02860   CheckBoxVTHR->setChecked(data.useVarThreMIA);
02861 
02863   CheckBoxPVM->setChecked(data.usePVM);
02864   ListBoxNOTH1->clear();
02865   for(QStringList::Iterator it = data.PVMExcludeHosts.begin(); it != data.PVMExcludeHosts.end(); ++it)
02866     ListBoxNOTH1->insertItem(*it);
02867   SpinBoxNCST->setValue(data.PVMNumShells);
02868   SpinBoxNTAS->setValue(data.PVMNumTasks);
02869   CheckBoxNOSE->setChecked(data.notOnMaster);
02870   SpinBoxNICE->setValue(data.valueNice);
02871   CheckBoxPACK->setChecked(data.usePacked);
02872 
02874   CheckBoxDebugPVM->setChecked(data.printDebugPVM);
02875   CheckBoxDebugFORC->setChecked(data.printDebugFORC);
02876   CheckBoxGoonINTE->setChecked(data.goonINTE);
02877   CheckBoxGoonSCF->setChecked(data.goonSCF);
02878   CheckBoxIntINTE->setChecked(data.printIntegrals);
02879   CheckBoxShellsINTE->setChecked(data.printShells);
02880   CheckBoxPrintSCF1->setChecked(data.levelPrintSCF > 0);
02881   CheckBoxPrintSCF2->setChecked(data.levelPrintSCF > 1);
02882   CheckBoxPrintSCF3->setChecked(data.levelPrintSCF > 2);
02883   SpinBoxPrintSCF->setValue(data.numVirtual);
02884 
02886   restoreTable(TableMain, data.numLinesExtraMain, data.hPosExtraMain, data.vPosExtraMain, data.contentsExtraMain);
02887   restoreTable(TablePVM,  data.numLinesExtraPVM,  data.hPosExtraPVM,  data.vPosExtraPVM,  data.contentsExtraPVM);
02888   restoreTable(TableINTE, data.numLinesExtraINTE, data.hPosExtraINTE, data.vPosExtraINTE, data.contentsExtraINTE);
02889   restoreTable(TableSCF,  data.numLinesExtraSCF,  data.hPosExtraSCF,  data.vPosExtraSCF,  data.contentsExtraSCF);
02890   restoreTable(TableFORC, data.numLinesExtraFORC, data.hPosExtraFORC, data.vPosExtraFORC, data.contentsExtraFORC);
02891 }
02892 
02894 QStringList BraboBase::parsedNUCLlines()
02897 {
02898   QStringList result;
02899   QStringList tempList = QStringList::split(",", LineEditNUCL->text()); 
02900   
02901   for(QStringList::Iterator it = tempList.begin(); it != tempList.end(); it++)
02902   {
02903     QString entry = *it;
02904     if(entry.contains("-"))
02905     {
02907       int startValue = entry.section("-", 0, 0, QString::SectionSkipEmpty).toInt();
02908       int endValue = entry.section("-", 1, 1, QString::SectionSkipEmpty).toInt();
02909       if(startValue < 1)
02910         startValue = 1;
02911       if(endValue < startValue)
02912         endValue = startValue;
02913       for(int i = startValue; i <= endValue; i++)
02914         result += inputLine("nucl", i);
02915     }
02916     else
02917     {
02919       int value = entry.toInt();
02920       if(value > 0)
02921         result += inputLine("nucl", value);
02922     }
02923   }
02924   return result;
02925 }
02926 
02928 void BraboBase::buildAtdens()
02933 {
02934   qDebug("*** generating atomic density basis set files ***");
02936   vector<unsigned int> atomSCFAtoms;
02937   for(unsigned int i = 1; i <= 20; i++) 
02938     atomSCFAtoms.push_back(i);
02939   atomSCFAtoms.push_back(27);
02940   for(unsigned int i = 31; i <= 35; i++) 
02941     atomSCFAtoms.push_back(i);
02942   atomSCFAtoms.push_back(45);
02943   atomSCFAtoms.push_back(53);
02944   
02946   QDir workDir("F:\\temp\\atdens"); // Windows
02947   //QDir workDir("/tmp/atdens"); // *nix
02948   if(!workDir.exists())
02949     workDir.mkdir(workDir.path());
02950   if(!QDir::setCurrent(workDir.path()))
02951   {
02952     qDebug("couldn't change into directory "+workDir.path());
02953     return;
02954   }
02955 
02957   QProcess* process = new QProcess(this);
02958   process->setWorkingDirectory(workDir);
02960   for(unsigned int basis = 0; basis < Basisset::maxBasissets(); basis++)
02961   //unsigned int basis = 0; // 3-21G
02962   {
02964     QString basisDir = Basisset::numToBasisDir(basis);
02965     QString basisDirBase = basisDir;
02966     basisDirBase.remove("p"); // same basis without polarisation. might have to be changed when new basis sets are added
02967     basisDir = Paths::basisset + QDir::separator() + basisDir;
02968     basisDirBase = Paths::basisset + QDir::separator() + basisDirBase;
02969 
02970     qDebug("building the atdens files for basis set "+Basisset::numToBasis(basis));
02971     qDebug("full basis dir = "+basisDir);
02972     qDebug("core basis dir = "+basisDirBase);
02973 
02975     for(vector<unsigned int>::iterator it = atomSCFAtoms.begin(); it != atomSCFAtoms.end(); it++)
02976     {
02977       unsigned int atom = *it;
02978       QString basisFile = AtomSet::numToAtom(atom).stripWhiteSpace() + "." + Basisset::extension();
02979 
02981       QFile basisFileCheck(basisDir + QDir::separator() + basisFile);
02982       if(!basisFileCheck.exists())
02983         continue;
02984 
02986       QFile atdens(basisDir + QDir::separator() + AtomSet::numToAtom(atom).stripWhiteSpace() + ".atdens");
02987       if(atdens.exists())
02988         continue;
02989 
02990       qDebug("  current atomic number = %d with basisset "+basisFile, atom);
02992       QString stdInput = "y\n" + basisFile + "\n" + QString::number(atom) + "\n";
02993       stdInput += basisDirBase + QDir::separator() + basisFile + "\ny\n";
02995       process->clearArguments();
02996       process->addArgument(Paths::atomscf_inp);
02997       process->launch(stdInput);
02998       qDebug("    running atomscf_inp");
02999       while(process->isRunning())
03000         qApp->processEvents();
03001       if(!process->normalExit())
03002         continue; // try next atom
03003 
03005       qDebug("    reading fort.1");
03006       QFile file1("fort.1"); // assume the working directory hasn't changed
03007       if(!file1.open(IO_ReadOnly))
03008         continue;
03009       QByteArray fort1 = file1.readAll();
03010       file1.close();
03012       process->clearArguments();
03013       process->addArgument(Paths::atomscf);
03014       process->launch(fort1);
03015       qDebug("    running atomscf");
03016       while(process->isRunning())
03017         qApp->processEvents();
03018       if(!process->normalExit())
03019         continue; // try next atom
03021       qDebug("    reading fort.2");
03022       QByteArray fort2 = process->readStdout();
03023       QFile file2("fort.2");
03024       if(!file2.open(IO_WriteOnly))
03025         continue;
03026       file2.writeBlock(fort2);
03027       file2.close();
03028 
03030       stdInput = "fort.2\n" + basisFile + "\n" + basisDir + "\nn\n"; // n = (no) extended format for the atdens file, but doesn't have any influence yet
03032       process->clearArguments();
03033       process->addArgument(Paths::atomscf_o2d);
03034       process->launch(stdInput);
03035       qDebug("    running atomscf_o2d");
03036       while(process->isRunning())
03037         qApp->processEvents();
03038       if(!process->normalExit())
03039         continue; // try next atom
03040       
03042       QFile file9("fort.9");
03043       qDebug("    copying fort.9 to "+atdens.name());
03044       if(!file9.open(IO_ReadOnly) || !atdens.open(IO_WriteOnly))
03045         continue;
03046       atdens.writeBlock(file9.readAll());
03047       file9.close();
03048       atdens.close();
03049     }
03050 
03051   }
03052   qDebug("*** finished ***");
03053 }
03054 
03058 
03059 QStringList BraboBase::pvmHosts = QStringList(); 
03060 unsigned int BraboBase::preferredBasisset = 0; 
03061 const BraboBase::XMLData BraboBase::xml = {
03063   "scf_method",
03064   "scf_type",
03065   "use_start_vector",
03066   "start_vector_file",
03067   "start_vector_file",
03068   "charge",
03070   "use_one_basis_set",
03071   "basis_set_1",
03072   "basis_set_atom",
03073   "basis_set_2",
03074   "list_atoms",
03075   "list_basissets",
03077   "mp2_type",
03078   "mp2_exclude_occupied",
03079   "mp2_exclude_virtual",
03080   "mp2_density",
03081   "use_field",
03082   "field_x",
03083   "field_y",
03084   "field_z",
03085   "use_scrf",
03086   "scrf_epsilon",
03087   "scrf_radius",
03089   "use_symmetry",
03090   "symmetry_auto",
03091   "symmetry_x__",
03092   "symmetry_y__",
03093   "symmetry_z__",
03094   "symmetry_xy_",
03095   "symmetry_yz_",
03096   "symmetry_xz_",
03097   "symmetry_xyz",
03099   "ipol",
03100   "use_skpc",
03101   "print_geom",
03102   "print_wf",
03103   "print_dm",
03104   "use_dst",
03105   "use_acd",
03106   "save_f11",
03107   "use_fato",
03108   "fato_number",
03109   "use_mia_force",
03111   "use_mulliken",
03112   "mulliken_no_overlap",
03113   "mulliken_each_iter",
03114   "use_stock",
03115   "stock_type",
03116   "stock_total_density",
03117   "stock_transition_1",
03118   "stock_transition_2",
03119   "use_stock_elmo",
03120   "use_stock_epar",
03122   "use_boys",
03123   "boys_iter",
03124   "boys_threshold",
03125   "nucl",
03126   "use_elmo",
03127   "use_exit",
03128   "use_jab",
03130   "scf_iter",
03131   "use_jacobi",
03132   "use_diis",
03133   "diis_thre",
03134   "diis_coeff",
03135   "lvsh",
03136   "use_dlvs",
03137   "thre_inte_a",
03138   "thre__inte_b",
03139   "thre_mia_a",
03140   "thre_mia_b",
03141   "thre_scf_a",
03142   "thre_scf_b",
03143   "thre_overlap_a",
03144   "thre_overlap_b",
03145   "use_vthr_mia",
03147   "use_pvm",
03148   "pvm_exclude_hosts",
03149   "pvm_shells",
03150   "pvm_tasks",
03151   "pvm_not_on_master",
03152   "pvm_nice",
03153   "pvm_packed",
03155   "debug_pvm",
03156   "debug_force",
03157   "goon_inte",
03158   "goon_scf",
03159   "print_integrals",
03160   "print_shells",
03161   "scf_print_level",
03162   "scf_print_virtual",
03164   "extra_main_lines",
03165   "extra_pvm_lines",
03166   "extra_inte_lines",
03167   "extra_scf_lines",
03168   "extra_forc_lines",
03169   "extra_main_hpos",
03170   "extra_pvm_hpos",
03171   "extra_inte_hpos",
03172   "extra_scf_hpos",
03173   "extra_forc_hpos",
03174   "extra_main_vpos",
03175   "extra_pvm_vpos",
03176   "extra_inte_vpos",
03177   "extra_scf_vpos",
03178   "extra_forc_vpos",
03179   "extra_main_contents",
03180   "extra_pvm_contents",
03181   "extra_inte_contents",
03182   "extra_scf_contents",
03183   "extra_forc_contents"
03184 };
03185 
03186 

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