relaxbase.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           relaxbase.h  -  description
00003                              -------------------
00004     begin                : Mon Jun 16 2003
00005     copyright            : (C) 2003-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef RELAXBASE_H
00022 #define RELAXBASE_H
00023 
00025 
00026 // C++ forward class declarations
00027 #include <vector>
00028 using std::vector;
00029 
00030 // Qt forward class declarations
00031 class QDomElement;
00032 class QProcess;
00033 class QString;
00034 
00035 // Xbrabo forward class declarations
00036 class AtomSet;
00037 
00038 // Base class header file
00039 #include "relaxwidget.h"
00040 
00041 
00043 class RelaxBase : public RelaxWidget
00044 {
00045   Q_OBJECT
00046 
00047   public:
00049     RelaxBase(AtomSet* atomset, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);// constructor
00050     ~RelaxBase();                       // destructor
00051 
00053     enum Input{AFF, MAFF};              
00054     
00056     void setName(const QString name);   // sets the name (filename prefix)
00057     void setDescription(const QString description);         // sets the description
00058     void setDir(const QString dir);     // sets the directory
00059     void setExtendedFormat(const bool state);     // sets extended format for coordinates & forces
00060 
00062     unsigned int inputGenerationFrequency();      // frequency with which the internal coordinates should be regenerated
00063     unsigned int maxSteps();            // the limit for the number of optimization steps
00064     void scaleFactors(vector<unsigned int>& steps, vector<double>& factors);    // the list of scalefactors
00065     
00067     QStringList generateInput(const Input type);         // generate input for a specific program
00068     void loadCML(const QDomElement* root);        // loads widget appearances from file
00069     void saveCML(QDomElement* root);    // saves widget appearances to file 
00070 
00071   public slots:
00072     void reset();                       // resets all widgets to their default values
00073 
00074   protected:
00075     void showEvent(QShowEvent* e);      // occurs each time the dialog is shown
00076   
00077   protected slots:
00078     void accept();                      // is called when the changes are accepted (OK clicked)
00079     void reject();                      // is called when the changes are rejected (Cancel or X clicked)
00080     
00081   private slots:
00083     void showPreview();                 // initializes showing a preview of the input file
00084     void showPreview2();                // does the actual showing 
00085     void readInputFile();               // reads the contents of an existing AFF into the widgets
00087     void setChanged(bool state = true); // sets the 'changed' status of the dialog
00088     void selectWidget(QListViewItem*);  // shows a widget from the widgetstack depending on the listview item
00090     void enableAutogenWidgets();                  // enabled/disables the Autogen widgets
00091     void enableSFACWidgets(bool state = true);    // enables/disables the SFAC widgets depending on RadioButtonSFAC{1|2}
00092     void newScaleFactor();                        // adds a scale factor to the list
00093     void deleteScaleFactor();                     // deletes a scale factor from the list
00095     void updateICEdit();                          // updates the widgets with the contents of the selected IC
00096     void updateICList();                          // updates ListViewIC with the contents of the widgets
00097     void updateICSpecifics();                     // updates the specific widgets
00098     void updateICType();                          // updates the type of the internal coordinate for all parts
00099     void newIC();                                 // creates a new internal coordinate
00100     void newICPart();                             // creates a new part for an internal coordinate
00101     void deleteIC();                              // deletes the current internal coordinate
00102     void clearIC();                               // clears the IC list
00103     void genIC();                                 // initiates the generation all internal coordinates
00104     void genIC2();                                // generates all internal coordinates
00105     void moveICUp();                              // moves an internal coordinate up
00106     void moveICDown();                            // moves an internal coordinate down
00108     void newFixedAtom();                          // adds an atom to the fixed atoms list
00109     void deleteFixedAtom();                       // removes an atom from the fixed atoms list
00110     void checkFIXABoxes();                        // makes sure at least 1 box stays checked
00111     void enableTROTWidgets(bool state = true);    // enables/disables the TROT widgets depending on CheckBoxTROT
00113     void newExtraBond();                          // adds a bond to the XBON list
00114     void deleteExtraBond();                       // removes a bond from the XBON list
00116     void enableUPDTWidgets(bool state = true);    // enables/disables the UPDT widgets depending on CheckBoxUPDT
00117     void enableSHRTWidgets(bool state = true);    // enables/disables the SHRt widgets depending on CHeckBoxSHRT
00119     void checkOverflow(int row, int col);         // spans a cell over multiple columns if needed
00120     void addExtraRow();                 // adds a row to Table
00121     void removeExtraRow();              // removes a row from Table
00122     void clearSelection();              // clears the selected cells in Table
00123     
00124   private:
00126     enum Categories{BASIC = 0, INTERNAL = 1, CARTESIAN = 2, ADVANCED = 3, DEBUG1 = 4, EXTRA = 5,
00127                     CARTESIAN_SYMMETRY = 6, CARTESIAN_OTHER = 7,
00128                     ADVANCED_THRESHOLDS = 8, ADVANCED_OTHER = 9};     
00129     enum Type{PreviewAFF, ICListAFF};   
00130                                             
00132     void makeConnections();             // sets up all permanent connections
00133     void init();                        // initializes the dialog
00134     void saveWidgets();                 // saves the contents of the widgets to the data struct
00135     void restoreWidgets();              // restores the widgets from the data struct
00136     QString icRepresentation(const unsigned int atom1, const unsigned int atom2, const unsigned int atom3 = 0, const int atom4 = 0);        // builds an internal coordinate from 4 atoms
00137     void getAtomsFromIC(const QString textIC, unsigned int& atom1, unsigned int& atom2, unsigned int& atom3, int& atom4);         // returns the atom numbers from a textual representation of an internal coordinate
00138     void renumberICs();                 // renumbers all internal coordinates
00139     QStringList generateAFFHeader();    // generates input for the first part of an .aff file
00140     QStringList generateBmatInput();    // generates input for Maff for generating BMAT internal coordinates
00141     bool makeDirCurrent(const QString dir, const QString title);      // makes a directory current
00142     void fillICListFromAFF(const QStringList aff);// adds the internal coordinates found in aff to the IC list
00143     bool startMAFF(const unsigned int slot);      // initiates the generation of an AFF file using MAFF
00144     QStringList readMAFFGeneratedICs(); // reads the output from a MAFF run and cleans up
00145 
00147     struct ICData
00149     {
00150       unsigned int          number;     
00151       bool                  rootItem;   
00152       QString               type;       
00153       QString               fc;         
00154       bool                  fix;        
00155       bool                  maximize;   
00156       QString               refValue;   
00157       QString               weight;     
00158       unsigned int          atom1;      
00159       unsigned int          atom2;      
00160       unsigned int          atom3;      
00161       unsigned int          atom4;      
00162     };
00163     struct WidgetData
00165     {                                                 // WIDGET                     KEYWORD(S)
00167       unsigned int          type;                 
00168       bool                  autoGenerate;         
00169       bool                  autoRegen;            
00170       unsigned int          autoGenFreq;          
00171       bool                  autoHBonds;           
00172       bool                  useOneScaleFactor;    
00173       QString               sfacValue1;           
00174       QString               sfacValue2;           
00175       unsigned int          sfacNumSteps;         
00176       QStringList           listValues;           
00177       vector<unsigned int>  listNumSteps;         
00178       unsigned int          numDIIS;              
00179       bool                  printShifts;          
00180       //bool                  useDiagonals;         ///< CheckBoxFDIA               FDIA
00181       unsigned int          numSteps;             
00182 
00184       vector<ICData>        ic;                   
00185 
00187       bool                  checkSymmetry;        
00188       bool                  checkSymmX;           
00189       bool                  checkSymmY;           
00190       bool                  checkSymmZ;           
00191       bool                  checkSymmXY;          
00192       bool                  checkSymmXZ;          
00193       bool                  checkSymmYZ;          
00194       bool                  checkSymmXYZ;         
00195 
00197       unsigned int          fixAtom;              
00198       bool                  fixX;                 
00199       bool                  fixY;                 
00200       bool                  fixZ;                 
00201       vector<unsigned int>  listFixedAtoms;       
00202       QStringList           listFixedXYZ;         
00203       bool                  optExternal;          
00204       unsigned int          optExternalAngle;     
00205       QString               optExternalA;         
00206       QString               optExternalB;         
00207       QString               optExternalC;         
00208       QString               optExternalAlpha;     
00209       QString               optExternalBeta;      
00210       QString               optExternalGamma;     
00211       bool                  mirrorImage;          
00212       bool                  writeXYZ;             
00213       
00215       QString               refineThre1;          
00216       QString               refineThre2;          
00217       QString               refineThre3;          
00218       QString               refineThre4;          
00219       QString               refineThre5;          
00220       unsigned int          maxIter;              
00221       QString               iterThre1;            
00222       QString               iterThre2;            
00223       QString               iterThre3;            
00224       QString               iterThre4;            
00225 
00227       unsigned int          xbonAtom1;            
00228       unsigned int          xbonAtom2;            
00229       vector<unsigned int>  listXbonAtoms1;       
00230       vector<unsigned int>  listXbonAtoms2;       
00231       unsigned int          massType;             
00232       bool                  setLowFreqs;          
00233       QString               lowFreqs;             
00234       bool                  orden;                
00235       
00237       bool                  goon;                 
00238       bool                  printDebug;           
00239       bool                  update;               
00240       unsigned int          updateType;           
00241       QString               updateScaleFactor;    
00242       bool                  compact;              
00243       QString               compactBonds;         
00244       QString               compactAngles;        
00245       QString               compactTorsions;      
00246 
00248       unsigned int          numLines;             
00249       vector<unsigned int>  hPos;                 
00250       vector<unsigned int>  vPos;                 
00251       QStringList           contents;             
00252     };
00253     struct XMLData
00256     {                                                 
00258       QString type;
00259       QString autoGenerate;
00260       QString autoRegen;
00261       QString autoGenFreq;
00262       QString autoHBonds;
00263       QString useOneScaleFactor;
00264       QString sfacValue1;
00265       QString sfacValue2;
00266       QString sfacNumSteps;
00267       QString listValues;
00268       QString listNumSteps;
00269       QString numDIIS;
00270       QString printShifts;
00271       //QString useDiagonals;
00272       QString numSteps;
00273 
00275       QString ic_number;
00276       QString ic_rootItem;
00277       QString ic_type;
00278       QString ic_fc;
00279       QString ic_fix;
00280       QString ic_maximize;
00281       QString ic_refValue;
00282       QString ic_weight;
00283       QString ic_atom1;
00284       QString ic_atom2;
00285       QString ic_atom3;
00286       QString ic_atom4;
00287 
00289       QString checkSymmetry;
00290       QString checkSymmX;     
00291       QString checkSymmY;
00292       QString checkSymmZ;
00293       QString checkSymmXY;
00294       QString checkSymmXZ;
00295       QString checkSymmYZ;
00296       QString checkSymmXYZ;
00297 
00299       QString fixAtom;
00300       QString fixX;
00301       QString fixY;
00302       QString fixZ;      
00303       QString listFixedAtoms;
00304       QString listFixedXYZ;
00305       QString optExternal;
00306       QString optExternalAngle;
00307       QString optExternalA;
00308       QString optExternalB;
00309       QString optExternalC;
00310       QString optExternalAlpha;
00311       QString optExternalBeta;
00312       QString optExternalGamma; 
00313       QString mirrorImage;
00314       QString writeXYZ;
00315       
00317       QString refineThre1;
00318       QString refineThre2;
00319       QString refineThre3;
00320       QString refineThre4;
00321       QString refineThre5;
00322       QString maxIter;
00323       QString iterThre1;
00324       QString iterThre2;
00325       QString iterThre3;
00326       QString iterThre4;
00327 
00329       QString xbonAtom1;
00330       QString xbonAtom2;
00331       QString listXbonAtoms1;
00332       QString listXbonAtoms2;
00333       QString massType;
00334       QString setLowFreqs;
00335       QString lowFreqs;
00336       QString orden;      
00337       
00339       QString goon;
00340       QString printDebug;
00341       QString update;
00342       QString updateType;
00343       QString updateScaleFactor;
00344       QString compact;
00345       QString compactBonds;
00346       QString compactAngles;
00347       QString compactTorsions;
00348 
00350       QString numLines;
00351       QString hPos;
00352       QString vPos;
00353       QString contents;                                                 
00354     };
00355 
00357     WidgetData data;                    
00358     static const XMLData xml;           
00359     AtomSet* atoms;                     
00360     vector<QString> category;           
00361     bool widgetChanged;                 
00362     QString calcName;                   
00363     QString calcDescription;            
00364     QString calcDir;                    
00365     bool calcXF;                        
00366     QProcess* maffProcess;              
00367 };
00368     
00369 #endif
00370 

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