From 692c82b45e92bda4649c01a7fef8fbdbc631a7f2 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 20 Nov 2024 17:03:46 +0100 Subject: [PATCH] add energy once --- prody/proteins/interactions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 2bed602d5..459fa9416 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -3488,13 +3488,14 @@ def buildInteractionMatrixEnergy(self, **kwargs): resChIDs = list(atoms.select('name CA').getChids()) resIDs_with_resChIDs = list(zip(resIDs, resChIDs)) - for nr_i,i in enumerate(interactions): + for i in interactions: if i != []: for ii in i: m1 = resIDs_with_resChIDs.index((int(ii[0][3:]),ii[2])) m2 = resIDs_with_resChIDs.index((int(ii[3][3:]),ii[5])) scoring = get_energy([ii[0][:3], ii[3][:3]], energy_list_type) - InteractionsMap[m1][m2] = InteractionsMap[m2][m1] = InteractionsMap[m1][m2] + float(scoring) + if InteractionsMap[m1][m2] == 0: + InteractionsMap[m1][m2] = InteractionsMap[m2][m1] = float(scoring) self._interactions_matrix_en = InteractionsMap