From 0cea4777ac7fdbb5260dc75949b4cc0ac4456e8d Mon Sep 17 00:00:00 2001 From: minhuanli Date: Fri, 22 Mar 2024 12:40:34 -0400 Subject: [PATCH] handle case where no sapce group record in PDB file --- SFC_Torch/io.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SFC_Torch/io.py b/SFC_Torch/io.py index 3fbecc4..979dfa6 100644 --- a/SFC_Torch/io.py +++ b/SFC_Torch/io.py @@ -129,7 +129,11 @@ def __init__(self, data): self.cra_name, self.res_id, ) = hier2array(structure) - self.spacegroup = gemmi.SpaceGroup(structure.spacegroup_hm) + try: + self.spacegroup = gemmi.SpaceGroup(structure.spacegroup_hm) + except: + self.spacegroup = gemmi.SpaceGroup("P 1") + print("No valid spacegroup in the file, set as P 1", flush=True) self.cell = structure.cell # Save the pdb headers, exclude the CRYST1 line