def write(self, filename):
<EOL>maxcol = <NUM_LIT><EOL>with open(filename,'<STR_LIT:w>') as outfile:<EOL><INDENT>for line in self.comments:<EOL><INDENT>comment = '<STR_LIT>'+str(line)<EOL>outfile.write(comment[:maxcol]+'<STR_LIT:\n>')<EOL><DEDENT>for component,object in self.sorted_components():<EOL><INDENT>object.write(outfile)<EOL><DEDENT>DXclass.write(self,outfile,quote=True)<EOL>for component,object in self.sorted_components():<EOL><INDENT>outfile.write('<STR_LIT>' % (component,str(object.id)))<EOL><DEDENT><DEDENT>
Write the complete dx object to the file.

        This is the simple OpenDX format which includes the data into
        the header via the 'object array ... data follows' statement.

        Only simple regular arrays are supported.

        The format should be compatible with VMD's dx reader plugin.