diff_pat segmentation fault if bragg too many points
first working version