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