Public Member Functions | |
def | __init__ (self, rod) |
def | get_deflection (self) |
def | get_EI_from_deflection (self, force_applied) |
def | get_persistence_length (self) |
def | get_entire_rod_stretch_energy (self) |
def | get_bending_response (self) |
def | get_bending_response_mutual (self, rotate=False) |
def | get_twist_amount (self, set_twist_amount=False) |
def | get_equipartition (self) |
def | get_constant_EI (self) |
def | get_constant_parameter (self, constant_index) |
def | get_starting_length (self) |
def | get_average_quantities (self) |
def | get_stretch_energy (self) |
def | plot (self, force=None, temp=None) |
def | persistence_segments (self) |
def | do_stretch_symmetry_test (self) |
def | do_bend_symmetry_test (self) |
def | get_delta_r (self) |
def | get_L_i (self) |
def | get_absolute_length (self, starting_node, ending_node, frame, equil=False, path=True, non_path_axis=0) |
def | whole_rod_avg (self, thing) |
def | filter_x (self, thing, dimension) |
def | apply_transformation_4x4 (self, pos_array, T) |
def | align_to_equil (self) |
def | thin (self, target_num_frames) |
def | get_node_rmsd (self, align=False) |
def | get_B_eigenvalues (self) |
def | get_time_rmsd (self, is_aligned=False, max_frame_index=-1) |
def | subdivide (self, iterations) |
def | decimate (self, determine_simplification_func, target_length, margin=0.5) |
The rod analysis class. This is where the actual tests happen. It's initialised using a rod object. It doesn't modify that object, but it does a load of measurements on it. It also plots the results of those measurements. Much like the rod itself, many quantities here are given as numpy arrays, of the form [frame][element][x,y,z] or sometimes [frame][element][quantity]. For reference, the tests that it does are: - Equipartition of energy - Euler beam dynamics - Persistence length - Symmetry of energies and forces The attributes are: rod: rod object. rod_math: instance of the py_rod_math object, containing rod-specific math functions. analytical_P: value of the persistence length converted analytically. analytical_deflection: deflection calculated analytically (for the bending beam test). analytical_kbT: analytical thermal energy, for the equipartition test p_i, equil_p_i - array containing values of p_i for each frame and element deflections: value of deflection for each frame (bending beam test) EI_from_deflection: value of EI calculated from euler beam theory for each frame. P: persistence length (again, given for each frame) bending_energy: bending energy between each adjacent pair of elements for each frame. Note that this is not actually calculated during the simulation (only the derivatives are). twist_amount: the value of delta_theta - equil_delta_theta in the twist energy formula. twist_energy: the value of twist energy between pairs of elements in the rod. p_i_extension: similar to the above, but this time for the quantity of r-r_equil for the stretching energy. There's also p_i_extension_x, y and z. average_twist_energy: twist energy averaged over the entire rod, given by frame. EI: the analytical value of EI, also known as the bending modulus B. starting_length: the length of the rod (along the contours) on the first frame. average_extension: the average p_i_extension for each frame. Also given in terms of x, y and z. delta_x, delta_y, delta_z, delta_twist - how much the rod has moved between each frame!
def ffeatools.modules.FFEA_rod.anal_rod.__init__ | ( | self, | |
rod | |||
) |
Initialize the rod analysis. This doens't do much, other than setting a few internal variables and firing up an instane of py_rod_math. Params: rod, an instance of FFEA_rod. Returns: nothing.
def ffeatools.modules.FFEA_rod.anal_rod.align_to_equil | ( | self | ) |
Align the trajectory to the equilibrium configuration using the icp (iterative closest point) library. Params: none Retruns: none, but updates self.rod.current_r
def ffeatools.modules.FFEA_rod.anal_rod.apply_transformation_4x4 | ( | self, | |
pos_array, | |||
T | |||
) |
Apply a 4x4 transformation matrix to our 2-D array of 3-D points. Returns the newly translated array.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.align_to_equil(), and ffeatools.modules.FFEA_rod.anal_rod.get_node_rmsd().
def ffeatools.modules.FFEA_rod.anal_rod.decimate | ( | self, | |
determine_simplification_func, | |||
target_length, | |||
margin = 0.5 |
|||
) |
For a given rod or rod trajectory, reduce the number of nodes in that trajectory, by averaging about nodes, grouped by their indices. Params: determine_simplification_func: the function that reduces the number of nodes in an ndarray, normally ndc_extractor.determine_simplification target_length: the desired number of nodes. Note: the actual rod you get out might be a number nearby this but not exactly it, to try and make the step size (e.g. the number of nodes that are averaged together) even. margin: how much to adjust the target length to make the step size even. Returns: noting. But updates all the self.rod arrays.
def ffeatools.modules.FFEA_rod.anal_rod.do_bend_symmetry_test | ( | self | ) |
For a rod created with the symmetry test function in rod_tests, this checks that the energies and dynamics are symmetric about the central node, for bend energy. Params:none returns: True if all tests pass, False otherwise, and prints some info.
def ffeatools.modules.FFEA_rod.anal_rod.do_stretch_symmetry_test | ( | self | ) |
For a rod created with the symmetry test function in rod_tests, this checks that the energies and dynamics are symmetric about the central node, for stretch energy. Params:none returns: True if all tests pass, False otherwise, and prints some info.
def ffeatools.modules.FFEA_rod.anal_rod.filter_x | ( | self, | |
thing, | |||
dimension | |||
) |
Given an array of form [frame][element][x,y,z], this returns an array of the form [frame][element][thing], where thing is the quantitiy for the dimension specified as a parameter. Params: thing, the array to filter, and dimension, the dimension to filter to. Returns: the filtered array.
def ffeatools.modules.FFEA_rod.anal_rod.get_absolute_length | ( | self, | |
starting_node, | |||
ending_node, | |||
frame, | |||
equil = False , |
|||
path = True , |
|||
non_path_axis = 0 |
|||
) |
Get the length along the rod (the contour length) of a subset of the rod, or the whole rod, in meters. Params: starting noe, ending node - indices of the start and end of the range of nodes to be measured. Frame: index of the frame to be used. Returns: length, a float.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
def ffeatools.modules.FFEA_rod.anal_rod.get_average_quantities | ( | self | ) |
Sets the average quantities as they are used in the equipartition test. Basically identical to the equipartition test, only it also sets self.average_extension_sq, which we need. Params:none Returns: none, but sets self.average_extension_sq, and also average_extension_sq_x, average_extension_sq_y, average_extension_sq_z.
def ffeatools.modules.FFEA_rod.anal_rod.get_B_eigenvalues | ( | self | ) |
Get the eigenvalues of the B matrix for each node. Params: none Returns: an array of the eigenvalues. Each B value will have two eigenvalues, so the resulting array will be (n-2)x2, where n is the number of nodes (-2 because the nodes at the end of the rod do not) have bending energies associated with them!).
def ffeatools.modules.FFEA_rod.anal_rod.get_bending_response | ( | self | ) |
Get the bending energy between adjacent rod elements for every pair of rod elements in every frame. Mathematically, this is identical to what goes on inside the rod simulation proper (although it happens 8x more there). Params: none Returns: none, but it populates self.bending_energy, an array.
def ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual | ( | self, | |
rotate = False |
|||
) |
Get the bending energy between adjacent rod elements for every pair of rod elements in every frame, using the mutual parallel transport method. Params: none Returns: none, but it populates self.bending_energy, an array.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_equipartition().
def ffeatools.modules.FFEA_rod.anal_rod.get_constant_EI | ( | self | ) |
This returns the value of EI (basically the value of the diagonal elements of B) but only if the rod is isotropic and the value of B is constant. Parameters: none Returns: none, but sets self.EI, a float.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_bending_response(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual(), and ffeatools.modules.FFEA_rod.anal_rod.plot().
def ffeatools.modules.FFEA_rod.anal_rod.get_constant_parameter | ( | self, | |
constant_index | |||
) |
Get the value of a material parameter based on the index (0 for stretch, 1 for twist). Only if that parameter is constant for the whole rod and the whole trajectory. Params: constant index, an int. Returns: the value of that parameter in SI units, a float.
def ffeatools.modules.FFEA_rod.anal_rod.get_deflection | ( | self | ) |
Get the vertical deflection away from the equilibrium at the end of the rod. Used in the euler beam test. Params: none. Returns: none, but it sets self.deflections, an array.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_EI_from_deflection().
def ffeatools.modules.FFEA_rod.anal_rod.get_delta_r | ( | self | ) |
Get the value of delta_r from the rod dynamics by subtracting the positions of the nth nodes from the nth plus 1th nodes. Params: none Returns: none, but sets delta_r_x, delta_r_y, delta_r_z, delta_twist, all arrays.
def ffeatools.modules.FFEA_rod.anal_rod.get_EI_from_deflection | ( | self, | |
force_applied | |||
) |
This gets the approximate value of EI (B) for rods with isotropic bending response. W=(PL^3)/(3EI) where W is the deflection, P is the force applied to the end of the beam, L is the beam length. Params: force_applied, the force applied to the end of the beam in N (a float). Returns: none, but sets self.EI_from_deflection, an array.
def ffeatools.modules.FFEA_rod.anal_rod.get_entire_rod_stretch_energy | ( | self | ) |
def ffeatools.modules.FFEA_rod.anal_rod.get_equipartition | ( | self | ) |
This gets all the quantities needed for an equipartition test, including stretching, bending and twisting energy. Basically, run this and then plot(temp=300) for the full equipartition experience.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_average_quantities().
def ffeatools.modules.FFEA_rod.anal_rod.get_L_i | ( | self | ) |
def ffeatools.modules.FFEA_rod.anal_rod.get_node_rmsd | ( | self, | |
align = False |
|||
) |
Get the per-node RMSD for the rod. Otherwise known as the time-averaged RMSD for each node. Params: align - whether the trajectory has already been aligned to the equilibrium configuration. If not, it uses the iterative closest point algorithm to align them. Please note: this algorithm can get confused with very bendy rods. If you see a gigantic spike in the middle of your RMSD, then it's confused (easier to spot in get_time_rmsd). Returns: the rmsd, a 1d numpy array indexed by node.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_time_rmsd().
def ffeatools.modules.FFEA_rod.anal_rod.get_persistence_length | ( | self | ) |
Get the value of the persistence length P from the current state of the rod. P = -L/log(<cos \theta>) where P is the persistence length, L is the length of the rod, and cos \theta is the cosine of the angle between the element at the start of the rod and the element at the end. Params: none. Returns: none, but populates self.P, an array containing a value for the persistence length for each frame.
def ffeatools.modules.FFEA_rod.anal_rod.get_starting_length | ( | self | ) |
Get the end to end length of the rod on the first frae. Params: none. Returns: none, but sets self.starting_length, a float.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
def ffeatools.modules.FFEA_rod.anal_rod.get_stretch_energy | ( | self | ) |
Computes the stretch energy for the rod using the new discretisation- independent formula. Params: none Returns: none, but sets self.stretch_energy
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_equipartition().
def ffeatools.modules.FFEA_rod.anal_rod.get_time_rmsd | ( | self, | |
is_aligned = False , |
|||
max_frame_index = -1 |
|||
) |
Get the time RMSD for the rod. That is, get the average RMSD of all the nodes for each frame in the trajectory. Params: is_aligned: whether the equilibrium and current structures are aligned or not. If they aren't aligned, they need to be, or you won't get best-fit RMSD, which is really the only useful RMSD. max_frame_index: find the rmsd for all frames up to this one. Returns: the time rmsd, a 1d numpy array.
def ffeatools.modules.FFEA_rod.anal_rod.get_twist_amount | ( | self, | |
set_twist_amount = False |
|||
) |
Get the twist energy between adjacent rod elements for every pair of rod elements in every frame. Mathematically, this is identical to what goes on inside the rod simulation proper (although it happens 8x more there). Params: none Returns: none, but it populates self.twist_energy, an array.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_equipartition().
def ffeatools.modules.FFEA_rod.anal_rod.persistence_segments | ( | self | ) |
Todo: this is an alternative version of the persistence length calulation that omits some of the worm-like chain assumptions.
def ffeatools.modules.FFEA_rod.anal_rod.plot | ( | self, | |
force = None , |
|||
temp = None |
|||
) |
For any tests you've done, this will plot the results. If you've run self.get_average_quantities(), it will plot the equipartition results. If you've run get_persistence_length, it plots those results, if you've run get_deflection, it plots that. The plots are saved as PDFs whose names are based on the filename of the loaded rod. Params: force, the force applied to the end node in the bending beam test (a float) temp, the temperature of the rod in kelvin (needed for the equipartition and persistence length tests.
def ffeatools.modules.FFEA_rod.anal_rod.subdivide | ( | self, | |
iterations | |||
) |
For a given rod (but not a trajectory!) create new nodes which are linearly interpolated to be between the positions of the existing nodes. Params: iterations - number of iterations to run. Each iteration doubles the number of nodes in the rod. Returns: nothing, but updates all the self.rod ndarrays.
def ffeatools.modules.FFEA_rod.anal_rod.thin | ( | self, | |
target_num_frames | |||
) |
Remove frames from the trajectory. Params: target_num_frames - the number of frames you desire. Returns: nothing, but it changes all the self.rod arrays. Also, like decimate, it might not give you exactly the number of frames you asked for, because it goes for an even interval instead.
def ffeatools.modules.FFEA_rod.anal_rod.whole_rod_avg | ( | self, | |
thing | |||
) |
Given an array of form [frame][element][thing], this function returns the average [thing] over every element for each frame. Params: thing, an array. Returns: the average over the whole rod, also an array.
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.analytical_deflection |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.analytical_kbT |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.analytical_P |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.average_twist_energy |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.bending_energy |
ffeatools.modules.FFEA_rod.anal_rod.deflections |
ffeatools.modules.FFEA_rod.anal_rod.delta_r_x |
ffeatools.modules.FFEA_rod.anal_rod.delta_r_y |
ffeatools.modules.FFEA_rod.anal_rod.delta_r_z |
ffeatools.modules.FFEA_rod.anal_rod.delta_twist |
ffeatools.modules.FFEA_rod.anal_rod.EI |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.EI_from_deflection |
ffeatools.modules.FFEA_rod.anal_rod.equil_p_i |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.get_absolute_length(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual(), ffeatools.modules.FFEA_rod.anal_rod.get_equipartition(), ffeatools.modules.FFEA_rod.anal_rod.get_L_i(), ffeatools.modules.FFEA_rod.anal_rod.get_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_twist_amount(), ffeatools.modules.FFEA_rod.anal_rod.persistence_segments(), and ffeatools.modules.FFEA_rod.anal_rod.thin().
ffeatools.modules.FFEA_rod.anal_rod.get_p_i |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.do_stretch_symmetry_test(), ffeatools.modules.FFEA_rod.anal_rod.get_absolute_length(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual(), ffeatools.modules.FFEA_rod.anal_rod.get_entire_rod_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_equipartition(), ffeatools.modules.FFEA_rod.anal_rod.get_L_i(), ffeatools.modules.FFEA_rod.anal_rod.get_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_twist_amount(), and ffeatools.modules.FFEA_rod.anal_rod.persistence_segments().
ffeatools.modules.FFEA_rod.anal_rod.P |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.p_i |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.do_stretch_symmetry_test(), ffeatools.modules.FFEA_rod.anal_rod.get_absolute_length(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual(), ffeatools.modules.FFEA_rod.anal_rod.get_entire_rod_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_equipartition(), ffeatools.modules.FFEA_rod.anal_rod.get_persistence_length(), ffeatools.modules.FFEA_rod.anal_rod.get_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_twist_amount(), ffeatools.modules.FFEA_rod.anal_rod.persistence_segments(), and ffeatools.modules.FFEA_rod.anal_rod.thin().
ffeatools.modules.FFEA_rod.anal_rod.py_rod_math |
ffeatools.modules.FFEA_rod.anal_rod.rod |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.align_to_equil(), ffeatools.modules.FFEA_rod.anal_rod.decimate(), ffeatools.modules.FFEA_rod.anal_rod.do_bend_symmetry_test(), ffeatools.modules.FFEA_rod.anal_rod.do_stretch_symmetry_test(), ffeatools.modules.FFEA_rod.anal_rod.get_absolute_length(), ffeatools.modules.FFEA_rod.anal_rod.get_B_eigenvalues(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response(), ffeatools.modules.FFEA_rod.anal_rod.get_bending_response_mutual(), ffeatools.modules.FFEA_rod.anal_rod.get_constant_EI(), ffeatools.modules.FFEA_rod.anal_rod.get_constant_parameter(), ffeatools.modules.FFEA_rod.anal_rod.get_deflection(), ffeatools.modules.FFEA_rod.anal_rod.get_EI_from_deflection(), ffeatools.modules.FFEA_rod.anal_rod.get_entire_rod_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_equipartition(), ffeatools.modules.FFEA_rod.anal_rod.get_L_i(), ffeatools.modules.FFEA_rod.anal_rod.get_node_rmsd(), ffeatools.modules.FFEA_rod.anal_rod.get_starting_length(), ffeatools.modules.FFEA_rod.anal_rod.get_stretch_energy(), ffeatools.modules.FFEA_rod.anal_rod.get_time_rmsd(), ffeatools.modules.FFEA_rod.anal_rod.get_twist_amount(), ffeatools.modules.FFEA_rod.anal_rod.persistence_segments(), ffeatools.modules.FFEA_rod.anal_rod.plot(), ffeatools.modules.FFEA_rod.anal_rod.subdivide(), and ffeatools.modules.FFEA_rod.anal_rod.thin().
ffeatools.modules.FFEA_rod.anal_rod.starting_length |
ffeatools.modules.FFEA_rod.anal_rod.stretch_energy |
Referenced by ffeatools.modules.FFEA_rod.anal_rod.plot().
ffeatools.modules.FFEA_rod.anal_rod.stretching_energy |
ffeatools.modules.FFEA_rod.anal_rod.twist_amount |
ffeatools.modules.FFEA_rod.anal_rod.twist_energy |