diff --git a/mathmech/Makefile b/mathmech/Makefile index c296953..9cde9e6 100644 --- a/mathmech/Makefile +++ b/mathmech/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: mathmech -# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 9 20:52:33 2013 +# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 10 04:06:18 2013 # Project: mathmech.pro # Template: app # Command: /usr/lib/qt4/bin/qmake -o Makefile mathmech.pro @@ -10,13 +10,13 @@ CC = gcc CXX = g++ -DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +DEFINES = -DQWT_DLL -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED CFLAGS = -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT $(DEFINES) CXXFLAGS = -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT $(DEFINES) -INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -I/usr/include/qwt -I. -I. LINK = g++ -LFLAGS = -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,-O1 -LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread +LFLAGS = -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,-O1 -lrt +LIBS = $(SUBLIBS) -L/usr/lib -L/usr/lib -lqwt -lQtSvg -lQtGui -lQtCore -lpthread AR = ar cqs RANLIB = QMAKE = /usr/lib/qt4/bin/qmake @@ -53,7 +53,8 @@ SOURCES = main.cpp \ agglwindow.cpp \ aboutwindow.cpp \ statgengraphwindow.cpp \ - settingswindow.cpp moc_mainwindow.cpp \ + settingswindow.cpp \ + aglallwindow.cpp moc_mainwindow.cpp \ moc_errorwindow.cpp \ moc_clear_items.cpp \ moc_start_events.cpp \ @@ -62,7 +63,8 @@ SOURCES = main.cpp \ moc_agglwindow.cpp \ moc_aboutwindow.cpp \ moc_statgengraphwindow.cpp \ - moc_settingswindow.cpp + moc_settingswindow.cpp \ + moc_aglallwindow.cpp OBJECTS = main.o \ mainwindow.o \ errorwindow.o \ @@ -74,6 +76,7 @@ OBJECTS = main.o \ aboutwindow.o \ statgengraphwindow.o \ settingswindow.o \ + aglallwindow.o \ moc_mainwindow.o \ moc_errorwindow.o \ moc_clear_items.o \ @@ -83,7 +86,8 @@ OBJECTS = main.o \ moc_agglwindow.o \ moc_aboutwindow.o \ moc_statgengraphwindow.o \ - moc_settingswindow.o + moc_settingswindow.o \ + moc_aglallwindow.o DIST = /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/common/gcc-base.conf \ @@ -99,6 +103,9 @@ DIST = /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/release.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/qwtconfig.pri \ + /usr/share/qt4/mkspecs/features/qwtfunctions.pri \ + /usr/share/qt4/mkspecs/features/qwt.prf \ /usr/share/qt4/mkspecs/features/shared.prf \ /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ @@ -139,7 +146,7 @@ first: all all: Makefile $(TARGET) -$(TARGET): ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h $(OBJECTS) +$(TARGET): ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h ui_aglallwindow.h $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \ @@ -157,6 +164,9 @@ Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/q /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/release.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/qwtconfig.pri \ + /usr/share/qt4/mkspecs/features/qwtfunctions.pri \ + /usr/share/qt4/mkspecs/features/qwt.prf \ /usr/share/qt4/mkspecs/features/shared.prf \ /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ @@ -168,6 +178,7 @@ Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/q /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtSvg.prl \ /usr/lib/libQtGui.prl \ /usr/lib/libQtCore.prl $(QMAKE) -o Makefile mathmech.pro @@ -186,6 +197,9 @@ Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/q /usr/share/qt4/mkspecs/features/default_pre.prf: /usr/share/qt4/mkspecs/features/release.prf: /usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/qwtconfig.pri: +/usr/share/qt4/mkspecs/features/qwtfunctions.pri: +/usr/share/qt4/mkspecs/features/qwt.prf: /usr/share/qt4/mkspecs/features/shared.prf: /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: /usr/share/qt4/mkspecs/features/warn_on.prf: @@ -197,6 +211,7 @@ Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/q /usr/share/qt4/mkspecs/features/yacc.prf: /usr/share/qt4/mkspecs/features/lex.prf: /usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtSvg.prl: /usr/lib/libQtGui.prl: /usr/lib/libQtCore.prl: qmake: FORCE @@ -204,7 +219,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) .tmp/mathmech1.0.0 || $(MKDIR) .tmp/mathmech1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.h errorwindow.h clear_items.h start_events.h update_fields.h atomtypeswindow.h agglwindow.h aboutwindow.h statgengraphwindow.h settingswindow.h .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp update_fields.cpp atomtypeswindow.cpp agglwindow.cpp aboutwindow.cpp statgengraphwindow.cpp settingswindow.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.ui atomtypeswindow.ui agglwindow.ui aboutwindow.ui statgengraphwindow.ui settingswindow.ui .tmp/mathmech1.0.0/ && (cd `dirname .tmp/mathmech1.0.0` && $(TAR) mathmech1.0.0.tar mathmech1.0.0 && $(COMPRESS) mathmech1.0.0.tar) && $(MOVE) `dirname .tmp/mathmech1.0.0`/mathmech1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mathmech1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.h errorwindow.h clear_items.h start_events.h update_fields.h atomtypeswindow.h agglwindow.h aboutwindow.h statgengraphwindow.h settingswindow.h aglallwindow.h .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp update_fields.cpp atomtypeswindow.cpp agglwindow.cpp aboutwindow.cpp statgengraphwindow.cpp settingswindow.cpp aglallwindow.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.ui atomtypeswindow.ui agglwindow.ui aboutwindow.ui statgengraphwindow.ui settingswindow.ui aglallwindow.ui .tmp/mathmech1.0.0/ && (cd `dirname .tmp/mathmech1.0.0` && $(TAR) mathmech1.0.0.tar mathmech1.0.0 && $(COMPRESS) mathmech1.0.0.tar) && $(MOVE) `dirname .tmp/mathmech1.0.0`/mathmech1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mathmech1.0.0 clean:compiler_clean @@ -225,9 +240,9 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all -compiler_moc_header_make_all: moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp moc_agglwindow.cpp moc_aboutwindow.cpp moc_statgengraphwindow.cpp moc_settingswindow.cpp +compiler_moc_header_make_all: moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp moc_agglwindow.cpp moc_aboutwindow.cpp moc_statgengraphwindow.cpp moc_settingswindow.cpp moc_aglallwindow.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp moc_agglwindow.cpp moc_aboutwindow.cpp moc_statgengraphwindow.cpp moc_settingswindow.cpp + -$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp moc_agglwindow.cpp moc_aboutwindow.cpp moc_statgengraphwindow.cpp moc_settingswindow.cpp moc_aglallwindow.cpp moc_mainwindow.cpp: mainwindow.h /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp @@ -258,6 +273,9 @@ moc_statgengraphwindow.cpp: statgengraphwindow.h moc_settingswindow.cpp: settingswindow.h /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) settingswindow.h -o moc_settingswindow.cpp +moc_aglallwindow.cpp: aglallwindow.h + /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) aglallwindow.h -o moc_aglallwindow.cpp + compiler_rcc_make_all: compiler_rcc_clean: compiler_image_collection_make_all: qmake_image_collection.cpp @@ -265,9 +283,9 @@ compiler_image_collection_clean: -$(DEL_FILE) qmake_image_collection.cpp compiler_moc_source_make_all: compiler_moc_source_clean: -compiler_uic_make_all: ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h +compiler_uic_make_all: ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h ui_aglallwindow.h compiler_uic_clean: - -$(DEL_FILE) ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h + -$(DEL_FILE) ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h ui_agglwindow.h ui_aboutwindow.h ui_statgengraphwindow.h ui_settingswindow.h ui_aglallwindow.h ui_mainwindow.h: mainwindow.ui /usr/lib/qt4/bin/uic mainwindow.ui -o ui_mainwindow.h @@ -289,6 +307,9 @@ ui_statgengraphwindow.h: statgengraphwindow.ui ui_settingswindow.h: settingswindow.ui /usr/lib/qt4/bin/uic settingswindow.ui -o ui_settingswindow.h +ui_aglallwindow.h: aglallwindow.ui + /usr/lib/qt4/bin/uic aglallwindow.ui -o ui_aglallwindow.h + compiler_yacc_decl_make_all: compiler_yacc_decl_clean: compiler_yacc_impl_make_all: @@ -326,7 +347,8 @@ start_events.o: start_events.cpp start_events.h \ mainwindow.h \ ui_mainwindow.h \ errorwindow.h \ - ui_errorwindow.h + ui_errorwindow.h \ + statgengraphwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o start_events.o start_events.cpp update_fields.o: update_fields.cpp update_fields.h \ @@ -355,9 +377,17 @@ statgengraphwindow.o: statgengraphwindow.cpp statgengraphwindow.h \ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o statgengraphwindow.o statgengraphwindow.cpp settingswindow.o: settingswindow.cpp settingswindow.h \ - ui_settingswindow.h + ui_settingswindow.h \ + errorwindow.h \ + ui_errorwindow.h \ + mainwindow.h \ + ui_mainwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o settingswindow.o settingswindow.cpp +aglallwindow.o: aglallwindow.cpp aglallwindow.h \ + ui_aglallwindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o aglallwindow.o aglallwindow.cpp + moc_mainwindow.o: moc_mainwindow.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp @@ -388,6 +418,9 @@ moc_statgengraphwindow.o: moc_statgengraphwindow.cpp moc_settingswindow.o: moc_settingswindow.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_settingswindow.o moc_settingswindow.cpp +moc_aglallwindow.o: moc_aglallwindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_aglallwindow.o moc_aglallwindow.cpp + ####### Install install: FORCE diff --git a/mathmech/aboutwindow.cpp b/mathmech/aboutwindow.cpp index 32010c2..8e7e4b6 100644 --- a/mathmech/aboutwindow.cpp +++ b/mathmech/aboutwindow.cpp @@ -1,3 +1,5 @@ +#include + #include "aboutwindow.h" #include "ui_aboutwindow.h" @@ -12,3 +14,10 @@ AboutWindow::~AboutWindow() { delete ui; } + +// ESC press event +void AboutWindow::keyPressEvent(QKeyEvent *pressedKey) +{ + if (pressedKey->key() == Qt::Key_Escape) + close(); +} diff --git a/mathmech/aboutwindow.h b/mathmech/aboutwindow.h index 8ecf17a..b5dcd94 100644 --- a/mathmech/aboutwindow.h +++ b/mathmech/aboutwindow.h @@ -17,6 +17,9 @@ public: private: Ui::AboutWindow *ui; + +// ESC pressed event + void keyPressEvent(QKeyEvent *pressedKey); }; #endif /* ABOUTWINDOW_H */ diff --git a/mathmech/aglallwindow.cpp b/mathmech/aglallwindow.cpp new file mode 100644 index 0000000..3a66cfd --- /dev/null +++ b/mathmech/aglallwindow.cpp @@ -0,0 +1,14 @@ +#include "aglallwindow.h" +#include "ui_aglallwindow.h" + +AglAllWindow::AglAllWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::AglAllWindow) +{ + ui->setupUi(this); +} + +AglAllWindow::~AglAllWindow() +{ + delete ui; +} diff --git a/mathmech/aglallwindow.h b/mathmech/aglallwindow.h new file mode 100644 index 0000000..f9a43aa --- /dev/null +++ b/mathmech/aglallwindow.h @@ -0,0 +1,22 @@ +#ifndef AGLALLWINDOW_H +#define AGLALLWINDOW_H + +#include + +namespace Ui { + class AglAllWindow; +} + +class AglAllWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit AglAllWindow(QWidget *parent = 0); + ~AglAllWindow(); + +private: + Ui::AglAllWindow *ui; +}; + +#endif // AGLALLWINDOW_H diff --git a/mathmech/aglallwindow.ui b/mathmech/aglallwindow.ui new file mode 100644 index 0000000..32a65c4 --- /dev/null +++ b/mathmech/aglallwindow.ui @@ -0,0 +1,21 @@ + + + AglAllWindow + + + + 0 + 0 + 240 + 320 + + + + MainWindow + + + + + + + diff --git a/mathmech/mainwindow.cpp b/mathmech/mainwindow.cpp index 11f9956..1f309b9 100644 --- a/mathmech/mainwindow.cpp +++ b/mathmech/mainwindow.cpp @@ -153,15 +153,19 @@ void MainWindow::on_radf_checkBox_ang_stateChanged(int arg1) { if (arg1 == 0) { + ui->radf_checkBox_graph->setCheckState(Qt::Checked); ui->radf_doubleSpinBox_angMax->setDisabled(true); ui->radf_doubleSpinBox_angMin->setDisabled(true); ui->radf_doubleSpinBox_angStep->setDisabled(true); + ui->radf_checkBox_graph->setEnabled(true); } else if (arg1 == 2) { + ui->radf_checkBox_graph->setCheckState(Qt::Unchecked); ui->radf_doubleSpinBox_angMax->setEnabled(true); ui->radf_doubleSpinBox_angMin->setEnabled(true); ui->radf_doubleSpinBox_angStep->setEnabled(true); + ui->radf_checkBox_graph->setDisabled(true); } } @@ -246,6 +250,17 @@ void MainWindow::on_trj_pushButton_atoms_clicked() ui->trj_lineEdit_atoms->setText(filename); } +void MainWindow::on_trj_pushButton_output_clicked() +{ + QString filename = QFileDialog::getSaveFileName( + this, + tr("Save files as"), + QDir(ui->trj_lineEdit_workDir->text()).absolutePath(), + tr("Mask of trajectory files")); + if (!filename.isEmpty()) + ui->trj_lineEdit_output->setText(filename); +} + void MainWindow::on_trj_pushButton_log_clicked() { QString filename = QFileDialog::getSaveFileName( @@ -267,6 +282,17 @@ void MainWindow::on_statgen_pushButton_workDir_clicked() ui->statgen_lineEdit_workDir->setText(dirname); } +void MainWindow::on_statgen_pushButton_input_clicked() +{ + QString filename = QFileDialog::getOpenFileName( + this, + tr("Select trajectory files"), + QDir(ui->statgen_lineEdit_workDir->text()).absolutePath(), + tr("Trajectory files (*.*[0-9])")); + if (!filename.isEmpty()) + ui->statgen_lineEdit_input->setText(filename.split(QString("."))[0]); +} + void MainWindow::on_statgen_pushButton_output_clicked() { QString filename = QFileDialog::getSaveFileName( @@ -342,6 +368,17 @@ void MainWindow::on_radf_pushButton_workDir_clicked() ui->radf_lineEdit_workDir->setText(dirname); } +void MainWindow::on_radf_pushButton_input_clicked() +{ + QString filename = QFileDialog::getOpenFileName( + this, + tr("Select trajectory files"), + QDir(ui->radf_lineEdit_workDir->text()).absolutePath(), + tr("Trajectory files (*.*[0-9])")); + if (!filename.isEmpty()) + ui->radf_lineEdit_input->setText(filename.split(QString("."))[0]); +} + void MainWindow::on_radf_pushButton_output_clicked() { QString filename = QFileDialog::getSaveFileName( @@ -350,7 +387,7 @@ void MainWindow::on_radf_pushButton_output_clicked() QDir(ui->radf_lineEdit_workDir->text()).absolutePath(), tr("Output files (*.dat)")); if (!filename.isEmpty()) - ui->envir_lineEdit_output->setText(filename); + ui->radf_lineEdit_output->setText(filename); } void MainWindow::on_radf_pushButton_log_clicked() diff --git a/mathmech/mainwindow.h b/mathmech/mainwindow.h index 6069225..7aca229 100644 --- a/mathmech/mainwindow.h +++ b/mathmech/mainwindow.h @@ -45,8 +45,10 @@ private slots: void on_trj_pushButton_workDir_clicked(); void on_trj_pushButton_input_clicked(); void on_trj_pushButton_atoms_clicked(); + void on_trj_pushButton_output_clicked(); void on_trj_pushButton_log_clicked(); void on_statgen_pushButton_workDir_clicked(); + void on_statgen_pushButton_input_clicked(); void on_statgen_pushButton_output_clicked(); void on_statgen_pushButton_log_clicked(); void on_envir_pushButton_workDir_clicked(); @@ -54,6 +56,7 @@ private slots: void on_envir_pushButton_output_clicked(); void on_envir_pushButton_log_clicked(); void on_radf_pushButton_workDir_clicked(); + void on_radf_pushButton_input_clicked(); void on_radf_pushButton_output_clicked(); void on_radf_pushButton_log_clicked(); void on_pdb_pushButton_workDir_clicked(); diff --git a/mathmech/mainwindow.ui b/mathmech/mainwindow.ui index 85ce21a..283f48b 100644 --- a/mathmech/mainwindow.ui +++ b/mathmech/mainwindow.ui @@ -268,12 +268,28 @@ - 365 + 320 23 + + + + + 80 + 23 + + + + Browse + + + true + + + @@ -500,6 +516,22 @@ + + + + + 80 + 23 + + + + Browse + + + true + + + @@ -1204,6 +1236,22 @@ + + + + + 80 + 23 + + + + Graph + + + true + + + @@ -1784,6 +1832,22 @@ + + + + + 80 + 23 + + + + Browse + + + true + + + @@ -2782,6 +2846,22 @@ + + + + + 80 + 23 + + + + Graph + + + true + + + @@ -3274,12 +3354,20 @@ - File creator + File &creator + + + &Tools + + + + + @@ -3337,7 +3425,17 @@ - Settings + &Settings + + + + + agl_all + + + + + statgen_all @@ -3353,6 +3451,7 @@ trj_lineEdit_atoms trj_pushButton_atoms trj_lineEdit_output + trj_pushButton_output trj_spinBox_totalTypes trj_checkBox_log trj_lineEdit_log @@ -3362,6 +3461,7 @@ statgen_lineEdit_workDir statgen_pushButton_workDir statgen_lineEdit_input + statgen_pushButton_input statgen_spinBox_stepsFirst statgen_spinBox_stepsLast statgen_doubleSpinBox_cellX @@ -3388,6 +3488,7 @@ statgen_lineEdit_log statgen_pushButton_log statgen_pushButton_clear + statgen_checkBox_graph statgen_pushButton_start envir_lineEdit_workDir envir_pushButton_workDir @@ -3408,6 +3509,7 @@ radf_lineEdit_workDir radf_pushButton_workDir radf_lineEdit_input + radf_pushButton_input radf_spinBox_stepsFirst radf_spinBox_stepsLast radf_doubleSpinBox_cellX @@ -3434,6 +3536,7 @@ radf_lineEdit_log radf_pushButton_log radf_pushButton_clear + radf_checkBox_graph radf_pushButton_start pdb_comboBox_mode pdb_lineEdit_workDir diff --git a/mathmech/mathmech b/mathmech/mathmech index 7aa97b2..dfa1aa5 100755 Binary files a/mathmech/mathmech and b/mathmech/mathmech differ diff --git a/mathmech/mathmech.pro b/mathmech/mathmech.pro index 4f35885..4bdbee2 100644 --- a/mathmech/mathmech.pro +++ b/mathmech/mathmech.pro @@ -6,6 +6,7 @@ TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . +CONFIG += qwt # Input HEADERS += mainwindow.h \ @@ -17,14 +18,16 @@ HEADERS += mainwindow.h \ agglwindow.h \ aboutwindow.h \ statgengraphwindow.h \ - settingswindow.h + settingswindow.h \ + aglallwindow.h FORMS += mainwindow.ui \ errorwindow.ui \ atomtypeswindow.ui \ agglwindow.ui \ aboutwindow.ui \ statgengraphwindow.ui \ - settingswindow.ui + settingswindow.ui \ + aglallwindow.ui SOURCES += main.cpp mainwindow.cpp \ errorwindow.cpp \ clear_items.cpp \ @@ -34,4 +37,5 @@ SOURCES += main.cpp mainwindow.cpp \ agglwindow.cpp \ aboutwindow.cpp \ statgengraphwindow.cpp \ - settingswindow.cpp + settingswindow.cpp \ + aglallwindow.cpp diff --git a/mathmech/mathmech.pro.user b/mathmech/mathmech.pro.user index 664b842..d0e5a8e 100644 --- a/mathmech/mathmech.pro.user +++ b/mathmech/mathmech.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/mathmech/settingswindow.ui b/mathmech/settingswindow.ui index acd3078..8c4d811 100644 --- a/mathmech/settingswindow.ui +++ b/mathmech/settingswindow.ui @@ -347,10 +347,8 @@ settings_lineEdit_agl settings_pushButton_agl settings_comboBox_lang - pushButton_6 settings_pushButton_close settings_pushButton_save - lineEdit_6 diff --git a/mathmech/start_events.cpp b/mathmech/start_events.cpp index feaa307..b04014d 100644 --- a/mathmech/start_events.cpp +++ b/mathmech/start_events.cpp @@ -6,6 +6,7 @@ #include "ui_mainwindow.h" #include "errorwindow.h" #include "ui_errorwindow.h" +#include "statgengraphwindow.h" Start_events::Start_events(MainWindow *wid) : parent(wid) @@ -218,6 +219,15 @@ void Start_events::start_statgen(QString mm_statgen_path) parent->ui->tabWidget->setEnabled(true); parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Done")); delete errorwin; + if (parent->ui->statgen_checkBox_graph->checkState() == 2) + { + QString filename = output; + if (!filename.contains(QDir::separator())) + filename = QFileInfo(QDir(workDir), filename).absoluteFilePath(); + StatgenGraphWindow *graphwin; + graphwin = new StatgenGraphWindow(parent, filename); + graphwin->show(); + } } void Start_events::start_envir(QString mm_envir_path) @@ -423,6 +433,15 @@ void Start_events::start_radf(QString mm_radf_path) parent->ui->tabWidget->setEnabled(true); parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Done")); delete errorwin; + if (parent->ui->radf_checkBox_graph->checkState() == 2) + { + QString filename = output; + if (!filename.contains(QDir::separator())) + filename = QFileInfo(QDir(workDir), filename).absoluteFilePath(); + StatgenGraphWindow *graphwin; + graphwin = new StatgenGraphWindow(parent, filename); + graphwin->show(); + } } void Start_events::start_pdb(QString mm_pdb_path) diff --git a/mathmech/statgengraphwindow.cpp b/mathmech/statgengraphwindow.cpp index 512c2a5..6554240 100644 --- a/mathmech/statgengraphwindow.cpp +++ b/mathmech/statgengraphwindow.cpp @@ -1,14 +1,159 @@ +#include +#include +#include +#include + +#include +#include +#include + #include "statgengraphwindow.h" #include "ui_statgengraphwindow.h" -StatgenGraphWindow::StatgenGraphWindow(QWidget *parent) : +StatgenGraphWindow::StatgenGraphWindow(QWidget *parent, QString inputfile) : QMainWindow(parent), ui(new Ui::StatgenGraphWindow) { ui->setupUi(this); + + _inputfile = inputfile; + + readData(); + paintGraph(); } StatgenGraphWindow::~StatgenGraphWindow() { delete ui; } + +// ESC press event +void StatgenGraphWindow::keyPressEvent(QKeyEvent *pressedKey) +{ + if (pressedKey->key() == Qt::Key_Escape) + close(); +} + +void StatgenGraphWindow::paintGraph() +{ + plot = new QwtPlot(ui->centralwidget); + plot->setMinimumSize(QSize(322, 280)); + ui->verticalLayout->addWidget(plot); + + plot->setFont(QFont("Times New Roman", 8, QFont::Bold)); + plot->setAxisFont(QwtPlot::xBottom, QFont("Times New Roman", 8, QFont::Bold)); + plot->setAxisFont(QwtPlot::yLeft, QFont("Times New Roman", 8, QFont::Bold)); + plot->setAxisAutoScale(QwtPlot::xBottom, true); + plot->setAxisAutoScale(QwtPlot::yLeft, true); + plot->setAutoReplot(true); + + QPen pen; + switch (type) + { + case 0: + plot->setAxisTitle(QwtPlot::xBottom, trUtf8("N")); + plot->setAxisTitle(QwtPlot::yLeft, trUtf8("p")); + + pen = QPen(QColor(0,0,0)); + QwtPlotCurve *p_curve; + p_curve = new QwtPlotCurve(QString("p")); + p_curve->setPen(pen); + p_curve->attach(plot); + p_curve->setSamples(x_axis, p_points); + + QwtPlotCurve *pn_curve; + pen = QPen(QColor(255,0,0)); + pn_curve = new QwtPlotCurve(QString("pn")); + pn_curve->setPen(pen); + pn_curve->attach(plot); + pn_curve->setSamples(x_axis, pn_points); + break; + case 1: + plot->setAxisTitle(QwtPlot::xBottom, trUtf8("N")); + plot->setAxisTitle(QwtPlot::yLeft, trUtf8("p")); + + pen = QPen(QColor(0,0,0)); + QwtPlotCurve *radf_curve; + radf_curve = new QwtPlotCurve(QString("RDF")); + radf_curve->setPen(pen); + radf_curve->attach(plot); + radf_curve->setSamples(x_axis, p_points); + break; + } + plot->replot(); +} + +void StatgenGraphWindow::readData() +{ + QString tmp_str; + QFile inp_file(_inputfile); + inp_file.open(QIODevice::ReadOnly); + tmp_str = QString(inp_file.readLine()); + int matrix=0; + if (tmp_str.contains(QString("statgen"))) + type = 0; + else if (tmp_str.contains(QString("radf"))) + type = 1; + while (!tmp_str.contains(QString("SUMMARY STATISTIC"))) + { + tmp_str = QString(inp_file.readLine()); + if ((type == 1) && (tmp_str.contains(QString("MATRIX=")))) + matrix = tmp_str.split(QString("MATRIX="), QString::SkipEmptyParts)[0].toInt(); + } + if (matrix == 0) + { + tmp_str = QString(inp_file.readLine()); + tmp_str = QString(inp_file.readLine()); + } + + switch(type) + { + case 0: + tmp_str = QString(inp_file.readLine()); + while (!tmp_str.contains(QString("---"))) + { + x_axis.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[0].toDouble()); + p_points.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[3].toDouble()); + pn_points.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[4].toDouble()); + tmp_str = QString(inp_file.readLine()); + } + break; + case 1: + tmp_str = QString(inp_file.readLine()); + while (!tmp_str.contains(QString("---"))) + { + x_axis.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[0].toDouble()); + switch(matrix) + { + case 0: + p_points.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[3].toDouble()); + break; + case 1: + p_points.append(tmp_str.split(QString(" "), QString::SkipEmptyParts)[1].toDouble()); + break; + } + tmp_str = QString(inp_file.readLine()); + } + break; + } + inp_file.close(); +} + +void StatgenGraphWindow::on_graph_pushButton_save_clicked() +{ + QPixmap qPix = QPixmap::grabWidget(plot); + QString filename = QFileDialog::getSaveFileName( + this, + tr("Save image as..."), + QDir::currentPath(), + tr("JPEG file (*.jpeg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp)")); + if (!filename.isEmpty()) + { + if (filename.contains(QRegExp("jpeg"))) + qPix.save(filename, "JPEG"); + else if (filename.contains(QRegExp("png"))) + qPix.save(filename, "PNG"); + else if (filename.contains(QRegExp("bmp"))) + qPix.save(filename, "BMP"); + } +} diff --git a/mathmech/statgengraphwindow.h b/mathmech/statgengraphwindow.h index 39fef55..4a571ba 100644 --- a/mathmech/statgengraphwindow.h +++ b/mathmech/statgengraphwindow.h @@ -2,6 +2,7 @@ #define STATGENGRAPHWINDOW_H #include +#include namespace Ui { class StatgenGraphWindow; @@ -12,11 +13,24 @@ class StatgenGraphWindow : public QMainWindow Q_OBJECT public: - explicit StatgenGraphWindow(QWidget *parent = 0); + explicit StatgenGraphWindow(QWidget *parent = 0, QString inputfile = ""); ~StatgenGraphWindow(); - + void paintGraph(); + void readData(); + +private slots: + void on_graph_pushButton_save_clicked(); + private: Ui::StatgenGraphWindow *ui; + QwtPlot *plot; + QVector x_axis; + QVector p_points; + QVector pn_points; + int type; + QString _inputfile; + + void keyPressEvent(QKeyEvent *pressedKey); }; #endif /* STATGENGRAPHWINDOW_H */ diff --git a/mathmech/statgengraphwindow.ui b/mathmech/statgengraphwindow.ui index 6cb4ffc..a88ba57 100644 --- a/mathmech/statgengraphwindow.ui +++ b/mathmech/statgengraphwindow.ui @@ -6,15 +6,88 @@ 0 0 - 240 - 320 + 418 + 299 Graph - + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 80 + 23 + + + + Save + + + true + + + + + + + + 80 + 23 + + + + Close + + + true + + + + + + + + + graph_pushButton_save + graph_pushButton_close + - + + + graph_pushButton_close + clicked() + StatgenGraphWindow + close() + + + 400 + 322 + + + 400 + 342 + + + + diff --git a/mathmech/update_fields.cpp b/mathmech/update_fields.cpp index a89fcbf..abe5a24 100644 --- a/mathmech/update_fields.cpp +++ b/mathmech/update_fields.cpp @@ -24,13 +24,7 @@ void Update_fields::setup_def_statgen() float cellX, cellY, cellZ; QStringList tmp_str; QString input = parent->ui->trj_lineEdit_input->text(); -#ifdef _WIN32 - if (input.contains("\\")) -#elif __linux - if (input.contains("/")) -#else - return; -#endif + if (input.contains(QDir::separator())) input = QFileInfo(input).absoluteFilePath(); else input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath(); @@ -40,7 +34,10 @@ void Update_fields::setup_def_statgen() return; if (parent->ui->trj_comboBox_type->currentIndex() == 0) { - for (int i=0; i<3; i++) + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + if (tmp_str[1] != QString("frame")) + return; + for (int i=0; i<2; i++) inp_trj.readLine(); tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = 10 * tmp_str[2].remove(tmp_str[2].count()-1, 1).toFloat(); @@ -51,7 +48,11 @@ void Update_fields::setup_def_statgen() } else if (parent->ui->trj_comboBox_type->currentIndex() == 1) { - inp_trj.readLine(); + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + bool ok = false; + cellX = tmp_str[0].toInt(&ok, 10); + if (!ok) + return; tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = tmp_str[0].toFloat(); cellY = tmp_str[1].toFloat(); @@ -73,13 +74,7 @@ void Update_fields::setup_def_envir() float cellX, cellY, cellZ; QStringList tmp_str; QString input = parent->ui->trj_lineEdit_input->text(); -#ifdef _WIN32 - if (input.contains("\\")) -#elif __linux - if (input.contains("/")) -#else - return; -#endif + if (input.contains(QDir::separator())) input = QFileInfo(input).absoluteFilePath(); else input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath(); @@ -89,7 +84,10 @@ void Update_fields::setup_def_envir() return; if (parent->ui->trj_comboBox_type->currentIndex() == 0) { - for (int i=0; i<3; i++) + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + if (tmp_str[1] != QString("frame")) + return; + for (int i=0; i<2; i++) inp_trj.readLine(); tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = 10 * tmp_str[2].remove(tmp_str[2].count()-1, 1).toFloat(); @@ -100,7 +98,11 @@ void Update_fields::setup_def_envir() } else if (parent->ui->trj_comboBox_type->currentIndex() == 1) { - inp_trj.readLine(); + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + bool ok = false; + cellX = tmp_str[0].toInt(&ok, 10); + if (!ok) + return; tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = tmp_str[0].toFloat(); cellY = tmp_str[1].toFloat(); @@ -126,13 +128,7 @@ void Update_fields::setup_def_radf() float cellX, cellY, cellZ; QStringList tmp_str; QString input = parent->ui->trj_lineEdit_input->text(); -#ifdef _WIN32 - if (input.contains("\\")) -#elif __linux - if (input.contains("/")) -#else - return; -#endif + if (input.contains(QDir::separator())) input = QFileInfo(input).absoluteFilePath(); else input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath(); @@ -142,7 +138,10 @@ void Update_fields::setup_def_radf() return; if (parent->ui->trj_comboBox_type->currentIndex() == 0) { - for (int i=0; i<3; i++) + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + if (tmp_str[1] != QString("frame")) + return; + for (int i=0; i<2; i++) inp_trj.readLine(); tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = 10 * tmp_str[2].remove(tmp_str[2].count()-1, 1).toFloat(); @@ -153,7 +152,11 @@ void Update_fields::setup_def_radf() } else if (parent->ui->trj_comboBox_type->currentIndex() == 1) { - inp_trj.readLine(); + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + bool ok = false; + cellX = tmp_str[0].toInt(&ok, 10); + if (!ok) + return; tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = tmp_str[0].toFloat(); cellY = tmp_str[1].toFloat(); @@ -175,13 +178,7 @@ void Update_fields::setup_def_pdb() float cellX, cellY, cellZ; QStringList tmp_str; QString input = parent->ui->trj_lineEdit_input->text(); -#ifdef _WIN32 - if (input.contains("\\")) -#elif __linux - if (input.contains("/")) -#else - return; -#endif + if (input.contains(QDir::separator())) input = QFileInfo(input).absoluteFilePath(); else input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath(); @@ -191,7 +188,10 @@ void Update_fields::setup_def_pdb() return; if (parent->ui->trj_comboBox_type->currentIndex() == 0) { - for (int i=0; i<3; i++) + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + if (tmp_str[1] != QString("frame")) + return; + for (int i=0; i<2; i++) inp_trj.readLine(); tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = 10 * tmp_str[2].remove(tmp_str[2].count()-1, 1).toFloat(); @@ -202,7 +202,11 @@ void Update_fields::setup_def_pdb() } else if (parent->ui->trj_comboBox_type->currentIndex() == 1) { - inp_trj.readLine(); + tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); + bool ok = false; + cellX = tmp_str[0].toInt(&ok, 10); + if (!ok) + return; tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts); cellX = tmp_str[0].toFloat(); cellY = tmp_str[1].toFloat(); diff --git a/mm_statgen/src/summary_stat.c b/mm_statgen/src/summary_stat.c index 6ea8a1a..da177e3 100644 --- a/mm_statgen/src/summary_stat.c +++ b/mm_statgen/src/summary_stat.c @@ -62,11 +62,11 @@ int summary_statistic (const char *filename, const int step, const int num_mol, fprintf (f_out, " %7i %7i %9.2f %9.5f %10.5f\n", i+1, stat_all[i], conc, p, pn); } + fprintf (f_out, "------------------------------------------------\n"); if (max_depth > 0) { // types of aglomerates - fprintf (f_out, "------------------------------------------------\n"); // linear and cycle x = type_agl[0] + type_agl[1]; type[0] = type_agl[0];