Skip to content

Commit

Permalink
Merge pull request #12 from padix-key/box
Browse files Browse the repository at this point in the history
Allow invalid CRYST1 records
  • Loading branch information
padix-key authored Jan 12, 2024
2 parents c8f187f + 0efd4f5 commit 8e59344
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python-src/fastpdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
__version__ = "1.3.0"

import os
import warnings
import numpy as np
from biotite.file import is_text
import biotite.structure as struc
Expand Down Expand Up @@ -166,10 +167,13 @@ def get_structure(self, model=None, altloc="first", extra_fields=None, include_b
raise ValueError(f"Unknown extra field: {field}")


box = self._pdb_file.parse_box()
if box is None:
atoms.box = None
else:
try:
box = self._pdb_file.parse_box()
except:
warnings.warn(
"File contains invalid 'CRYST1' record, box is ignored"
)
if box is not None:
len_a, len_b, len_c, alpha, beta, gamma = box
box = struc.vectors_from_unitcell(
len_a, len_b, len_c,
Expand Down

0 comments on commit 8e59344

Please sign in to comment.