module.Line(p2, p2 - bond_vector, material=material2)) else: objects.append( module.Cylinder(p1, p1 + bond_vector, radius, material=material1)) objects.append( module.Cylinder(p2, p2 - bond_vector, radius, material=material2)) return objects Database.registerInstanceClass(Bond.blueprintclass, Bond) # # Bond angles # class BondAngle(object): """ Bond angle A bond angle is the angle between two bonds that share a common atom. It is defined by two bond objects (attributes b1 and b2) and an atom object (the common atom, attribute ca). """ def __init__(self, b1, b2, ca): self.b1 = b1 # bond 1
ChemicalObject.writeXML(self, file, memo, toplevel) if toplevel: return ['<molecule ref="%s"/>' % name] else: return None def getXMLAtomOrder(self): if self.type is None: atoms = [] for molecule in self.molecules: atoms.extend(molecule.getXMLAtomOrder()) return atoms else: return ChemicalObject.getXMLAtomOrder(self) Database.registerInstanceClass(Atom.blueprintclass, Atom) Database.registerInstanceClass(Group.blueprintclass, Group) Database.registerInstanceClass(Molecule.blueprintclass, Molecule) Database.registerInstanceClass(Crystal.blueprintclass, Crystal) Database.registerInstanceClass(Complex.blueprintclass, Complex) class AtomCluster(CompositeChemicalObject, ChemicalObject): """ An agglomeration of atoms An atom cluster acts like a molecule without any bonds or atom properties. It can be used to represent a group of atoms that are known to form a chemical unit but whose chemical properties are not sufficiently known to define a molecule.
if toplevel: return ['<molecule ref="%s"/>' % name] else: return None def getXMLAtomOrder(self): if self.type is None: atoms = [] for molecule in self.molecules: atoms.extend(molecule.getXMLAtomOrder()) return atoms else: return ChemicalObject.getXMLAtomOrder(self) Database.registerInstanceClass(Atom.blueprintclass, Atom) Database.registerInstanceClass(Group.blueprintclass, Group) Database.registerInstanceClass(Molecule.blueprintclass, Molecule) Database.registerInstanceClass(Crystal.blueprintclass, Crystal) Database.registerInstanceClass(Complex.blueprintclass, Complex) class AtomCluster(CompositeChemicalObject, ChemicalObject): """ An agglomeration of atoms An atom cluster acts like a molecule without any bonds or atom properties. It can be used to represent a group of atoms that are known to form a chemical unit but whose chemical properties are not sufficiently known to define a molecule. """
objects.append(module.Cylinder(p1, p2, radius, material = material1)) else: if radius is None: objects.append(module.Line(p1, p1+bond_vector, material = material1)) objects.append(module.Line(p2, p2-bond_vector, material = material2)) else: objects.append(module.Cylinder(p1, p1+bond_vector, radius, material = material1)) objects.append(module.Cylinder(p2, p2-bond_vector, radius, material = material2)) return objects Database.registerInstanceClass(Bond.blueprintclass, Bond) # # Bond angles # class BondAngle(object): """ Bond angle A bond angle is the angle between two bonds that share a common atom. It is defined by two bond objects (attributes b1 and b2) and an atom object (the common atom, attribute ca). """ def __init__(self, b1, b2, ca):