HOX (X=Cl, Br, I, and At) can engage in either a H-bond (HB) or halogen bond (XB) with a base-like HCN, NH , and imidazole. Although the former is energetically preferred for X=Cl and Br, it is the XB that is more stable for At, with I showing little preference. MgY forms a Mg-bond with the O atom of HOX, which grows stronger in the order X=Cl