working implementation of max ngam finder from biomassf=1