Ab initio studies of magnetic properties of cobalt and tetracobalt nitride Co4N