Curve Shorten Module

geodesic.curve_shorten.compute_geodesic(curve_obj, local_num_nodes, tol, metric, grad_metric, processes=1)[source]

This function creates a new task to compute a geodesic midpoint and submits it to the worker pool.

Parameters:
  • curve_obj (curve) – A GeometricMD curve object describing the initial trajectory between start and end configurations.
  • local_num_nodes (int) – The number of points to use when computing the local geodesics.
  • tol (float) – The tolerance by which if the total curve movement falls below this number then the Birkhoff method stops.
  • metric (func) – A Python function taking a single vector argument the same dimension as the start point.
  • processes (optional, int) – The number of processes to parallelise the task over.
geodesic.curve_shorten.compute_metric(points, metric_function)[source]

Takes a list of NumPy arrays describing points molecular configurations, evaluates the metric at each point and returns a list of metric values at those points.

Parameters:
  • points (list) – A list of NumPy arrays describing molecular configurations.
  • metric_function (func) – A Python function which gives the value of sqrt(2(E - V)) at a given point.
Returns:

A list of metric values at the corresponding points.

Return type:

list

geodesic.curve_shorten.find_geodesic_midpoint(start_point, end_point, number_of_inner_points, dimension, node_number, metric, grad_metric)[source]

This function computes the local geodesic curve joining start_point to end_point using the L-BFGS method.

Parameters:
  • start_point (numpy.array) – The first end point of the curve.
  • end_point (numpy.array) – The last end point of the curve.
  • number_of_inner_points (int) – The number of nodes along the curve, less the end points.
  • dimension (int) – The dimension of the problem. Computed from the atomistic simulation environment.
  • node_number (int) – The node number for which we are calculating a new position for.
  • metric (func) – A Python function taking a single vector argument the same dimension as the start point.
  • grad_metric (func) – A Python function taking a single vector argument the same dimension as the start point. Returning a vector the same length as it’s argument.
Returns:

The midpoint along the approximate local geodesic curve.

Return type:

numpy.array

geodesic.curve_shorten.generate_points(x, start_point, end_point, rotation_matrix, total_number_of_points, co_dimension)[source]

This function computes the local geodesic curve joining start_point to end_point using the L-BFGS method.

Parameters:
  • x (numpy.array) – Array of vectors in co-dimension dimensional space, stacked flat. This vector characterises points of the curve as translations from the line joining start_point to end_point.
  • start_point (numpy.array) – The first end point of the curve.
  • end_point (numpy.array) – The last end point of the curve.
  • rotation_matrix (numpy.array) – A numpy.array describing the rotation from co_dimension + 1 dimensional space to the tangent space of the line joining start_point to end_point.
  • total_number_of_points (int) – The total number of points used in the local geodesic computation, including endpoints.
  • co_dimension (int) – The dimension of the configuration space, less one.
Returns:

The midpoint along the approximate local geodesic curve.

Return type:

numpy.array

geodesic.curve_shorten.get_rotation(start_point, end_point, dimension)[source]
Computes the transformation from dimension dimensional space to the tangent space of the line
joining start_point to end_point.
Parameters:
  • start_point (numpy.array) – The first end point of the curve.
  • end_point (numpy.array) – The last end point of the curve.
  • dimension (int) – The dimension of the configuration space.
Returns:

The matrix representing the linear transformation from dimension dimensional space to the tangent space of the line joining start_point to end_point.

Return type:

numpy.array

geodesic.curve_shorten.length(x, start_point, end_point, rotation_matrix, total_number_of_points, co_dimension, metric)[source]

This function computes the length of the local geodesic as a function of shifts from the line joining start_point to end_point. It also returns the gradient of this function for the L-BFGS method.

Parameters:
  • x (numpy.array) – Array of vectors in co-dimension dimensional space, stacked flat. This vector characterises points of the curve as translations from the line joining start_point to end_point.
  • start_point (numpy.array) – The first end point of the curve.
  • end_point (numpy.array) – The last end point of the curve.
  • rotation_matrix (numpy.array) – A numpy.array describing the rotation from co_dimension + 1 dimensional space to the tangent space of the line joining start_point to end_point.
  • total_number_of_points (int) – The total number of points used in the local geodesic computation, including endpoints.
  • co_dimension (int) – The dimension of the configuration space, less one.
  • metric (func) – A Python function which when given a list of NumPy arrays, returns a list of metric values on those arrays.
Returns:

The approximate length of the geodesic. numpy.array :

The gradient of the approximate length of the geodesic.

Return type:

float

geodesic.curve_shorten.norm(x, matrix)[source]

Computes the value of sqrt(<x, matrix*x>).

Parameters:
  • x (numpy.array) – A vector, stored as a NumPy array, to compute the norm for.
  • matrix (numpy.array) – A matrix, stored as a NumPy array, used in the computation of <x, matrix*x>.
Returns:

The value of sqrt(<x, matrix*x>).

Return type:

float

geodesic.curve_shorten.norm_gradient(x, matrix)[source]

Computes the gradient of sqrt(<x, matrix*x>).

Parameters:
  • x (numpy.array) – A vector, stored as a NumPy array, to compute the norm for.
  • matrix (numpy.array) – A matrix, stored as a NumPy array, used in the computation of <x, matrix*x>.
Returns:

The gradient of sqrt(<x, matrix*x>).

Return type:

numpy.array