def refinable_params_one_ncs_to_asu(self, x=None): """ Expand refinabale parameters corresponding to one NCS copy to parameters corresponding to whole ASU. """ x_old = self.xray_structure.sites_cart() if not x: x = self.x if self.refine_sites or self.refine_transformations: if self.use_ncs_constraints or self.refine_transformations: new_x = nu.apply_transforms( ncs_coordinates=flex.vec3_double(x), ncs_restraints_group_list=self.ncs_restraints_group_list, total_asu_length=x_old.size(), extended_ncs_selection=self.extended_ncs_selection, round_coordinates=False, center_of_coordinates=self.ncs_groups_coordinates_centers) new_x = new_x.select(self.refine_selection) new_x = x_old.set_selected(self.refine_selection, new_x) else: new_x = self.x return new_x.as_double() elif self.refine_u_iso: if self.use_ncs_constraints: return grads_one_ncs_to_asu( ncs_restraints_group_list=self.ncs_restraints_group_list, extended_ncs_selection=self.extended_ncs_selection, total_asu_length=x_old.size(), master_grad=x) else: return flex.double(list(x))
def refinable_params_one_ncs_to_asu(self, x=None): """ Expand refinabale parameters corresponding to one NCS copy to parameters corresponding to whole ASU. """ x_old = self.xray_structure.sites_cart() if not x : x = self.x if self.refine_sites or self.refine_transformations: if self.use_ncs_constraints or self.refine_transformations: new_x = nu.apply_transforms( ncs_coordinates = flex.vec3_double(x), ncs_restraints_group_list = self.ncs_restraints_group_list, total_asu_length = x_old.size(), extended_ncs_selection = self.extended_ncs_selection, round_coordinates = False, center_of_coordinates = self.ncs_groups_coordinates_centers) new_x = new_x.select(self.refine_selection) new_x = x_old.set_selected(self.refine_selection,new_x) else: new_x = self.x return new_x.as_double() elif self.refine_u_iso: if self.use_ncs_constraints: return grads_one_ncs_to_asu( ncs_restraints_group_list = self.ncs_restraints_group_list, extended_ncs_selection = self.extended_ncs_selection, total_asu_length = x_old.size(), master_grad = x) else: return flex.double(list(x))
def test_MTRIX(self): '''Test MTRIX record processing''' # print sys._getframe().f_code.co_name cau_expected_results = [ [1.0, 1.0, 1.0], [1.0, -1.0, 1.0], [-0.366025, 1.366025, 1.0], [-1.366025, 0.366025, 1.0], [1.0, 1.5, 1.0], [94.618, -5.253, 91.582], [94.618, -91.582, -5.253], [51.858229, 79.315053, 91.582], [-42.759771, 84.568053, 91.582], [94.618, -4.753, 91.582], [62.395, 51.344, 80.786], [62.395, -80.786, 51.344], [-13.267688, 79.70763, 80.786], [-75.662688, 28.36363, 80.786], [62.395, 51.844, 80.786], [39.954, 51.526, 72.372], [39.954, -72.372, 51.526], [-24.645804, 60.364163, 72.372], [-64.599804, 8.838163, 72.372], [39.954, 52.026, 72.372]] # use MTRIX data multimer_data = multimer( file_name='multimer_test_data.pdb', reconstruction_type='cau') cau_multimer_xyz = list(multimer_data.sites_cart()) cau_multimer_xyz.sort() cau_expected_results.sort() assert approx_equal(cau_expected_results,cau_multimer_xyz,eps=0.001) # Test that the number of MTRIX record to process is correct self.assertEqual(multimer_data.number_of_transforms,4) # Test getting non-rounded ASU source_xyz = multimer_data.get_ncs_hierarchy().atoms().extract_xyz() xyz = apply_transforms( ncs_coordinates = source_xyz, ncs_restraints_group_list = multimer_data.get_ncs_restraints_group_list(), total_asu_length = multimer_data.total_asu_length(), extended_ncs_selection = flex.size_t_range(source_xyz.size()), round_coordinates=False) cau_multimer_xyz = list(xyz) cau_multimer_xyz.sort() assert approx_equal(cau_expected_results,cau_multimer_xyz,eps=0.00001) # Test multimer without rounding multimer_data = multimer( file_name='multimer_test_data.pdb', round_coordinates=False, reconstruction_type='cau') cau_multimer_xyz = list(multimer_data.sites_cart()) cau_multimer_xyz.sort() cau_expected_results.sort() assert approx_equal(cau_expected_results,cau_multimer_xyz,eps=0.00001)