wrote Fortran code to test thm2