mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-05 18:15:48 +00:00
Edited start_events
This commit is contained in:
@ -22,13 +22,13 @@ void ErrorWindow::set_message(int mess)
|
||||
message = QApplication::translate("ErrorWindow", "Work directory does not exists");
|
||||
break;
|
||||
case 1:
|
||||
message = QApplication::translate("ErrorWindow", "Input file does not exists");
|
||||
message = QApplication::translate("ErrorWindow", "Input file is not set");
|
||||
break;
|
||||
case 2:
|
||||
message = QApplication::translate("ErrorWindow", "Atoms in plane must be different");
|
||||
break;
|
||||
case 3:
|
||||
message = QApplication::translate("ErrorWindow", "Atom types file does not exists");
|
||||
message = QApplication::translate("ErrorWindow", "Atom types file is not set");
|
||||
break;
|
||||
case 4:
|
||||
message = QApplication::translate("ErrorWindow", "Output file is not set");
|
||||
|
@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
mm_radf_path = QString("/home/arcanis/Documents/github/moldyn/mathmech/bin/mm_radf");
|
||||
mm_statgen_path = QString("/home/arcanis/Documents/github/moldyn/mathmech/bin/mm_statgen");
|
||||
mm_trj_path = QString("/home/arcanis/Documents/github/moldyn/mathmech/bin/mm_trj");
|
||||
mm_trj2pdb_path = QString("/home/arcanis/Documents/github/moldyn/bin/mm_trj2pdb");
|
||||
mm_trj2pdb_path = QString("/home/arcanis/Documents/github/moldyn/mathmech/bin/mm_trj2pdb");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -560,10 +560,18 @@ void MainWindow::on_statgen_pushButton_start_clicked()
|
||||
|
||||
void MainWindow::on_envir_pushButton_start_clicked()
|
||||
{
|
||||
start_events->stat_envir(mm_envir_path);
|
||||
start_events->start_envir(mm_envir_path);
|
||||
}
|
||||
|
||||
void MainWindow::on_radf_pushButton_start_clicked()
|
||||
{
|
||||
start_events->stat_radf(mm_radf_path);
|
||||
start_events->start_radf(mm_radf_path);
|
||||
}
|
||||
|
||||
void MainWindow::on_pdb_pushButton_start_clicked()
|
||||
{
|
||||
if (ui->pdb_comboBox_mode->currentIndex() == 0)
|
||||
start_events->start_pdb(mm_agl_path);
|
||||
else if (ui->pdb_comboBox_mode->currentIndex() == 1)
|
||||
start_events->start_pdb(mm_trj2pdb_path);
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ private slots:
|
||||
void on_statgen_pushButton_start_clicked();
|
||||
void on_envir_pushButton_start_clicked();
|
||||
void on_radf_pushButton_start_clicked();
|
||||
void on_pdb_pushButton_start_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="trj">
|
||||
<attribute name="title">
|
||||
|
Binary file not shown.
@ -254,7 +254,7 @@ void Start_events::start_statgen(QString mm_statgen_path)
|
||||
delete errorwin;
|
||||
}
|
||||
|
||||
void Start_events::stat_envir(QString mm_envir_path)
|
||||
void Start_events::start_envir(QString mm_envir_path)
|
||||
{
|
||||
errorwin = new ErrorWindow(parent);
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'envir'..."));
|
||||
@ -352,7 +352,7 @@ void Start_events::stat_envir(QString mm_envir_path)
|
||||
delete errorwin;
|
||||
}
|
||||
|
||||
void Start_events::stat_radf(QString mm_radf_path)
|
||||
void Start_events::start_radf(QString mm_radf_path)
|
||||
{
|
||||
errorwin = new ErrorWindow(parent);
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'radf'..."));
|
||||
@ -484,8 +484,131 @@ void Start_events::stat_radf(QString mm_radf_path)
|
||||
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
|
||||
command.append(" -q");
|
||||
|
||||
// system(command.toStdString().c_str());
|
||||
printf("%s\n", command.toStdString().c_str());
|
||||
system(command.toStdString().c_str());
|
||||
parent->ui->tabWidget->setEnabled(true);
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Done"));
|
||||
delete errorwin;
|
||||
}
|
||||
|
||||
void Start_events::start_pdb(QString mm_pdb_path)
|
||||
{
|
||||
errorwin = new ErrorWindow(parent);
|
||||
if (parent->ui->pdb_comboBox_mode->currentIndex() == 0)
|
||||
{
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'agl'..."));
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'agl'..."));
|
||||
}
|
||||
else if (parent->ui->pdb_comboBox_mode->currentIndex() == 1)
|
||||
{
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'trj2pdb'..."));
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Processing 'trj2pdb'..."));
|
||||
}
|
||||
|
||||
// read variables
|
||||
QString workDir = parent->ui->pdb_lineEdit_workDir->text();
|
||||
QString input = parent->ui->pdb_lineEdit_input->text();
|
||||
QString agl, cellX, cellY, cellZ;
|
||||
if (parent->ui->pdb_comboBox_mode->currentIndex() == 0)
|
||||
{
|
||||
agl = parent->ui->pdb_lineEdit_agl->text();
|
||||
cellX.setNum(parent->ui->pdb_doubleSpinBox_cellX->value(), 'f', 4);
|
||||
cellY.setNum(parent->ui->pdb_doubleSpinBox_cellY->value(), 'f', 4);
|
||||
cellZ.setNum(parent->ui->pdb_doubleSpinBox_cellZ->value(), 'f', 4);
|
||||
}
|
||||
QString output = parent->ui->pdb_lineEdit_output->text();
|
||||
QString log;
|
||||
if (parent->ui->pdb_checkBox_log->checkState() == 2)
|
||||
log = parent->ui->pdb_lineEdit_log->text();
|
||||
|
||||
// error check
|
||||
if ((workDir == "") || (!QDir(workDir).exists()))
|
||||
{
|
||||
errorwin->set_message(0);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
if (input == "")
|
||||
{
|
||||
errorwin->set_message(1);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
if ((parent->ui->pdb_comboBox_mode->currentIndex() == 0) && (agl == ""))
|
||||
{
|
||||
errorwin->set_message(1);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
if (output == "")
|
||||
{
|
||||
errorwin->set_message(4);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
if ((parent->ui->pdb_checkBox_log->checkState() == 2) && (log == ""))
|
||||
{
|
||||
errorwin->set_message(6);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
if (!QFile(mm_pdb_path).exists())
|
||||
{
|
||||
errorwin->set_message(7);
|
||||
errorwin->show();
|
||||
return;
|
||||
}
|
||||
|
||||
// exec
|
||||
parent->ui->tabWidget->setDisabled(true);
|
||||
QString command;
|
||||
command.append(mm_pdb_path);
|
||||
if (parent->ui->pdb_comboBox_mode->currentIndex() == 0)
|
||||
#ifdef _WIN32
|
||||
if (agl.contains("\\"))
|
||||
#elif __linux
|
||||
if (agl.contains("/"))
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
command.append(" -a " + QFileInfo(agl).absoluteFilePath());
|
||||
else
|
||||
command.append(" -a " + QFileInfo(QDir(workDir), agl).absoluteFilePath());
|
||||
#ifdef _WIN32
|
||||
if (input.contains("\\"))
|
||||
#elif __linux
|
||||
if (input.contains("/"))
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
command.append(" -i " + QFileInfo(input).absoluteFilePath());
|
||||
else
|
||||
command.append(" -i " + QFileInfo(QDir(workDir), input).absoluteFilePath());
|
||||
if (parent->ui->pdb_comboBox_mode->currentIndex() == 0)
|
||||
command.append(" -c " + cellX + "," + cellY + "," + cellZ);
|
||||
#ifdef _WIN32
|
||||
if (output.contains("\\"))
|
||||
#elif __linux
|
||||
if (output.contains("/"))
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
command.append(" -o " + QFileInfo(output).absoluteFilePath());
|
||||
else
|
||||
command.append(" -o " + QFileInfo(QDir(workDir), output).absoluteFilePath());
|
||||
#ifdef _WIN32
|
||||
if (log.contains("\\"))
|
||||
#elif __linux
|
||||
if (log.contains("/"))
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
command.append(" -l " + QFileInfo(log).absoluteFilePath());
|
||||
else
|
||||
command.append(" -l " + QFileInfo(QDir(workDir), log).absoluteFilePath());
|
||||
command.append(" -q");
|
||||
|
||||
// system(command.toStdString().c_str());
|
||||
printf ("%s\n", command.toStdString().c_str());
|
||||
parent->ui->tabWidget->setEnabled(true);
|
||||
parent->ui->statusBar->showMessage(QApplication::translate("Start_events", "Done"));
|
||||
delete errorwin;
|
||||
|
@ -13,8 +13,9 @@ public:
|
||||
explicit Start_events(MainWindow *wid = 0);
|
||||
void start_trj(QString mm_trj_path);
|
||||
void start_statgen(QString mm_statgen_path);
|
||||
void stat_envir(QString mm_envir_path);
|
||||
void stat_radf(QString mm_radf_path);
|
||||
void start_envir(QString mm_envir_path);
|
||||
void start_radf(QString mm_radf_path);
|
||||
void start_pdb(QString mm_pdb_path);
|
||||
|
||||
signals:
|
||||
|
||||
|
Reference in New Issue
Block a user