function writeGMG(basename,gmg)
% writePCG(basename,pcg) --- write PCG file

fid=fopen([basename,'.',gmg.ext],'wt');

%0.
fprintf(fid,'%s\n',['# MATLAB writeGMG ' datestr(now)]);
fprintf(    '%s\n',['# MATLAB writeGMG ' datestr(now)]);

% 0.  RCLOSE IITER HCLOSE MXITER
fprintf(fid,'%10.4g%10.4g%10.4g%10.4g%4s     RCLOSE IITER HCLOSE MXITER \n', gmg.RCLOSE, gmg.IITER, gmg.HCLOSE, gmg.MXITER,' ');

fprintf(fid,'%10.4g%10.4g%10.4g%4s     DAMP IADAMP IOUTGMG  \n', gmg.DAMP, gmg.IADAMP, gmg.IOUTGMG,' ' );

fprintf(fid,'%10.4g%10.4g%4s     ISM ISC  \n', gmg.ISM, gmg.ISC, ' '  );

fprintf(fid,'%10.4g%4s     RELAX  \n', gmg.RELAX, ' ' );


fclose(fid);
