6. scoria.Manipulation module

class scoria.Manipulation.Manipulation(parent_molecule_object)

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

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.

Wrapper function for rotate_molecule_around_a_line_between_atoms()

Parameters:
  • line_point1_index (int) – An int, the index of the first atom at one end of the line segment.
  • line_point2_index (int) – An int, the index of the second atom at the other end of the line segment.
  • rotate (float) – 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.

Wrapper function for rotate_molecule_around_a_line_between_points()

Parameters:
  • line_point1 (numpy.array) – A numpy.array (x, y, z) corresponding to one end of the line segment.
  • line_point2 (numpy.array) – A numpy.array (x, y, z) corresponding to the other end of the line segment.
  • rotate (float) – 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.

Requires the numpy library.

Wrapper function for rotate_molecule_around_pivot_atom()

Parameters:
  • pivot_index (int) – An int, the index of the atom about which the molecular model will be rotated.
  • thetax (float) – A float, the angle to rotate relative to the x axis, in radians.
  • thetay (float) – A float, the angle to rotate relative to the y axis, in radians.
  • thetaz (float) – 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.

Requires the numpy library.

Wrapper function for rotate_molecule_around_pivot_point()

Parameters:
  • pivot (numpy.array) – A numpy.array, the (x, y, z) coordinate about which the molecular model will be rotated.
  • thetax (float) – A float, the angle to rotate relative to the x axis, in radians.
  • thetay (float) – A float, the angle to rotate relative to the y axis, in radians.
  • thetaz (float) – 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.

Wrapper function for set_atom_location()

Parameters:
  • atom_index (int) – An int, the index of the target atom.
  • new_location (numpy.array) – A numpy.array specifying the new (x, y, z) coordinate of the specified atom.
Returns:

A numpy.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.

Wrapper function for translate_molecule()

Parameters:delta (numpy.array) – A numpy.array (delta_x, delta_y, delta_z) specifying the amount to move each atom along the x, y, and z coordinates.