using OpenMP to speedup calculations