Example #1
0
 def as_cif_block(self, cif_block=None):
   if cif_block is None:
     cif_block = iotbx.cif.model.block()
   cif_block["_reflns.B_iso_Wilson_estimate"] = round_2_for_cif(self.wilson_b)
   cif_block["_refine.B_iso_mean"] = round_2_for_cif(self.b_mean_a)
   #_refine.aniso_B[1][1]
   #_refine.aniso_B[2][2]
   #_refine.aniso_B[3][3]
   #_refine.aniso_B[1][2]
   #_refine.aniso_B[1][3]
   #_refine.aniso_B[2][3]
   return cif_block
Example #2
0
    def as_cif_block(self, cif_block=None):
        if cif_block is None:
            cif_block = iotbx.cif.model.block()
        if self.data_x is not None:
            cif_block = self.data_x.as_cif_block(cif_block=cif_block)
        # XXX Neutron data?

        if self.geometry is not None:
            pdbx_refine_id = ''
            if self.data_x is not None:
                pdbx_refine_id = 'X-ray'
            if self.data_n is not None:
                pdbx_refine_id = 'Neutron' if self.data_x is None else 'X-ray+Neutron'
            cif_block = self.geometry.as_cif_block(
                cif_block=cif_block, pdbx_refine_id=pdbx_refine_id)
        if self.adp is not None:
            cif_block = self.adp.as_cif_block(cif_block=cif_block)
            cif_block["_reflns.B_iso_Wilson_estimate"] = round_2_for_cif(
                self.wilson_b)
        cif_block = self.model.tls_groups_as_cif_block(cif_block=cif_block)

        # What about anomalous_scatterer_groups here?

        # adding NCS information.
        # It is not clear why we dump cartesian NCS first, and if it is absent,
        # Torsion NCS next. What about NCS constraints?
        if self.model.cartesian_NCS_present():
            self.model.cartesian_NCS_as_cif_block(cif_block=cif_block)
        elif self.model.torsion_NCS_present():
            self.model.torsion_NCS_as_cif_block(cif_block=cif_block)
        return cif_block
Example #3
0
  def as_cif_block(self, cif_block=None):
    if cif_block is None:
      cif_block = iotbx.cif.model.block()
    pdbx_refine_id = ''
    if self.data_x is not None:
      pdbx_refine_id = 'X-RAY DIFFRACTION'
    if self.data_n is not None:
      # !!! Warning: "X-ray+Neutron" is not compliant with mmCIF dictionary:
      # http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Items/_exptl.method.html
      pdbx_refine_id = 'NEUTRON DIFFRACTION' if self.data_x is None else 'X-ray+Neutron'
    if self.data_x is not None:
      cif_block = self.data_x.as_cif_block(cif_block=cif_block, scattering_type=pdbx_refine_id)
    # XXX Neutron data?

    if self.geometry is not None:
      cif_block = self.geometry.as_cif_block(cif_block=cif_block, pdbx_refine_id=pdbx_refine_id)
    if self.adp is not None:
      cif_block = self.adp.as_cif_block(cif_block=cif_block)
      cif_block["_reflns.B_iso_Wilson_estimate"] = round_2_for_cif(self.wilson_b)
    cif_block = self.model.tls_groups_as_cif_block(cif_block=cif_block)

    # What about anomalous_scatterer_groups here?

    # adding NCS information.
    # It is not clear why we dump cartesian NCS first, and if it is absent,
    # Torsion NCS next. What about NCS constraints?
    if self.model.cartesian_NCS_present():
      self.model.cartesian_NCS_as_cif_block(cif_block=cif_block)
    elif self.model.torsion_NCS_present():
      self.model.torsion_NCS_as_cif_block(cif_block=cif_block)
    return cif_block
Example #4
0
 def as_cif_block(self, cif_block=None):
   if cif_block is None:
     cif_block = iotbx.cif.model.block()
   if self._result.overall is not None:
     cif_block["_refine.B_iso_mean"] = round_2_for_cif(self._result.overall.mean)
   else:
     cif_block["_refine.B_iso_mean"] = '?'
   return cif_block
Example #5
0
 def as_cif_block(self, cif_block=None):
   if cif_block is None:
     cif_block = iotbx.cif.model.block()
   if self.data_x is not None:
     cif_block = self.data_x.as_cif_block(cif_block=cif_block, scattering_type=self._pdbx_refine_id)
   if self.wilson_b is not None:
     cif_block["_reflns.B_iso_Wilson_estimate"] = round_2_for_cif(self.wilson_b)
   # XXX Neutron data?
   if self.geometry is not None:
     cif_block = self.geometry.as_cif_block(cif_block=cif_block, pdbx_refine_id=self._pdbx_refine_id)
   if self.adp is not None:
     cif_block = self.adp.as_cif_block(cif_block=cif_block)
   cif_block = self.model.tls_groups_as_cif_block(cif_block=cif_block)
   # What about anomalous_scatterer_groups here?
   return cif_block
Example #6
0
    def as_cif_block(self,
                     cif_block=None,
                     scattering_type="X-RAY DIFFRACTION"):
        import iotbx.cif.model
        if cif_block is None:
            cif_block = iotbx.cif.model.block()

        cif_block["_refine.pdbx_refine_id"] = scattering_type
        cif_block["_refine.ls_d_res_low"] = round_2_for_cif(self.d_max)
        cif_block["_refine.ls_d_res_high"] = round_2_for_cif(self.d_min)
        cif_block["_refine.pdbx_ls_sigma_F"] = round_2_for_cif(
            self.min_f_obs_over_sigma)
        cif_block["_refine.ls_percent_reflns_obs"] = round_2_for_cif(
            self.completeness_in_range * 100.0)
        cif_block["_refine.ls_number_reflns_obs"] = self.number_of_reflections
        #_refine.ls_number_reflns_all
        cif_block["_refine.ls_number_reflns_R_work"] = (
            self.number_of_reflections - self.number_of_test_reflections)
        cif_block[
            "_refine.ls_number_reflns_R_free"] = self.number_of_test_reflections
        cif_block["_refine.ls_R_factor_obs"] = round_4_for_cif(self.r_all)
        cif_block["_refine.ls_R_factor_R_work"] = round_4_for_cif(self.r_work)
        cif_block["_refine.ls_R_factor_R_free"] = round_4_for_cif(self.r_free)
        cif_block["_refine.ls_percent_reflns_R_free"] = round_2_for_cif(
            self.number_of_test_reflections / self.number_of_reflections * 100)

        loop = iotbx.cif.model.loop(header=(
            "_refine_ls_shell.pdbx_refine_id",
            #"_refine_ls_shell.pdbx_total_number_of_bins_used",
            "_refine_ls_shell.d_res_high",
            "_refine_ls_shell.d_res_low",
            "_refine_ls_shell.number_reflns_R_work",
            "_refine_ls_shell.R_factor_R_work",
            "_refine_ls_shell.percent_reflns_obs",
            "_refine_ls_shell.R_factor_R_free",
            #"_refine_ls_shell.R_factor_R_free_error",
            #"_refine_ls_shell.percent_reflns_R_free",
            "_refine_ls_shell.number_reflns_R_free",
            #"_refine_ls_shell.number_reflns_all",
            #"_refine_ls_shell.R_factor_all",
            #"_refine_ls_shell.redundancy_reflns_obs",
            #"_refine_ls_shell.number_reflns_obs",
        ))

        for bin in self.bins:
            d_max, d_min = [float(d) for d in bin.d_range.split('-')]
            loop.add_row((scattering_type, round_2_for_cif(d_min),
                          round_2_for_cif(d_max), bin.n_work,
                          round_4_for_cif(bin.r_work),
                          round_2_for_cif(bin.completeness * 100),
                          round_4_for_cif(bin.r_free), bin.n_free))

        cif_block.add_loop(loop)

        cif_block["_refine.solvent_model_details"] = "FLAT BULK SOLVENT MODEL"
        #_refine.solvent_model_param_ksol
        #_refine.solvent_model_param_bsol
        cif_block["_refine.pdbx_solvent_vdw_probe_radii"] = round_4_for_cif(
            self.mask_solvent_radius)
        cif_block["_refine.pdbx_solvent_shrinkage_radii"] = round_4_for_cif(
            self.mask_shrink_radius)

        # twinning?

        cif_block["_refine.overall_SU_ML"] = round_4_for_cif(
            self.ml_coordinate_error)
        cif_block["_refine.pdbx_overall_phase_error"] = round_4_for_cif(
            self.ml_phase_error)

        return cif_block
Example #7
0
 def as_cif_block(self, cif_block=None):
     if cif_block is None:
         cif_block = iotbx.cif.model.block()
     cif_block["_refine.B_iso_mean"] = \
       round_2_for_cif(self._result.overall.mean)
     return cif_block