From 131d149ae69fca99ecf3c28d031dd24422e1fc62 Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavier.robin@unibas.ch>
Date: Wed, 26 Jul 2023 11:04:20 +0200
Subject: [PATCH] feat: report possible compatibiltiy issues

---
 modules/conop/src/compound_lib.cc | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc
index 094eb454a..691abadb8 100644
--- a/modules/conop/src/compound_lib.cc
+++ b/modules/conop/src/compound_lib.cc
@@ -397,7 +397,6 @@ CompoundLibPtr CompoundLib::Load(const String& database, bool readonly)
   }
   String aq;
   sqlite3_stmt* stmt;
-  std::stringstream ss;
   // check if SMILES are available
   aq="SELECT smiles FROM chem_compounds LIMIT 1";
   retval=sqlite3_prepare_v2(lib->db_->ptr, aq.c_str(),
@@ -417,12 +416,24 @@ CompoundLibPtr CompoundLib::Load(const String& database, bool readonly)
   lib->creation_date_ = lib->GetCreationDate();
   lib->ost_version_used_ = lib->GetOSTVersionUsed();
 
+  // Report compatibility issues
   if (lib->ost_version_used_.compare(COMPAT_VERSION) < 0) {
+    std::stringstream ss;
     ss << "Compound lib was created with an unsupported version of OST: "
        << lib->ost_version_used_
        << ". Please update your compound library.";
     throw ost::Error(ss.str());
   }
+  if (!lib->smiles_available_) {
+    LOG_WARNING("SMILES not available in compound library v."
+                << lib->ost_version_used_
+                << ". Only empty strings will be returned.");
+  }
+  if (!lib->charges_available_) {
+    LOG_WARNING("Charges not available in compound library v."
+                << lib->ost_version_used_
+                << ". All charges will be 0.");
+  }
   return lib;
 }
 
-- 
GitLab