enhencement:callback function for continuum snake
This commit adds callback function class used in continuum snake. Class
is called `ContinuumSnakeCallBack`.
@@ -50,9 +50,27 @@ class MyCallBack(CallBackBaseClass):
self.list["directors"].append(system.director_collection.copy())
self.list["velocity"].append(system.velocity_collection.copy())
- # We are appending in the user defined list at the begining of the simulation
- # self.list_position.append(system.position_collection.copy())
- # self.dir_memory_list.append(system.director_collection.copy())
- # self.velocity_memory_list.append(system.velocity_collection.copy())
+ return
+
+
+class ContinuumSnakeCallBack(CallBackBaseClass):
+ """
+ Call back function for continuum snake
+ """
+
+ def __init__(self, step_skip: int, list):
+ CallBackBaseClass.__init__(self)
+ self.every = step_skip
+ self.list = list
+
+ def make_callback(self, system, time, current_step: int):
+
+ if current_step % self.every == 0:
+
+ self.list["time"].append(time)
+ self.list["step"].append(current_step)
+ self.list["position"].append(system.position_collection.copy())
+ self.list["velocity"].append(system.velocity_collection.copy())
+ self.list["avg_velocity"].append(system.compute_velocity_center_of_mass())
return
