Curve Shorten Module

geometricmd.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

geometricmd.curve_shorten.compute_trajectory(trajectory, local_num_nodes, energy, tol, filename, configuration, length_function=<function length>)[source]

This function updates the trajectory object positions to represent the shortest curve.

Parameters:
  • trajectory (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.
  • energy (float) – The total energy of the system.
  • tol (float) – The tolerance by which if the total curve movement falls below this number then the Birkhoff method stops.
  • filename (str) – The filename for the output files from the simulation.
  • configuration (dict) – A dictionary containing additional parameters for the simulation. Accepts: ‘processes’ - the number of processors to use (defaults to 1), ‘write_to_log’ - a boolean value, if true writes to a logfile, otherwise prints to console (defaults to False) and ‘save_every’ - an integer indicating the program will save after every ‘save_every’th iteration of the Birkhoff algorithm (defaults to 1).
  • length_function (func) – A Python function that approximates the length of a curve.
geometricmd.curve_shorten.find_geodesic_midpoint(start_point, end_point, number_of_inner_points, dimension, mass_matrix, molecule, energy, node_number, length_function)[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.
  • mass_matrix (numpy.array) – A diagonal NumPy array containing the masses of the molecular system as computed in the SimulationClient object.
  • molecule (ase.atoms) – The ASE atoms object corresponding to the molecule being simulated.
  • energy (float) – The total energy of the system.
  • node_number (int) – The node number for which we are calculating a new position for.
  • length_function (func) – A Python function that estimates the length of a curve and also returns it’s gradient.
Returns:

The node number for which the returned midpoint corresponds to. numpy.array :

The midpoint along the approximate local geodesic curve.

Return type:

int

geometricmd.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

geometricmd.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

geometricmd.curve_shorten.length(x, start_point, end_point, mass_matrix, 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.
  • mass_matrix (numpy.array) – A numpy.array describing the mass matrix for the molecule as a dynamical system.
  • 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

geometricmd.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

geometricmd.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