diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc index 89499b698121fb6610460889479d67a09af0fddd..9ca3729cae37702539847beae13b31dccea87bdb 100644 --- a/modules/conop/src/chemdict_tool.cc +++ b/modules/conop/src/chemdict_tool.cc @@ -116,6 +116,11 @@ int main(int argc, char const *argv[]) compound_lib.reset(); cdp.SetCompoundLib(in_mem_lib); cdp.Parse(); + if (cdp.GetImportedCount() == 0) + { + std::cout << "No compound imported from " << argv[2] << std::endl; + return 1; + } in_mem_lib->SetChemLibInfo(); conop::CompoundLibPtr copy = in_mem_lib->Copy(argv[3]); if (! copy) { diff --git a/modules/io/src/mol/chemdict_parser.cc b/modules/io/src/mol/chemdict_parser.cc index 3f97a49b5207db5d8d6b17dbdf13fffd8da50c3c..f1b2610ad549f78090b6ff2fb14ce47af92d4413 100644 --- a/modules/io/src/mol/chemdict_parser.cc +++ b/modules/io/src/mol/chemdict_parser.cc @@ -215,6 +215,7 @@ void ChemdictParser::OnEndData() } } lib_->AddCompound(compound_); + ++imported_count_; } } } diff --git a/modules/io/src/mol/chemdict_parser.hh b/modules/io/src/mol/chemdict_parser.hh index 46a83ec3b36d599b917d08c280119911d63d034c..fe4981c116945e2a1031def2d5c97dc9c435e1d0 100644 --- a/modules/io/src/mol/chemdict_parser.hh +++ b/modules/io/src/mol/chemdict_parser.hh @@ -44,7 +44,8 @@ public: bool ignore_reserved=false, bool ignore_obsolete=false): StarParser(stream), compound_(new conop::Compound("UNK")), last_(0), loop_type_(DONT_KNOW), dialect_(dialect), - ignore_reserved_(ignore_reserved), ignore_obsolete_(ignore_obsolete) + ignore_reserved_(ignore_reserved), ignore_obsolete_(ignore_obsolete), + imported_count_(0) { this->InitTypeMap(); this->InitPDBXTypeMap(); @@ -65,6 +66,12 @@ public: { lib_=lib; } + + /// \brief Get the number of compounds that were successfully parsed + int GetImportedCount() + { + return imported_count_; + } private: void InitTypeMap(); void InitPDBXTypeMap(); @@ -98,6 +105,7 @@ private: conop::Compound::Dialect dialect_; bool ignore_reserved_; bool ignore_obsolete_; + int imported_count_; };