[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kalzium/frameworks] src/tools: Comment out optimization button
From:       Andreas Cord-Landwehr <cordlandwehr () kde ! org>
Date:       2016-10-30 22:38:16
Message-ID: E1c0yk4-0002vd-RL () code ! kde ! org
[Download RAW message or body]

Git commit 877408c4ab8a6c2138322f5de5cec1acb8d02048 by Andreas Cord-Landwehr.
Committed on 30/10/2016 at 22:24.
Pushed by cordlandwehr into branch 'frameworks'.

Comment out optimization button

Currently, there seems to be no proper way for doing the plumbing
between OpenBabel and Avogadro2 for this functionality.

M  +29   -27   src/tools/moleculeview.cpp
M  +2    -3    src/tools/moleculeviewerwidget.ui
M  +2    -2    src/tools/obconverter.cpp

http://commits.kde.org/kalzium/877408c4ab8a6c2138322f5de5cec1acb8d02048

diff --git a/src/tools/moleculeview.cpp b/src/tools/moleculeview.cpp
index 8f862e2..652bea4 100644
--- a/src/tools/moleculeview.cpp
+++ b/src/tools/moleculeview.cpp
@@ -20,7 +20,6 @@
 #include <avogadro/qtgui/molecule.h>
 #include <avogadro/qtgui/scenepluginmodel.h>
 #include <avogadro/qtgui/toolplugin.h>
-// #include <avogadro/qtplugins/openbabel/openbabel.h>FIXME:Avogadro2
 
 #include <QFileInfo>
 #include <QGLFormat>
@@ -71,10 +70,10 @@ MoleculeDialog::MoleculeDialog(QWidget * parent)
     ui.setupUi(mainWidget());
 
     // Attempt to set up the UFF forcefield
-    m_forceField = OBForceField::FindForceField("UFF");
-    if (!m_forceField) {
-        ui.optimizeButton->setEnabled(false);
-    }
+//     m_forceField = OBForceField::FindForceField("UFF");
+//     if (!m_forceField) {
+//         ui.optimizeButton->setEnabled(false);
+//     }
 
     ui.styleCombo->addItems({"Ball and Stick", "Van der Waals", "Wireframe"});
     connect(ui.styleCombo, static_cast<void (QComboBox::*)(const \
QString&)>(&QComboBox::currentIndexChanged), @@ -85,8 +84,9 @@ \
MoleculeDialog::MoleculeDialog(QWidget * parent)  this, \
&MoleculeDialog::setViewEdit);  
     // Editing parameters
-    connect(ui.optimizeButton, &QPushButton::clicked,
-            this, &MoleculeDialog::slotGeometryOptimize);
+// commented out until we find new API for pumbling to OpenBabel
+//     connect(ui.optimizeButton, &QPushButton::clicked,
+//             this, &MoleculeDialog::slotGeometryOptimize);
     connect(ui.clearDrawingButton, &QPushButton::clicked,
             this, &MoleculeDialog::clearAllElementsInEditor);
 
@@ -293,28 +293,30 @@ void MoleculeDialog::slotDownloadNewStuff()
     }
 }
 
+//TODO there is currently no API to perform the necessary OpenBabel-Avogadro
+//     conversions, after the migration to Avogadro2; at least with v0.9
 void MoleculeDialog::slotGeometryOptimize()
 {
-    // Perform a geometry optimization
-    if (!m_forceField) {
-        return;
-    }
-
-    Molecule* molecule = ui.glWidget->molecule();
-    OpenBabel::OBMol obmol;//(molecule->OBMol());//FIXME:Avogadro2
-
-    // Warn the user if the force field cannot be set up for the molecule
-    if (!m_forceField->Setup(obmol)) {
-        KMessageBox::error(this,
-                        i18n("Could not set up force field for this molecule"),
-                        i18n("Kalzium"));
-        return;
-    }
-
-    // Reasonable default values for most users
-    m_forceField->SteepestDescentInitialize(500, 1.0e-5);
-    // Provide some feedback as the optimization runs
-//     while (m_forceField->SteepestDescentTakeNSteps(5)) {//FIXME:Avogadro2
+//     // Perform a geometry optimization
+//     if (!m_forceField) {
+//         return;
+//     }
+//
+//     Molecule* molecule = ui.glWidget->molecule();
+//     OpenBabel::OBMol obmol;//(molecule->OBMol());
+//
+//     // Warn the user if the force field cannot be set up for the molecule
+//     if (!m_forceField->Setup(obmol)) {
+//         KMessageBox::error(this,
+//                         i18n("Could not set up force field for this molecule"),
+//                         i18n("Kalzium"));
+//         return;
+//     }
+//
+//     // Reasonable default values for most users
+//     m_forceField->SteepestDescentInitialize(500, 1.0e-5);
+//     // Provide some feedback as the optimization runs
+//     while (m_forceField->SteepestDescentTakeNSteps(5)) {
 //         m_forceField->UpdateCoordinates(obmol);
 //         molecule->setOBMol(&obmol);
 //         molecule->update();
diff --git a/src/tools/moleculeviewerwidget.ui b/src/tools/moleculeviewerwidget.ui
index 9b84f4d..5bd6c2b 100644
--- a/src/tools/moleculeviewerwidget.ui
+++ b/src/tools/moleculeviewerwidget.ui
@@ -138,13 +138,13 @@
            <layout class="QVBoxLayout" name="verticalLayout_2">
             <item>
              <layout class="QVBoxLayout" name="editTabLayout">
-              <item>
+<!--              <item>
                <widget class="QPushButton" name="optimizeButton">
                 <property name="text">
                  <string>Optimize</string>
                 </property>
                </widget>
-              </item>
+              </item>-->
               <item>
                <spacer name="spacer_2">
                 <property name="orientation">
@@ -288,7 +288,6 @@
  </customwidgets>
  <tabstops>
   <tabstop>styleCombo</tabstop>
-  <tabstop>optimizeButton</tabstop>
  </tabstops>
  <resources/>
  <connections/>
diff --git a/src/tools/obconverter.cpp b/src/tools/obconverter.cpp
index c815f55..f1b21fd 100644
--- a/src/tools/obconverter.cpp
+++ b/src/tools/obconverter.cpp
@@ -89,10 +89,10 @@ void KOpenBabel::setupWindow()
     connect(ui.addFileButton,
             SIGNAL(clicked()), SLOT(slotAddFile()));
 
-    connect(ui.deleteFileButton, 
+    connect(ui.deleteFileButton,
             SIGNAL(clicked()), SLOT(slotDeleteFile()));
 
-    connect(ui.selectAllFileButton, 
+    connect(ui.selectAllFileButton,
             SIGNAL(clicked()), SLOT(slotSelectAll()));
 
     connect(this,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic