1 """@namespace IMP.EMageFit.imp_general.movement
2 Utility functions to handle movement.
15 Apply a random transformation to the rigid body and change the reference
18 bb = alg.BoundingBox3D(alg.Vector3D(-max_trans, -max_trans, -max_trans),
19 alg.Vector3D(max_trans, max_trans, max_trans))
20 Trand = alg.Transformation3D(alg.get_random_rotation_3d(),
21 alg.get_random_vector_in(bb))
22 ref = rb.get_reference_frame()
23 Tr = ref.get_transformation_to()
24 T = alg.compose(Trand, Tr)
25 rb.set_reference_frame(alg.ReferenceFrame3D(T))
31 If fn_write is different from False, write to file
34 t = T.get_translation()
35 xyz1 = [
core.XYZ(l)
for l
in atom.get_leaves(prot)]
36 coords = [p.get_coordinates()
for p
in xyz1]
37 newvs = [R.get_rotated(v) + t
for v
in coords]
38 for i
in range(len(newvs)):
39 xyz1[i].set_coordinates(newvs[i])
41 atom.write_pdb(prot, fn_write)
46 Return a random transformation
47 @param max_distance Maximum translation allowed
48 @param max_angle Maximum rotation angle allowed
49 @param seed If specified, seed for random number generator
57 phi = random.uniform(-max_angle, max_angle)
58 theta = random.uniform(-max_angle, max_angle)
59 psi = random.uniform(-max_angle, max_angle)
60 trans_x = random.uniform(-max_distance, max_distance)
61 trans_y = random.uniform(-max_distance, max_distance)
62 trans_z = random.uniform(-max_distance, max_distance)
63 trns = alg.Vector3D(trans_x, trans_y, trans_z)
64 rot = alg.get_rotation_from_fixed_zyz(phi, theta, psi)
65 transformation = alg.Transformation3D(rot, trns)
def apply_random_transform
Apply a random transformation to the rigid body and change the reference frame.
def apply_transformation_to_hierarchy
If fn_write is different from False, write to file.
A decorator for a particle with x,y,z coordinates.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
def get_random_transformation
Return a random transformation.
Functionality for loading, creating, manipulating and scoring atomic structures.