From cf2102170e3052f4dfce9d1b2a70401a16ce6deb Mon Sep 17 00:00:00 2001 From: Perminder Date: Sat, 6 Apr 2024 23:17:56 +0530 Subject: [PATCH] fixes --- avogadro/qtplugins/forcefield/forcefield.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/avogadro/qtplugins/forcefield/forcefield.cpp b/avogadro/qtplugins/forcefield/forcefield.cpp index 0ec38eb4be..92d2d11615 100644 --- a/avogadro/qtplugins/forcefield/forcefield.cpp +++ b/avogadro/qtplugins/forcefield/forcefield.cpp @@ -241,6 +241,12 @@ void Forcefield::optimize() if (m_molecule == nullptr || m_method == nullptr) return; + if(!m_molecule->atomCount()){ + QMessageBox::information(nullptr, tr("Avogadro"), + tr("No atoms provided for optimization")); + return; + } + // merge all coordinate updates into one step for undo bool isInteractive = m_molecule->undoMolecule()->isInteractive(); m_molecule->undoMolecule()->setInteractive(true); @@ -353,7 +359,7 @@ void Forcefield::energy() { if (m_molecule == nullptr || m_method == nullptr) return; - + int n = m_molecule->atomCount(); // we have to cast the current 3d positions into a VectorXd Core::Array pos = m_molecule->atomPositions3d();