Conditions determining the morphology and nanoscale magnetism of Co nanoparticles: Experimental and numerical studies