The folding of the secondary structure into distinct arrangements known as domains.