Skip to content

Commit

Permalink
feat: Allow setting of temperature through button & update docs (#1855)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhinoella committed Apr 16, 2024
1 parent f3fd784 commit 2ef3002
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 14 deletions.
17 changes: 14 additions & 3 deletions src/gui/configurationTab.cpp
Expand Up @@ -10,6 +10,7 @@
#include "gui/helpers/comboPopulator.h"
#include "gui/keywordWidgets/producers.h"
#include "main/dissolve.h"
#include <QInputDialog>
#include <QMessageBox>

ConfigurationTab::ConfigurationTab(DissolveWindow *dissolveWindow, Dissolve &dissolve, MainTabsWidget *parent,
Expand Down Expand Up @@ -57,6 +58,8 @@ ConfigurationTab::ConfigurationTab(DissolveWindow *dissolveWindow, Dissolve &dis
ui_.TargetedPotentialsFrame->setHidden(true);
connect(ui_.ConfigurationButtonGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this,
SLOT(buttonGroupToggled(QAbstractButton *, bool)));
connect(ui_.TemperatureToolButton, SIGNAL(clicked(bool)), dissolveWindow_,
SLOT(on_ConfigurationAdjustTemperatureAction_triggered(bool)));
}

/*
Expand Down Expand Up @@ -129,14 +132,21 @@ void ConfigurationTab::updateDensityLabel()
}
}

void ConfigurationTab::updateTemperatureLabel()
{
if (!configuration_)
ui_.TemperatureLabel->setText("N/A");
else
{
ui_.TemperatureLabel->setText(QString::number(configuration_->temperature()).append(QString(" K")));
}
}

// Update controls in tab
void ConfigurationTab::updateControls()
{
Locker refreshLocker(refreshLock_);

// Temperature
ui_.TemperatureLabel->setText(QString::number(configuration_->temperature()).append(QString(" K")));

// Current Box
const auto *box = configuration_->box();
ui_.CurrentBoxTypeLabel->setText(QString::fromStdString(std::string(Box::boxTypes().keyword(box->type()))));
Expand All @@ -148,6 +158,7 @@ void ConfigurationTab::updateControls()
boxInfo += QString("<b>&#x3B3;:</b> %1&#xb0;").arg(box->axisAngles().z);
ui_.CurrentBoxFrame->setToolTip(boxInfo);
updateDensityLabel();
updateTemperatureLabel();

// Populations
ui_.AtomPopulationLabel->setText(QString::number(configuration_->nAtoms()));
Expand Down
2 changes: 2 additions & 0 deletions src/gui/configurationTab.h
Expand Up @@ -71,6 +71,8 @@ class ConfigurationTab : public QWidget, public MainTab
private:
// Update density label
void updateDensityLabel();
// Update temperature label
void updateTemperatureLabel();

public:
// Update controls in tab
Expand Down
2 changes: 1 addition & 1 deletion src/gui/configurationTab.ui
Expand Up @@ -337,7 +337,7 @@
<item>
<widget class="QToolButton" name="TemperatureToolButton">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>...</string>
Expand Down
2 changes: 1 addition & 1 deletion src/procedure/nodes/temperature.cpp
Expand Up @@ -29,4 +29,4 @@ bool TemperatureProcedureNode::execute(const ProcedureContext &procedureContext)
auto *cfg = procedureContext.configuration();
cfg->setTemperature(temperature_.asDouble());
return true;
}
}
2 changes: 1 addition & 1 deletion src/procedure/nodes/temperature.h
Expand Up @@ -32,4 +32,4 @@ class TemperatureProcedureNode : public ProcedureNode
public:
// Execute node
bool execute(const ProcedureContext &procedureContext) override;
};
};
2 changes: 1 addition & 1 deletion web/docs/examples/argon/step3.md
Expand Up @@ -45,7 +45,7 @@ In the {{< node "Add" >}} node note how we have referenced the "rho" parameter f

Finally, we need to set the correct temperature for the configuration.

{{< action type="groups">}}Select the {{< node "Temperature" >}} node{{</action>}}
{{< action type="mouse">}}On the configuration viewer toolbar, click the {{< gui-button icon="temperature" text="Temperature" >}} button{{</action>}}
{{< action type="edit" text="Set the **Temperature** to 85 K to match that of the experimental measurement" />}}

{{< tip >}}You can recreate a configuration at any time by clicking the {{< gui-button text="Generate" icon="repeat" >}} button, but bear in mind that other quantities calculated by modules may also need to be cleared. Remove all of this data to begin a 'clean' run with the **Clear Module Data** option in the **Simulation** menu.{{< /tip >}}
Expand Down
1 change: 0 additions & 1 deletion web/docs/examples/benzene/step2.md
Expand Up @@ -23,7 +23,6 @@ In anticipation of some bad contacts:
{{< action type="mouse">}}Drag the {{< node "SizeFactor" >}} node into the **Procedure** section to add it{{< /action >}}
{{< action type="edit" text="Set the value for the _Size Factor_ to 10.0" />}}


Finally, before we move on, we will have to reduce our pair potential range from the default of 15 &#8491; since this is larger than the half the maximum width of our simulation box.

{{< action type="tabs">}} Go to the {{< gui-tab type="ff" text="Forcefield" >}} tab, {{<gui-button text="Pair Potentials">}} section{{< /action >}}
Expand Down
2 changes: 1 addition & 1 deletion web/docs/examples/cu-btc/step3.md
Expand Up @@ -6,7 +6,7 @@ weight: 1

### Create a Configuration

When importing the original CIF file a configuration was automatically created, so in this example we're ready to go. It might be instructive to look at the nodes in the generator, specifcally the {< node "Add" >}} node for the framework species. If you look at its control parameters you will see that the **BoxAction** parameter is `Set`, meaning that the configuration's box is set from that defined in the species.
When importing the original CIF file a configuration was automatically created, so in this example we're ready to go. It might be instructive to look at the nodes in the generator, specifcally the {{< node "Add" >}} node for the framework species. If you look at its control parameters you will see that the **BoxAction** parameter is `Set`, meaning that the configuration's box is set from that defined in the species.

### Set up Layers

Expand Down
2 changes: 1 addition & 1 deletion web/docs/examples/emim-oac/step4.md
Expand Up @@ -23,7 +23,7 @@ We need to adjust our pair potential range which is currently set to 15 &#8491;
The final thing to do is change the temperature (our experimental data was measured at 323 K) and set a size factor for our box - since we have rings in our cation we need to apply a size factor during the initial equilibration to help prevent occurrences of interlocking rings.

{{< action type="tabs">}}Go to the {{< gui-tab type="configuration" text="Bulk" >}} configuration tab{{< /action >}}
{{< action type="groups">}}Click the {{< node "Temperature">}} node{{< /action >}}
{{< action type="mouse">}}On the configuration viewer toolbar, click the {{< gui-button icon="temperature" text="Temperature" >}} button{{</action>}}
{{< action type="edit" >}}Set the **Temperature** to `323.0`{{< /action >}}
{{< action type="groups">}}Click the {{< gui-button icon="palette" text="Show Avaliable Nodes">}} button{{< /action >}}
{{< action type="mouse">}}Drag the {{<node "SizeFactor">}} node into the Node list{{< /action >}}
Expand Down
6 changes: 3 additions & 3 deletions web/docs/examples/silica/step5.md
Expand Up @@ -7,10 +7,9 @@ type: docs
To ensure that our silicon and oxygen atoms are well mixed and distributed we're going to "cook" the box at a high temperature to start with.

{{< action type="tabs">}} Go to the {{<gui-tab text="Bulk" type="configuration">}} configuration tab {{</action >}}
{{< action type="edit">}}Select the {{<node "Temperature">}} node {{</action>}}
{{< action type="mouse">}}On the configuration viewer toolbar, click the {{< gui-button icon="temperature" text="Temperature" >}} button{{</action>}}
{{< action type="edit" text="Change the **Temperature** to 2000.0" />}}


Now we'll run for 250 steps:

{{< action type="menu" text="Simulation &#8680; Run For..." />}}
Expand All @@ -25,8 +24,9 @@ You can open the {{< module "NeutronSQ" >}} module in the _RDF / Neutron S(Q)_ l
We'll now reset the temperature of the box to 298 K and run a second equilibration.

{{< action type="tabs">}} Go to the {{<gui-tab text="Bulk" type="configuration">}} configuration tab {{</action >}}
{{< action type="edit">}}Select the {{<node "Temperature">}} node {{</action>}}
{{< action type="mouse">}}On the configuration viewer toolbar, click the {{< gui-button icon="temperature" text="Temperature" >}} button{{</action>}}
{{< action type="edit" text="Change the **Temperature** to 298.0" />}}

{{< action type="menu" text="Simulation &#8680; Run For..." />}}
{{< step >}}Set the number of steps to 250 and click {{< gui-button text="OK" >}}{{< /step >}}

Expand Down
2 changes: 1 addition & 1 deletion web/docs/examples/water/step2.md
Expand Up @@ -19,7 +19,7 @@ One thousand water molecules should have a cubic box size of just over 31 &#8491

Before we proceed we'll tweak the temperature of the configuration.

{{< action type="mouse">}}Select the {{<node "Temperature">}} node{{</action>}}
{{< action type="mouse">}}On the configuration viewer toolbar, click the {{< gui-button icon="temperature" text="Temperature" >}} button{{</action>}}
{{< action type="edit" text="Set the **Temperature** to 298 K" />}}

{{< cimage src="../waterbox.png" caption="Initial, randomised water box containing 1000 molecules" >}}
Expand Down

1 comment on commit 2ef3002

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 2ef3002 Previous: f3fd784 Ratio
BM_Box_MinimumVector<OrthorhombicBox> 11.749811956210861 ns/iter 4.643403831235341 ns/iter 2.53

This comment was automatically generated by workflow using github-action-benchmark.

CC: @disorderedmaterials/dissolve-devs

Please sign in to comment.