Show how to create an detect files where frames represent multiple states of the same thing.
7 tfn = RMF._get_temporary_file_path(
"multistate.rmf3")
11 rh = fh.get_root_node()
12 pf = RMF.ParticleFactory(fh)
13 bf = RMF.BondFactory(fh)
14 sf = RMF.StateFactory(fh)
17 def create_hierarchy(state):
19 rt = rh.add_child(
"state" + str(state), RMF.REPRESENTATION)
20 sf.get(rt).set_static_state_index(state)
22 n = rt.add_child(str(i), RMF.REPRESENTATION)
24 pf.get(n).set_static_mass(1)
25 pf.get(n).set_static_radius(1)
27 b = rt.add_child(
"b", RMF.BOND)
29 bd.set_bonded_0(ns[i].get_id().get_index())
30 bd.set_bonded_1(ns[i + 1].get_id().get_index())
35 all_ps.append(create_hierarchy(i))
37 for frame
in range(0, 4):
38 fh.add_frame(str(i), RMF.FRAME)
39 for state, sps
in enumerate(all_ps):
40 for particle, p
in enumerate(sps):
42 p).set_coordinates(
RMF.Vector3(particle + frame + .1 * state,