Skip to content
Snippets Groups Projects
Commit 4b4401ea authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

OpenMM plugin folders are only loaded once per path per execution.

parent 9c2c35cc
Branches
Tags
No related merge requests found
......@@ -267,6 +267,16 @@ SimulationPtr Simulation::Load(const String& filename, SettingsPtr settings){
}
void Simulation::EnsurePluginsLoaded(const String& plugin_path) {
// note: this is guaranteed to be constructed on first use only
static std::set<String> already_loaded;
if (already_loaded.find(plugin_path) == already_loaded.end()) {
// not loaded yet: load directory, but only once!
OpenMM::Platform::loadPluginsFromDirectory(plugin_path);
already_loaded.insert(plugin_path);
}
}
void Simulation::Init(const TopologyPtr top,
const SettingsPtr settings){
......
......@@ -145,6 +145,9 @@ private:
int TimeToNextNotification();
// loads plugins from directory for OpenMM BUT only once per unique path!
static void EnsurePluginsLoaded(const String& plugin_path);
SystemPtr system_;
IntegratorPtr integrator_;
ContextPtr context_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment