diff --git a/finalcif/cif/cif_file_io.py b/finalcif/cif/cif_file_io.py index f012eaa5..040fbe19 100644 --- a/finalcif/cif/cif_file_io.py +++ b/finalcif/cif/cif_file_io.py @@ -356,6 +356,12 @@ def _hkl_from_shelx(self) -> str: print('No hkl data found in CIF!, {}'.format(e)) return '' + @property + def fab_file(self): + if self['_shelx_fab_file']: + return self['_shelx_fab_file'] + return '' + @property def hkl_as_cif(self) -> str: return HKL(self.hkl_file, self.block.name, hklf_type=self.hklf_number).hkl_as_cif @@ -823,7 +829,7 @@ def angles(self, without_H: bool = False) -> Generator: publ_loop = self.block.find_loop('_geom_angle_publ_flag') angle = namedtuple('angle', ('label1', 'label2', 'label3', 'angle_val', 'symm1', 'symm2')) for label1, label2, label3, angle_val, symm1, symm2, publ in \ - zip(label1, label2, label3, angle_val, symm1, symm2, publ_loop): + zip(label1, label2, label3, angle_val, symm1, symm2, publ_loop): if (without_H and (self.ishydrogen(label1) or self.ishydrogen(label2) or self.ishydrogen(label3)) or (self.yes_not_set(publ))): continue @@ -895,7 +901,7 @@ def hydrogen_bonds(self) -> Generator: hydr = namedtuple('HydrogenBond', ('label_d', 'label_h', 'label_a', 'dist_dh', 'dist_ha', 'dist_da', 'angle_dha', 'symm')) for label_d, label_h, label_a, dist_dh, dist_ha, dist_da, angle_dha, symm, publ in ( - zip(label_d, label_h, label_a, dist_dh, dist_ha, dist_da, angle_dha, symm, publ_loop)): + zip(label_d, label_h, label_a, dist_dh, dist_ha, dist_da, angle_dha, symm, publ_loop)): if self.yes_not_set(publ): continue if self.picometer: diff --git a/finalcif/tools/shred.py b/finalcif/tools/shred.py index c3a851ea..ec42034a 100644 --- a/finalcif/tools/shred.py +++ b/finalcif/tools/shred.py @@ -26,9 +26,12 @@ def shred_cif(self) -> None: suffix='_' + self._cif.block.name + '-finalcif.res') hklfile_path = self._cif.finalcif_file_prefixed(prefix='', suffix='_' + self._cif.block.name + '-finalcif.hkl') + fabfile_path = self._cif.finalcif_file_prefixed(prefix='', + suffix='_' + self._cif.block.name + '-finalcif.fab') else: resfile_path = self._cif.finalcif_file.with_suffix('.res') hklfile_path = self._cif.finalcif_file.with_suffix('.hkl') + fabfile_path = self._cif.finalcif_file.with_suffix('.fab') res_data = None hkl_data = None if not self._cif: @@ -51,6 +54,8 @@ def shred_cif(self) -> None: hkl_data = self.format_hkl_data(hkl_data) if not self._write_hkl_file(hklfile_path, hkl_data): return None + if fab_data := self._cif.fab_file: + self._write_hkl_file(fabfile_path, fab_data) self._show_info(resfile_path, hklfile_path, res_data, hkl_data) @staticmethod