Theoretical study of the structural, electronic and dynamical properties of rocksalt ScN and GaN