The shape (octagonal prism or pyramid) depends on the size of the atoms, specifically their radii, and the stoichiometry (how they join together).
Ionic Bonding
Electrons transfer from the cation (positively charged ion) to the anion (negatively charged ion).
This transfer results in the atoms becoming ions, and the bond formed is called ionic bonding.
Ionic bonding is an electrical force, specifically an electrostatic attraction, due to the charge between ions.
The magnitude (strength) of the attraction depends on:
The size of the ions involved.
The charge of the ions involved.
Larger atoms with many missing outer electron shells can form stronger bonds.
Smaller atoms tend to form less strong bonds.
Valence Electrons and Periodic Table Groups
The strength of ionic bonds is related to the number of valence electrons missing.
The number of valence electrons is related to the group that the element is in on the periodic table (groups +1, +2, +3 tend to lose electrons; -1, -2, -3 tend to gain electrons).
Whether an atom gains or loses electrons depends on how full its outer electron shells are.
The key principle of ionic bonding is sharing (transferring) of one or more electrons.
Properties of Ionic Compounds
Hard solids.
Crystalline structure.
Brittle.
High melting point (hard to break apart into a liquid).
Do not conduct electricity in solid form because electrons are bonded and not free to move.