def __init__(self, site, u_iso, u_star, occupancy, fp, fdp):
   self.site = site
   self.u_iso = u_iso
   self.u_star = u_star
   self.flags = xray.scatterer_flags()
   self.flags.set_use_u(
     iso=(u_iso is not None),
     aniso=(u_star is not None))
   self.occupancy = occupancy
   self.fp = fp
   self.fdp = fdp
 def __init__(self, site, u_iso, u_star, occupancy, fp, fdp):
   self.site = site
   self.u_iso = u_iso
   self.u_star = u_star
   self.flags = xray.scatterer_flags()
   self.flags.set_use_u(
     iso=(u_iso is not None),
     aniso=(u_star is not None))
   self.occupancy = occupancy
   self.fp = fp
   self.fdp = fdp
Exemple #3
0
    def __init__(self,
                 xray_structure,
                 obs_,
                 exti=None,
                 connectivity_table=None):
        if exti is None:
            exti = xray.dummy_extinction_correction()
        adopt_init_args(self, locals())
        assert obs_.fo_sq.anomalous_flag()
        assert not (obs_.twin_fractions and obs_.merohedral_components)

        xray_structure = xray_structure.deep_copy_scatterers()
        for sc in xray_structure.scatterers():
            f = xray.scatterer_flags()
            f.set_use_u_aniso(sc.flags.use_u_aniso())
            f.set_use_u_iso(sc.flags.use_u_iso())
            f.set_use_fp_fdp(True)
            sc.flags = f

        twin_fractions = ()
        it = xray.twin_component(sgtbx.rot_mx((-1, 0, 0, 0, -1, 0, 0, 0, -1)),
                                 0.2, True)
        twin_components = (it, )
        obs = observations.customized_copy(obs_, twin_fractions,
                                           twin_components)
        # reparameterisation needs all fractions
        twin_fractions += twin_components
        if connectivity_table is None:
            connectivity_table = smtbx.utils.connectivity_table(xray_structure)
        reparametrisation = constraints.reparametrisation(
            xray_structure, [],
            connectivity_table,
            twin_fractions=twin_fractions,
            extinction=exti)
        normal_eqns = least_squares.crystallographic_ls(obs, reparametrisation)
        cycles = normal_eqns_solving.naive_iterations(normal_eqns,
                                                      n_max_iterations=10,
                                                      gradient_threshold=1e-7,
                                                      step_threshold=1e-4)
        self.flack_x = it.value
        self.sigma_x = math.sqrt(
            normal_eqns.covariance_matrix(
                jacobian_transpose=reparametrisation.
                jacobian_transpose_matching(
                    reparametrisation.mapping_to_grad_fc_independent_scalars))
            [0])
Exemple #4
0
  def __init__(self, xray_structure, obs_, exti=None, connectivity_table=None):
    if exti is None:
      exti = xray.dummy_extinction_correction()
    adopt_init_args(self, locals())
    assert obs_.fo_sq.anomalous_flag()
    xray_structure = xray_structure.deep_copy_scatterers()
    flags = xray_structure.scatterer_flags()
    for sc in xray_structure.scatterers():
      f = xray.scatterer_flags()
      f.set_use_u_aniso(sc.flags.use_u_aniso())
      f.set_use_u_iso(sc.flags.use_u_iso())
      f.set_use_fp_fdp(True)
      sc.flags = f

    twin_fractions = obs_.twin_fractions
    twin_components = obs_.merohedral_components
    for tw in twin_fractions: tw.grad = False
    for tc in twin_components: tc.grad = False

    it = xray.twin_component(sgtbx.rot_mx((-1,0,0,0,-1,0,0,0,-1)), 0.2, True)
    twin_components += (it,)
    obs = observations.customized_copy(obs_, twin_fractions, twin_components)
    # reparameterisation needs all fractions
    twin_fractions += twin_components
    if connectivity_table is None:
      connectivity_table = smtbx.utils.connectivity_table(xray_structure)
    reparametrisation = constraints.reparametrisation(
      xray_structure, [], connectivity_table,
      twin_fractions=twin_fractions,
      extinction=exti
    )
    normal_eqns = least_squares.crystallographic_ls(obs,
      reparametrisation)
    cycles = normal_eqns_solving.naive_iterations(
      normal_eqns, n_max_iterations=10,
      gradient_threshold=1e-7,
      step_threshold=1e-4)
    self.flack_x = it.value
    self.sigma_x = math.sqrt(normal_eqns.covariance_matrix(
      jacobian_transpose=reparametrisation.jacobian_transpose_matching(
        reparametrisation.mapping_to_grad_fc_independent_scalars))[0])