def assemble_topology(self):
self.logger.debug("<STR_LIT>")<EOL>top = '<STR_LIT>'<EOL>self.logger.debug("<STR_LIT>")<EOL>top += self.toptemplate<EOL>top = top.replace('<STR_LIT>',       '<STR_LIT>'.join( self._make_defaults(self.system)) )<EOL>top = top.replace('<STR_LIT>',      '<STR_LIT>'.join( self._make_atomtypes(self.system)) )<EOL>top = top.replace('<STR_LIT>',  '<STR_LIT>'.join( self._make_nonbond_param(self.system)) )<EOL>top = top.replace('<STR_LIT>',      '<STR_LIT>'.join( self._make_pairtypes(self.system)) )<EOL>top = top.replace('<STR_LIT>',      '<STR_LIT>'.join( self._make_bondtypes(self.system)) )<EOL>top = top.replace('<STR_LIT>','<STR_LIT>'.join( self._make_constrainttypes(self.system)))<EOL>top = top.replace('<STR_LIT>',     '<STR_LIT>'.join( self._make_angletypes(self.system)))<EOL>top = top.replace('<STR_LIT>',  '<STR_LIT>'.join( self._make_dihedraltypes(self.system)) )<EOL>top = top.replace('<STR_LIT>',  '<STR_LIT>'.join( self._make_impropertypes(self.system)) )<EOL>top = top.replace('<STR_LIT>',      '<STR_LIT>'.join( self._make_cmaptypes(self.system)) )<EOL>for i,(molname,m) in enumerate(self.system.dict_molname_mol.items()):<EOL><INDENT>itp = self.itptemplate<EOL>itp = itp.replace('<STR_LIT>',  '<STR_LIT>'.join( self._make_moleculetype(m, molname, m.exclusion_numb))  )<EOL>itp = itp.replace('<STR_LIT>',         '<STR_LIT>'.join( self._make_atoms(m))  )<EOL>itp = itp.replace('<STR_LIT>',         '<STR_LIT>'.join( self._make_bonds(m))  )<EOL>itp = itp.replace('<STR_LIT>',         '<STR_LIT>'.join( self._make_pairs(m))  )<EOL>itp = itp.replace('<STR_LIT>',       '<STR_LIT>'.join( self._make_settles(m))  )<EOL>itp = itp.replace('<STR_LIT>','<STR_LIT>'.join( self._make_virtual_sites3(m))  )<EOL>itp = itp.replace('<STR_LIT>',    '<STR_LIT>'.join( self._make_exclusions(m))  )<EOL>itp = itp.replace('<STR_LIT>',        '<STR_LIT>'.join( self._make_angles(m)) )<EOL>itp = itp.replace('<STR_LIT>',     '<STR_LIT>'.join( self._make_dihedrals(m)) )<EOL>itp = itp.replace('<STR_LIT>',     '<STR_LIT>'.join( self._make_impropers(m)) )<EOL>itp = itp.replace('<STR_LIT>',         '<STR_LIT>'.join( self._make_cmaps(m)) )<EOL>if not self.multiple_output:<EOL><INDENT>top += itp<EOL><DEDENT>else:<EOL><INDENT>outfile = "<STR_LIT>".format(molname)<EOL>top += '<STR_LIT>'.format( molname )<EOL>with open(outfile, "<STR_LIT:w>") as f:<EOL><INDENT>f.writelines([itp])<EOL><DEDENT><DEDENT><DEDENT>top += '<STR_LIT>'<EOL>top += '<STR_LIT>'<EOL>molecules = [("<STR_LIT>", <NUM_LIT:0>)]<EOL>for m in self.system.molecules:<EOL><INDENT>if (molecules[-<NUM_LIT:1>][<NUM_LIT:0>] != m.name):<EOL><INDENT>molecules.append([m.name, <NUM_LIT:0>])<EOL><DEDENT>if molecules[-<NUM_LIT:1>][<NUM_LIT:0>] == m.name:<EOL><INDENT>molecules[-<NUM_LIT:1>][<NUM_LIT:1>] += <NUM_LIT:1><EOL><DEDENT><DEDENT>for molname, n in molecules[<NUM_LIT:1>:]:<EOL><INDENT>top += '<STR_LIT>'.format(molname, n)<EOL><DEDENT>top += '<STR_LIT:\n>'<EOL>with open(self.outfile, '<STR_LIT:w>') as f:<EOL><INDENT>f.writelines([top])<EOL><DEDENT>
Call the various member self._make_* functions to convert the topology object into a string