mmtbx.ncs¶
Submodules¶
mmtbx.ncs.ligands module¶
Post-fitting cleanup of ligand positions to match NCS operations present in protein model. This can be used to recover cases where one copy is placed successfully but another misses due to interfering protein atoms, weak density, false positive in empty protein density, etc. It can also accelerate ligand placement for large structures if at least one copy is already placed with high confidence. Should only be used when the initial placement (e.g. LigandFit CC) is sufficiently good.
Usually this will be called via the command mmtbx.apply_ncs_to_ligand.
- class mmtbx.ncs.ligands.apply_ligand_ncs(pdb_hierarchy, fmodel, ligand_code, params, atom_selection=None, add_new_ligands_to_pdb=False, only_segid=None, log=None)¶
Bases:
object
Wrapper class; this should be the primary entry point for external calling routines.
- Parameters:
pdb_hierarchy – initial model with one or more copies of the target ligand
fmodel – mmtbx.f_model.manager object corresponding to the model
ligand_code – three-letter residue name of ligand
params – phil scope_extract object for ncs_ligand_phil
atom_selection – selection for reference ligand (default: search for all copies and pick one with the best CC)
add_new_ligands_to_pdb – generate combined PDB hierarchy and fmodel with new ligands incorporated
only_segid
log – filehandle-like object
- property n_ligands¶
- write_maps(file_name)¶
- write_pdb(file_name)¶
- mmtbx.ncs.ligands.combine_ligands_and_hierarchy(pdb_hierarchy, ligands, log=None)¶
- mmtbx.ncs.ligands.extract_ligand_residues(pdb_hierarchy, ligand_code, atom_selection=None, only_segid=None)¶
Extract the atom_group object(s) with given 3-character residue name.
- Parameters:
pdb_hierarchy – input model
ligand_code – 3-letter residue ID
atom_selection – optional flex.bool object specifying ligand selection to use
only_segid – optional segid which ligand(s) must match
- Returns:
list of atom_group objects
- class mmtbx.ncs.ligands.get_final_maps_and_cc(fmodel, ligands, params, log)¶
Bases:
object
- write_maps(file_name)¶
- class mmtbx.ncs.ligands.group_operators(selection, sele_str, sites_cart)¶
Bases:
object
Object for storing information about NCS relationships relative to an atom selection, i.e. given four identical chains A, B, C, and D, this might store information about chain B and the NCS operators for approximate superpositioning on chains A, C, and D.
- add_operator(ops, sele_str)¶
Save an NCS operator and corresponding atom selection.
- distance_from_center(sites)¶
Compute the distance between centers-of-mass of this selection and the given sites. Used to determine ligand-protein chain relationships.
- show_summary(out=None, prefix='')¶
Print out selections and NCS operators.
- mmtbx.ncs.ligands.remove_clashing_atoms(xray_structure, pdb_hierarchy, ligands, params, log)¶
Since the transformed ligands will very frequently overlap with existing atoms, these need to be deleted if we are confident about the new positions.
- mmtbx.ncs.ligands.resid_str(atom)¶
- class mmtbx.ncs.ligands.sample_operators(pdb_hierarchy, fmodel, ncs_operators, ligands, params, log=None)¶
Bases:
object
Determines an appropriate “reference” ligand, and samples the density around sites transformed by each operator, applying the best operator to the other ligand copies if meeting cutoff criteria.
- get_new_fcalc_map(sites_new, i_seqs)¶
- get_sites_cc(atoms, sites=None)¶
- setup_maps()¶
Create 2mFo-DFc, mFo-DFc, and Fc maps.
- mmtbx.ncs.ligands.xyz_distance(xyz1, xyz2)¶
mmtbx.ncs.ncs module¶
- mmtbx.ncs.ncs.abs(aa)¶
- mmtbx.ncs.ncs.crystal_symmetry_to_ncs(crystal_symmetry=None)¶
- mmtbx.ncs.ncs.euler_frac_to_rot_trans(euler_values, frac, unit_cell)¶
- mmtbx.ncs.ncs.generate_ncs_ops(symmetry=None, must_be_consistent_with_space_group_number=None, helical_rot_deg=None, helical_trans_z_angstrom=None, op_max=None, two_fold_along_x=None, include_helical_symmetry=None, max_helical_ops_to_check=None, require_helical_or_point_group_symmetry=None, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)¶
- mmtbx.ncs.ncs.get_c_symmetry(n=None, is_d=False, two_fold_along_x=None, ncs_name=None)¶
- mmtbx.ncs.ncs.get_d_symmetry(n=None, two_fold_along_x=True, ncs_name=None)¶
- mmtbx.ncs.ncs.get_helical_symmetry(helical_rot_deg=None, helical_trans_z_angstrom=None, max_ops=None)¶
- mmtbx.ncs.ncs.get_ncs_from_text(text=None, text_is_ncs_spec=None, rotate_about_z=None, rotate_about_y=None, rotate_about_new_y=None, ncs_name=None, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)¶
- mmtbx.ncs.ncs.get_rot_y(rot_deg=None)¶
- mmtbx.ncs.ncs.get_rot_z(rot_deg=None)¶
- mmtbx.ncs.ncs.is_identity(r, t, tol=0.01)¶
- mmtbx.ncs.ncs.is_in_range(z, z_min, z_max)¶
- mmtbx.ncs.ncs.is_same_transform(r1, t1, r2, t2, tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05)¶
- class mmtbx.ncs.ncs.ncs(exclude_h=None, exclude_d=None)¶
Bases:
object
- add_cc_list(cc_list)¶
- add_identity_op()¶
- add_source_info(source_info)¶
- adjust_magnification(magnification=None)¶
- apply_ncs_to_sites(sites_cart=None, ncs_obj=None, exclude_identity=False, ncs_id=None)¶
- as_ncs_spec_string(format='ncs_spec')¶
shifts to original location and returns text string
- change_of_basis(change_of_basis_operator=None, unit_cell=None, new_unit_cell=None)¶
- coordinate_offset(coordinate_offset=None, unit_cell=None, new_unit_cell=None)¶
- deep_copy(change_of_basis_operator=None, unit_cell=None, coordinate_offset=None, scale_factor=None, new_unit_cell=None, ops_to_keep=None, extract_point_group_symmetry=None, hierarchy_to_match_order=None)¶
- display_all(verbose=True, log=None)¶
- extend_helix_operators(z_range=None, tol_z=0.01, max_operators=None)¶
- format_all_for_biomt(log=None, quiet=False, out=None)¶
- format_all_for_group_specification(log=None, quiet=True, out=None, file_name=None)¶
- format_all_for_phenix_refine(quiet=False, out=None, prefix='refinement.pdb_interpretation.ncs_group')¶
This function is an older version of creating phil for phenix refine, it is modified to replicate a new phil parameters that can handle selection to the level of atoms, “format_phil_for_phenix_refine”.
When it will still can be used in the older form, which allows only residue level selection.
- format_all_for_resolve(log=None, quiet=False, out=None, crystal_number=None, skip_identity_if_first=False, ncs_domain_pdb=True)¶
- format_phil_for_ncs(log=None, quiet=False, out=None)¶
Writes NCS phil selection in NCS format
- format_phil_for_phenix_refine(log=None, quiet=False, out=None)¶
Writes NCS phil selection in phenix_refine format
- get_1_char_after_key(line)¶
- get_1_value_after_key(line)¶
- get_3_values_after_key(line)¶
- get_helix_parameters(z_range=None, tol_z=0.01, max_operators=None)¶
- get_ncs_name()¶
- get_res_range_after_key(line)¶
- identity_op_id_in_first_group()¶
- import_ncs_group(ncs_rota_matr=None, center_orth=None, trans_orth=None, chain_residue_id=None, residues_in_common_list=None, rmsd_list=None, ncs_domain_pdb=None, cc=None, source_of_ncs_info=None, ncs_group_object=None)¶
- init_ncs_group()¶
- init_oper()¶
- invert_matrices()¶
- is_helical_along_z(tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05)¶
- is_point_group_symmetry(tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05)¶
- is_similar_ncs_object(other, tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05, allow_self_contained_in_other=True)¶
Determine if self and other are similar ncs objects ncs groups do not have to be in same order
- magnification(scale_factor=None)¶
- map_inside_unit_cell(unit_cell=None)¶
- max_operators()¶
- ncs_from_import(rot_list=None, trans_list=None, invert_matrices=True)¶
- ncs_from_pdb_input_BIOMT(pdb_inp=None, log=None, quiet=False, invert_matrices=True)¶
- ncs_groups()¶
- ncs_oper_in_first_group()¶
- ncs_read()¶
- overall_cc()¶
- overall_note()¶
- overall_rmsd()¶
- read_ncs(file_name=None, lines=[], source_info='', log=None, quiet=False)¶
- rotate_about_y(rot_deg=None, invert_matrices=True)¶
- rotate_about_z(rot_deg=None, invert_matrices=True)¶
- rotate_matrices(rot=None)¶
- save_existing_group_info()¶
- save_ncs_group()¶
- save_oper()¶
- select_first_ncs_group()¶
- select_first_ncs_operator()¶
- set_ncs_name(ncs_name)¶
- set_shift_cart(shift_cart)¶
- set_unit_ncs()¶
- shift_back_cart()¶
- shift_cart()¶
- show_summary(verbose=True, log=None)¶
- sort_by_z_translation(tol_z=0.01)¶
- class mmtbx.ncs.ncs.ncs_group(ncs_rota_matr=None, center_orth=None, trans_orth=None, chain_residue_id=None, source_of_ncs_info=None, rmsd_list=None, ncs_domain_pdb=None, residues_in_common_list=None, cc=None, note=None, exclude_h=None, exclude_d=None)¶
Bases:
object
- add_cc(cc)¶
- add_chain_residue_id(chain_residue_id)¶
- add_identity_op()¶
- add_note(note)¶
- add_residues_in_common_list(residues_in_common_list)¶
- add_rmsd_list(rmsd_list)¶
- adjust_magnification(magnification=None)¶
- apply_cob_to_vector(vector=None, change_of_basis_operator=None, coordinate_offset=None, unit_cell=None, new_unit_cell=None)¶
- cc()¶
- centers()¶
- chain_residue_id()¶
- copy_rot_trans(list_of_matrices, list_of_translations, change_of_basis_operator=None, coordinate_offset=None, scale_factor=None, unit_cell=None, new_unit_cell=None)¶
- copy_vector_list(list_of_vectors, change_of_basis_operator=None, coordinate_offset=None, scale_factor=None, unit_cell=None, new_unit_cell=None)¶
- deep_copy(change_of_basis_operator=None, unit_cell=None, coordinate_offset=None, new_unit_cell=None, scale_factor=None, extract_point_group_symmetry=None, ops_to_keep=None, hierarchy_to_match_order=None)¶
- deep_copy_ops_to_keep(ops_to_keep=None)¶
- deep_copy_order(hierarchy_to_match_order=None)¶
- delete_inv()¶
- display_summary(verbose=None)¶
- extend_helix_operators(z_range=None, tol_z=0.01, max_operators=None)¶
- extract_point_group_symmetry(tol_r=None, abs_tol_t=None, rel_tol_t=None)¶
- format_for_biomt(crystal_number=None, skip_identity_if_first=False, ncs_domain_pdb=True)¶
- format_for_phenix_refine(prefix='pdb_interpretation.ncs_group')¶
- format_for_resolve(crystal_number=None, skip_identity_if_first=False, ncs_domain_pdb=True)¶
- format_group_specification()¶
- get_forwards_reverse_helix(r1=None, t1=None, r2=None, t2=None)¶
- get_helix_parameters(tol_z=0.01)¶
- get_helix_theta()¶
- get_helix_z_translation()¶
- get_inverses()¶
- get_new_group(hierarchy_to_match_order=None)¶
- get_order_dict(hierarchy_to_match_order=None)¶
- get_theta_along_z(m0, m1)¶
- get_trans_along_z(t0, t1)¶
- helix_rt_forwards()¶
- helix_rt_reverse()¶
- identity_op_id()¶
- invert_matrices()¶
- is_helical_along_z(tol_z=0.01, tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05)¶
- is_point_group_symmetry(tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05, symmetry_to_match=None)¶
- is_similar_ncs_group(other, tol_r=0.02, abs_tol_t=2.0, rel_tol_t=0.05, allow_self_contained_in_other=True)¶
return True if all operations of self match one of other
- map_inside_unit_cell(unit_cell=None)¶
- n_ncs_oper()¶
- ncs_domain_pdb()¶
- note()¶
- oper_adds_offset(i1, tol_r=None, abs_tol_t=None, rel_tol_t=None)¶
- print_list(list_of_real)¶
- residues_in_common_list()¶
- rmsd_list()¶
- rota_matrices()¶
- rota_matrices_inv()¶
- rotate_matrices(rot=None)¶
- rotations_translations_forward_euler()¶
- round(value, n_digit)¶
- sort_by_z_translation(tol_z=0.01, allow_negative_z_translation=False)¶
- source_of_ncs_info()¶
- translations_orth()¶
- translations_orth_inv()¶
- mmtbx.ncs.ncs.offset_inside_cell(center, unit_cell, orthogonalize=True)¶
- mmtbx.ncs.ncs.offset_inside_zero_one(x)¶
- mmtbx.ncs.ncs.remove_extra(text)¶
- mmtbx.ncs.ncs.remove_ncs_not_consistent_with_space_group_number(sg_number, ncs_list)¶
- remove ncs ojbect that are not consistent with space_group number
sg_number
NOTE: allows ncs that has higher symmetry than sg_number
- mmtbx.ncs.ncs.remove_quotes_from_chain_id(chain_residue_id)¶
- mmtbx.ncs.ncs.remove_single_quotes(text)¶
- mmtbx.ncs.ncs.value(str)¶
mmtbx.ncs.restraints module¶
mmtbx.ncs.ncs_search module¶
- mmtbx.ncs.ncs_search.find_ncs_in_hierarchy(ph, chains_info=None, chain_max_rmsd=5.0, log=None, chain_similarity_threshold=0.85, residue_match_radius=4.0)¶
Find NCS relation in hierarchy
- Parameters:
ph (object) – hierarchy
use_minimal_master_ncs (bool) – use maximal or minimal common chains in master ncs groups
chain_max_rmsd (float) – limit of rms difference chains when aligned together
residue_match_radius (float) – max allow distance difference between pairs of matching atoms of two residues
chain_similarity_threshold (float) – min similarity between matching chains
- Returns:
groups_list - class_ncs_restraints_group_list
- mmtbx.ncs.ncs_search.get_bool_selection_to_keep(big_selection, small_selection)¶
given 2 iselections (they are sorted), returns bool selection of size big selection showing what are the matches with small selection. Rather fast algorithm but may be beneficial to transfer to C++ O(n+m), where n,m - sizes of selections
- mmtbx.ncs.ncs_search.get_chain_xyz(hierarchy, chain_id)¶
- mmtbx.ncs.ncs_search.get_chains_info(ph, selection_list=None)¶
Collect information about chains or segments of the hierarchy according to selection strings Exclude water atoms When there are alternate conformations, we use the first one
- Parameters:
ph – pdb_hierarchy
- Returns:
- values are object containing
res_name (list of str): list of residues names resid (list of str): list of residues sequence number, resid atom_names (list of flex.str): per residue atom names atom_selection (list of flex.size_t()): per residue atom selections chains_atom_number (int): list of number of atoms in each chain
exclude_water (bool): exclude water
- Return type:
chains_info (dict)
- mmtbx.ncs.ncs_search.get_copy_master_selections_from_match_dict(match_dict, prel_gr_dict, master, ch_copy)¶
- mmtbx.ncs.ncs_search.get_info_from_match_dict(match_dict, key, chain)¶
- mmtbx.ncs.ncs_search.get_match_rmsd(ph, ch_a_id, ch_b_id, list_a, list_b)¶
get RMSD of the match
- Parameters:
ph (_type_) – hierarchy
ch_a_id (str) – one chain id
ch_b_id (str) – another chain id
list_a (flex.size_t) – one selection
list_b (flex.size_t) – another selection
- Returns:
rmsd, ref_sites, other_sites_best, r,t
- mmtbx.ncs.ncs_search.get_matching_atoms(chains_info, a_id, b_id, res_num_a, res_num_b)¶
Get selection of matching chains, match residues atoms We keep only residues with continuous matching atoms
Residues with alternative locations and of different size are excluded
- Parameters:
- Returns:
matching atoms selection sel_a/b_flat (list): matching atoms (sel_a/b) flattened selection -
faster to create on the go then convert sel_a/b later. Literally: sel_a_flat = [x for y in sel_a for x in y].sort()
res_num_a/b (list of int): updated res_num_a/b msg (str): message regarding matching residues with different atom number
- Return type:
sel_a/b (list of lists)
- mmtbx.ncs.ncs_search.get_preliminary_ncs_groups(match_dict)¶
- mmtbx.ncs.ncs_search.make_flips_if_necessary_torsion(const_h, flip_h)¶
3 times faster than other (removed) procedure.
- mmtbx.ncs.ncs_search.mmtbx_res_alignment(seq_a, seq_b, min_percent=0.85, atomnames=False)¶
- mmtbx.ncs.ncs_search.my_get_rot_trans(ph, master_selection, copy_selection, master_chain_id, copy_chain_id)¶
Get rotation and translation using superpose.
This function is used only when phil parameters are provided. In this case we require the selection of NCS master and copies to be correct. Correct means:
residue sequence in master and copies is exactly the same
the number of atoms in master and copies is exactly the same
One can get exact selection strings by ncs_object.show(verbose=True)
- Parameters:
ph – hierarchy
master/copy_selection – master and copy iselections
- mmtbx.ncs.ncs_search.my_selection(ph, ch_id, sel_list_extended_original)¶
- custom-made selection function for selecting one
chain - whole or parts. Speed reasons.
- Parameters:
ph (_type_) – hierarchy
ch_id (str) – chain id which will be selected
sel_list_extended_original (flex.size_t) – selection
- Returns:
new hierarchy
- Return type:
- mmtbx.ncs.ncs_search.ncs_grouping_and_group_dict(match_dict, hierarchy)¶
The implementation of simplest way to do NCS grouping. Maximum one chain in selection. Do the job of minimal_master_ncs_grouping/minimal_ncs_operators_grouping.
- mmtbx.ncs.ncs_search.remove_far_atoms(list_a, list_b, res_list_a, res_list_b, ref_sites, other_sites, residue_match_radius=4.0)¶
When comparing lists of matching atoms, remove residues where some atoms are are locally misaligned, for example when matching residues are perpendicular to each other rather than being close to parallel.
The criteria used: For each matching residues, the difference between distance of farthest matching atoms pair and the distance of closest pair mast be < residue_match_radius
- Parameters:
- Returns:
sel_a,sel_b, res_list_a_new,res_list_b_new, ref_sites_new,other_sites_new
- Return type:
Updated arguments
- mmtbx.ncs.ncs_search.search_ncs_relations(ph=None, chains_info=None, chain_similarity_threshold=0.85, chain_max_rmsd=2.0, residue_match_radius=4, log=None)¶
Search for NCS relations between chains or parts of chains, in a protein hierarchy
- Parameters:
ph (object) – hierarchy
chains_info (dict) – values are object containing res_name (list of str): list of residues names resid (list of str): list of residues sequence number, resid atom_names (list of flex.str): per residue atom names atom_selection (list of flex.size_t()): per residue atom selections chains_atom_number (int): list of number of atoms in each chain
- Returns:
message regarding matching residues with different atom number match_dict(dict): key:(chains_id_a,chains_id_b)
- val:[selection_a,selection_b,
res_list_a,res_list_b,rot,trans,rmsd]
- Return type:
msg (str)
- mmtbx.ncs.ncs_search.shortcut_1(hierarchy, chains_info, chain_similarity_threshold, chain_max_rmsd, log, residue_match_radius)¶
Checking the case when whole hierarchy was produced by multiplication of molecule with BIOMT or MTRIX matrices (or both). In this case we are expecting to find identical chains with 0 rmsd between them.
mmtbx.ncs.ncs_utils module¶
- mmtbx.ncs.ncs_utils.apply_transforms(ncs_coordinates, ncs_restraints_group_list, total_asu_length, extended_ncs_selection, round_coordinates=True, center_of_coordinates=None)¶
Apply transformation to ncs_coordinates, and round the results if round_coordinates is True
- Parameters:
ncs_coordinates (flex.vec3) – master ncs coordinates
ncs_restraints_group_list – list of ncs_restraint_group objects
total_asu_length (int) – Complete ASU length extended_ncs_selection (flex.size_t): master ncs and non-ncs related parts
center_of_coordinates – when not None, contains the center of coordinate of the master for each ncs copy
- Returns:
- Asymmetric or biological unit parts that are related via
ncs operations
- Return type:
- mmtbx.ncs.ncs_utils.compute_transform_grad(grad_wrt_xyz, xyz_asu, x, ncs_restraints_group_list)¶
XXX XXX Consider making it method of class_ncs_restraints_group_list XXX
Compute gradient in respect to the rotation angles and the translation vectors. R = Rx(the)Ry(psi)Rz(phi)
- Parameters:
grad_wrt_xyz (flex.double) – gradients with respect to xyz.
ncs_restraints_group_list – list containing ncs_restraint_group objects
transforms_obj (ncs_group_object) – containing information in rotation matrices and to which chains they apply
xyz_asu (flex.vec3) – The coordinates sites cart of the complete ASU
x (flex double) – The angles, in the form (theta_1,psi_1,phi_1,tx_1,ty_1,tz_1,.. theta_n,psi_n,phi_n,tx_n/s,ty_n/s,tz_n/s)
- Returns:
the gradient
- Return type:
g (flex.double)
- mmtbx.ncs.ncs_utils.flip_atoms_in_ncs_groups(hierarchy, ncs_restraints_group_list, mon_lib_srv=None)¶
XXX XXX not used, only tested. May have some value. XXX This function will actually modify hierarchy by making necessary flips in ncs-related residues. Flip will be made by exchanging atom coordinates. Will make all copies consistent with master.
- mmtbx.ncs.ncs_utils.get_list_of_best_ncs_copy_map_correlation(ncs_groups, xray_structure=None, fmodel=None, map_data=None, d_min=None)¶
Finds the copy with best map correlation in each ncs group
- mmtbx.ncs.ncs_utils.get_refine_selection(refine_selection=None, number_of_atoms=None)¶
populate refine_selection with all atoms if no selection is given
- mmtbx.ncs.ncs_utils.get_weight(fmodel=None, restraints_manager=None, sites=None, transformations=None, u_iso=None, ncs_restraints_group_list=None, refine_selection=None, minimized_obj=None)¶
Calculates weights for refinements by slightly shaking the minimized parameters and taking the ratio: (restraint manager grad norm / parameters gradient norm)
When calling this function during refinement macro cycle, the minimized object, “minimized_obj” , may contains fmodel, restraints_manager, refinement type info (sites, transformations, u_iso) and ncs_restraints_group_list.
- Parameters:
fmodel – F-model object
restraints_manager – Restraints manager object
sites (bool) – Refine by sites
u_iso (bool) – Refine using u_iso
transformations (bool) – Refine using transformations rotations, translations (matrix objects):
ncs_restraints_group_list – list of ncs_restraint_group objects
refine_selection (flex.size_t) – selection of all ncs related copies and non ncs related parts to be included in selection (to be refined)
minimized_obj – Minimization object containing all the other parameters above
- Return type:
weight (int)
Example: >>>get_weight(minimized_obj=minimized_obj)
or
- >>>get_weight(fmodel=fmodel,
restraints_manager=grm, sites=sites, transformations=transformations, u_iso=u_iso, ncs_restraints_group_list=ncs_restraints_group_list, refine_selection=refine_selection)
- mmtbx.ncs.ncs_utils.remove_items_from_selection(selection, remove)¶
Remove a set of atoms from “selection”
- Parameters:
selection (flex.size_t) – atom selection
remove (flex.size_t) – atoms to remove from selection
- Returns:
modified atom selection
- Return type:
- Examples::
>>>a = flex.size_t([1,2,5,6,4]) >>>r = flex.size_t([2,5]) >>>s = remove_items_from_selection(a,r,10) >>>list(s) [1,6,4]
- mmtbx.ncs.ncs_utils.rotation_to_angles(rotation, deg=False)¶
Get the rotation angles around the axis x,y,z for rotation r Such that r = Rx*Ry*Rz Those angles are the Tait-Bryan angles form of Euler angles
Note that typically there are two solutions, and this function will return only one. In the case that cos(beta) == 0 there are infinite number of solutions, the function returns the one where gamma = 0
- Parameters:
r – (flex.double) of the form (Rxx,Rxy,Rxz,Ryx,Ryy,Ryz,Rzx,Rzy,Rzz)
deg – When False use radians, when True use degrees
- Returns:
(alpha, beta, gamma) rotation angles around the x,y,z
- Return type:
- mmtbx.ncs.ncs_utils.selected_positions(selection, positions)¶
Returns only the selected indices in the positions specified in “positions” keeping the order
- Parameters:
selection (flex.size_t) – Atoms selection
positions (set or list) – the allowed positions in the selections
- Returns:
(selected atoms, atoms, not selected)
- Return type:
- Examples::
>>>a = flex.size_t([1,2,5,6,4]) >>>pos = {0,3,4} >>>s,d = selected_positions(a,pos) >>>list(s) [1,6,4] >>>list(d) [2,5]
- mmtbx.ncs.ncs_utils.shake_transformations(x, shake_angles_sigma=0.035, shake_translation_sigma=0.5)¶
XXX XXX Used here in get_weight(). XXX Not clear what relation MTRIX have to this function at all… XXX
Shake rotation matrices and translation vectors of a rotation matrices and translation vectors from the MTRIX records in a PDB file.
- Parameters:
x (flex.double) – [(alpha_1,beta_1,gamma_1,Tx_1/s,Ty_1/s,Tz_1/s)…]
shake_angles_sigma (float) – the sigma (in radians) of the random gaussian shaking of the rotation angles
shake_translation_sigma (float) – the sigma (in angstrom) of the random gaussian shaking of the translation
- Returns:
The shaken x
- Return type:
new_x (flex.double)