Show how to create an detect files where frames represent multiple states of the same thing.
5 from __future__
import print_function
8 tfn = RMF._get_temporary_file_path(
"multistate.rmf3")
12 rh = fh.get_root_node()
13 pf = RMF.ParticleFactory(fh)
14 bf = RMF.BondFactory(fh)
15 sf = RMF.StateFactory(fh)
18 def create_hierarchy(state):
20 rt = rh.add_child(
"state" + str(state), RMF.REPRESENTATION)
21 sf.get(rt).set_static_state_index(state)
23 n = rt.add_child(str(i), RMF.REPRESENTATION)
25 pf.get(n).set_static_mass(1)
26 pf.get(n).set_static_radius(1)
28 b = rt.add_child(
"b", RMF.BOND)
30 bd.set_bonded_0(ns[i].get_id().get_index())
31 bd.set_bonded_1(ns[i + 1].get_id().get_index())
36 all_ps.append(create_hierarchy(i))
38 for frame
in range(0, 4):
39 fh.add_frame(str(i), RMF.FRAME)
40 for state, sps
in enumerate(all_ps):
41 for particle, p
in enumerate(sps):
43 p).set_coordinates(
RMF.Vector3(particle + frame + .1 * state,