Curvature

In MembraneCurvature, we calculate curvature from a height field \(z = f(x,y)\) using the Monge gauge formulas, where partial derivatives are estimated from the derived surface.

With the Monge gauge formulas, we map first derivatives \((\partial_x, \partial_y)\), and second and mixed derivatives \((\partial_{xx}, \partial_{yy}, \partial_{xy})\) to the definitions of curvature.

Mean curvature \(H\), defined by:

\[H = \frac{(1+\partial_x^2)\partial_{yy}+(1+\partial_y^2)\partial_{xx}-2\partial_x\partial_y\partial_{xy}} {2(1+\partial_x^2+\partial_y^2)^{3/2}},\]

and Gaussian curvature \(K\), defined by:

\[K = \frac{\partial_{xx}\partial_{yy}-\partial_{xy}^2} {(1+\partial_x^2+\partial_y^2)^2}.\]

The Monge gauge formulas are implemented separately in the helpers mean_curvature_monge() and gaussian_curvature_monge(), which accept precomputed partial derivatives as arguments. This approach intends to separate the curvature algebra from the derivative estimation.

To estimate partial derivatives, we use mean_curvature() and gaussian_curvature() from the discrete height field using numpy.gradient(), then pass them to the Monge gauge functions above. Optional spacing arguments (dx, dy) are forwarded to numpy.gradient() for physical-unit calculations.

Since the mean curvature calculates the arithmetic mean of two principal curvatures, the default units of \(H\) are Å-1. On the other hand, Gaussian curvature calculates the geometric mean of the two principal curvatures. Therefore, the default units of \(K\) are Å-2. In general, units of mean curvature are [length] -1, and units of Gaussian curvature are [length] -2.

Note

When spacing is provided to numpy.gradient() (for example, dx and dy from the simulation box and grid definition), curvature calculations are performed in physical units and are less sensitive to grid bin count than with implicit unit spacing. However, results are not exactly bin-independent because finite-difference discretization error increases for coarse grids.

Warning

Numpy cannot calculate the gradient for arrays with inner array of length==1 unless axis=0 is specified. Therefore in the functions here included for mean and Gaussian curvature, shape of arrays must be at least (2,2). In general, to calculate a numerical gradients shape of arrays must be >=(edge_order + 1).

Functions

membrane_curvature.curvature.gaussian_curvature(Z, *varargs)[source]

Calculate Gaussian curvature from Z cloud points.

Uses numpy.gradient() on Z, then gaussian_curvature_monge().

Parameters:
  • Z (np.ndarray.) – Multidimensional array of shape (n,n).

  • varargs (list of scalar or array, optional) – Spacing between f values. Default unitary spacing for all dimensions. See np.gradient docs for more information.

Returns:

K – The result of Gaussian curvature of Z. Returns multidimensional array object with values of Gaussian curvature of shape (n, n).

Return type:

np.ndarray.

membrane_curvature.curvature.gaussian_curvature_monge(fx, fy, fxx, fyy, fxy)[source]

Helper to calculate Gaussian curvature \(K\) from partial derivatives of \(z = f(x, y)\).

Same expression as in gaussian_curvature() once first derivatives \((\partial_x, \partial_y)\) and second and mixed derivatives \((\partial_{xx}, \partial_{yy}, \partial_{xy})\) of \(z\) are known, supplied as fx, fy, fxx, fyy, fxy (see the module equations above). This function does not compute gradients.

Parameters:
  • fx (np.ndarray.) – Values of \(\partial_x\) on the grid.

  • fy (np.ndarray.) – Values of \(\partial_y\) on the grid.

  • fxx (np.ndarray.) – Values of \(\partial_{xx}\) on the grid.

  • fyy (np.ndarray.) – Values of \(\partial_{yy}\) on the grid.

  • fxy (np.ndarray.) – Values of \(\partial_{xy}\) on the grid.

Returns:

K – Gaussian curvature, same shape as the input arrays.

Return type:

np.ndarray.

membrane_curvature.curvature.mean_curvature(Z, *varargs)[source]

Calculates mean curvature from Z cloud points.

Uses numpy.gradient() on Z, then mean_curvature_monge().

Parameters:
  • Z (np.ndarray.) – Multidimensional array of shape (n,n).

  • varargs (list of scalar or array, optional) – Spacing between f values. Default unitary spacing for all dimensions. See np.gradient docs for more information.

Returns:

H – The result of mean curvature of Z. Returns multidimensional array object with values of mean curvature of shape (n, n).

Return type:

np.ndarray.

membrane_curvature.curvature.mean_curvature_monge(fx, fy, fxx, fyy, fxy)[source]

Helper to calculate mean curvature \(H\) from partial derivatives of \(z = f(x, y)\).

Same expression as in mean_curvature() once first derivatives \((\partial_x, \partial_y)\) and second and mixed derivatives \((\partial_{xx}, \partial_{yy}, \partial_{xy})\) of \(z\) are known, supplied as fx, fy, fxx, fyy, fxy (see the module equations above). This function does not compute gradients.

Parameters:
  • fx (np.ndarray.) – Values of \(\partial_x\) on the grid.

  • fy (np.ndarray.) – Values of \(\partial_y\) on the grid.

  • fxx (np.ndarray.) – Values of \(\partial_{xx}\) on the grid.

  • fyy (np.ndarray.) – Values of \(\partial_{yy}\) on the grid.

  • fxy (np.ndarray.) – Values of \(\partial_{xy}\) on the grid.

Returns:

H – Mean curvature, same shape as the input arrays.

Return type:

np.ndarray.