The molecular dynamics method is used to study the formation of Ge nanoislands on pit-patterned Si(100) substrates. For substrates with overlapping pits and pits in the shape of truncated inverted pyramids, the energy surface is calculated. On the basis of its analysis, the mechanism of nuclear surface diffusion on the pit-patterned surface is described. The specific energy of Ge/Si heterostructures with different morphology of nanoislands in pits is calculated. It is shown that the configuration with multiple nanoislands in a pit can be thermodynamically favorable.