@@ -2047,11 +2047,11 @@ def fixDefault(val, dtype):
2047
2047
2048
2048
# Parsing CRYST1 data
2049
2049
cryst = dataObj .getObj ("cell" )
2050
+ crystalinfo = {}
2050
2051
if cryst is not None and cryst .getRowCount () == 1 :
2051
2052
row = cryst .getRow (0 )
2052
2053
attrs = cryst .getAttributeList ()
2053
2054
2054
- crystalinfo = {}
2055
2055
for source_field , target in cryst1_mapping .items ():
2056
2056
if source_field not in attrs :
2057
2057
continue
@@ -2317,7 +2317,18 @@ def fixDefault(val, dtype):
2317
2317
2318
2318
if not macromolecule :
2319
2319
topo .record = ["HETATM" ] * len (topo .name )
2320
- return MolFactory .construct (topo , Trajectory (coords = coords ), filename , frame )
2320
+
2321
+ box = None
2322
+ boxangles = None
2323
+ if "a" in crystalinfo and "b" in crystalinfo and "c" in crystalinfo :
2324
+ box = np .array ([crystalinfo ["a" ], crystalinfo ["b" ], crystalinfo ["c" ]])
2325
+ if "alpha" in crystalinfo and "beta" in crystalinfo and "gamma" in crystalinfo :
2326
+ boxangles = np .array (
2327
+ [crystalinfo ["alpha" ], crystalinfo ["beta" ], crystalinfo ["gamma" ]]
2328
+ )
2329
+ return MolFactory .construct (
2330
+ topo , Trajectory (coords = coords , box = box , boxangles = boxangles ), filename , frame
2331
+ )
2321
2332
2322
2333
2323
2334
_ATOM_TYPE_REG_EX = re .compile (r"^\S+x\d+$" )
@@ -3819,6 +3830,11 @@ def test_bcif_pdb(self):
3819
3830
mol2 .bonds = np .zeros ((0 , 2 ), dtype = np .uint32 )
3820
3831
mol2 .bondtype = np .zeros ((0 ,), dtype = object )
3821
3832
3833
+ extra_except = []
3834
+ if pdbid == "6a5j" :
3835
+ # The CIF file is missing crystal info
3836
+ extra_except = ["box" , "boxangles" ]
3837
+
3822
3838
assert mol_equal (
3823
3839
mol1 ,
3824
3840
mol2 ,
@@ -3829,7 +3845,8 @@ def test_bcif_pdb(self):
3829
3845
"segid" ,
3830
3846
"serial" ,
3831
3847
"bondtype" ,
3832
- ],
3848
+ ]
3849
+ + extra_except ,
3833
3850
)
3834
3851
3835
3852
def test_inpcrd (self ):
0 commit comments