From 89861d435494767f89ed2373216bf7232ad37504 Mon Sep 17 00:00:00 2001
From: Alexander Puck Neuwirth <APN-Pucky@users.noreply.github.com>
Date: Tue, 20 Feb 2024 15:38:35 +0100
Subject: [PATCH] Do not overwrite `rwgt` weights with `weights` weights

Hotfix for #230
---
 src/pylhe/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pylhe/__init__.py b/src/pylhe/__init__.py
index 8f92e1a3..657f6239 100644
--- a/src/pylhe/__init__.py
+++ b/src/pylhe/__init__.py
@@ -354,7 +354,7 @@ def read_lhe_with_attributes(filepath):
                                     read_lhe_init(filepath)
                                 )
                             for i, w in enumerate(sub.text.split()):
-                                if w:
+                                if w and not index_map[i] in eventdict["weights"]:
                                     eventdict["weights"][index_map[i]] = float(w)
                         if sub.tag == "rwgt":
                             for r in sub: