ribbon.ribbon module#
- class ribbon.ribbon.Ribbon(length, width, thickness, dl, dw, dt)[source]#
Bases:
object- Parameters:
- lengthfloat
Length of the ribbon.
- widthfloat
Width of the ribbon.
- thicknessfloat
Thickness of the ribbon. If zero, the ribbon is a 2D surface in 3-space.
- dlfloat
Grid spacing in the length direction.
- dwfloat
Grid spacing in the width direction.
- dtfloat
Grid spacing in the thickness direction. Ignored if thickness = 0.
- Attributes:
- lengthfloat
Length of the ribbon.
- widthfloat
Width of the ribbon.
- thicknessfloat
Thickness of the ribbon. If zero, the ribbon is a 2D surface in 3-space.
- dlfloat
Grid spacing in the length direction.
- dwfloat
Grid spacing in the width direction.
- dtfloat
Grid spacing in the thickness direction. Ignored if thickness = 0.
- l, m, nfloat or callable
Curvature along length, width, and thickness directions, respectively. If any of the curvatures is callable, it should be of the form y = f (x), where x (float) is the arclength coordinate and y (float) is the curvature.
- u, v, w1d ndarray
Coordinates of the reference grid along length, width, and thickness directions, respectively.
- mline(n,3) ndarray
Coordinates of the grid points on the ribbon midline in current configuration.
- msurf(m,n,3) ndarray
Coordinates of the grid points on the ribbon midsurface in the current configuration.
- grid(m,n,p,3) ndarray
Coordinates of the grid points of the ribbon in the current configuration.
- atom_refpos(n,3) ndarray
Atom coordinates in the reference state.
- atom_pos(n,3) ndarray
Atom coordinates in the current configuration.
Methods
create([orient_along])Constructs the ribbon and orients it along orient_along.
Returns the gaussian curvature along the ribbon midline.
Returns the mean curvature along the ribbon midline.
Returns the pitch along the ribbon midline.
Returns the radius along the ribbon midline.
Returns the angle (in radians) between the principal curvature direction and the lengthwise direction along the ribbon midline.
set_atom_refpos(atom_refpos)Setter for the reference positions of atoms.
set_curvatures(l, m, n)Setter for the curvatures along the three directions.
- set_atom_refpos(atom_refpos)[source]#
Setter for the reference positions of atoms.
- Parameters:
- atom_refpos(n,3) ndarray
Atom positions in the reference state. Must be within the domain [0,
length] x [-width/2,width/2] x [-thickness/2,thickness/2].
- Returns:
- None
- set_curvatures(l, m, n)[source]#
Setter for the curvatures along the three directions.
If any of the curvatures is callable, it should be of the form y = f (x), where x (float) is the arclength coordinate and y (float) is the curvature.
- Parameters:
- lfloat or callable
Curvature along the length direction
- mfloat or callable
Curvature along the width direction
- nfloat or callable
Curvature along the thickness direction
- Returns:
- None
- get_radius()[source]#
Returns the radius along the ribbon midline.
- Returns:
- float or tuple of 1D ndarrays
Radius along the ribbon midline. If all curvatures are constants, a float is returned. If any of the curvatures is callable, a tuple (x,y) is returned, where x contains the arclength coordinates of the ribbon midline and y contains the corresponding radii.
- get_pitch()[source]#
Returns the pitch along the ribbon midline.
- Returns:
- float or tuple of 1D ndarrays
Pitch along the the ribbons midline. If all curvatures are constants, a float is returned. If any of the curvatures is callable, a tuple (x,y) is returned, where x contains the arclength coordinates of the ribbon midline and y contains the corresponding pitch values.
- get_gauss_curvature()[source]#
Returns the gaussian curvature along the ribbon midline.
- Returns:
- float or tuple of 1D ndarrays
Gaussian curvature along the ribbons midline. If all curvatures are constants, a float is returned. If any of the curvatures is callable, a tuple (x,y) is returned, where x contains the arclength coordinates of the ribbon midline and y contains the corresponding gaussian curvatures.
- get_mean_curvature()[source]#
Returns the mean curvature along the ribbon midline.
- Returns:
- float or tuple of 1D ndarrays
Mean curvature along the ribbons midline. If all curvatures are constants, a float is returned. If any of the curvatures is callable, a tuple (x,y) is returned, where x contains the arclength coordinates of the ribbon midline and y contains the corresponding mean curvatures.
- get_theta()[source]#
Returns the angle (in radians) between the principal curvature direction and the lengthwise direction along the ribbon midline.
- Returns:
- float or tuple of 1D ndarrays
Angle (in radians). If all curvatures are constants, a float is returned. If any of the curvatures is callable, a tuple (x,y) is returned, where x contains the arclength coordinates of the ribbon midline and y contains the corresponding angle.