Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask before re-perceiving a space group #1639

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading