function write_meshgen_conformant_result( GRID, fn )
    %% output tip geometry to TAPSim in a format which meshgen can read
    natoms = length(GRID(1,:));
    mynodefile_name = fn;
    fileID = fopen(mynodefile_name,'w');
    fprintf(fileID,['ASCII ' num2str(uint32(natoms)) ' 0 0\n']);
    TMP(:,1) = reshape(GRID(1,:),[natoms 1]);
    TMP(:,2) = reshape(GRID(2,:),[natoms 1]);
    TMP(:,3) = reshape(GRID(3,:),[natoms 1]);
    TMP(:,4) = reshape(GRID(4,:),[natoms 1]);
    dlmwrite(mynodefile_name,TMP,'-append','delimiter','\t'); %,'precision','%.6E%.6E%.6E%.d');
    fclose(fileID);
    ['Meshgen-conformant pillar grid point cloud written to ' fn]
end

