def write_mesa(self, mesa_isos_file='<STR_LIT>',<EOL>add_excess_iso='<STR_LIT>', outfile='<STR_LIT>',<EOL>header_string='<STR_LIT>',<EOL>header_char='<STR_LIT:!>'):
f=open('<STR_LIT>')<EOL>a=f.readlines()<EOL>isos=[]<EOL>for i in range(len(a)):<EOL><INDENT>isos.append(a[i].strip().rstrip('<STR_LIT:U+002C>'))<EOL><DEDENT>mesa_names=[]<EOL>abus=[]<EOL>for i in range(len(self.z)):<EOL><INDENT>b=self.names[i].split()<EOL>a='<STR_LIT>'<EOL>a=a.join(b)<EOL>if a in isos:<EOL><INDENT>mesa_names.append(a)<EOL>abus.append(self.abu[i])<EOL><DEDENT><DEDENT>for i in range(len(isos)):<EOL><INDENT>if isos[i] not in mesa_names:<EOL><INDENT>mesa_names.append(isos[i])<EOL>abus.append(<NUM_LIT:0.0>)<EOL><DEDENT><DEDENT>excess=<NUM_LIT:1.>-np.sum(np.array(abus))<EOL>abus=np.array(abus)<EOL>abus[mesa_names.index(add_excess_iso)] += excess<EOL>dcols=['<STR_LIT>','<STR_LIT>']<EOL>data=[mesa_names,abus]<EOL>hd=[header_string]<EOL>att.write(outfile,hd,dcols,data,header_char=header_char)<EOL>return mesa_names,abus<EOL>
Write initial abundance file, returns written abundances and
mesa names.

Parameters
----------
mesa_isos_file : string, optional
    List with isos copied from mesa network definition file in
    mesa/data/net_data/nets.  The default is 'isos.txt'.
add_excess_iso : string, optional
    Add 1.-sum(isos in mesa net) to this isotope.  The defualt
    is 'fe56'.
outfile : string, optional
    name of output file.  The default file is 'xa_iniabu.dat'.
header_string : string, optional
    Srting with header line.  The default is
    'initial abundances for a MESA run'.
header_char : character, optional
    The default is '!'.

Examples
--------

>>> from NuGridPy import utils
>>> !ls ~/PPN/forum.astro.keele.ac.uk/frames/mppnp/USEEPP/   # find ppn initial abundance file
>>> !cat ~/mesa/data/net_data/nets/agb.net                   # find isos needed in mesa net
>>> !cat > isos.txt                                          # paste needed isos into file
>>> help(utils.iniabu)                                       # check documentation of method
>>> x=utils.iniabu('path_to_here/forum.astro.keele.ac.uk/frames/mppnp/USEEPP/iniab2.0E-02GN93.ppn')
>>> x.write_mesa?
>>> mnames,mabus = x.write_mesa(add_excess_iso='ne22',
...                header_string='mppnp/USEEPP/iniab2.0E-02GN93.ppn for mesa/agb.net',
...                outfile='xa_2.0E-02GN93.mesa')