Rigid Body Mutators

ProtoSyn Core module makes available two Rigid Body Mutators: the RotationRigidBodyMutator, which changes a Pose State by introducing a rigid body rotation; and the TranslationRigidBodyMutator, which changes a Pose State by introducing a rigid body translation.

ProtoSyn.Mutators.RotationRigidBodyMutatorType
RotationRigidBodyMutator(axis_sampler::Function, angle_sampler::Function, pivot_sampler::Function, step_size::AbstractFloat, selection::Opt{AbstractSelection})

Return a new RotationRigidBodyMutator instance. This AbstractMutator is a functor, called with the following signature:

(rigid_body_mutator::RotationRigidBodyMutator)(pose::Pose)

The RotationRigidBodyMutator AbstractMutator applies a rotation to all Atom instances in a given Pose based on a given angle and axis, and centered around a pivot position (See rotation_matrix_from_axis_angle). The applied rotation's angle is sampled by calling angle_sampler (receives no input arguments and should return a Float angle value in radians) and multiplied by the step_size value. The rotation's axis is sampled from the axis_sampler (receives no input arguments and should return a Vector{Float} with size 3, the X, Y and Z dimensions). Finally, this rotation is centered in a pivot position, sampled from pivot_sampler (receives the Pose and a list of selected Atom indexes as the input arguments and should return a Vector{Float} with size 3, the X, Y and Z dimensions). If an AbstractSelection selection is provided, only the selected Atom instances are rotated and used as input for pivot_sampler. Note that the RotationRigidBodyMutator syncs any pending internal to cartesian coordinate conversion (using the i2c! method). Requests cartesian to internal coordinates conversion (using request_c2i! method). Does not sync! the given Pose afterwards.

The RotationRigidBodyMutator AbstractMutator can also be optionally called using the following signature, in which case only the provided list of Atom instances will be considered for the application of this AbstractMutator.

(rigid_body_mutator::RotationRigidBodyMutator)(pose::Pose, atoms::Vector{Atom})

Fields

  • axis_sampler::Function - Should return a Vector{Float} axis (X, Y and Z dimensions). Is called with no input arguments;
  • angle_sampler::Function - Should return a Float angle value (in radians). Is called with no input arguments;
  • pivot_sampler::Function - Should return a Vector{Float} position (X, Y and Z dimensions). Is called with 2 input arguments: a Pose instance and a Vector{Int} with the indexes of the selected Atom instances;
  • step_size::AbstractFloat - Multiplies the sampled angle by this value;
  • selection::Opt{AbstractSelection} - If given, this Mutator will only be applied to the selected Atom instances.

See also

TranslationRigidBodyMutator

Examples

julia> m = ProtoSyn.Mutators.RotationRigidBodyMutator(ProtoSyn.rand_vector_in_sphere, randn, ProtoSyn.center_of_mass, 1.0, rn"CBZ")
⚯  Rotation Rigid Body Mutator:
+----------------------------------------------------------------------+
| Index | Field                       | Value                          |
+----------------------------------------------------------------------+
| 1     | axis_sampler                | Function rand_vector_in_sphere |
| 2     | angle_sampler               | Function randn                 |
| 3     | pivot_sampler               | Function center_of_mass        |
| 4     | step_size                   | 1.0000                         |
+----------------------------------------------------------------------+
 ● Selection: Set
 └── FieldSelection › Residue.name = CBZ
source

ProtoSyn Rotation Rigid Body Mutator

Figure 1 | A schematic representation of a RotationRigidBodyMutator instance. In this example, showcasing a 2 molecule simulation, a RotationRigidBodyMutator is applied to a carbamazepine (CBZ) ligand, by selecting it based on the Residue.name (rn"CBZ"). The axis for the rotation is sampled from rand_vector_in_sphere, the angle is sampled from randn and the pivot position if the Pose center_of_mass.

ProtoSyn.Mutators.TranslationRigidBodyMutatorType
TranslationRigidBodyMutator(translation_vector_sampler::Function, step_size::AbstractFloat, selection::Opt{AbstractSelection})

Return a new TranslationRigidBodyMutator instance. This AbstractMutator is a functor, called with the following signature:

(rigid_body_mutator::TranslationRigidBodyMutator)(pose::Pose)

The TranslationRigidBodyMutator AbstractMutator applies a translation to all Atom instances in a given Pose based on a given axis. This axis is sampled from translation_vector_sampler (who receives no input arguments and should return a Vector{Float} with size 3, the X, Y and Z dimensions). Although not necessary, this Vector{Float} should have norm 1.0. The translation vector is then multiplied by step_size. If an AbstractSelection selection is provided, only the selected Atom instances are translated. Note that the TranslationRigidBodyMutator syncs any pending internal to cartesian coordinate conversion (using the i2c! method). Requests cartesian to internal coordinates conversion (using request_c2i! method). Does not sync! the given Pose afterwards.

The TranslationRigidBodyMutator AbstractMutator can also be optionally called using the following signature, in which case only the provided list of Atom instances will be considered for the application of this AbstractMutator.

(rigid_body_mutator::TranslationRigidBodyMutator)(pose::Pose, atoms::Vector{Atom})

Fields

  • translation_vector_sampler::Function - Should return a Vector{Float} axis (X, Y and Z dimensions). Is called with no input arguments;
  • step_size::AbstractFloat - Multiplies the sampled axis by this value;
  • selection::Opt{AbstractSelection} - If given, this Mutator will only translate the selected Atom instances;

See also

TranslationRigidBodyMutator

Examples

julia> m = ProtoSyn.Mutators.TranslationRigidBodyMutator(ProtoSyn.rand_vector_in_sphere, 1.0, rn"CBZ")
⚯  Translation Rigid Body Mutator:
+----------------------------------------------------------------------+
| Index | Field                       | Value                          |
+----------------------------------------------------------------------+
| 1     | translation_vector_sampler  | Function rand_vector_in_sphere |
| 2     | step_size                   | 1.0000                         |
+----------------------------------------------------------------------+
 ● Selection: Set
 └── FieldSelection › Residue.name = CBZ
source

ProtoSyn Translation Rigid Body Mutator

Figure 2 | A schematic representation of a TranslationRigidBodyMutator instance. In this example, the Mutator is applied to a carbamazepine (CBZ) ligand, by selecting it based on the Residue.name (rn"CBZ"). The translation vector is sampled from rand_vector_in_sphere. All the selected atoms will suffer this translation.