def writeBond(self, bond, configuration, distance): p1 = bond.a1.position(configuration) p2 = bond.a2.position(configuration) if p1 is not None and p2 is not None: bond_vector = 0.5*distance(bond.a1, bond.a2, configuration) cut = bond_vector != 0.5*(p2-p1) if not cut: c = VRML.Line(p1, p2, material = self.bond_material) c.writeToFile(self) else: c = VRML.Line(p1, p1+bond_vector, material = self.bond_material) c.writeToFile(self) c = VRML.Line(p2, p2-bond_vector, material = self.bond_material) c.writeToFile(self)
def writeBond(self, bond, configuration, distance): p1 = bond.a1.position(configuration) p2 = bond.a2.position(configuration) if p1 is not None and p2 is not None: bond_vector = 0.5 * distance(bond.a1, bond.a2, configuration) cut = bond_vector != 0.5 * (p2 - p1) color1 = self.atomColor(bond.a1) color2 = self.atomColor(bond.a2) material1 = VRML.EmissiveMaterial(color1) material2 = VRML.EmissiveMaterial(color2) if color1 == color2 and not cut: c = VRML.Line(p1, p2, material=material1) c.writeToFile(self) else: c = VRML.Line(p1, p1 + bond_vector, material=material1) c.writeToFile(self) c = VRML.Line(p2, p2 - bond_vector, material=material2) c.writeToFile(self)