3 class GyrationTensor(Base):
5 Class for analysis of gyration tensors.
13 The run to analyze, as an instance of `Run`.
18 def _computeValueAsFunctionOfTime(self):
20 Takes the raw simulation output, and computes the gyration tensor as
21 a function of time. The result is returned as an
22 `collcections.OrderedDict`, where each value is a list containing, in
23 this order, the `xx`, `xy`, `xz`, `yy`, `yz`, and `zz` components of the
24 gyration tensor, followed by the smallest eigenvalue and the `x`, `y`,
25 and `z` components of the associated eigenvector, followed by the
26 second-to-largest eigenvalue and its eigenvector, followed by the
27 largest eigenvalue and its eigenvector.
30 from collections
import OrderedDict
32 config = self.
getRun().getConfiguration()
37 timestep = config[
"mpc.timestep"]
38 time = timestep * config[
"mpc.warmupSteps"]
43 particles = snapshots.readTimestep()
44 particles.setUniformMass(starPolymers.getParticleMass())
46 if particles.isEmpty():
49 particles.shiftToCenterOfMassFrame()
50 starPolymers.setParticles(particles)
52 S = particles.getGyrationTensor()
53 values = [S[0][0], S[0][1], S[0][2], S[1][1], S[1][2], S[2][2]]
55 eigensystem = particles.getGyrationTensorEigensystem()
56 for eigenvalue, eigenvector
in eigensystem:
57 values += [eigenvalue]
58 values += [eigenvector[i]
for i
in range(0, 3)]
66 def _getCacheFilename(self):
68 Returns the filename where cached data is (expected to be) saved to.
71 return "gyrationTensor.txt"
74 def _getCacheMetadata(self):
76 Returns the cache metadata.
81 metadata = {
"cacheVersion": cacheVersion}
85 def _getCacheValueInterpreter(self):
87 Returns what is to be used as the `valueInterpreter` argument to
88 `Cache.getDataOrderedDict`.
91 def valueInterpreter(string):
93 return ast.literal_eval(string)
95 return valueInterpreter