diff --git a/mathmech/Makefile b/mathmech/Makefile index 9cde9e6..c990a44 100644 --- a/mathmech/Makefile +++ b/mathmech/Makefile @@ -1,9 +1,9 @@ ############################################################################# # Makefile for building: mathmech -# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 10 04:06:18 2013 +# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 23 22:01:14 2013 # Project: mathmech.pro # Template: app -# Command: /usr/lib/qt4/bin/qmake -o Makefile mathmech.pro +# Command: /usr/bin/qmake-qt4 -o Makefile mathmech.pro ############################################################################# ####### Compiler, tools and options @@ -19,7 +19,7 @@ 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 +QMAKE = /usr/bin/qmake-qt4 TAR = tar -cf COMPRESS = gzip -9f COPY = cp -f @@ -323,15 +323,17 @@ compiler_clean: compiler_moc_header_clean compiler_uic_clean main.o: main.cpp mainwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp -mainwindow.o: mainwindow.cpp mainwindow.h \ - ui_mainwindow.h \ - aboutwindow.h \ +mainwindow.o: mainwindow.cpp aboutwindow.h \ agglwindow.h \ + aglallwindow.h \ atomtypeswindow.h \ settingswindow.h \ clear_items.h \ start_events.h \ - update_fields.h + statgengraphwindow.h \ + update_fields.h \ + mainwindow.h \ + ui_mainwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp errorwindow.o: errorwindow.cpp errorwindow.h \ @@ -343,29 +345,25 @@ clear_items.o: clear_items.cpp clear_items.h \ ui_mainwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o clear_items.o clear_items.cpp -start_events.o: start_events.cpp start_events.h \ - mainwindow.h \ +start_events.o: start_events.cpp mainwindow.h \ ui_mainwindow.h \ errorwindow.h \ - ui_errorwindow.h \ - statgengraphwindow.h + start_events.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o start_events.o start_events.cpp -update_fields.o: update_fields.cpp update_fields.h \ - mainwindow.h \ - ui_mainwindow.h +update_fields.o: update_fields.cpp mainwindow.h \ + ui_mainwindow.h \ + update_fields.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o update_fields.o update_fields.cpp -atomtypeswindow.o: atomtypeswindow.cpp atomtypeswindow.h \ - ui_atomtypeswindow.h \ - errorwindow.h \ - ui_errorwindow.h +atomtypeswindow.o: atomtypeswindow.cpp errorwindow.h \ + atomtypeswindow.h \ + ui_atomtypeswindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o atomtypeswindow.o atomtypeswindow.cpp -agglwindow.o: agglwindow.cpp agglwindow.h \ - ui_agglwindow.h \ - errorwindow.h \ - ui_errorwindow.h +agglwindow.o: agglwindow.cpp errorwindow.h \ + agglwindow.h \ + ui_agglwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o agglwindow.o agglwindow.cpp aboutwindow.o: aboutwindow.cpp aboutwindow.h \ @@ -376,15 +374,15 @@ statgengraphwindow.o: statgengraphwindow.cpp statgengraphwindow.h \ ui_statgengraphwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o statgengraphwindow.o statgengraphwindow.cpp -settingswindow.o: settingswindow.cpp settingswindow.h \ - ui_settingswindow.h \ - errorwindow.h \ - ui_errorwindow.h \ +settingswindow.o: settingswindow.cpp errorwindow.h \ mainwindow.h \ - ui_mainwindow.h + ui_mainwindow.h \ + settingswindow.h \ + ui_settingswindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o settingswindow.o settingswindow.cpp -aglallwindow.o: aglallwindow.cpp aglallwindow.h \ +aglallwindow.o: aglallwindow.cpp errorwindow.h \ + aglallwindow.h \ ui_aglallwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o aglallwindow.o aglallwindow.cpp diff --git a/mathmech/build/CMakeLists.txt b/mathmech/build/CMakeLists.txt new file mode 100644 index 0000000..4048a29 --- /dev/null +++ b/mathmech/build/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required (VERSION 2.6) + +set (PROJECT mathmech) + +# additional options +OPTION (WITH_DEBUG_MODE "Build with debug mode" OFF) +OPTION (ADD_INCLUDE "Add include files" OFF) + +# executable path +set (EXECUTABLE_OUTPUT_PATH ${${PROJECT}_BINARY_DIR}) + +# verbose +set (CMAKE_VERBOSE_MAKEFILE ON) + +# flags +if ( WITH_DEBUG_MODE ) + add_definitions ( -DDEBUG_MODE=1 ) +endif () +if ( CMAKE_COMPILER_IS_GNUCXX ) + set (ADD_CXX_FLAGS "-Wall") + set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS_DEBUG "-g -O0") + set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") +elseif ( MSVC ) + set (ADD_CXX_FLAGS "/W4") + set (CMAKE_CXX_FLAGS "${ADD_CXX_FLAGS}") +else () + message ("Unknown compiler") +endif () + +# set directories +set (${PROJECT}_BINARY_DIR ../bin) +set (${PROJECT}_RESOURCE_DIR ../resources) +set (${PROJECT}_TRANSLATION_DIR ${${PROJECT}_RESOURCE_DIR}/translations) + +# set files +set (HEADERS + ../aboutwindow.h + ../aglallwindow.h + ../agglwindow.h + ../atomtypeswindow.h + ../clear_items.h + ../errorwindow.h + ../mainwindow.h + ../settingswindow.h + ../start_events.h + ../statgengraphwindow.h + ../update_fields.h) +set (SOURCES + ../aboutwindow.cpp + ../aglallwindow.cpp + ../agglwindow.cpp + ../atomtypeswindow.cpp + ../clear_items.cpp + ../errorwindow.cpp + ../main.cpp + ../mainwindow.cpp + ../settingswindow.cpp + ../start_events.cpp + ../statgengraphwindow.cpp + ../update_fields.cpp) +set (FORMS + ../aboutwindow.ui + ../agglwindow.ui + ../aglallwindow.ui + ../atomtypeswindow.ui + ../errorwindow.ui + ../mainwindow.ui + ../settingswindow.ui + ../statgengraphwindow.ui) +# set library +if (CMAKE_COMPILER_IS_GNUCXX) + set (LIBRARIES m) +else () + set (LIBRARIES) +endif() +set (LANGUAGES + eng + rus) +set (RESOURCES + ${${PROJECT}_RESOURCE_DIR}/resources.qrc) + + +# compile +project (${PROJECT}) +include_directories (../ + ${CMAKE_CURRENT_BINARY_DIR}) + +find_package (Qt4 REQUIRED) +include (${QT_USE_FILE}) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) +qt4_wrap_ui (UI_HEADERS ${FORMS}) +foreach (LANGUAGE ${LANGUAGES}) + set (TS ${${PROJECT}_TRANSLATION_DIR}/${LANGUAGE}.ts) + set (QM ${${PROJECT}_TRANSLATION_DIR}/${LANGUAGE}.qm) + set (TRANSLATIONS ${TRANSLATIONS} ${TS}) + set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM}) + add_custom_command ( + OUTPUT ${QM} + COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} + MAIN_DEPENDENCY ${TS}) +endforeach() +add_custom_target ( + translations + COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS}) +add_custom_command ( + TARGET translations + COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS}) + +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) +source_group ("Generated Files" FILES ${MOC_SOURCES}) +source_group ("Resource Files" FILES ${QRC_SOURCES}) + +add_executable (${PROJECT} WIN32 ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS}) + +target_link_libraries (${PROJECT} ${LIBRARIES} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) + +# install properties +INSTALL (TARGETS ${PROJECT} DESTINATION bin) diff --git a/mathmech/errorwindow.cpp b/mathmech/errorwindow.cpp index ab2601d..d854526 100644 --- a/mathmech/errorwindow.cpp +++ b/mathmech/errorwindow.cpp @@ -55,10 +55,7 @@ void ErrorWindow::set_message(int mess) message = QApplication::translate("ErrorWindow", "Invalid file type"); break; case 12: - - break; - case 13: - + message = QApplication::translate("ErrorWindow", "Interaction step is not set"); break; default: message = QApplication::translate("ErrorWindow", "Unknown error"); diff --git a/mathmech/mainwindow.cpp b/mathmech/mainwindow.cpp index 7a3ee27..d01150e 100644 --- a/mathmech/mainwindow.cpp +++ b/mathmech/mainwindow.cpp @@ -663,6 +663,9 @@ void MainWindow::start_events_statgen() depth.setNum(ui->statgen_spinBox_depth->value()); else depth = QString("#"); + float int_step; + if (ui->statgen_checkBox_anal->checkState() == 2) + int_step = ui->statgen_doubleSpinBox_anal->value(); QString log; if (ui->statgen_checkBox_log->checkState() == 2) log = ui->statgen_lineEdit_log->text(); @@ -671,17 +674,32 @@ void MainWindow::start_events_statgen() ui->statusBar->showMessage(QApplication::translate("MainWindow", "Processing 'statgen'...")); ui->statusBar->showMessage(QApplication::translate("MainWindow", "Processing 'statgen'...")); - bool check = start_events->start_statgen(mm_statgen_path, - workDir, - mask, - firstStep, - lastStep, - cellX, cellY, cellZ, - atom0, atom1, atom2, atom3, - inter, - output, - depth, - log); + bool check; + if (ui->statgen_checkBox_anal->checkState() == 0) + check = start_events->start_statgen(mm_statgen_path, + workDir, + mask, + firstStep, + lastStep, + cellX, cellY, cellZ, + atom0, atom1, atom2, atom3, + inter, + output, + depth, + log); + else if (ui->statgen_checkBox_anal->checkState() == 2) + check = start_events->start_statgen_analysis(mm_statgen_path, + workDir, + mask, + firstStep, + lastStep, + cellX, cellY, cellZ, + atom0, atom1, atom2, atom3, + inter, + output, + depth, + log, + int_step); ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done")); if ((ui->statgen_checkBox_graph->checkState() == 2) && (check == true)) diff --git a/mathmech/mathmech b/mathmech/mathmech deleted file mode 100755 index a429b54..0000000 Binary files a/mathmech/mathmech and /dev/null differ diff --git a/mathmech/mathmech.pro.user b/mathmech/mathmech.pro.user index a754421..08c9c90 100644 --- a/mathmech/mathmech.pro.user +++ b/mathmech/mathmech.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/mathmech/resources/resources.qrc b/mathmech/resources/resources.qrc new file mode 100644 index 0000000..ef68396 --- /dev/null +++ b/mathmech/resources/resources.qrc @@ -0,0 +1,6 @@ + + + translations/rus.qm + translations/eng.qm + + diff --git a/mathmech/resources/translations/eng.qm b/mathmech/resources/translations/eng.qm new file mode 100644 index 0000000..be651ee --- /dev/null +++ b/mathmech/resources/translations/eng.qm @@ -0,0 +1 @@ +<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/mathmech/resources/translations/eng.ts b/mathmech/resources/translations/eng.ts new file mode 100644 index 0000000..33b7b2a --- /dev/null +++ b/mathmech/resources/translations/eng.ts @@ -0,0 +1,378 @@ + + + + + AgglWindow + + + Select file + + + + + 'statgen' output files (*.dat);;All files (*.*) + + + + + Save file as... + + + + + Agglomerate files (*.agl);;All files (*.*) + + + + + AglAll + + + + Processing 'agl'... + + + + + Done + + + + + AglAllWindow + + + Select work directory + + + + + Select trajectory file + + + + + 'statgen' output files (*.dat);;All files (*.*) + + + + + Save file as... + + + + + PDB files (*.pdb);;All files (*.*) + + + + + AtomTypesWindow + + + + + Add new molecule + + + + + Save file as... + + + + + Atom types files (*.types);;All files (*.*) + + + + + ErrorWindow + + + Work directory does not exists + + + + + Input file is not set + + + + + Atoms in plane must be different + + + + + Atom types file is not set + + + + + Output file is not set + + + + + Atom type must contain 2 characters + + + + + Log file is not set + + + + + Component is not found + + + + + Atom types is not set + + + + + Something wrong + + + + + Interactions are not set + + + + + Invalid file type + + + + + Interaction step is not set + + + + + Unknown error + + + + + MainWindow + + + Ready + + + + + + + + + Select work directory + + + + + + + Select trajectory file + + + + + All files (*.*) + + + + + Select atom types file + + + + + Atom types files (*.types);;All files (*.*) + + + + + Save files as + + + + + Mask of trajectory files + + + + + + + + + Save log file as... + + + + + + + + + Log files (*.log) + + + + + + Select trajectory files + + + + + + + + Trajectory files (*.*[0-9]) + + + + + + Save output file as... + + + + + + Output files (*.dat) + + + + + + Save PDB file as... + + + + + + PDB files (*.pdb) + + + + + Select agglomerate file + + + + + Agglomerate files (*.agl);;All files (*.*) + + + + + + Processing 'trj'... + + + + + + + + + Done + + + + + + Processing 'statgen'... + + + + + + Processing 'envir'... + + + + + + Processing 'radf'... + + + + + + Processing 'agl'... + + + + + + Processing 'trj2pdb'... + + + + + SettingsWindow + + + + + + + + Select component + + + + + + + + + + All files (*) + + + + + StatgenGraphWindow + + + N + + + + + p + + + + + r + + + + + g + + + + + Save image as... + + + + + JPEG file (*.jpeg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp) + + + + diff --git a/mathmech/resources/translations/rus.qm b/mathmech/resources/translations/rus.qm new file mode 100644 index 0000000..be651ee --- /dev/null +++ b/mathmech/resources/translations/rus.qm @@ -0,0 +1 @@ +<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/mathmech/resources/translations/rus.ts b/mathmech/resources/translations/rus.ts new file mode 100644 index 0000000..33b7b2a --- /dev/null +++ b/mathmech/resources/translations/rus.ts @@ -0,0 +1,378 @@ + + + + + AgglWindow + + + Select file + + + + + 'statgen' output files (*.dat);;All files (*.*) + + + + + Save file as... + + + + + Agglomerate files (*.agl);;All files (*.*) + + + + + AglAll + + + + Processing 'agl'... + + + + + Done + + + + + AglAllWindow + + + Select work directory + + + + + Select trajectory file + + + + + 'statgen' output files (*.dat);;All files (*.*) + + + + + Save file as... + + + + + PDB files (*.pdb);;All files (*.*) + + + + + AtomTypesWindow + + + + + Add new molecule + + + + + Save file as... + + + + + Atom types files (*.types);;All files (*.*) + + + + + ErrorWindow + + + Work directory does not exists + + + + + Input file is not set + + + + + Atoms in plane must be different + + + + + Atom types file is not set + + + + + Output file is not set + + + + + Atom type must contain 2 characters + + + + + Log file is not set + + + + + Component is not found + + + + + Atom types is not set + + + + + Something wrong + + + + + Interactions are not set + + + + + Invalid file type + + + + + Interaction step is not set + + + + + Unknown error + + + + + MainWindow + + + Ready + + + + + + + + + Select work directory + + + + + + + Select trajectory file + + + + + All files (*.*) + + + + + Select atom types file + + + + + Atom types files (*.types);;All files (*.*) + + + + + Save files as + + + + + Mask of trajectory files + + + + + + + + + Save log file as... + + + + + + + + + Log files (*.log) + + + + + + Select trajectory files + + + + + + + + Trajectory files (*.*[0-9]) + + + + + + Save output file as... + + + + + + Output files (*.dat) + + + + + + Save PDB file as... + + + + + + PDB files (*.pdb) + + + + + Select agglomerate file + + + + + Agglomerate files (*.agl);;All files (*.*) + + + + + + Processing 'trj'... + + + + + + + + + Done + + + + + + Processing 'statgen'... + + + + + + Processing 'envir'... + + + + + + Processing 'radf'... + + + + + + Processing 'agl'... + + + + + + Processing 'trj2pdb'... + + + + + SettingsWindow + + + + + + + + Select component + + + + + + + + + + All files (*) + + + + + StatgenGraphWindow + + + N + + + + + p + + + + + r + + + + + g + + + + + Save image as... + + + + + JPEG file (*.jpeg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp) + + + + diff --git a/mathmech/start_events.cpp b/mathmech/start_events.cpp index e86c5da..e4010dc 100644 --- a/mathmech/start_events.cpp +++ b/mathmech/start_events.cpp @@ -178,6 +178,132 @@ bool Start_events::start_statgen(QString mm_statgen_path, return true; } +bool Start_events::start_statgen_analysis(QString mm_statgen_path, + QString workDir, + QString mask, + QString firstStep, + QString lastStep, + QString cellX, QString cellY, QString cellZ, + QString atom0, QString atom1, QString atom2, QString atom3, + QString inter, + QString output, + QString depth, + QString log, + float int_step) +{ +// error check + errorwin = new ErrorWindow(parent); + if ((workDir == "") || (!QDir(workDir).exists())) + { + errorwin->set_message(0); + errorwin->show(); + return false; + } + if (mask == "") + { + errorwin->set_message(1); + errorwin->show(); + return false; + } + if (inter == "") + { + errorwin->set_message(10); + errorwin->show(); + return false; + } + if (output == "") + { + errorwin->set_message(4); + errorwin->show(); + return false; + } + if ((log != QString("#")) && (log == "")) + { + errorwin->set_message(6); + errorwin->show(); + return false; + } + if (int_step == 0.0) + { + errorwin->set_message(12); + errorwin->show(); + return false; + } + if (!QFile(mm_statgen_path).exists()) + { + errorwin->set_message(7); + errorwin->show(); + return false; + } + delete errorwin; + +// parsing criteria + int imax = 10; + QStringList inter_list = inter.split(QString(" -r "), QString::SkipEmptyParts); + float *inter_list_one; + inter_list_one = new float[16*inter_list.count()]; + for (i=0; i<16*inter_list.count(); i++) + inter_list_one = -1.0; + float item; + int index; + for (int i=0; i 0.0) + while (imax*int_step > inter_list_one) + imax--; + +// exec + for (int i=-imax; i<=imax; i++) + { + QString command; + command.append(mm_statgen_path); + if (mask.contains(QDir::separator())) + command.append(" -i " + QFileInfo(mask).absoluteFilePath()); + else + command.append(" -i " + QFileInfo(QDir(workDir), mask).absoluteFilePath()); + command.append(" -s " + firstStep + "," + lastStep); + command.append(" -c " + cellX + "," + cellY + "," + cellZ); + command.append(" -a " + atom0); + if (atom1 != QString("#")) + command.append("," + atom1); + if (atom2 != QString("#")) + command.append("," + atom2); + if (atom3 != QString("#")) + command.append("," + atom3); + command.append(inter); + if (output.contains(QDir::separator())) + command.append(" -o " + QFileInfo(output).absoluteFilePath()); + else + command.append(" -o " + QFileInfo(QDir(workDir), output).absoluteFilePath()); + if (depth != QString("#")) + command.append(" -g " + depth); + if (log != QString("#")) + { + if (log.contains(QDir::separator())) + command.append(" -l " + QFileInfo(log).absoluteFilePath()); + else + command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath()); + } + command.append(" -q"); + + system(command.toStdString().c_str()); + } + delete inter_list_one; + return true; +} + bool Start_events::start_envir(QString mm_envir_path, QString workDir, QString input, diff --git a/mathmech/start_events.h b/mathmech/start_events.h index eb46729..9f9de06 100644 --- a/mathmech/start_events.h +++ b/mathmech/start_events.h @@ -31,6 +31,18 @@ public: QString output, QString depth, QString log); + bool start_statgen_analysis(QString mm_statgen_path, + QString workDir, + QString mask, + QString firstStep, + QString lastStep, + QString cellX, QString cellY, QString cellZ, + QString atom0, QString atom1, QString atom2, QString atom3, + QString inter, + QString output, + QString depth, + QString log, + float int_step); bool start_envir(QString mm_envir_path, QString workDir, QString input,