RMF
bonds.py
1## \example bonds.py
2# Show how to extract bonds from a file.
3import RMF
4
5
6def print_bonds(node, bf):
7 if bf.get_is(node):
8 bd = bf.get(node)
9 print("bond", bd.get_bonded_0(), bd.get_bonded_1())
10 else:
11 for c in node.get_children():
12 print_bonds(c, bf)
13
14fh = RMF.open_rmf_file_read_only(RMF.get_example_path("simple.rmf3"))
15fh.set_current_frame(RMF.FrameID(0))
16bf = RMF.BondFactory(fh)
17
18print_bonds(fh.get_root_node(), bf)
FileConstHandle open_rmf_file_read_only(std::string path)