Electronic and magnetic structures of 4f in Ga1−xGdxN