void ApbsDialog::saveInputFile() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save APBS Input File"), "apbs.in", tr("ABPS Input (*.in)")); if (!fileName.isEmpty()) { saveInputFile(fileName); QMessageBox::information(this, tr("Success"), tr("Input file written to '%1'").arg(fileName)); } }
void MOPACInputDialog::computeClicked() { if (m_process != 0) { QMessageBox::warning(this, tr("MOPAC Running."), tr("MOPAC is already running. Wait until the previous calculation is finished.")); return; } QString fileName = saveInputFile(ui.previewText->toPlainText(), tr("MOPAC Input Deck"), QString("mop")); if (fileName.isEmpty()) return; QFileInfo info(mopacPath); if (!info.exists() || !info.isExecutable()) { QMessageBox::warning(this, tr("MOPAC Not Installed."), tr("The MOPAC executable, cannot be found.")); return; } m_process = new QProcess(this); QFileInfo input(fileName); m_process->setWorkingDirectory(input.absolutePath()); QStringList arguments; arguments << fileName; m_inputFile = fileName; // save for reading in output m_process->start(mopacPath, arguments); if (!m_process->waitForStarted()) { QMessageBox::warning(this, tr("MOPAC failed to start."), tr("MOPAC did not start. Perhaps it is not installed correctly.")); } connect(m_process, SIGNAL(finished(int)), this, SLOT(finished(int))); m_progress = new QProgressDialog(this); m_progress->setRange(0,0); // indeterminate progress m_progress->setLabelText(tr("Running MOPAC calculation...")); m_progress->show(); connect(m_progress, SIGNAL(canceled()), this, SLOT(stopProcess())); }
void ApbsDialog::runApbs() { saveInputFile("apbs.in"); // run apbs QStringList arguments; arguments.append("apbs.in"); QProcess process; process.start("apbs", arguments); // FIXME: show progress dialog process.waitForFinished(); if (process.exitStatus() == QProcess::NormalExit) { m_cubeFileName = "pot-PE0.dx"; ApbsOutputDialog dialog(this); connect(&dialog, SIGNAL(accepted()), this, SLOT(accept())); int code = dialog.exec(); if (code == QDialog::Accepted) { m_loadStructureFile = dialog.loadStructureFile(); m_loadCubeFile = dialog.loadCubeFile(); } else { m_loadStructureFile = false; m_loadCubeFile = false; } } else { m_loadStructureFile = false; m_loadCubeFile = false; QMessageBox::critical(this, tr("Error"), tr("Error running APBS: %1").arg( process.readAllStandardError().constData())); } }
void MOPACInputDialog::generateClicked() { //saveInputFile(); saveInputFile(ui.previewText->toPlainText(), tr("MOPAC Input Deck"), QString("mop")); }