From 36f7836b48bd9e6ec2298fe0820275b12385645d Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 5 Mar 2025 13:55:40 +0100
Subject: [PATCH] lddtpli bugfix: handle case when mdl chain is not mapped to
 any chem group in ref

This is relevant if there are added mdl contacts.
---
 modules/mol/alg/pymod/ligand_scoring_lddtpli.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/mol/alg/pymod/ligand_scoring_lddtpli.py b/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
index 7e22be4aa..9338b484f 100644
--- a/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
+++ b/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
@@ -451,6 +451,11 @@ class LDDTPLIScorer(ligand_scoring_base.LigandScorer):
             already_mapped = set()
             for mdl_ch in mdl_chains:
                 if mdl_ch not in lddt_chain_mapping:
+
+                    if mdl_ch in self._mdl_chains_without_chem_mapping:
+                        # this mdl chain does not map to any trg chain
+                        continue
+
                     # check which chain in trg is closest
                     chem_grp_idx = None
                     for i, m in enumerate(self._chem_mapping):
-- 
GitLab