예제 #1
0
    def __init__(self, *args, **kwds):
        super(restrained_crystal_structure_builder,
              self).__init__(*args, **kwds)
        geom = geometry_restraints
        adp = adp_restraints
        self._proxies = {}

        self._proxies = {
            'bond':
            geometry_restraints.shared_bond_simple_proxy(),
            'angle':
            geometry_restraints.shared_angle_proxy(),
            'dihedral':
            geometry_restraints.shared_dihedral_proxy(),
            'planarity':
            geometry_restraints.shared_planarity_proxy(),
            'chirality':
            geometry_restraints.shared_chirality_proxy(),
            'bond_similarity':
            geometry_restraints.shared_bond_similarity_proxy(),
            'adp_similarity':
            adp_restraints.shared_adp_similarity_proxy(),
            'rigid_bond':
            adp_restraints.shared_rigid_bond_proxy(),
            'isotropic_adp':
            adp_restraints.shared_isotropic_adp_proxy(),
            'fixed_u_eq_adp':
            adp_restraints.shared_fixed_u_eq_adp_proxy(),
            'adp_u_eq_similarity':
            adp_restraints.shared_adp_u_eq_similarity_proxy(),
            'adp_volume_similarity':
            adp_restraints.shared_adp_volume_similarity_proxy(),
        }
예제 #2
0
  def __init__(self, *args, **kwds):
    super(restrained_crystal_structure_builder, self).__init__(*args, **kwds)
    geom = geometry_restraints
    adp = adp_restraints
    self._proxies = {}

    self._proxies = {
      'bond': geometry_restraints.shared_bond_simple_proxy(),
      'angle': geometry_restraints.shared_angle_proxy(),
      'dihedral': geometry_restraints.shared_dihedral_proxy(),
      'planarity': geometry_restraints.shared_planarity_proxy(),
      'chirality': geometry_restraints.shared_chirality_proxy(),
      'bond_similarity': geometry_restraints.shared_bond_similarity_proxy(),
      'adp_similarity': adp_restraints.shared_adp_similarity_proxy(),
      'rigid_bond': adp_restraints.shared_rigid_bond_proxy(),
      'isotropic_adp': adp_restraints.shared_isotropic_adp_proxy(),
      'fixed_u_eq_adp': adp_restraints.shared_fixed_u_eq_adp_proxy(),
      'adp_u_eq_similarity': adp_restraints.shared_adp_u_eq_similarity_proxy(),
      'adp_volume_similarity': adp_restraints.shared_adp_volume_similarity_proxy(),
    }
예제 #3
0
def exercise_geometry_restraints_as_cif():
    quartz = xray.structure(crystal_symmetry=crystal.symmetry(
        (5.01, 5.01, 5.47, 90, 90, 120), "P6222"),
                            scatterers=flex.xray_scatterer([
                                xray.scatterer("Si", (1 / 2., 1 / 2., 1 / 3.)),
                                xray.scatterer("O", (0.197, -0.197, 0.83333))
                            ]))
    bond_proxies = geometry_restraints.shared_bond_simple_proxy((
        geometry_restraints.bond_simple_proxy(
            i_seqs=[0, 1],
            rt_mx_ji=sgtbx.rt_mx("x-y,x,z-2/3"),
            distance_ideal=1.6,
            weight=3.2),
        geometry_restraints.bond_simple_proxy(i_seqs=[0, 1],
                                              distance_ideal=1.7,
                                              weight=1.8),
    ))
    dihedral_proxies = geometry_restraints.shared_dihedral_proxy((
        geometry_restraints.dihedral_proxy(
            i_seqs=[1, 0, 1, 0],
            sym_ops=(sgtbx.rt_mx("1+y,1-x+y, z-1/3"), sgtbx.rt_mx(),
                     sgtbx.rt_mx("x-y,x,z-2/3"), sgtbx.rt_mx("1-x,y-x,1/3-z")),
            angle_ideal=-30,
            weight=2),
        geometry_restraints.dihedral_proxy(
            i_seqs=[1, 0, 1, 0],
            sym_ops=(sgtbx.rt_mx("1+y,1-x+y, z-1/3"), sgtbx.rt_mx(),
                     sgtbx.rt_mx("-y,x-y,z-1/3"), sgtbx.rt_mx("x-y,x,1/3+z")),
            angle_ideal=90,
            weight=3),
    ))
    angle_proxies = geometry_restraints.shared_angle_proxy((
        geometry_restraints.angle_proxy(i_seqs=[1, 0, 1],
                                        sym_ops=(sgtbx.rt_mx("x-y,x,z-2/3"),
                                                 sgtbx.rt_mx(),
                                                 sgtbx.rt_mx("-y,x-y,z-1/3")),
                                        angle_ideal=103,
                                        weight=2),
        geometry_restraints.angle_proxy(
            i_seqs=[1, 0, 1],
            sym_ops=(sgtbx.rt_mx("y+1,-x+y+1,z-1/3"), sgtbx.rt_mx(),
                     sgtbx.rt_mx("-y,x-y,z-1/3")),
            angle_ideal=110,
            weight=5),
        geometry_restraints.angle_proxy(i_seqs=[0, 1, 0],
                                        sym_ops=(sgtbx.rt_mx("y,-x+y,z+2/3"),
                                                 sgtbx.rt_mx(),
                                                 sgtbx.rt_mx("-x+y,-x,z+1/3")),
                                        angle_ideal=150,
                                        weight=5),
    ))
    bond_similarity_proxies = geometry_restraints.shared_bond_similarity_proxy(
        (geometry_restraints.bond_similarity_proxy(
            i_seqs=[(0, 1), (0, 1), (0, 1)],
            sym_ops=(sgtbx.rt_mx("x-y,x,z-2/3"), sgtbx.rt_mx("-y,x-y,z-1/3"),
                     sgtbx.rt_mx("y+1,-x+y+1,z-1/3")),
            weights=(1, 1, 1)), ))
    cif_block = iotbx.cif.model.block()
    iotbx.cif.restraints.add_to_cif_block(
        cif_block,
        quartz,
        bond_proxies=bond_proxies,
        angle_proxies=angle_proxies,
        dihedral_proxies=dihedral_proxies,
        bond_similarity_proxies=bond_similarity_proxies)
    s = StringIO()
    cif_block.show(out=s)
    assert not show_diff(
        s.getvalue(), """\
loop_
  _restr_distance_atom_site_label_1
  _restr_distance_atom_site_label_2
  _restr_distance_site_symmetry_2
  _restr_distance_target
  _restr_distance_target_weight_param
  _restr_distance_diff
  Si  O  2_554  1.6000  0.5590  -0.0160
  Si  O  1      1.7000  0.7454  -2.3838

loop_
  _restr_angle_atom_site_label_1
  _restr_angle_atom_site_label_2
  _restr_angle_atom_site_label_3
  _restr_angle_site_symmetry_1
  _restr_angle_site_symmetry_2
  _restr_angle_site_symmetry_3
  _restr_angle_target
  _restr_angle_target_weight_param
  _restr_angle_diff
  O   Si  O   2_554  1  4_554  103.0000  0.7071   1.6926
  O   Si  O   3_664  1  4_554  110.0000  0.4472  -1.3127
  Si  O   Si  3      1  5      150.0000  0.4472   3.0700

loop_
  _restr_torsion_atom_site_label_1
  _restr_torsion_atom_site_label_2
  _restr_torsion_atom_site_label_3
  _restr_torsion_atom_site_label_4
  _restr_torsion_site_symmetry_1
  _restr_torsion_site_symmetry_2
  _restr_torsion_site_symmetry_3
  _restr_torsion_site_symmetry_4
  _restr_torsion_angle_target
  _restr_torsion_weight_param
  _restr_torsion_diff
  O  Si  O  Si  3_664  1  2_554  7_655  -30.0000  0.7071   6.9078
  O  Si  O  Si  3_664  1  4_554  2       90.0000  0.5774  11.7036

loop_
  _restr_equal_distance_class_class_id
  _restr_equal_distance_class_target_weight_param
  _restr_equal_distance_class_average
  _restr_equal_distance_class_esd
  _restr_equal_distance_class_diff_max
  1  1.0000  1.6160  0.0000  0.0000

loop_
  _restr_equal_distance_atom_site_label_1
  _restr_equal_distance_atom_site_label_2
  _restr_equal_distance_site_symmetry_2
  _restr_equal_distance_class_id
  Si  O  2_554  1
  Si  O  4_554  1
  Si  O  3_664  1

""")
예제 #4
0
def exercise_geometry_restraints_as_cif():
  quartz = xray.structure(
    crystal_symmetry=crystal.symmetry(
      (5.01,5.01,5.47,90,90,120), "P6222"),
    scatterers=flex.xray_scatterer([
      xray.scatterer("Si", (1/2.,1/2.,1/3.)),
      xray.scatterer("O", (0.197,-0.197,0.83333))]))
  bond_proxies = geometry_restraints.shared_bond_simple_proxy((
    geometry_restraints.bond_simple_proxy(
      i_seqs=[0,1],
      rt_mx_ji=sgtbx.rt_mx("x-y,x,z-2/3"),
      distance_ideal=1.6,
      weight=3.2),
    geometry_restraints.bond_simple_proxy(
      i_seqs=[0,1],
      distance_ideal=1.7,
      weight=1.8),
  ))
  dihedral_proxies = geometry_restraints.shared_dihedral_proxy((
    geometry_restraints.dihedral_proxy(
      i_seqs = [1,0,1,0],
      sym_ops = (sgtbx.rt_mx("1+y,1-x+y, z-1/3"),
                 sgtbx.rt_mx(),
                 sgtbx.rt_mx("x-y,x,z-2/3"),
                 sgtbx.rt_mx("1-x,y-x,1/3-z")),
      angle_ideal=-30,
      weight=2),
    geometry_restraints.dihedral_proxy(
      i_seqs = [1,0,1,0],
      sym_ops = (sgtbx.rt_mx("1+y,1-x+y, z-1/3"),
                 sgtbx.rt_mx(),
                 sgtbx.rt_mx("-y,x-y,z-1/3"),
                 sgtbx.rt_mx("x-y,x,1/3+z")),
      angle_ideal=90,
      weight=3),
  ))
  angle_proxies = geometry_restraints.shared_angle_proxy((
    geometry_restraints.angle_proxy(
      i_seqs = [1,0,1],
      sym_ops = (sgtbx.rt_mx("x-y,x,z-2/3"),
                 sgtbx.rt_mx(),
                 sgtbx.rt_mx("-y,x-y,z-1/3")),
      angle_ideal=103,
      weight=2),
    geometry_restraints.angle_proxy(
      i_seqs = [1,0,1],
      sym_ops = (sgtbx.rt_mx("y+1,-x+y+1,z-1/3"),
                 sgtbx.rt_mx(),
                 sgtbx.rt_mx("-y,x-y,z-1/3")),
      angle_ideal=110,
      weight=5),
    geometry_restraints.angle_proxy(
      i_seqs = [0,1,0],
      sym_ops = (sgtbx.rt_mx("y,-x+y,z+2/3"),
                 sgtbx.rt_mx(),
                 sgtbx.rt_mx("-x+y,-x,z+1/3")),
      angle_ideal=150,
      weight=5),
  ))
  bond_similarity_proxies = geometry_restraints.shared_bond_similarity_proxy((
    geometry_restraints.bond_similarity_proxy(
      i_seqs=[(0,1),(0,1),(0,1)],
      sym_ops=(sgtbx.rt_mx("x-y,x,z-2/3"),
               sgtbx.rt_mx("-y,x-y,z-1/3"),
               sgtbx.rt_mx("y+1,-x+y+1,z-1/3")),
      weights=(1,1,1)),
  ))
  cif_block = iotbx.cif.model.block()
  iotbx.cif.restraints.add_to_cif_block(
    cif_block, quartz,
    bond_proxies=bond_proxies,
    angle_proxies=angle_proxies,
    dihedral_proxies=dihedral_proxies,
    bond_similarity_proxies=bond_similarity_proxies)
  s = StringIO()
  cif_block.show(out=s)
  assert not show_diff(s.getvalue(), """\
loop_
  _restr_distance_atom_site_label_1
  _restr_distance_atom_site_label_2
  _restr_distance_site_symmetry_2
  _restr_distance_target
  _restr_distance_target_weight_param
  _restr_distance_diff
  Si  O  2_554  1.6000  0.5590  -0.0160
  Si  O  1      1.7000  0.7454  -2.3838

loop_
  _restr_angle_atom_site_label_1
  _restr_angle_atom_site_label_2
  _restr_angle_atom_site_label_3
  _restr_angle_site_symmetry_1
  _restr_angle_site_symmetry_2
  _restr_angle_site_symmetry_3
  _restr_angle_target
  _restr_angle_target_weight_param
  _restr_angle_diff
  O   Si  O   2_554  1  4_554  103.0000  0.7071   1.6926
  O   Si  O   3_664  1  4_554  110.0000  0.4472  -1.3127
  Si  O   Si  3      1  5      150.0000  0.4472   3.0700

loop_
  _restr_torsion_atom_site_label_1
  _restr_torsion_atom_site_label_2
  _restr_torsion_atom_site_label_3
  _restr_torsion_atom_site_label_4
  _restr_torsion_site_symmetry_1
  _restr_torsion_site_symmetry_2
  _restr_torsion_site_symmetry_3
  _restr_torsion_site_symmetry_4
  _restr_torsion_angle_target
  _restr_torsion_weight_param
  _restr_torsion_diff
  O  Si  O  Si  3_664  1  2_554  7_655  -30.0000  0.7071   6.9078
  O  Si  O  Si  3_664  1  4_554  2       90.0000  0.5774  11.7036

loop_
  _restr_equal_distance_class_class_id
  _restr_equal_distance_class_target_weight_param
  _restr_equal_distance_class_average
  _restr_equal_distance_class_esd
  _restr_equal_distance_class_diff_max
  1  1.0000  1.6160  0.0000  0.0000

loop_
  _restr_equal_distance_atom_site_label_1
  _restr_equal_distance_atom_site_label_2
  _restr_equal_distance_site_symmetry_2
  _restr_equal_distance_class_id
  Si  O  2_554  1
  Si  O  4_554  1
  Si  O  3_664  1

""")