Skip to content

Commit

Permalink
Merge pull request #1639 from ghutchis/dont-perceive-set-spacegroup
Browse files Browse the repository at this point in the history
Ask before re-perceiving a space group
  • Loading branch information
ghutchis authored Mar 2, 2024
2 parents 7061aac + 31b8ac0 commit ab5331d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions avogadro/qtplugins/spacegroup/spacegroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,25 @@ void SpaceGroup::updateActions()

void SpaceGroup::perceiveSpaceGroup()
{
// only do this if we don't have a Hall number set
if (m_molecule == nullptr)
return;

if (m_molecule->hallNumber() != 0) {
// Ask if the user wants to overwrite the current space group
std::string hallSymbol =
Core::SpaceGroups::hallSymbol(m_molecule->hallNumber());

QMessageBox::StandardButton reply;
reply = QMessageBox::question(nullptr, tr("Perceive Space Group"),
tr("The space group is already set to: %1.\n"
"Would you like to overwrite it?")
.arg(hallSymbol.c_str()),
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::No)
return;
}

unsigned short hallNumber = AvoSpglib::getHallNumber(*m_molecule, m_spgTol);
unsigned short intNum = Core::SpaceGroups::internationalNumber(hallNumber);
std::string hallSymbol = Core::SpaceGroups::hallSymbol(hallNumber);
Expand Down

0 comments on commit ab5331d

Please sign in to comment.