Edited files

This commit is contained in:
arcan1s
2013-08-08 06:40:06 +04:00
parent 8a37a3cbab
commit 020d912704
10 changed files with 332 additions and 53 deletions

View File

@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: mathmech
# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 6 23:41:09 2013
# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 8 04:28:38 2013
# Project: mathmech.pro
# Template: app
# Command: /usr/lib/qt4/bin/qmake -o Makefile mathmech.pro
@ -47,19 +47,23 @@ SOURCES = main.cpp \
mainwindow.cpp \
errorwindow.cpp \
clear_items.cpp \
start_events.cpp moc_mainwindow.cpp \
start_events.cpp \
update_fields.cpp moc_mainwindow.cpp \
moc_errorwindow.cpp \
moc_clear_items.cpp \
moc_start_events.cpp
moc_start_events.cpp \
moc_update_fields.cpp
OBJECTS = main.o \
mainwindow.o \
errorwindow.o \
clear_items.o \
start_events.o \
update_fields.o \
moc_mainwindow.o \
moc_errorwindow.o \
moc_clear_items.o \
moc_start_events.o
moc_start_events.o \
moc_update_fields.o
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/common/gcc-base.conf \
@ -180,7 +184,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 .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.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 .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp update_fields.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.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
@ -201,9 +205,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
compiler_moc_header_make_all: moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp
-$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp
moc_mainwindow.cpp: mainwindow.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
@ -216,6 +220,9 @@ moc_clear_items.cpp: clear_items.h
moc_start_events.cpp: start_events.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) start_events.h -o moc_start_events.cpp
moc_update_fields.cpp: update_fields.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) update_fields.h -o moc_update_fields.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
@ -267,6 +274,11 @@ start_events.o: start_events.cpp start_events.h \
ui_errorwindow.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
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o update_fields.o update_fields.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
@ -279,6 +291,9 @@ moc_clear_items.o: moc_clear_items.cpp
moc_start_events.o: moc_start_events.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_start_events.o moc_start_events.cpp
moc_update_fields.o: moc_update_fields.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_update_fields.o moc_update_fields.cpp
####### Install
install: FORCE

View File

@ -5,12 +5,14 @@
#include "ui_mainwindow.h"
#include "clear_items.h"
#include "start_events.h"
#include "update_fields.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
clear_items(new Clear_items(this)),
start_events(new Start_events(this))
start_events(new Start_events(this)),
update_fields(new Update_fields(this))
{
ui->setupUi(this);
statgen_crit = new float[10];
@ -32,6 +34,7 @@ MainWindow::~MainWindow()
delete ui;
delete clear_items;
delete start_events;
delete update_fields;
delete statgen_crit;
}
@ -47,7 +50,6 @@ void MainWindow::on_trj_checkBox_log_stateChanged(int arg1)
{
ui->trj_lineEdit_log->setEnabled(true);
ui->trj_pushButton_log->setEnabled(true);
ui->trj_lineEdit_log->clear();
}
}
@ -56,10 +58,7 @@ void MainWindow::on_statgen_checkBox_depth_stateChanged(int arg1)
if (arg1 == 0)
ui->statgen_spinBox_depth->setDisabled(true);
else if (arg1 == 2)
{
ui->statgen_spinBox_depth->setEnabled(true);
ui->statgen_spinBox_depth->setValue(10);
}
}
void MainWindow::on_statgen_checkBox_log_stateChanged(int arg1)
@ -73,7 +72,6 @@ void MainWindow::on_statgen_checkBox_log_stateChanged(int arg1)
{
ui->statgen_lineEdit_log->setEnabled(true);
ui->statgen_pushButton_log->setEnabled(true);
ui->statgen_lineEdit_log->clear();
}
}
@ -88,7 +86,6 @@ void MainWindow::on_statgen_checkBox_atoms1_stateChanged(int arg1)
else if (arg1 == 2)
{
ui->statgen_spinBox_atoms1->setEnabled(true);
ui->statgen_spinBox_atoms1->setValue(0);
ui->statgen_checkBox_atoms2->setEnabled(true);
}
update_interaction();
@ -105,7 +102,6 @@ void MainWindow::on_statgen_checkBox_atoms2_stateChanged(int arg1)
else if (arg1 == 2)
{
ui->statgen_spinBox_atoms2->setEnabled(true);
ui->statgen_spinBox_atoms2->setValue(0);
ui->statgen_checkBox_atoms3->setEnabled(true);
}
update_interaction();
@ -116,10 +112,7 @@ void MainWindow::on_statgen_checkBox_atoms3_stateChanged(int arg1)
if (arg1 == 0)
ui->statgen_spinBox_atoms3->setDisabled(true);
else if (arg1 == 2)
{
ui->statgen_spinBox_atoms3->setEnabled(true);
ui->statgen_spinBox_atoms3->setValue(0);
}
update_interaction();
}
@ -134,7 +127,6 @@ void MainWindow::on_envir_checkBox_log_stateChanged(int arg1)
{
ui->envir_lineEdit_log->setEnabled(true);
ui->envir_pushButton_log->setEnabled(true);
ui->envir_lineEdit_log->clear();
}
}
@ -153,10 +145,6 @@ void MainWindow::on_radf_comboBox_atom_currentIndexChanged(int index)
ui->radf_spinBox_atoms2->setEnabled(true);
ui->radf_spinBox_atoms4->setEnabled(true);
ui->radf_spinBox_atoms5->setEnabled(true);
ui->radf_spinBox_atoms1->setValue(0);
ui->radf_spinBox_atoms2->setValue(0);
ui->radf_spinBox_atoms4->setValue(0);
ui->radf_spinBox_atoms5->setValue(0);
}
}
@ -173,9 +161,6 @@ void MainWindow::on_radf_checkBox_ang_stateChanged(int arg1)
ui->radf_doubleSpinBox_angMax->setEnabled(true);
ui->radf_doubleSpinBox_angMin->setEnabled(true);
ui->radf_doubleSpinBox_angStep->setEnabled(true);
ui->radf_doubleSpinBox_angMax->setValue(90.0);
ui->radf_doubleSpinBox_angMin->setValue(0.0);
ui->radf_doubleSpinBox_angStep->setValue(15.0);
}
}
@ -190,7 +175,6 @@ void MainWindow::on_radf_checkBox_log_stateChanged(int arg1)
{
ui->radf_lineEdit_log->setEnabled(true);
ui->radf_pushButton_log->setEnabled(true);
ui->radf_lineEdit_log->clear();
}
}
@ -206,10 +190,6 @@ void MainWindow::on_pdb_comboBox_mode_currentIndexChanged(int index)
}
else if (index == 0)
{
ui->pdb_lineEdit_agl->clear();
ui->pdb_doubleSpinBox_cellX->setValue(0.1);
ui->pdb_doubleSpinBox_cellY->setValue(0.1);
ui->pdb_doubleSpinBox_cellZ->setValue(0.1);
ui->pdb_lineEdit_agl->setEnabled(true);
ui->pdb_pushButton_agl->setEnabled(true);
ui->pdb_doubleSpinBox_cellX->setEnabled(true);
@ -229,7 +209,6 @@ void MainWindow::on_pdb_checkBox_log_stateChanged(int arg1)
{
ui->pdb_lineEdit_log->setEnabled(true);
ui->pdb_pushButton_log->setEnabled(true);
ui->pdb_lineEdit_log->clear();
}
}
@ -575,3 +554,23 @@ void MainWindow::on_pdb_pushButton_start_clicked()
else if (ui->pdb_comboBox_mode->currentIndex() == 1)
start_events->start_pdb(mm_trj2pdb_path);
}
// completion
void MainWindow::on_tabWidget_currentChanged(int index)
{
switch(index)
{
case 1:
update_fields->setup_def_statgen();
break;
case 2:
update_fields->setup_def_envir();
break;
case 3:
update_fields->setup_def_radf();
break;
case 4:
update_fields->setup_def_pdb();
break;
}
}

View File

@ -5,6 +5,7 @@
class Clear_items;
class Start_events;
class Update_fields;
namespace Ui {
class MainWindow;
@ -70,6 +71,8 @@ private slots:
void on_envir_pushButton_start_clicked();
void on_radf_pushButton_start_clicked();
void on_pdb_pushButton_start_clicked();
// completion
void on_tabWidget_currentChanged(int index);
private:
Ui::MainWindow *ui;
@ -86,6 +89,8 @@ private:
friend class Clear_items;
Start_events *start_events;
friend class Start_events;
Update_fields *update_fields;
friend class Update_fields;
};
#endif /* MAINWINDOW_H */

Binary file not shown.

View File

@ -11,10 +11,12 @@ INCLUDEPATH += .
HEADERS += mainwindow.h \
errorwindow.h \
clear_items.h \
start_events.h
start_events.h \
update_fields.h
FORMS += mainwindow.ui \
errorwindow.ui
SOURCES += main.cpp mainwindow.cpp \
errorwindow.cpp \
clear_items.cpp \
start_events.cpp
start_events.cpp \
update_fields.cpp

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.8.0, 2013-08-07T23:34:47. -->
<!-- Written by QtCreator 2.8.0, 2013-08-08T06:17:50. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -7,8 +7,6 @@
#include "errorwindow.h"
#include "ui_errorwindow.h"
#include <stdio.h>
Start_events::Start_events(MainWindow *wid) :
parent(wid)
{
@ -109,6 +107,7 @@ void Start_events::start_trj(QString mm_trj_path)
command.append(" -o " + QFileInfo(QDir(workDir), mask).absoluteFilePath());
command.append(" -tt " + totalTypes);
if (parent->ui->trj_checkBox_log->checkState() == 2)
{
#ifdef _WIN32
if (log.contains("\\"))
#elif __linux
@ -119,6 +118,7 @@ void Start_events::start_trj(QString mm_trj_path)
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
}
command.append(" -q");
system(command.toStdString().c_str());
@ -236,6 +236,7 @@ void Start_events::start_statgen(QString mm_statgen_path)
if (parent->ui->statgen_checkBox_depth->checkState() == 2)
command.append(" -g " + depth);
if (parent->ui->statgen_checkBox_log->checkState() == 2)
{
#ifdef _WIN32
if (log.contains("\\"))
#elif __linux
@ -246,6 +247,7 @@ void Start_events::start_statgen(QString mm_statgen_path)
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
}
command.append(" -q");
system(command.toStdString().c_str());
@ -334,6 +336,7 @@ void Start_events::start_envir(QString mm_envir_path)
command.append(" -n " + molecule);
command.append(" -r " + radius);
if (parent->ui->statgen_checkBox_log->checkState() == 2)
{
#ifdef _WIN32
if (log.contains("\\"))
#elif __linux
@ -344,6 +347,7 @@ void Start_events::start_envir(QString mm_envir_path)
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
}
command.append(" -q");
system(command.toStdString().c_str());
@ -472,16 +476,19 @@ void Start_events::start_radf(QString mm_radf_path)
}
if (parent->ui->radf_checkBox_matrix->checkState() == 2)
command.append(" -m ");
if (parent->ui->radf_checkBox_log->checkState() == 2)
{
#ifdef _WIN32
if (log.contains("\\"))
if (log.contains("\\"))
#elif __linux
if (log.contains("/"))
if (log.contains("/"))
#else
return;
return;
#endif
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
}
command.append(" -q");
system(command.toStdString().c_str());
@ -563,6 +570,7 @@ void Start_events::start_pdb(QString mm_pdb_path)
QString command;
command.append(mm_pdb_path);
if (parent->ui->pdb_comboBox_mode->currentIndex() == 0)
{
#ifdef _WIN32
if (agl.contains("\\"))
#elif __linux
@ -573,6 +581,7 @@ void Start_events::start_pdb(QString mm_pdb_path)
command.append(" -a " + QFileInfo(agl).absoluteFilePath());
else
command.append(" -a " + QFileInfo(QDir(workDir), agl).absoluteFilePath());
}
#ifdef _WIN32
if (input.contains("\\"))
#elif __linux
@ -595,16 +604,19 @@ void Start_events::start_pdb(QString mm_pdb_path)
command.append(" -o " + QFileInfo(output).absoluteFilePath());
else
command.append(" -o " + QFileInfo(QDir(workDir), output).absoluteFilePath());
if (parent->ui->statgen_checkBox_log->checkState() == 2)
{
#ifdef _WIN32
if (log.contains("\\"))
if (log.contains("\\"))
#elif __linux
if (log.contains("/"))
if (log.contains("/"))
#else
return;
return;
#endif
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
command.append(" -l " + QFileInfo(log).absoluteFilePath());
else
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
}
command.append(" -q");
// system(command.toStdString().c_str());

219
mathmech/update_fields.cpp Normal file
View File

@ -0,0 +1,219 @@
#include <QDir>
#include <math.h>
#include "update_fields.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <stdio.h>
Update_fields::Update_fields(MainWindow *wid) :
parent(wid)
{
}
void Update_fields::setup_def_statgen()
{
// set work directory
parent->ui->statgen_lineEdit_workDir->setText(parent->ui->trj_lineEdit_workDir->text());
// set mask
parent->ui->statgen_lineEdit_input->setText(parent->ui->trj_lineEdit_output->text());
// set steps
parent->ui->statgen_spinBox_stepsLast->setValue(parent->ui->trj_spinBox_steps->value());
// set cell size
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
input = QFileInfo(input).absoluteFilePath();
else
input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath();
QFile inp_trj(input);
bool exists = inp_trj.open(QIODevice::ReadOnly);
if (!exists)
return;
if (parent->ui->trj_comboBox_type->currentIndex() == 0)
{
for (int i=0; i<3; 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();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellY = 10 * tmp_str[3].remove(tmp_str[3].count()-1, 1).toFloat();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellZ = 10 * tmp_str[4].remove(tmp_str[4].count()-2, 1).toFloat();
}
else if (parent->ui->trj_comboBox_type->currentIndex() == 1)
{
inp_trj.readLine();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellX = tmp_str[0].toFloat();
cellY = tmp_str[1].toFloat();
cellZ = tmp_str[2].toFloat();
}
else
return;
inp_trj.close();
parent->ui->statgen_doubleSpinBox_cellX->setValue(cellX);
parent->ui->statgen_doubleSpinBox_cellY->setValue(cellY);
parent->ui->statgen_doubleSpinBox_cellZ->setValue(cellZ);
}
void Update_fields::setup_def_envir()
{
// set work directory
parent->ui->envir_lineEdit_workDir->setText(parent->ui->trj_lineEdit_workDir->text());
// set cell size
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
input = QFileInfo(input).absoluteFilePath();
else
input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath();
QFile inp_trj(input);
bool exists = inp_trj.open(QIODevice::ReadOnly);
if (!exists)
return;
if (parent->ui->trj_comboBox_type->currentIndex() == 0)
{
for (int i=0; i<3; 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();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellY = 10 * tmp_str[3].remove(tmp_str[3].count()-1, 1).toFloat();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellZ = 10 * tmp_str[4].remove(tmp_str[4].count()-2, 1).toFloat();
}
else if (parent->ui->trj_comboBox_type->currentIndex() == 1)
{
inp_trj.readLine();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellX = tmp_str[0].toFloat();
cellY = tmp_str[1].toFloat();
cellZ = tmp_str[2].toFloat();
}
else
return;
inp_trj.close();
parent->ui->envir_doubleSpinBox_cellX->setValue(cellX);
parent->ui->envir_doubleSpinBox_cellY->setValue(cellY);
parent->ui->envir_doubleSpinBox_cellZ->setValue(cellZ);
}
void Update_fields::setup_def_radf()
{
// set work directory
parent->ui->radf_lineEdit_workDir->setText(parent->ui->trj_lineEdit_workDir->text());
// set mask
parent->ui->radf_lineEdit_input->setText(parent->ui->trj_lineEdit_output->text());
// set steps
parent->ui->radf_spinBox_stepsLast->setValue(parent->ui->trj_spinBox_steps->value());
// set cell size
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
input = QFileInfo(input).absoluteFilePath();
else
input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath();
QFile inp_trj(input);
bool exists = inp_trj.open(QIODevice::ReadOnly);
if (!exists)
return;
if (parent->ui->trj_comboBox_type->currentIndex() == 0)
{
for (int i=0; i<3; 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();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellY = 10 * tmp_str[3].remove(tmp_str[3].count()-1, 1).toFloat();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellZ = 10 * tmp_str[4].remove(tmp_str[4].count()-2, 1).toFloat();
}
else if (parent->ui->trj_comboBox_type->currentIndex() == 1)
{
inp_trj.readLine();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellX = tmp_str[0].toFloat();
cellY = tmp_str[1].toFloat();
cellZ = tmp_str[2].toFloat();
}
else
return;
inp_trj.close();
parent->ui->radf_doubleSpinBox_cellX->setValue(cellX);
parent->ui->radf_doubleSpinBox_cellY->setValue(cellY);
parent->ui->radf_doubleSpinBox_cellZ->setValue(cellZ);
}
void Update_fields::setup_def_pdb()
{
// set work directory
parent->ui->pdb_lineEdit_workDir->setText(parent->ui->trj_lineEdit_workDir->text());
// set cell size
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
input = QFileInfo(input).absoluteFilePath();
else
input = QFileInfo(QDir(parent->ui->trj_lineEdit_workDir->text()), input).absoluteFilePath();
QFile inp_trj(input);
bool exists = inp_trj.open(QIODevice::ReadOnly);
if (!exists)
return;
if (parent->ui->trj_comboBox_type->currentIndex() == 0)
{
for (int i=0; i<3; 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();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellY = 10 * tmp_str[3].remove(tmp_str[3].count()-1, 1).toFloat();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellZ = 10 * tmp_str[4].remove(tmp_str[4].count()-2, 1).toFloat();
}
else if (parent->ui->trj_comboBox_type->currentIndex() == 1)
{
inp_trj.readLine();
tmp_str = QString(inp_trj.readLine()).split(' ', QString::SkipEmptyParts);
cellX = tmp_str[0].toFloat();
cellY = tmp_str[1].toFloat();
cellZ = tmp_str[2].toFloat();
}
else
return;
inp_trj.close();
parent->ui->pdb_doubleSpinBox_cellX->setValue(cellX);
parent->ui->pdb_doubleSpinBox_cellY->setValue(cellY);
parent->ui->pdb_doubleSpinBox_cellZ->setValue(cellZ);
}

27
mathmech/update_fields.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef UPDATE_FIELDS_H
#define UPDATE_FIELDS_H
#include <QWidget>
class MainWindow;
class Update_fields : public QWidget
{
Q_OBJECT
public:
explicit Update_fields(MainWindow *wid = 0);
void setup_def_statgen();
void setup_def_envir();
void setup_def_radf();
void setup_def_pdb();
signals:
public slots:
private:
MainWindow *parent;
};
#endif /* UPDATE_FIELDS_H */