RMF
Main Page
Related Pages
Namespaces
Classes
Files
Examples
bonds.py
Show how to extract bonds from a file.
1
## \example bonds.py
2
# Show how to extract bonds from a file.
3
import
RMF
4
5
6
def
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
14
fh =
RMF.open_rmf_file_read_only
(RMF.get_example_path(
"simple.rmf3"
))
15
fh.set_current_frame(
RMF.FrameID
(0))
16
bf = RMF.BondFactory(fh)
17
18
print_bonds(fh.get_root_node(), bf)