From af9686f0c9716a6d814adb7c191ee28097b3c9f8 Mon Sep 17 00:00:00 2001 From: Stefan Doerr Date: Mon, 17 Jan 2022 12:24:33 +0200 Subject: [PATCH] fix bug and add support for integer resnames which exist in PDB --- pdb2pqr/definitions.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pdb2pqr/definitions.py b/pdb2pqr/definitions.py index 896e4c30..8217003e 100644 --- a/pdb2pqr/definitions.py +++ b/pdb2pqr/definitions.py @@ -101,11 +101,14 @@ def characters(self, text): if text.isspace(): return _LOGGER.debug(f"Got text for <{self.curelement}>: {text}") - # If this is a float, make it so - try: - value = float(str(text)) - except ValueError: - value = str(text) + + # If this is a float, make it so. Except for residue names which should stay string + value = str(text) + if self.curelement != "name": + try: + value = float(value) + except ValueError: + pass # Special cases - lists and dictionaries if self.curelement == "bond":