Show how to add bonds to a file.
3 from __future__
import print_function
7 def copy_to_residues(pin, pout, rcf, rf, pcf, pf, acf, af, ccf, cf, bf, prev):
11 rpout.set_residue_type(rpin.get_residue_type())
12 rpout.set_residue_index(rpin.get_residue_index())
15 ca = pin.get_children()[0]
16 for c
in pin.get_children():
18 if acf.get_is(c)
and c.get_name().find(
"CA") != -1:
20 mass += pcf.get(c).get_mass()
23 ppout.set_coordinates(pca.get_coordinates())
27 bd = bf.get(pout.add_child(
"bond", RMF.BOND))
28 bd.set_bonded_0(prev.get_id().get_index())
29 bd.set_bonded_1(pout.get_id().get_index())
33 cf.get(pout).set_chain_id(ccf.get(pin).get_chain_id())
35 for inch
in pin.get_children():
36 if inch.get_type() == RMF.REPRESENTATION:
37 outch = pout.add_child(inch.get_name(), inch.get_type())
38 prev = copy_to_residues(
55 outpath = RMF._get_temporary_file_path(
"3U7W-residues.rmf")
57 out.add_frame(
"nothing", RMF.FRAME)
58 print(
"file is", outpath)
59 bf = RMF.BondFactory(out)
61 rcf = RMF.ResidueFactory(fh)
62 rf = RMF.ResidueFactory(out)
63 pcf = RMF.ParticleFactory(fh)
64 pf = RMF.ParticleFactory(out)
65 acf = RMF.AtomFactory(fh)
66 af = RMF.AtomFactory(out)
67 ccf = RMF.ChainFactory(fh)
68 cf = RMF.ChainFactory(out)
69 bf = RMF.BondFactory(out)