corrections to material calc_n and added script for test