From 943eed94032d953590814463613c7a79bdfe4d21 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Wed, 20 Oct 2010 17:52:31 +0200
Subject: [PATCH] treat UNL properly

---
 modules/conop/src/conop.cc            | 2 +-
 modules/io/src/mol/chemdict_parser.cc | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/conop/src/conop.cc b/modules/conop/src/conop.cc
index 76273ce5f..e21519d7c 100644
--- a/modules/conop/src/conop.cc
+++ b/modules/conop/src/conop.cc
@@ -181,7 +181,7 @@ public:
   virtual bool VisitResidue(const mol::ResidueHandle& res)
   {
     String key=builder_->IdentifyResidue(res);
-    if (key=="UNK" && res.GetKey()!="UNK") {
+    if (key=="UNK" && res.GetKey()!="UNK" && res.GetKey()!="UNL") {
       unk_res_[res.GetKey()]+=1;
     }
     builder_->FillResidueProps(res);
diff --git a/modules/io/src/mol/chemdict_parser.cc b/modules/io/src/mol/chemdict_parser.cc
index 2668221ba..4e52b0877 100644
--- a/modules/io/src/mol/chemdict_parser.cc
+++ b/modules/io/src/mol/chemdict_parser.cc
@@ -6,6 +6,10 @@ using namespace ost::conop;
   
 bool ChemdictParser::OnBeginData(const StringRef& data_name) 
 {    
+  if (data_name==StringRef("UNL",3)) {
+    compound_=CompoundPtr();
+    return false;    
+  }
   compound_.reset(new Compound(data_name.str()));
   compound_->SetDialect(dialect_);
   if (last_!=data_name[0]) {
@@ -119,7 +123,7 @@ void ChemdictParser::OnDataItem(const StarDataItem& item)
 
 void ChemdictParser::OnEndData()
 {
-  if (insert_) {
+  if (insert_ && compound_) {
     if (compound_->GetAtomSpecs().empty()) {
       compound_->AddAtom(atom_);
     }
-- 
GitLab