ffeatools.modules.FFEA_rod.rod_creator Class Reference

Public Member Functions

def parse_threejs (self, threejs)
 
def parse_pdb (self, pdb_file, atom_names=["CA"])
 
def preview_rod (self, rod)
 
def create_spline (self, x_points, y_points, z_points, num_samples, degree=3, smoothness=0)
 
def create_rod_spline (self, data, num_nodes, degree=3, smoothness=2)
 
def create_rod_parametric (self, x_eqn, y_eqn, z_eqn, t_max, t_min, num_nodes)
 
def create_material_frame (self, rod)
 
def rotate_material_frame (self, rod, function, material_frame, function_range=(0, 2 *np.pi))
 
def set_params (self, rod, stretch_constant, torsion_constant, radius, bending_modulus=None, rod_segments=None, E=None, r=None, frames=None)
 
def get_connection_info (self, script, blob_no, face_no=None, element_no=None, nodes=None, use_first=True)
 
def get_euler_angles_from_pdb (self, surface_nodes, r0, r1)
 

Detailed Description

The rod_creator class is just a collection of functions that create rods,
it doesn't have any state or anything. In fact, immediately after this
script is loaded, the rod_creator class definition is replaced by an
instance of itself.

All of the creation functions here output rod frames, so in order to use
the rod creator, you'll need to initialize an empty rod object, and then
run either create_rod_spline or create_rod_parametric to create
rod.equil_r[0] and rod.current_r[0].  Then, use create_material_frame and possibly
rotate_material_frame to create rod.equil_m[0] and rod.current_m[0].

Member Function Documentation

◆ create_material_frame()

def ffeatools.modules.FFEA_rod.rod_creator.create_material_frame (   self,
  rod 
)
For a given rod, create a material frame.
For the rod to be at equilibrium twist, all of the m and n vectors
must be pointing the same way relative to the rod segments. So, to
create an equilibrium material frame, you create a material frame
arbitrarily for one element, and then parallel transport it up the
entire length of the rod.

Params:
    rod - a rod object with a current_r

Returns:
    current_material_frame: material frame for the rod in its current state
    equil_material_frame: material frame for the rod in its 

◆ create_rod_parametric()

def ffeatools.modules.FFEA_rod.rod_creator.create_rod_parametric (   self,
  x_eqn,
  y_eqn,
  z_eqn,
  t_max,
  t_min,
  num_nodes 
)
Create a rod frame (a 2-d array of 3-d points) using 3 parametric
equations, one for each dimension.

Params:
    x_eqn, y_eqn, z_eqn: python functions with one parameter (t)
    t_max, t_min: max and min values for t (min at node 0, max at n)
    num_nodes: number of nodes
Returns:
    a 2-d numpy array containing the positions of the rod nodes,
    that you can use as rod.current_r[0] and rod.equil_r[0]

◆ create_rod_spline()

def ffeatools.modules.FFEA_rod.rod_creator.create_rod_spline (   self,
  data,
  num_nodes,
  degree = 3,
  smoothness = 2 
)
Given a 2-d array of spline control points (or a string containing the
output from the threejs spline creator), the number of nodes desired, the
smoothness and degree of the desired spline, return a rod frame.
Use this to fill in the current_r[0] or equil_r[0] of a object.

Params:
    data: either a 2-d array containing spline control points in 3 dimensions,
    or a string containing the output from this tool:
    https://threejs.org/examples/?q=spline#webgl_geometry_spline_editor
    num_nodes: number of times to sample the spline equation
    degree: degree of the polynomial
    smoothness: number of continuous derivatives of the spline function
Returns:
    a rod frame, for either current_r or equil_r (a 2-d numpy array of points)

◆ create_spline()

def ffeatools.modules.FFEA_rod.rod_creator.create_spline (   self,
  x_points,
  y_points,
  z_points,
  num_samples,
  degree = 3,
  smoothness = 0 
)
Given a set of spline control points and some spline parameters, make
a spline, and sample it at a bunch of points, returning a 2-d array
containing the x, y, and z co-ordinates of the spline at those points.

Parameters:
    x_points, y_points, z_points: spline control points
    num_samples: number of times to sample the spline equation
    degree: degree of the polynomial
    smoothness: number of continuous derivatives of the spline function
Returns:
    rod, a 2-d array containing the co-ordinates of the spline samples
    knots_tck - a tuple (t,c,k) containing the vector of knots, b-spline
    coefficients, and the degree of the spline
    spline_params: an array of the values of the parameter

Referenced by ffeatools.modules.FFEA_rod.rod_creator.create_rod_spline().

◆ get_connection_info()

def ffeatools.modules.FFEA_rod.rod_creator.get_connection_info (   self,
  script,
  blob_no,
  face_no = None,
  element_no = None,
  nodes = None,
  use_first = True 
)
Used to acquire the information necessary to set up a rod-blob coupling.
Params:
    script - an instance of an FFEA_script
    blob_no - ID of the blob with the connection (int)
    nodes - a one-dimensional list\array containing the indices (ints) of the three nodes on the face of the element.
Returns:
    the element id containing those nodes (int)

◆ get_euler_angles_from_pdb()

def ffeatools.modules.FFEA_rod.rod_creator.get_euler_angles_from_pdb (   self,
  surface_nodes,
  r0,
  r1 
)

◆ parse_pdb()

def ffeatools.modules.FFEA_rod.rod_creator.parse_pdb (   self,
  pdb_file,
  atom_names = ["CA"] 
)

◆ parse_threejs()

def ffeatools.modules.FFEA_rod.rod_creator.parse_threejs (   self,
  threejs 
)
Parse a threejs spline object, generated and exported via this tool:
https://threejs.org/examples/?q=spline#webgl_geometry_spline_editor
Parameters: a string containing the contents of the 'exportSpline' dialog.
Returns 3 arrays containing the x, y and z co-ordinates of the spline
control points.

Referenced by ffeatools.modules.FFEA_rod.rod_creator.create_rod_spline().

◆ preview_rod()

def ffeatools.modules.FFEA_rod.rod_creator.preview_rod (   self,
  rod 
)
Use matplotlib to plot a frame, as generated by the create_rod_spline
or create_rod_parametric functions. Useful if you want to see what
your rod will look like without having to write the trajectory and
open up pymol.

◆ rotate_material_frame()

def ffeatools.modules.FFEA_rod.rod_creator.rotate_material_frame (   self,
  rod,
  function,
  material_frame,
  function_range = (0, 2*np.pi) 
)
Rotate the material frame. Note: you should not use this to rotate the
equilibrium material frame, that should always be straight. If you
want to create an intrinsically twisted rod with an anisotropic bending
modulus, rotate the B matrix instead!

Params:
    rod - a rod object
    function: the function that determines what the bend angle will be
    material_frame: rod.current_m
    function_range: a tuple containing the parameter of the function at
    the beginning and end of the rod. Default is (0, 2*pi).
    
Returns:
    a material frame frame.

◆ set_params()

def ffeatools.modules.FFEA_rod.rod_creator.set_params (   self,
  rod,
  stretch_constant,
  torsion_constant,
  radius,
  bending_modulus = None,
  rod_segments = None,
  E = None,
  r = None,
  frames = None 
)
Set the material parameters uniformally. By default, this is for
the entire rod, although optionally you can set some sub-region of
the rod.
Params:
    rod: rod object.
    stretch_constant: stretch constant, in SI units (this is normally
    the spring constant multiplied by the measured spring length!)
    torsion_constnat: torsion constant, in SI units (this is the same deal)
    radius: radius of the rod (for computing the mobility). Half of the equilibrium rod length is about right.
    bending modulus: this is normally EI, the young's modulus multiplied
    by the second moment of area. Optionally, you can instead supply
    E, I: a young's modulus and a radius.
    rod_segment (optional): a range object containing the indices
    of nodes to modify.
Returns:
    nothing, it modifies the rod object that's given to it.

The documentation for this class was generated from the following file: