updated the comments at the beginning. Removed all the previous version history and explained that it is a subroutine to be called from R. Also added info about the data that was written to Dataky.dat but which is now kept internally in the variables that are in the common statement 'dataky'