add a more flexible function for scale factor and fix one error in create_mass_matrices.f90

add a more flexible function for scale factor and fix one error in create_mass_matrices.f90