From 513bd8bc7e8e085b78891aa7882c4f2111aa2469 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sun, 4 Feb 2024 22:03:31 +0100
Subject: [PATCH] mmcif writer: ensure that all hetero residues are written in
 chem comp

---
 modules/io/src/mol/mmcif_writer.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc
index 158f17fdc..e944bf9a2 100644
--- a/modules/io/src/mol/mmcif_writer.cc
+++ b/modules/io/src/mol/mmcif_writer.cc
@@ -987,6 +987,9 @@ namespace {
     std::set<String> unique_compounds;
     for(auto ent: entity_infos) {
       unique_compounds.insert(ent.mon_ids.begin(), ent.mon_ids.end());
+      for(auto het_it: ent.het) {
+        unique_compounds.insert(het_it.second.begin(), het_it.second.end());
+      }
     }
     std::vector<ost::io::StarWriterValue> comp_data(2);
     for(auto mon_id: unique_compounds) {
-- 
GitLab