diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index aee806c81a..d4b97ea231 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -190,6 +190,8 @@ set(PROJECT_SOURCES fileviewer.h preferences.cpp preferences.h + runwham.cpp + runwham.h setvariables.cpp setvariables.h slideshow.h diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index 59e8017fc0..df5571587a 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -22,6 +22,7 @@ #include "lammpsrunner.h" #include "logwindow.h" #include "preferences.h" +#include "runwham.h" #include "setvariables.h" #include "slideshow.h" #include "stdcapture.h" @@ -212,6 +213,7 @@ LammpsGui::LammpsGui(QWidget *parent, const QString &filename) : connect(ui->actionRun_Buffer, &QAction::triggered, this, &LammpsGui::run_buffer); connect(ui->actionRun_File, &QAction::triggered, this, &LammpsGui::run_file); connect(ui->actionStop_LAMMPS, &QAction::triggered, this, &LammpsGui::stop_run); + connect(ui->actionRun_WHAM, &QAction::triggered, this, &LammpsGui::run_wham); connect(ui->actionSet_Variables, &QAction::triggered, this, &LammpsGui::edit_variables); connect(ui->actionImage, &QAction::triggered, this, &LammpsGui::render_image); connect(ui->actionLAMMPS_Tutorial, &QAction::triggered, this, &LammpsGui::tutorial_web); @@ -1848,6 +1850,13 @@ void LammpsGui::edit_variables() } } +void LammpsGui::run_wham() +{ + RunWHAM do_run(this); + do_run.setFont(font()); + do_run.exec(); +} + void LammpsGui::findandreplace() { FindAndReplace find(ui->textEdit, this); diff --git a/tools/lammps-gui/lammpsgui.h b/tools/lammps-gui/lammpsgui.h index cb61f368a5..ecb6335ab9 100644 --- a/tools/lammps-gui/lammpsgui.h +++ b/tools/lammps-gui/lammpsgui.h @@ -111,6 +111,7 @@ private slots: void findandreplace(); void run_buffer() { do_run(true); } void run_file() { do_run(false); } + void run_wham(); void edit_variables(); void render_image(); diff --git a/tools/lammps-gui/lammpsgui.ui b/tools/lammps-gui/lammpsgui.ui index c6dbd6a507..390db39e50 100644 --- a/tools/lammps-gui/lammpsgui.ui +++ b/tools/lammps-gui/lammpsgui.ui @@ -75,6 +75,8 @@ + + @@ -287,6 +289,14 @@ Ctrl+/ + + + + + + Run &WHAM Utility + + diff --git a/tools/lammps-gui/runwham.cpp b/tools/lammps-gui/runwham.cpp new file mode 100644 index 0000000000..d155992b07 --- /dev/null +++ b/tools/lammps-gui/runwham.cpp @@ -0,0 +1,87 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "runwham.h" + +#include +#include +#include +#include +#include +#include +#include + +RunWHAM::RunWHAM(QWidget *parent) : QDialog(parent) +{ + int irow = 0; + auto *layout = new QGridLayout; + auto *top = new QLabel("Run WHAM Utility:"); + layout->addWidget(top, irow++, 0, 1, 2, Qt::AlignHCenter); + + auto *label = new QLabel("Units: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + auto *field = new QLineEdit("real"); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Mininum value: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit(""); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Maximum value: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit(""); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Number of bins: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit("50"); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Tolerance: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit("1.0e-8"); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Temperature: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit("300.0"); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Metadata file: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit(""); + layout->addWidget(field, irow++, 1, 1, 1); + label = new QLabel("Output file: "); + layout->addWidget(label, irow, 0, 1, 1, Qt::AlignLeft); + field = new QLineEdit(""); + layout->addWidget(field, irow++, 1, 1, 1); + + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel); + auto *add = new QPushButton("&Run WHAM"); + add->setObjectName("run_wham"); + buttonBox->addButton(add, QDialogButtonBox::ActionRole); + connect(add, &QPushButton::released, this, &RunWHAM::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + + layout->addWidget(buttonBox, irow++, 0, 1, 2, Qt::AlignHCenter); + setLayout(layout); + setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); + setWindowTitle("LAMMPS-GUI - Run WHAM Utility"); + resize(300, 200); +} + +void RunWHAM::accept() +{ + // assemble command line and run WHAM + fprintf(stderr, "Running WHAM\n"); + QDialog::accept(); +} + +// Local Variables: +// c-basic-offset: 4 +// End: diff --git a/tools/lammps-gui/runwham.h b/tools/lammps-gui/runwham.h new file mode 100644 index 0000000000..ab8370273f --- /dev/null +++ b/tools/lammps-gui/runwham.h @@ -0,0 +1,34 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef RUN_WHAM_H +#define RUN_WHAM_H + +#include + +class RunWHAM : public QDialog { + Q_OBJECT + +public: + explicit RunWHAM(QWidget *parent = nullptr); + ~RunWHAM() = default; + +private slots: + void accept() override; +}; + +#endif + +// Local Variables: +// c-basic-offset: 4 +// End: