00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00020
00021 #ifndef RELAXBASE_H
00022 #define RELAXBASE_H
00023
00025
00026
00027 #include <vector>
00028 using std::vector;
00029
00030
00031 class QDomElement;
00032 class QProcess;
00033 class QString;
00034
00035
00036 class AtomSet;
00037
00038
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);
00050 ~RelaxBase();
00051
00053 enum Input{AFF, MAFF};
00054
00056 void setName(const QString name);
00057 void setDescription(const QString description);
00058 void setDir(const QString dir);
00059 void setExtendedFormat(const bool state);
00060
00062 unsigned int inputGenerationFrequency();
00063 unsigned int maxSteps();
00064 void scaleFactors(vector<unsigned int>& steps, vector<double>& factors);
00065
00067 QStringList generateInput(const Input type);
00068 void loadCML(const QDomElement* root);
00069 void saveCML(QDomElement* root);
00070
00071 public slots:
00072 void reset();
00073
00074 protected:
00075 void showEvent(QShowEvent* e);
00076
00077 protected slots:
00078 void accept();
00079 void reject();
00080
00081 private slots:
00083 void showPreview();
00084 void showPreview2();
00085 void readInputFile();
00087 void setChanged(bool state = true);
00088 void selectWidget(QListViewItem*);
00090 void enableAutogenWidgets();
00091 void enableSFACWidgets(bool state = true);
00092 void newScaleFactor();
00093 void deleteScaleFactor();
00095 void updateICEdit();
00096 void updateICList();
00097 void updateICSpecifics();
00098 void updateICType();
00099 void newIC();
00100 void newICPart();
00101 void deleteIC();
00102 void clearIC();
00103 void genIC();
00104 void genIC2();
00105 void moveICUp();
00106 void moveICDown();
00108 void newFixedAtom();
00109 void deleteFixedAtom();
00110 void checkFIXABoxes();
00111 void enableTROTWidgets(bool state = true);
00113 void newExtraBond();
00114 void deleteExtraBond();
00116 void enableUPDTWidgets(bool state = true);
00117 void enableSHRTWidgets(bool state = true);
00119 void checkOverflow(int row, int col);
00120 void addExtraRow();
00121 void removeExtraRow();
00122 void clearSelection();
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();
00133 void init();
00134 void saveWidgets();
00135 void restoreWidgets();
00136 QString icRepresentation(const unsigned int atom1, const unsigned int atom2, const unsigned int atom3 = 0, const int atom4 = 0);
00137 void getAtomsFromIC(const QString textIC, unsigned int& atom1, unsigned int& atom2, unsigned int& atom3, int& atom4);
00138 void renumberICs();
00139 QStringList generateAFFHeader();
00140 QStringList generateBmatInput();
00141 bool makeDirCurrent(const QString dir, const QString title);
00142 void fillICListFromAFF(const QStringList aff);
00143 bool startMAFF(const unsigned int slot);
00144 QStringList readMAFFGeneratedICs();
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 {
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
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
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