From 03b194ffccbe59debbef21772b1fb96b0df0ad8d Mon Sep 17 00:00:00 2001
From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Mon, 10 May 2010 05:38:55 +0000
Subject: [PATCH] fix import of compounds with only one atom

components.cif does not use a loop_ section if the residue only
has one atom. Now we also handle these single atom residues
properly

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2214 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/conop/src/chemdict_tool.cc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc
index 79b36b7b1..865425d8c 100644
--- a/modules/conop/src/chemdict_tool.cc
+++ b/modules/conop/src/chemdict_tool.cc
@@ -140,12 +140,23 @@ public:
       } else if (item.GetName()==StringRef("pdbx_modified_date", 18)) {
         compound_->SetModificationDate(conop::Date::FromString(item.GetValue()));
       }
+    } else if (item.GetName()==StringRef("atom_id", 7)) {
+      atom_.name=item.GetValue().str();
+    } else if (item.GetName()==StringRef("alt_atom_id", 11)) {
+      atom_.alt_name=item.GetValue().str();
+    } else if (item.GetName()==StringRef("type_symbol", 11)) {
+      atom_.element=item.GetValue().str();
+    } else if (item.GetName()==StringRef("pdbx_ordinal", 12)) {
+      atom_.ordinal=item.GetValue().to_int().second-1;
     }
   }
   
   virtual void OnEndData()
   {
     if (insert_) {
+      if (compound_->GetAtomSpecs().empty()) {
+        compound_->AddAtom(atom_);
+      }
       lib_->AddCompound(compound_);      
     }
   }
@@ -176,6 +187,7 @@ private:
   static std::map<String, mol::ChemClass> tm_;  
   std::map<String, int>                   atom_map_;
   LoopType                                loop_type_;  
+  conop::AtomSpec                         atom_;
 };
 
 std::map<String, mol::ChemClass> ChemDictParser::tm_=std::map<String, mol::ChemClass>();
-- 
GitLab