small improvements of molecule visualization.

This commit is contained in:
Axel Kohlmeyer
2025-04-10 08:56:57 -04:00
parent bc031bdd7a
commit dfc10e5b59
2 changed files with 9 additions and 2 deletions

View File

@ -2,8 +2,6 @@ LAMMPS-GUI TODO list:
# Short term goals (v1.x) # Short term goals (v1.x)
- add feature to visualize "molecules" from the molecule command.
this could use the image viewer, but create an empty system and then just one molecule
- implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences. - implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences.
- add a "Filter data" checkbox to the "Charts" window to select whether data should be dropped. - add a "Filter data" checkbox to the "Charts" window to select whether data should be dropped.
- add a "Charts tab" to the preferences with the following (default) settings: - add a "Charts tab" to the preferences with the following (default) settings:

View File

@ -559,6 +559,13 @@ void ImageViewer::change_molecule(int)
auto *box = findChild<QComboBox *>("molecule"); auto *box = findChild<QComboBox *>("molecule");
molecule = box ? box->currentText() : "none"; molecule = box ? box->currentText() : "none";
box = findChild<QComboBox *>("group");
if (molecule == "none") {
box->setEnabled(true);
} else {
box->setEnabled(false);
}
createImage(); createImage();
} }
@ -594,6 +601,7 @@ void ImageViewer::createImage()
QString molcreate = "create_atoms 0 single %1 %2 %3 mol %4 312944 group %5 units box"; QString molcreate = "create_atoms 0 single %1 %2 %3 mol %4 312944 group %5 units box";
group = "imgviewer_tmp_mol"; group = "imgviewer_tmp_mol";
lammps->command(molcreate.arg(xmid).arg(ymid).arg(zmid).arg(molecule).arg(group)); lammps->command(molcreate.arg(xmid).arg(ymid).arg(zmid).arg(molecule).arg(group));
lammps->command(QString("neigh_modify exclude group all %1").arg(group));
lammps->command("run 0 post no"); lammps->command("run 0 post no");
} }
@ -743,6 +751,7 @@ void ImageViewer::createImage()
repaint(); repaint();
if (molecule != "none") { if (molecule != "none") {
lammps->command("neigh_modify exclude none");
lammps->command(QString("delete_atoms group %1 compress no").arg(group)); lammps->command(QString("delete_atoms group %1 compress no").arg(group));
lammps->command(QString("group %1 delete").arg(group)); lammps->command(QString("group %1 delete").arg(group));
group = oldgroup; group = oldgroup;