diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst
index 456c6bf3f1..3e56bd4756 100644
--- a/doc/src/Howto_lammps_gui.rst
+++ b/doc/src/Howto_lammps_gui.rst
@@ -752,13 +752,16 @@ Tutorials
The *Tutorials* menu is to support the set of LAMMPS tutorials for
beginners and intermediate LAMMPS users documented in (:ref:`Gravelle1
-`). From the drop down menu you can select which of the eight
-currently available tutorial sessions you want to start and then will be
-taken to a 'wizard' dialog where you can choose in which folder you want
-to work, whether you want that folder to be cleared, and also whether
-you want to download the solutions files (can be large). The dialog
-will then start downloading the files requested and load the first input
-file for the selected session into LAMMPS-GUI.
+`). From the drop down menu you can select which of the
+eight currently available tutorial sessions you want to start and then
+will be taken to a 'wizard' dialog where you can choose in which folder
+you want to work, whether you want that folder to be wiped from *any*
+files, whether you want to download the solutions files (which can be
+large) to a ``solution`` sub-folder, and whether you want the
+corresponding tutorial's online version opened in your web browser. The
+dialog will then start downloading the files requested (download
+progress is reported in the status line) and load the first input file
+for the selected session into LAMMPS-GUI.
About
^^^^^
diff --git a/tools/lammps-gui/lammps-gui.appdata.xml b/tools/lammps-gui/lammps-gui.appdata.xml
index 898966dccc..c1e54880b0 100644
--- a/tools/lammps-gui/lammps-gui.appdata.xml
+++ b/tools/lammps-gui/lammps-gui.appdata.xml
@@ -60,6 +60,8 @@
Change working directory to user's home dir if initial directory is "/" or the Application folder
Add preferences option to set https proxy, if not already set via environment variable
Add option to visualize molecules defined through the molecule command
+ Add text fields for editing plot title and axis labels for charts
+ Add option to automatically open tutorial websites (enabled by default)
diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp
index 09a180683d..d515e8df78 100644
--- a/tools/lammps-gui/lammpsgui.cpp
+++ b/tools/lammps-gui/lammpsgui.cpp
@@ -1617,7 +1617,7 @@ QWizardPage *LammpsGui::tutorial_directory(const int ntutorial)
"created if necessary and LAMMPS-GUI will download the files required for the "
"tutorial. If selected, an existing directory may be cleared from old "
"files.
\nAvailable files of the tutorial solution may be downloaded to a "
- "sub-folder \"solution\", if requested.
\n")
+ "sub-folder called \"solution\", if requested.\n")
.arg(ntutorial));
label->setWordWrap(true);
@@ -1657,6 +1657,7 @@ QWizardPage *LammpsGui::tutorial_directory(const int ntutorial)
auto *solval = new QCheckBox;
auto *purgelabel = new QLabel("Remove existing files from directory");
auto *sollabel = new QLabel("Download solutions");
+
purgeval->setCheckState(Qt::Unchecked);
purgeval->setObjectName("t_dirpurge");
solval->setCheckState(Qt::Unchecked);
@@ -1668,6 +1669,18 @@ QWizardPage *LammpsGui::tutorial_directory(const int ntutorial)
grid->setColumnStretch(0, 0);
grid->setColumnStretch(1, 100);
+ // we have tutorials 1 to 7 currently available online
+
+ QCheckBox *webval = nullptr;
+ if ((ntutorial > 0) && (ntutorial < 8)) {
+ grid->addWidget(new QLabel, 2, 0, 1, 2, Qt::AlignVCenter);
+ webval = new QCheckBox;
+ webval->setCheckState(Qt::Checked);
+ webval->setObjectName("t_webopen");
+ grid->addWidget(webval, 3, 0, Qt::AlignVCenter);
+ grid->addWidget(new QLabel("Open tutorial webpage in web browser"), 3, 1, Qt::AlignVCenter);
+ }
+
auto *label2 = new QLabel(
QString("
\nClick on "
"the \"Finish\" button to complete the setup and start the download.
"));
@@ -2008,7 +2021,8 @@ static const QString geturl =
"geturl https://raw.githubusercontent.com/lammpstutorials/"
"lammpstutorials-article/refs/heads/main/files/tutorial%1/%2 output %2 verify no";
-void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, bool getsolution)
+void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, bool getsolution,
+ bool openwebpage)
{
constexpr int BUFLEN = 1024;
char errorbuf[BUFLEN];
@@ -2023,6 +2037,36 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo
QDir directory(dir);
directory.cd(dir);
+ if (openwebpage) {
+ QString weburl = "https://lammpstutorials.github.io/sphinx/build/html/tutorial%1/%2.html";
+ switch (tutno) {
+ case 1:
+ weburl = weburl.arg(tutno).arg("lennard-jones-fluid");
+ break;
+ case 2:
+ weburl = weburl.arg(tutno).arg("breaking-a-carbon-nanotube");
+ break;
+ case 3:
+ weburl = weburl.arg(tutno).arg("polymer-in-water");
+ break;
+ case 4:
+ weburl = weburl.arg(tutno).arg("nanosheard-electrolyte");
+ break;
+ case 5:
+ weburl = weburl.arg(tutno).arg("reactive-silicon-dioxide");
+ break;
+ case 6:
+ weburl = weburl.arg(tutno).arg("water-adsorption-in-silica");
+ break;
+ case 7:
+ weburl = weburl.arg(tutno).arg("free-energy-calculation");
+ break;
+ default:
+ weburl = "https://lammpstutorials.github.io/";
+ }
+ QDesktopServices::openUrl(QUrl(weburl));
+ }
+
if (purgedir) purge_directory(dir);
if (getsolution) directory.mkpath("solution");
@@ -2138,10 +2182,14 @@ void TutorialWizard::accept()
auto *dirname = findChild("t_directory");
auto *dirpurge = findChild("t_dirpurge");
auto *getsol = findChild("t_getsolution");
+ auto *webopen = findChild("t_webopen");
bool purgedir = false;
bool getsolution = false;
+ bool openwebpage = false;
QString curdir;
+ if (webopen) openwebpage = (webopen->checkState() == Qt::Checked);
+
// create and populate directory.
if (dirname) {
QDir directory;
@@ -2165,7 +2213,7 @@ void TutorialWizard::accept()
LammpsGui *main = nullptr;
for (QWidget *widget : QApplication::topLevelWidgets())
if (widget->objectName() == "LammpsGui") main = dynamic_cast(widget);
- if (main) main->setup_tutorial(_ntutorial, curdir, purgedir, getsolution);
+ if (main) main->setup_tutorial(_ntutorial, curdir, purgedir, getsolution, openwebpage);
}
}
diff --git a/tools/lammps-gui/lammpsgui.h b/tools/lammps-gui/lammpsgui.h
index 38fe00607e..4966522cea 100644
--- a/tools/lammps-gui/lammpsgui.h
+++ b/tools/lammps-gui/lammpsgui.h
@@ -85,7 +85,8 @@ protected:
void setFont(const QFont &newfont);
QWizardPage *tutorial_intro(const int ntutorial, const QString &infotext);
QWizardPage *tutorial_directory(const int ntutorial);
- void setup_tutorial(int ntutorial, const QString &dir, bool purgedir, bool getsolution);
+ void setup_tutorial(int ntutorial, const QString &dir, bool purgedir, bool getsolution,
+ bool openwebpage);
void purge_inspect_list();
bool eventFilter(QObject *watched, QEvent *event) override;