Thermodynamic stability and ultrasmall-size effect of nanodiamonds.