File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
avogadro/qtplugins/forcefield Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -65,18 +65,19 @@ Forcefield::Forcefield(QObject* parent_)
6565 m_gradientTolerance = settings.value (" gradientTolerance" , 1.0e-4 ).toDouble ();
6666 settings.endGroup ();
6767
68+ // prefer to use Python interface scripts if available
69+ refreshScripts ();
70+
6871 // add the openbabel calculators in case they don't exist
6972#ifdef BUILD_GPL_PLUGINS
7073 // These directly use Open Babel and are fast
74+ qDebug () << " registering GPL plugins" ;
7175 Calc::EnergyManager::registerModel (new OBEnergy (" MMFF94" ));
7276 Calc::EnergyManager::registerModel (new OBEnergy (" UFF" ));
7377 Calc::EnergyManager::registerModel (new OBEnergy (" GAFF" ));
74- #endif
75-
76- refreshScripts ();
77-
78- #ifndef BUILD_GPL_PLUGINS
79- // These call obmm and can be slow
78+ #else
79+ // These call obmm and can be slower
80+ qDebug () << " registering obmm plugins" ;
8081 Calc::EnergyManager::registerModel (new OBMMEnergy (" MMFF94" ));
8182 Calc::EnergyManager::registerModel (new OBMMEnergy (" UFF" ));
8283 Calc::EnergyManager::registerModel (new OBMMEnergy (" GAFF" ));
Original file line number Diff line number Diff line change 1818#include < openbabel/obconversion.h>
1919#include < openbabel/obiter.h>
2020
21+ #include < QCoreApplication>
2122#include < QDebug>
2223#include < QDir>
2324
@@ -43,12 +44,25 @@ OBEnergy::OBEnergy(const std::string& method)
4344 : m_identifier(method), m_name(method), m_molecule(nullptr )
4445{
4546 d = new Private;
47+
48+ // make sure we set the Open Babel variables for data files
49+ #ifdef _WIN32
50+ QByteArray dataDir =
51+ QString (QCoreApplication::applicationDirPath () + " /data" ).toLocal8Bit ();
52+ qputenv (" BABEL_DATADIR" , dataDir);
53+ #endif
4654 // Ensure the plugins are loaded
4755 OBPlugin::LoadAllPlugins ();
4856
4957 d->m_forceField = static_cast <OBForceField*>(
5058 OBPlugin::GetPlugin (" forcefields" , method.c_str ()));
5159
60+ qDebug () << " OBEnergy: method: " << method.c_str ();
61+ if (d->m_forceField == nullptr ) {
62+ qDebug () << " OBEnergy: method not found: " << method.c_str ();
63+ qDebug () << OBPlugin::ListAsString (" forcefields" ).c_str ();
64+ }
65+
5266 if (method == " UFF" ) {
5367 m_description = tr (" Universal Force Field" );
5468 m_elements.reset ();
You can’t perform that action at this time.
0 commit comments