From 9974ad822d1beacec35bbd13c7e130265f7537ae Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Tue, 2 Aug 2022 09:57:54 +0200
Subject: [PATCH] bugfix: SCHWED-5469

Make assigning Mol IDs more permissive in PDB reader. I.e. allow COMPND
keywords for chains that are not in the finally loaded entity if no_hetatms
is True in the IO profile. They're missing if solely composed of hetatms.
---
 modules/io/src/mol/pdb_reader.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/io/src/mol/pdb_reader.cc b/modules/io/src/mol/pdb_reader.cc
index 14acca8ca..3aeefcbd7 100644
--- a/modules/io/src/mol/pdb_reader.cc
+++ b/modules/io/src/mol/pdb_reader.cc
@@ -482,7 +482,10 @@ void PDBReader::AssignMolIds(mol::EntityHandle ent) {
         mol::ChainHandle chain=ent.FindChain(*chain_iterator);
         if (chain) {
           chain.SetIntProp("mol_id", compnd_iterator->mol_id);
-        }else{
+        }else if (!profile_.no_hetatms){
+          // only throw if no_hetatms flag is False. Some chains might be
+          // missing if no_hetatms is true and they're solely composed of
+          // hetatms.
           LOG_WARNING("failed to assign MOL_ID to chain: "<<*chain_iterator <<std::endl);
           std::stringstream ss;
           ss << "could not map COMPND record MOL_ID onto chain";
-- 
GitLab