Skip to content

Manipulation

Manipulation(parent_molecule_object)

A class for translating and rotating the atomic coordinates of a pymolecule.Molecule object

Initializes the pymolecule.Manipulation class.

PARAMETER DESCRIPTION
parent_molecule_object

The pymolecule.Molecule object associated with this class.

parent_molecule = parent_molecule_object instance-attribute

coordinate_undo()

Resets the coordinates of all atoms to those saved using the set_coordinate_undo_point function.

rotate_molecule_around_a_line_between_atoms(line_point1_index, line_point2_index, rotate)

Rotate the molecular model about a line segment. The end points of the line segment are atoms of specified indices.

PARAMETER DESCRIPTION
line_point1_index

An int, the index of the first atom at one end of the line segment.

line_point2_index

An int, the index of the second atom at the other end of the line segment.

rotate

A float, the angle of rotation, in radians.

rotate_molecule_around_a_line_between_points(line_point1, line_point2, rotate)

Rotate the molecular model about a line segment. The end points of the line segment are explicitly specified coordinates.

PARAMETER DESCRIPTION
line_point1

A np.array (x, y, z) corresponding to one end of the line segment.

line_point2

A np.array (x, y, z) corresponding to the other end of the line segment.

rotate

A float, the angle of rotation, in radians.

rotate_molecule_around_pivot_atom(pivot_index, thetax, thetay, thetaz)

Rotate the molecular model around a specified atom.

PARAMETER DESCRIPTION
pivot_index

An int, the index of the atom about which the molecular model will be rotated.

thetax

A float, the angle to rotate relative to the x axis, in radians.

thetay

A float, the angle to rotate relative to the y axis, in radians.

thetaz

A float, the angle to rotate relative to the z axis, in radians.

rotate_molecule_around_pivot_point(pivot, thetax, thetay, thetaz)

Rotate the molecular model around a specified atom.

PARAMETER DESCRIPTION
pivot

A np.array, the (x, y, z) coordinate about which the molecular model will be rotated.

thetax

A float, the angle to rotate relative to the x axis, in radians.

thetay

A float, the angle to rotate relative to the y axis, in radians.

thetaz

A float, the angle to rotate relative to the z axis, in radians.

set_atom_location(atom_index, new_location)

Translates the entire molecular model (without rotating) so that the atom with the specified index is located at the specified coordinate.

PARAMETER DESCRIPTION
atom_index

An int, the index of the target atom.

new_location

A np.array specifying the new (x, y, z) coordinate of the specified atom.

RETURNS DESCRIPTION

A np.array specifying the (delta_x, delta_y, delta_z) vector by which the pmolecule.Molecule was translated.

set_coordinate_undo_point()

Sets ("saves") the undo point of the atom coordinates. Any subsequent manipulations of atomic coordinates can be "undone" by reseting to this configuration via the coordinate_undo function.

translate_molecule(delta)

Translate all the atoms of the molecular model by a specified vector.

PARAMETER DESCRIPTION
delta

A np.array (delta_x, delta_y, delta_z) specifying the amount to move each atom along the x, y, and z coordinates.