3 class EckartAngularVelocityVector(Base):
5 Class for analysis of Eckart-frame angular velocity vectors, as defined in
6 `MPCDAnalysis.EckartSystem`.
14 The run to analyze, as an instance of `Run`.
17 super(EckartAngularVelocityVector, self).
__init__(run)
22 Returns a `matplotlib.axes.Axes` object that contains a plot of the
23 Eckart angular velocities of star polymer, with the horizontal axis
24 showing the simulation time `t`, and the Cartesian components of the
25 Eckart angular velocity vector, in radians per time unit.
28 import matplotlib.figure
30 figure = matplotlib.figure.Figure()
31 axes = figure.add_subplot(1, 1, 1)
36 frequencies = [[], [], []]
37 for datum
in data.values():
39 frequencies[i].append(datum[i])
41 _line, = axes.plot(data.keys(), frequencies[0])
43 legendLabels.append(
"Eckart Angular Velocity: x Component")
45 _line, = axes.plot(data.keys(), frequencies[1])
47 legendLabels.append(
"Eckart Angular Velocity: y Component")
49 _line, = axes.plot(data.keys(), frequencies[2])
51 legendLabels.append(
"Eckart Angular Velocity: z Component")
53 axes.legend(lines, legendLabels)
55 axes.set_title(
"Star Polymer Eckart Angular Velocity")
56 axes.set_xlabel(
"Simulation Time t")
57 axes.set_ylabel(
"Eckart Angular Velocity [rad/T]")
62 def _computeValueAsFunctionOfTime(self):
64 Takes the raw simulation output, and computes the Eckart angular
65 velocity vector as a function of time. The result is returned as an
66 `collcections.OrderedDict`.
69 from collections
import OrderedDict
72 config = self.
getRun().getConfiguration()
77 timestep = config[
"mpc.timestep"]
78 time = timestep * config[
"mpc.warmupSteps"]
84 particles = snapshots.readTimestep()
85 particles.setUniformMass(starPolymers.getParticleMass())
87 if particles.isEmpty():
90 if eckartSystem
is None:
92 eckartSystem = EckartSystem(particles)
94 ret[time] = eckartSystem.getEckartAngularVelocityVector(particles)
99 def _getCacheFilename(self):
101 Returns the filename where cached data is (expected to be) saved to.
104 return "eckartAngularVelocityVectors.txt"
107 def _getCacheValueInterpreter(self):
109 Returns what is to be used as the `valueInterpreter` argument to
110 `Cache.getDataOrderedDict`.
113 def valueInterpreter(string):
115 return ast.literal_eval(string)
117 return valueInterpreter