def write(self, filename=None, ncol=ncol, format=format):
with open(self.filename(filename, ext='<STR_LIT>'), '<STR_LIT:w>') as ndx:<EOL><INDENT>for name in self:<EOL><INDENT>atomnumbers = self._getarray(name)  <EOL>ndx.write('<STR_LIT>'.format(name))<EOL>for k in range(<NUM_LIT:0>, len(atomnumbers), ncol):<EOL><INDENT>line = atomnumbers[k:k+ncol].astype(int)   <EOL>n = len(line)<EOL>ndx.write(("<STR_LIT:U+0020>".join(n*[format])+'<STR_LIT:\n>') % tuple(line))<EOL><DEDENT>ndx.write('<STR_LIT:\n>')<EOL><DEDENT><DEDENT>
Write index file to *filename* (or overwrite the file that the index was read from)