Depletion of gaseous CO in protoplanetary disks by surface-energy-regulated ice formation